Commit 58e84f6
RDMA/cma: Allow UD qp_type to join multicast only
As for multicast:
- The SIDR is the only mode that makes sense;
- Besides PS_UDP, other port spaces like PS_IB is also allowed, as it is
UD compatible. In this case qkey also needs to be set [1].
This patch allows only UD qp_type to join multicast, and set qkey to
default if it's not set, to fix an uninit-value error: the ib->rec.qkey
field is accessed without being initialized.
=====================================================
BUG: KMSAN: uninit-value in cma_set_qkey drivers/infiniband/core/cma.c:510 [inline]
BUG: KMSAN: uninit-value in cma_make_mc_event+0xb73/0xe00 drivers/infiniband/core/cma.c:4570
cma_set_qkey drivers/infiniband/core/cma.c:510 [inline]
cma_make_mc_event+0xb73/0xe00 drivers/infiniband/core/cma.c:4570
cma_iboe_join_multicast drivers/infiniband/core/cma.c:4782 [inline]
rdma_join_multicast+0x2b83/0x30a0 drivers/infiniband/core/cma.c:4814
ucma_process_join+0xa76/0xf60 drivers/infiniband/core/ucma.c:1479
ucma_join_multicast+0x1e3/0x250 drivers/infiniband/core/ucma.c:1546
ucma_write+0x639/0x6d0 drivers/infiniband/core/ucma.c:1732
vfs_write+0x8ce/0x2030 fs/read_write.c:588
ksys_write+0x28c/0x520 fs/read_write.c:643
__do_sys_write fs/read_write.c:655 [inline]
__se_sys_write fs/read_write.c:652 [inline]
__ia32_sys_write+0xdb/0x120 fs/read_write.c:652
do_syscall_32_irqs_on arch/x86/entry/common.c:114 [inline]
__do_fast_syscall_32+0x96/0xf0 arch/x86/entry/common.c:180
do_fast_syscall_32+0x34/0x70 arch/x86/entry/common.c:205
do_SYSENTER_32+0x1b/0x20 arch/x86/entry/common.c:248
entry_SYSENTER_compat_after_hwframe+0x4d/0x5c
Local variable ib.i created at:
cma_iboe_join_multicast drivers/infiniband/core/cma.c:4737 [inline]
rdma_join_multicast+0x586/0x30a0 drivers/infiniband/core/cma.c:4814
ucma_process_join+0xa76/0xf60 drivers/infiniband/core/ucma.c:1479
CPU: 0 PID: 29874 Comm: syz-executor.3 Not tainted 5.16.0-rc3-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
=====================================================
[1] https://lore.kernel.org/linux-rdma/[email protected]/
Fixes: b5de0c6 ("RDMA/cma: Fix use after free race in roce multicast join")
Reported-by: [email protected]
Signed-off-by: Mark Zhang <[email protected]>
Link: https://lore.kernel.org/r/58a4a98323b5e6b1282e83f6b76960d06e43b9fa.1679309909.git.leon@kernel.org
Signed-off-by: Leon Romanovsky <[email protected]>1 parent 6bd1bca commit 58e84f6
1 file changed
Lines changed: 34 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
624 | 624 | | |
625 | 625 | | |
626 | 626 | | |
627 | | - | |
| 627 | + | |
628 | 628 | | |
629 | 629 | | |
630 | 630 | | |
631 | 631 | | |
632 | | - | |
633 | | - | |
634 | | - | |
635 | | - | |
636 | | - | |
637 | | - | |
638 | | - | |
639 | | - | |
640 | | - | |
641 | | - | |
642 | | - | |
643 | 632 | | |
644 | 633 | | |
645 | 634 | | |
| |||
659 | 648 | | |
660 | 649 | | |
661 | 650 | | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
662 | 661 | | |
663 | 662 | | |
664 | 663 | | |
| |||
1229 | 1228 | | |
1230 | 1229 | | |
1231 | 1230 | | |
1232 | | - | |
| 1231 | + | |
1233 | 1232 | | |
1234 | 1233 | | |
1235 | 1234 | | |
| |||
4569 | 4568 | | |
4570 | 4569 | | |
4571 | 4570 | | |
4572 | | - | |
| 4571 | + | |
| 4572 | + | |
| 4573 | + | |
| 4574 | + | |
4573 | 4575 | | |
4574 | 4576 | | |
4575 | 4577 | | |
| |||
4774 | 4776 | | |
4775 | 4777 | | |
4776 | 4778 | | |
4777 | | - | |
4778 | | - | |
4779 | | - | |
| 4779 | + | |
4780 | 4780 | | |
4781 | 4781 | | |
4782 | 4782 | | |
| |||
4804 | 4804 | | |
4805 | 4805 | | |
4806 | 4806 | | |
4807 | | - | |
| 4807 | + | |
4808 | 4808 | | |
4809 | 4809 | | |
4810 | 4810 | | |
| |||
4823 | 4823 | | |
4824 | 4824 | | |
4825 | 4825 | | |
4826 | | - | |
4827 | | - | |
| 4826 | + | |
| 4827 | + | |
| 4828 | + | |
| 4829 | + | |
| 4830 | + | |
4828 | 4831 | | |
4829 | 4832 | | |
4830 | 4833 | | |
| |||
4877 | 4880 | | |
4878 | 4881 | | |
4879 | 4882 | | |
4880 | | - | |
4881 | | - | |
4882 | | - | |
| 4883 | + | |
| 4884 | + | |
| 4885 | + | |
| 4886 | + | |
| 4887 | + | |
4883 | 4888 | | |
4884 | 4889 | | |
4885 | 4890 | | |
| |||
4956 | 4961 | | |
4957 | 4962 | | |
4958 | 4963 | | |
4959 | | - | |
4960 | | - | |
4961 | | - | |
4962 | 4964 | | |
4963 | 4965 | | |
4964 | 4966 | | |
| |||
4984 | 4986 | | |
4985 | 4987 | | |
4986 | 4988 | | |
| 4989 | + | |
| 4990 | + | |
| 4991 | + | |
4987 | 4992 | | |
4988 | 4993 | | |
4989 | 4994 | | |
| |||
5009 | 5014 | | |
5010 | 5015 | | |
5011 | 5016 | | |
| 5017 | + | |
| 5018 | + | |
| 5019 | + | |
5012 | 5020 | | |
5013 | 5021 | | |
5014 | 5022 | | |
| |||
0 commit comments