Commit f1acf1a
net:rds: Fix possible deadlock in rds_message_put
Functions rds_still_queued and rds_clear_recv_queue lock a given socket
in order to safely iterate over the incoming rds messages. However
calling rds_inc_put while under this lock creates a potential deadlock.
rds_inc_put may eventually call rds_message_purge, which will lock
m_rs_lock. This is the incorrect locking order since m_rs_lock is
meant to be locked before the socket. To fix this, we move the message
item to a local list or variable that wont need rs_recv_lock protection.
Then we can safely call rds_inc_put on any item stored locally after
rs_recv_lock is released.
Fixes: bdbe6fb ("RDS: recv.c")
Reported-by: syzbot+f9db6ff27b9bfdcfeca0@syzkaller.appspotmail.com
Reported-by: syzbot+dcd73ff9291e6d34b3ab@syzkaller.appspotmail.com
Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
Link: https://lore.kernel.org/r/20240209022854.200292-1-allison.henderson@oracle.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>1 parent 9f30831 commit f1acf1a
1 file changed
+11
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
425 | 425 | | |
426 | 426 | | |
427 | 427 | | |
| 428 | + | |
428 | 429 | | |
429 | 430 | | |
430 | 431 | | |
| |||
435 | 436 | | |
436 | 437 | | |
437 | 438 | | |
438 | | - | |
| 439 | + | |
439 | 440 | | |
440 | 441 | | |
441 | 442 | | |
442 | 443 | | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
443 | 447 | | |
444 | 448 | | |
445 | 449 | | |
| |||
758 | 762 | | |
759 | 763 | | |
760 | 764 | | |
| 765 | + | |
761 | 766 | | |
762 | 767 | | |
763 | 768 | | |
764 | 769 | | |
765 | 770 | | |
766 | 771 | | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
767 | 777 | | |
768 | 778 | | |
769 | 779 | | |
770 | | - | |
771 | 780 | | |
772 | 781 | | |
773 | 782 | | |
| |||
0 commit comments