Repository navigation
Commit 2d4cf3d
usbnet: include wait queue head in device structure
[ Upstream commit 14a0d63 ]
This fixes a race which happens by freeing an object on the stack.
Quoting Julius:
> The issue is
> that it calls usbnet_terminate_urbs() before that, which temporarily
> installs a waitqueue in dev->wait in order to be able to wait on the
> tasklet to run and finish up some queues. The waiting itself looks
> okay, but the access to 'dev->wait' is totally unprotected and can
> race arbitrarily. I think in this case usbnet_bh() managed to succeed
> it's dev->wait check just before usbnet_terminate_urbs() sets it back
> to NULL. The latter then finishes and the waitqueue_t structure on its
> stack gets overwritten by other functions halfway through the
> wake_up() call in usbnet_bh().
The fix is to just not allocate the data structure on the stack.
As dev->wait is abused as a flag it also takes a runtime PM change
to fix this bug.
Signed-off-by: Oliver Neukum <oneukum@suse.de>
Reported-by: Grant Grundler <grundler@google.com>
Tested-by: Grant Grundler <grundler@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent 8d45088 commit 2d4cf3d
2 files changed
Lines changed: 20 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
727 | 727 | | |
728 | 728 | | |
729 | 729 | | |
730 | | - | |
731 | 730 | | |
732 | 731 | | |
733 | 732 | | |
734 | 733 | | |
735 | | - | |
| 734 | + | |
736 | 735 | | |
737 | | - | |
738 | 736 | | |
739 | 737 | | |
740 | 738 | | |
| |||
748 | 746 | | |
749 | 747 | | |
750 | 748 | | |
751 | | - | |
752 | | - | |
| 749 | + | |
753 | 750 | | |
754 | 751 | | |
755 | 752 | | |
756 | 753 | | |
757 | 754 | | |
758 | 755 | | |
759 | | - | |
| 756 | + | |
760 | 757 | | |
761 | 758 | | |
762 | 759 | | |
| |||
766 | 763 | | |
767 | 764 | | |
768 | 765 | | |
| 766 | + | |
| 767 | + | |
769 | 768 | | |
770 | 769 | | |
771 | 770 | | |
| |||
792 | 791 | | |
793 | 792 | | |
794 | 793 | | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
795 | 797 | | |
796 | 798 | | |
797 | 799 | | |
| |||
1360 | 1362 | | |
1361 | 1363 | | |
1362 | 1364 | | |
1363 | | - | |
1364 | | - | |
1365 | | - | |
1366 | | - | |
1367 | | - | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
1368 | 1371 | | |
1369 | 1372 | | |
1370 | 1373 | | |
| |||
1502 | 1505 | | |
1503 | 1506 | | |
1504 | 1507 | | |
| 1508 | + | |
1505 | 1509 | | |
1506 | 1510 | | |
1507 | 1511 | | |
| |||
1694 | 1698 | | |
1695 | 1699 | | |
1696 | 1700 | | |
1697 | | - | |
1698 | | - | |
1699 | | - | |
| 1701 | + | |
| 1702 | + | |
| 1703 | + | |
| 1704 | + | |
1700 | 1705 | | |
1701 | 1706 | | |
1702 | 1707 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
0 commit comments