Repository navigation
Commit 14a0d63
usbnet: include wait queue head in device structure
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>1 parent 681daee commit 14a0d63
2 files changed
Lines changed: 20 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
752 | 752 | | |
753 | 753 | | |
754 | 754 | | |
755 | | - | |
756 | 755 | | |
757 | 756 | | |
758 | 757 | | |
759 | 758 | | |
760 | | - | |
| 759 | + | |
761 | 760 | | |
762 | | - | |
763 | 761 | | |
764 | 762 | | |
765 | 763 | | |
| |||
773 | 771 | | |
774 | 772 | | |
775 | 773 | | |
776 | | - | |
777 | | - | |
| 774 | + | |
778 | 775 | | |
779 | 776 | | |
780 | 777 | | |
781 | 778 | | |
782 | 779 | | |
783 | 780 | | |
784 | | - | |
| 781 | + | |
785 | 782 | | |
786 | 783 | | |
787 | 784 | | |
| |||
791 | 788 | | |
792 | 789 | | |
793 | 790 | | |
| 791 | + | |
| 792 | + | |
794 | 793 | | |
795 | 794 | | |
796 | 795 | | |
| |||
817 | 816 | | |
818 | 817 | | |
819 | 818 | | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
820 | 822 | | |
821 | 823 | | |
822 | 824 | | |
| |||
1437 | 1439 | | |
1438 | 1440 | | |
1439 | 1441 | | |
1440 | | - | |
1441 | | - | |
1442 | | - | |
1443 | | - | |
1444 | | - | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
1445 | 1448 | | |
1446 | 1449 | | |
1447 | 1450 | | |
| |||
1580 | 1583 | | |
1581 | 1584 | | |
1582 | 1585 | | |
| 1586 | + | |
1583 | 1587 | | |
1584 | 1588 | | |
1585 | 1589 | | |
| |||
1791 | 1795 | | |
1792 | 1796 | | |
1793 | 1797 | | |
1794 | | - | |
1795 | | - | |
1796 | | - | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
1797 | 1802 | | |
1798 | 1803 | | |
1799 | 1804 | | |
| |||
| 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