public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] RDMA/rxe: fix null deref on srq->rq.queue after resize failure
@ 2025-10-21  2:20 Yi Liu
  2025-10-21  3:48 ` Zhu Yanjun
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Yi Liu @ 2025-10-21  2:20 UTC (permalink / raw)
  To: linux-rdma; +Cc: Zhu Yanjun, Jason Gunthorpe, leon@kernel.org

A NULL pointer dereference can occur in rxe_srq_chk_attr() when
ibv_modify_srq() is invoked twice in succession under certain error
conditions. The first call may fail in rxe_queue_resize(), which leads
rxe_srq_from_attr() to set srq->rq.queue = NULL. The second call then
triggers a crash (null deref) when accessing
srq->rq.queue->buf->index_mask.

Call Trace:
<TASK>
rxe_modify_srq+0x170/0x480 [rdma_rxe]
? __pfx_rxe_modify_srq+0x10/0x10 [rdma_rxe]
? uverbs_try_lock_object+0x4f/0xa0 [ib_uverbs]
? rdma_lookup_get_uobject+0x1f0/0x380 [ib_uverbs]
ib_uverbs_modify_srq+0x204/0x290 [ib_uverbs]
? __pfx_ib_uverbs_modify_srq+0x10/0x10 [ib_uverbs]
? tryinc_node_nr_active+0xe6/0x150
? uverbs_fill_udata+0xed/0x4f0 [ib_uverbs]
ib_uverbs_handler_UVERBS_METHOD_INVOKE_WRITE+0x2c0/0x470 [ib_uverbs]
? __pfx_ib_uverbs_handler_UVERBS_METHOD_INVOKE_WRITE+0x10/0x10 [ib_uverbs]
? uverbs_fill_udata+0xed/0x4f0 [ib_uverbs]
ib_uverbs_run_method+0x55a/0x6e0 [ib_uverbs]
? __pfx_ib_uverbs_handler_UVERBS_METHOD_INVOKE_WRITE+0x10/0x10 [ib_uverbs]
ib_uverbs_cmd_verbs+0x54d/0x800 [ib_uverbs]
? __pfx_ib_uverbs_cmd_verbs+0x10/0x10 [ib_uverbs]
? __pfx___raw_spin_lock_irqsave+0x10/0x10
? __pfx_do_vfs_ioctl+0x10/0x10
? ioctl_has_perm.constprop.0.isra.0+0x2c7/0x4c0
? __pfx_ioctl_has_perm.constprop.0.isra.0+0x10/0x10
ib_uverbs_ioctl+0x13e/0x220 [ib_uverbs]
? __pfx_ib_uverbs_ioctl+0x10/0x10 [ib_uverbs]
__x64_sys_ioctl+0x138/0x1c0
do_syscall_64+0x82/0x250
? fdget_pos+0x58/0x4c0
? ksys_write+0xf3/0x1c0
? __pfx_ksys_write+0x10/0x10
? do_syscall_64+0xc8/0x250
? __pfx_vm_mmap_pgoff+0x10/0x10
? fget+0x173/0x230
? fput+0x2a/0x80
? ksys_mmap_pgoff+0x224/0x4c0
? do_syscall_64+0xc8/0x250
? do_user_addr_fault+0x37b/0xfe0
? clear_bhb_loop+0x50/0xa0
? clear_bhb_loop+0x50/0xa0
? clear_bhb_loop+0x50/0xa0
entry_SYSCALL_64_after_hwframe+0x76/0x7e

Fix by aligning the error handling path in rxe_srq_from_attr() with
rxe_cq_resize_queue(), which also uses rxe_queue_resize(): do not
nullify the queue when resize fails.

Reported-by: Liu Yi <asatsuyu.liu@gmail.com>
Link: https://paste.ubuntu.com/p/Zhj65q6gr9/
Fixes: 8700e3e7c485 ("Soft RoCE driver")
Tested-by: Zhu Yanjun <yanjun.zhu@linux.dev>
Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
---
drivers/infiniband/sw/rxe/rxe_srq.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/drivers/infiniband/sw/rxe/rxe_srq.c
b/drivers/infiniband/sw/rxe/rxe_srq.c
index 3661cb627d28..2764dc00e2f3 100644
--- a/drivers/infiniband/sw/rxe/rxe_srq.c
+++ b/drivers/infiniband/sw/rxe/rxe_srq.c
@@ -182,8 +182,6 @@ int rxe_srq_from_attr(struct rxe_dev *rxe, struct
rxe_srq *srq,
return 0;

err_free:
- rxe_queue_cleanup(q);
- srq->rq.queue = NULL;
return err;
}

--
2.34.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] RDMA/rxe: fix null deref on srq->rq.queue after resize failure
  2025-10-21  2:20 [PATCH] RDMA/rxe: fix null deref on srq->rq.queue after resize failure Yi Liu
@ 2025-10-21  3:48 ` Zhu Yanjun
  2025-10-21 13:42 ` Junxian Huang
  2025-10-27 13:30 ` Leon Romanovsky
  2 siblings, 0 replies; 8+ messages in thread
From: Zhu Yanjun @ 2025-10-21  3:48 UTC (permalink / raw)
  To: Yi Liu, linux-rdma; +Cc: Jason Gunthorpe, leon@kernel.org

在 2025/10/20 19:20, Yi Liu 写道:
> A NULL pointer dereference can occur in rxe_srq_chk_attr() when
> ibv_modify_srq() is invoked twice in succession under certain error
> conditions. The first call may fail in rxe_queue_resize(), which leads
> rxe_srq_from_attr() to set srq->rq.queue = NULL. The second call then
> triggers a crash (null deref) when accessing
> srq->rq.queue->buf->index_mask.
> 
> Call Trace:
> <TASK>
> rxe_modify_srq+0x170/0x480 [rdma_rxe]
> ? __pfx_rxe_modify_srq+0x10/0x10 [rdma_rxe]
> ? uverbs_try_lock_object+0x4f/0xa0 [ib_uverbs]
> ? rdma_lookup_get_uobject+0x1f0/0x380 [ib_uverbs]
> ib_uverbs_modify_srq+0x204/0x290 [ib_uverbs]
> ? __pfx_ib_uverbs_modify_srq+0x10/0x10 [ib_uverbs]
> ? tryinc_node_nr_active+0xe6/0x150
> ? uverbs_fill_udata+0xed/0x4f0 [ib_uverbs]
> ib_uverbs_handler_UVERBS_METHOD_INVOKE_WRITE+0x2c0/0x470 [ib_uverbs]
> ? __pfx_ib_uverbs_handler_UVERBS_METHOD_INVOKE_WRITE+0x10/0x10 [ib_uverbs]
> ? uverbs_fill_udata+0xed/0x4f0 [ib_uverbs]
> ib_uverbs_run_method+0x55a/0x6e0 [ib_uverbs]
> ? __pfx_ib_uverbs_handler_UVERBS_METHOD_INVOKE_WRITE+0x10/0x10 [ib_uverbs]
> ib_uverbs_cmd_verbs+0x54d/0x800 [ib_uverbs]
> ? __pfx_ib_uverbs_cmd_verbs+0x10/0x10 [ib_uverbs]
> ? __pfx___raw_spin_lock_irqsave+0x10/0x10
> ? __pfx_do_vfs_ioctl+0x10/0x10
> ? ioctl_has_perm.constprop.0.isra.0+0x2c7/0x4c0
> ? __pfx_ioctl_has_perm.constprop.0.isra.0+0x10/0x10
> ib_uverbs_ioctl+0x13e/0x220 [ib_uverbs]
> ? __pfx_ib_uverbs_ioctl+0x10/0x10 [ib_uverbs]
> __x64_sys_ioctl+0x138/0x1c0
> do_syscall_64+0x82/0x250
> ? fdget_pos+0x58/0x4c0
> ? ksys_write+0xf3/0x1c0
> ? __pfx_ksys_write+0x10/0x10
> ? do_syscall_64+0xc8/0x250
> ? __pfx_vm_mmap_pgoff+0x10/0x10
> ? fget+0x173/0x230
> ? fput+0x2a/0x80
> ? ksys_mmap_pgoff+0x224/0x4c0
> ? do_syscall_64+0xc8/0x250
> ? do_user_addr_fault+0x37b/0xfe0
> ? clear_bhb_loop+0x50/0xa0
> ? clear_bhb_loop+0x50/0xa0
> ? clear_bhb_loop+0x50/0xa0
> entry_SYSCALL_64_after_hwframe+0x76/0x7e
> 
> Fix by aligning the error handling path in rxe_srq_from_attr() with
> rxe_cq_resize_queue(), which also uses rxe_queue_resize(): do not
> nullify the queue when resize fails.
> 
> Reported-by: Liu Yi <asatsuyu.liu@gmail.com>
> Link: https://paste.ubuntu.com/p/Zhj65q6gr9/
> Fixes: 8700e3e7c485 ("Soft RoCE driver")
> Tested-by: Zhu Yanjun <yanjun.zhu@linux.dev>
> Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>

Thanks a lot. You are the author of this commit.
Signed-off-by: Liu Yi <asatsuyu.liu@gmail.com>

Please Jason && Leon also comment on this commit.
Thanks a lot.

Yanjun.Zhu

> ---
> drivers/infiniband/sw/rxe/rxe_srq.c | 2 --
> 1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/infiniband/sw/rxe/rxe_srq.c
> b/drivers/infiniband/sw/rxe/rxe_srq.c
> index 3661cb627d28..2764dc00e2f3 100644
> --- a/drivers/infiniband/sw/rxe/rxe_srq.c
> +++ b/drivers/infiniband/sw/rxe/rxe_srq.c
> @@ -182,8 +182,6 @@ int rxe_srq_from_attr(struct rxe_dev *rxe, struct
> rxe_srq *srq,
> return 0;
> 
> err_free:
> - rxe_queue_cleanup(q);
> - srq->rq.queue = NULL;
> return err;
> }
> 
> --
> 2.34.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] RDMA/rxe: fix null deref on srq->rq.queue after resize failure
  2025-10-21  2:20 [PATCH] RDMA/rxe: fix null deref on srq->rq.queue after resize failure Yi Liu
  2025-10-21  3:48 ` Zhu Yanjun
@ 2025-10-21 13:42 ` Junxian Huang
  2025-10-21 18:06   ` yanjun.zhu
  2025-10-27 13:30 ` Leon Romanovsky
  2 siblings, 1 reply; 8+ messages in thread
From: Junxian Huang @ 2025-10-21 13:42 UTC (permalink / raw)
  To: Yi Liu, linux-rdma; +Cc: Zhu Yanjun, Jason Gunthorpe, leon@kernel.org



On 2025/10/21 10:20, Yi Liu wrote:
> A NULL pointer dereference can occur in rxe_srq_chk_attr() when
> ibv_modify_srq() is invoked twice in succession under certain error
> conditions. The first call may fail in rxe_queue_resize(), which leads
> rxe_srq_from_attr() to set srq->rq.queue = NULL. The second call then
> triggers a crash (null deref) when accessing
> srq->rq.queue->buf->index_mask.
> 
> Call Trace:
> <TASK>
> rxe_modify_srq+0x170/0x480 [rdma_rxe]
> ? __pfx_rxe_modify_srq+0x10/0x10 [rdma_rxe]
> ? uverbs_try_lock_object+0x4f/0xa0 [ib_uverbs]
> ? rdma_lookup_get_uobject+0x1f0/0x380 [ib_uverbs]
> ib_uverbs_modify_srq+0x204/0x290 [ib_uverbs]
> ? __pfx_ib_uverbs_modify_srq+0x10/0x10 [ib_uverbs]
> ? tryinc_node_nr_active+0xe6/0x150
> ? uverbs_fill_udata+0xed/0x4f0 [ib_uverbs]
> ib_uverbs_handler_UVERBS_METHOD_INVOKE_WRITE+0x2c0/0x470 [ib_uverbs]
> ? __pfx_ib_uverbs_handler_UVERBS_METHOD_INVOKE_WRITE+0x10/0x10 [ib_uverbs]
> ? uverbs_fill_udata+0xed/0x4f0 [ib_uverbs]
> ib_uverbs_run_method+0x55a/0x6e0 [ib_uverbs]
> ? __pfx_ib_uverbs_handler_UVERBS_METHOD_INVOKE_WRITE+0x10/0x10 [ib_uverbs]
> ib_uverbs_cmd_verbs+0x54d/0x800 [ib_uverbs]
> ? __pfx_ib_uverbs_cmd_verbs+0x10/0x10 [ib_uverbs]
> ? __pfx___raw_spin_lock_irqsave+0x10/0x10
> ? __pfx_do_vfs_ioctl+0x10/0x10
> ? ioctl_has_perm.constprop.0.isra.0+0x2c7/0x4c0
> ? __pfx_ioctl_has_perm.constprop.0.isra.0+0x10/0x10
> ib_uverbs_ioctl+0x13e/0x220 [ib_uverbs]
> ? __pfx_ib_uverbs_ioctl+0x10/0x10 [ib_uverbs]
> __x64_sys_ioctl+0x138/0x1c0
> do_syscall_64+0x82/0x250
> ? fdget_pos+0x58/0x4c0
> ? ksys_write+0xf3/0x1c0
> ? __pfx_ksys_write+0x10/0x10
> ? do_syscall_64+0xc8/0x250
> ? __pfx_vm_mmap_pgoff+0x10/0x10
> ? fget+0x173/0x230
> ? fput+0x2a/0x80
> ? ksys_mmap_pgoff+0x224/0x4c0
> ? do_syscall_64+0xc8/0x250
> ? do_user_addr_fault+0x37b/0xfe0
> ? clear_bhb_loop+0x50/0xa0
> ? clear_bhb_loop+0x50/0xa0
> ? clear_bhb_loop+0x50/0xa0
> entry_SYSCALL_64_after_hwframe+0x76/0x7e
> 
> Fix by aligning the error handling path in rxe_srq_from_attr() with
> rxe_cq_resize_queue(), which also uses rxe_queue_resize(): do not
> nullify the queue when resize fails.
> 
> Reported-by: Liu Yi <asatsuyu.liu@gmail.com>
> Link: https://paste.ubuntu.com/p/Zhj65q6gr9/
> Fixes: 8700e3e7c485 ("Soft RoCE driver")
> Tested-by: Zhu Yanjun <yanjun.zhu@linux.dev>
> Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
> ---
> drivers/infiniband/sw/rxe/rxe_srq.c | 2 --
> 1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/infiniband/sw/rxe/rxe_srq.c
> b/drivers/infiniband/sw/rxe/rxe_srq.c
> index 3661cb627d28..2764dc00e2f3 100644
> --- a/drivers/infiniband/sw/rxe/rxe_srq.c
> +++ b/drivers/infiniband/sw/rxe/rxe_srq.c
> @@ -182,8 +182,6 @@ int rxe_srq_from_attr(struct rxe_dev *rxe, struct
> rxe_srq *srq,
> return 0;
> 
> err_free:
> - rxe_queue_cleanup(q);
> - srq->rq.queue = NULL;
> return err;

A minor suggestion, this err_free label doesn’t seem necessary any more.
You can return directly at the place where you jump to err_free currently.

Junxian

> }
> 
> --
> 2.34.1
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] RDMA/rxe: fix null deref on srq->rq.queue after resize failure
  2025-10-21 13:42 ` Junxian Huang
@ 2025-10-21 18:06   ` yanjun.zhu
  0 siblings, 0 replies; 8+ messages in thread
From: yanjun.zhu @ 2025-10-21 18:06 UTC (permalink / raw)
  To: Junxian Huang, Yi Liu, linux-rdma; +Cc: Jason Gunthorpe, leon@kernel.org

On 10/21/25 6:42 AM, Junxian Huang wrote:
> 
> 
> On 2025/10/21 10:20, Yi Liu wrote:
>> A NULL pointer dereference can occur in rxe_srq_chk_attr() when
>> ibv_modify_srq() is invoked twice in succession under certain error
>> conditions. The first call may fail in rxe_queue_resize(), which leads
>> rxe_srq_from_attr() to set srq->rq.queue = NULL. The second call then
>> triggers a crash (null deref) when accessing
>> srq->rq.queue->buf->index_mask.
>>
>> Call Trace:
>> <TASK>
>> rxe_modify_srq+0x170/0x480 [rdma_rxe]
>> ? __pfx_rxe_modify_srq+0x10/0x10 [rdma_rxe]
>> ? uverbs_try_lock_object+0x4f/0xa0 [ib_uverbs]
>> ? rdma_lookup_get_uobject+0x1f0/0x380 [ib_uverbs]
>> ib_uverbs_modify_srq+0x204/0x290 [ib_uverbs]
>> ? __pfx_ib_uverbs_modify_srq+0x10/0x10 [ib_uverbs]
>> ? tryinc_node_nr_active+0xe6/0x150
>> ? uverbs_fill_udata+0xed/0x4f0 [ib_uverbs]
>> ib_uverbs_handler_UVERBS_METHOD_INVOKE_WRITE+0x2c0/0x470 [ib_uverbs]
>> ? __pfx_ib_uverbs_handler_UVERBS_METHOD_INVOKE_WRITE+0x10/0x10 [ib_uverbs]
>> ? uverbs_fill_udata+0xed/0x4f0 [ib_uverbs]
>> ib_uverbs_run_method+0x55a/0x6e0 [ib_uverbs]
>> ? __pfx_ib_uverbs_handler_UVERBS_METHOD_INVOKE_WRITE+0x10/0x10 [ib_uverbs]
>> ib_uverbs_cmd_verbs+0x54d/0x800 [ib_uverbs]
>> ? __pfx_ib_uverbs_cmd_verbs+0x10/0x10 [ib_uverbs]
>> ? __pfx___raw_spin_lock_irqsave+0x10/0x10
>> ? __pfx_do_vfs_ioctl+0x10/0x10
>> ? ioctl_has_perm.constprop.0.isra.0+0x2c7/0x4c0
>> ? __pfx_ioctl_has_perm.constprop.0.isra.0+0x10/0x10
>> ib_uverbs_ioctl+0x13e/0x220 [ib_uverbs]
>> ? __pfx_ib_uverbs_ioctl+0x10/0x10 [ib_uverbs]
>> __x64_sys_ioctl+0x138/0x1c0
>> do_syscall_64+0x82/0x250
>> ? fdget_pos+0x58/0x4c0
>> ? ksys_write+0xf3/0x1c0
>> ? __pfx_ksys_write+0x10/0x10
>> ? do_syscall_64+0xc8/0x250
>> ? __pfx_vm_mmap_pgoff+0x10/0x10
>> ? fget+0x173/0x230
>> ? fput+0x2a/0x80
>> ? ksys_mmap_pgoff+0x224/0x4c0
>> ? do_syscall_64+0xc8/0x250
>> ? do_user_addr_fault+0x37b/0xfe0
>> ? clear_bhb_loop+0x50/0xa0
>> ? clear_bhb_loop+0x50/0xa0
>> ? clear_bhb_loop+0x50/0xa0
>> entry_SYSCALL_64_after_hwframe+0x76/0x7e
>>
>> Fix by aligning the error handling path in rxe_srq_from_attr() with
>> rxe_cq_resize_queue(), which also uses rxe_queue_resize(): do not
>> nullify the queue when resize fails.
>>
>> Reported-by: Liu Yi <asatsuyu.liu@gmail.com>
>> Link: https://paste.ubuntu.com/p/Zhj65q6gr9/
>> Fixes: 8700e3e7c485 ("Soft RoCE driver")
>> Tested-by: Zhu Yanjun <yanjun.zhu@linux.dev>
>> Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
>> ---
>> drivers/infiniband/sw/rxe/rxe_srq.c | 2 --
>> 1 file changed, 2 deletions(-)
>>
>> diff --git a/drivers/infiniband/sw/rxe/rxe_srq.c
>> b/drivers/infiniband/sw/rxe/rxe_srq.c
>> index 3661cb627d28..2764dc00e2f3 100644
>> --- a/drivers/infiniband/sw/rxe/rxe_srq.c
>> +++ b/drivers/infiniband/sw/rxe/rxe_srq.c
>> @@ -182,8 +182,6 @@ int rxe_srq_from_attr(struct rxe_dev *rxe, struct
>> rxe_srq *srq,
>> return 0;
>>
>> err_free:
>> - rxe_queue_cleanup(q);
>> - srq->rq.queue = NULL;
>> return err;
> 
> A minor suggestion, this err_free label doesn’t seem necessary any more.
> You can return directly at the place where you jump to err_free currently.

Thanks a lot. It might be better to return immediately when an error 
occurs, but keeping the current state unchanged could also be a valid 
option.

Best Regards,
Yanjun.Zhu

> 
> Junxian
> 
>> }
>>
>> --
>> 2.34.1
>>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] RDMA/rxe: fix null deref on srq->rq.queue after resize failure
  2025-10-21  2:20 [PATCH] RDMA/rxe: fix null deref on srq->rq.queue after resize failure Yi Liu
  2025-10-21  3:48 ` Zhu Yanjun
  2025-10-21 13:42 ` Junxian Huang
@ 2025-10-27 13:30 ` Leon Romanovsky
  2025-10-27 16:56   ` Yanjun.Zhu
  2 siblings, 1 reply; 8+ messages in thread
From: Leon Romanovsky @ 2025-10-27 13:30 UTC (permalink / raw)
  To: Yi Liu; +Cc: linux-rdma, Zhu Yanjun, Jason Gunthorpe

On Tue, Oct 21, 2025 at 10:20:26AM +0800, Yi Liu wrote:
> A NULL pointer dereference can occur in rxe_srq_chk_attr() when
> ibv_modify_srq() is invoked twice in succession under certain error
> conditions. The first call may fail in rxe_queue_resize(), which leads
> rxe_srq_from_attr() to set srq->rq.queue = NULL. The second call then
> triggers a crash (null deref) when accessing
> srq->rq.queue->buf->index_mask.
> 
> Call Trace:
> <TASK>
> rxe_modify_srq+0x170/0x480 [rdma_rxe]
> ? __pfx_rxe_modify_srq+0x10/0x10 [rdma_rxe]
> ? uverbs_try_lock_object+0x4f/0xa0 [ib_uverbs]
> ? rdma_lookup_get_uobject+0x1f0/0x380 [ib_uverbs]
> ib_uverbs_modify_srq+0x204/0x290 [ib_uverbs]
> ? __pfx_ib_uverbs_modify_srq+0x10/0x10 [ib_uverbs]
> ? tryinc_node_nr_active+0xe6/0x150
> ? uverbs_fill_udata+0xed/0x4f0 [ib_uverbs]
> ib_uverbs_handler_UVERBS_METHOD_INVOKE_WRITE+0x2c0/0x470 [ib_uverbs]
> ? __pfx_ib_uverbs_handler_UVERBS_METHOD_INVOKE_WRITE+0x10/0x10 [ib_uverbs]
> ? uverbs_fill_udata+0xed/0x4f0 [ib_uverbs]
> ib_uverbs_run_method+0x55a/0x6e0 [ib_uverbs]
> ? __pfx_ib_uverbs_handler_UVERBS_METHOD_INVOKE_WRITE+0x10/0x10 [ib_uverbs]
> ib_uverbs_cmd_verbs+0x54d/0x800 [ib_uverbs]
> ? __pfx_ib_uverbs_cmd_verbs+0x10/0x10 [ib_uverbs]
> ? __pfx___raw_spin_lock_irqsave+0x10/0x10
> ? __pfx_do_vfs_ioctl+0x10/0x10
> ? ioctl_has_perm.constprop.0.isra.0+0x2c7/0x4c0
> ? __pfx_ioctl_has_perm.constprop.0.isra.0+0x10/0x10
> ib_uverbs_ioctl+0x13e/0x220 [ib_uverbs]
> ? __pfx_ib_uverbs_ioctl+0x10/0x10 [ib_uverbs]
> __x64_sys_ioctl+0x138/0x1c0
> do_syscall_64+0x82/0x250
> ? fdget_pos+0x58/0x4c0
> ? ksys_write+0xf3/0x1c0
> ? __pfx_ksys_write+0x10/0x10
> ? do_syscall_64+0xc8/0x250
> ? __pfx_vm_mmap_pgoff+0x10/0x10
> ? fget+0x173/0x230
> ? fput+0x2a/0x80
> ? ksys_mmap_pgoff+0x224/0x4c0
> ? do_syscall_64+0xc8/0x250
> ? do_user_addr_fault+0x37b/0xfe0
> ? clear_bhb_loop+0x50/0xa0
> ? clear_bhb_loop+0x50/0xa0
> ? clear_bhb_loop+0x50/0xa0
> entry_SYSCALL_64_after_hwframe+0x76/0x7e
> 
> Fix by aligning the error handling path in rxe_srq_from_attr() with
> rxe_cq_resize_queue(), which also uses rxe_queue_resize(): do not
> nullify the queue when resize fails.
> 
> Reported-by: Liu Yi <asatsuyu.liu@gmail.com>
> Link: https://paste.ubuntu.com/p/Zhj65q6gr9/
> Fixes: 8700e3e7c485 ("Soft RoCE driver")
> Tested-by: Zhu Yanjun <yanjun.zhu@linux.dev>
> Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
> ---
> drivers/infiniband/sw/rxe/rxe_srq.c | 2 --
> 1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/infiniband/sw/rxe/rxe_srq.c
> b/drivers/infiniband/sw/rxe/rxe_srq.c
> index 3661cb627d28..2764dc00e2f3 100644
> --- a/drivers/infiniband/sw/rxe/rxe_srq.c
> +++ b/drivers/infiniband/sw/rxe/rxe_srq.c
> @@ -182,8 +182,6 @@ int rxe_srq_from_attr(struct rxe_dev *rxe, struct
> rxe_srq *srq,
> return 0;
> 
> err_free:
> - rxe_queue_cleanup(q);
> - srq->rq.queue = NULL;
> return err;
> }

This patch is badly formatted and doesn't apply.

Applying: RDMA/rxe: fix null deref on srq->rq.queue after resize failure
Patch failed at 0001 RDMA/rxe: fix null deref on srq->rq.queue after resize failure
error: git diff header lacks filename information when removing 1 leading pathname component (line 6)
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Press any key to continue...


> 
> --
> 2.34.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] RDMA/rxe: fix null deref on srq->rq.queue after resize failure
  2025-10-27 13:30 ` Leon Romanovsky
@ 2025-10-27 16:56   ` Yanjun.Zhu
  2025-10-28  2:31     ` Yi Liu
  0 siblings, 1 reply; 8+ messages in thread
From: Yanjun.Zhu @ 2025-10-27 16:56 UTC (permalink / raw)
  To: Leon Romanovsky, Yi Liu; +Cc: linux-rdma, Jason Gunthorpe


On 10/27/25 6:30 AM, Leon Romanovsky wrote:
>> err_free:
>> - rxe_queue_cleanup(q);
>> - srq->rq.queue = NULL;
>> return err;
>> }
> This patch is badly formatted and doesn't apply.


Sorry. I will send a new patch very soon.

Yanjun.Zhu


>
> Applying: RDMA/rxe: fix null deref on srq->rq.queue after resize failure
> Patch failed at 0001 RDMA/rxe: fix null deref on srq->rq.queue after resize failure
> error: git diff header lacks filename information when removing 1 leading pathname component (line 6)
> hint: Use 'git am --show-current-patch=diff' to see the failed patch
> hint: When you have resolved this problem, run "git am --continue".
> hint: If you prefer to skip this patch, run "git am --skip" instead.
> hint: To restore the original branch and stop patching, run "git am --abort".
> hint: Disable this message with "git config set advice.mergeConflict false"
> Press any key to continue...
>
>
>> --
>> 2.34.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] RDMA/rxe: fix null deref on srq->rq.queue after resize failure
  2025-10-27 16:56   ` Yanjun.Zhu
@ 2025-10-28  2:31     ` Yi Liu
  2025-10-28  4:19       ` Zhu Yanjun
  0 siblings, 1 reply; 8+ messages in thread
From: Yi Liu @ 2025-10-28  2:31 UTC (permalink / raw)
  To: Yanjun.Zhu; +Cc: Leon Romanovsky, linux-rdma, Jason Gunthorpe

Thanks for your kind help. I think the format issue comes from the
Gmail Web Client. I did not send the email by "git send-email".

Yanjun.Zhu <yanjun.zhu@linux.dev> 于2025年10月28日周二 00:56写道:
>
>
> On 10/27/25 6:30 AM, Leon Romanovsky wrote:
> >> err_free:
> >> - rxe_queue_cleanup(q);
> >> - srq->rq.queue = NULL;
> >> return err;
> >> }
> > This patch is badly formatted and doesn't apply.
>
>
> Sorry. I will send a new patch very soon.
>
> Yanjun.Zhu
>
>
> >
> > Applying: RDMA/rxe: fix null deref on srq->rq.queue after resize failure
> > Patch failed at 0001 RDMA/rxe: fix null deref on srq->rq.queue after resize failure
> > error: git diff header lacks filename information when removing 1 leading pathname component (line 6)
> > hint: Use 'git am --show-current-patch=diff' to see the failed patch
> > hint: When you have resolved this problem, run "git am --continue".
> > hint: If you prefer to skip this patch, run "git am --skip" instead.
> > hint: To restore the original branch and stop patching, run "git am --abort".
> > hint: Disable this message with "git config set advice.mergeConflict false"
> > Press any key to continue...
> >
> >
> >> --
> >> 2.34.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] RDMA/rxe: fix null deref on srq->rq.queue after resize failure
  2025-10-28  2:31     ` Yi Liu
@ 2025-10-28  4:19       ` Zhu Yanjun
  0 siblings, 0 replies; 8+ messages in thread
From: Zhu Yanjun @ 2025-10-28  4:19 UTC (permalink / raw)
  To: Yi Liu; +Cc: Leon Romanovsky, linux-rdma, Jason Gunthorpe

在 2025/10/27 19:31, Yi Liu 写道:
> Thanks for your kind help. I think the format issue comes from the
> Gmail Web Client. I did not send the email by "git send-email".

No worries ^_^. Let us wait for the further feedback.

Yanjun.Zhu

> 
> Yanjun.Zhu <yanjun.zhu@linux.dev> 于2025年10月28日周二 00:56写道:
>>
>>
>> On 10/27/25 6:30 AM, Leon Romanovsky wrote:
>>>> err_free:
>>>> - rxe_queue_cleanup(q);
>>>> - srq->rq.queue = NULL;
>>>> return err;
>>>> }
>>> This patch is badly formatted and doesn't apply.
>>
>>
>> Sorry. I will send a new patch very soon.
>>
>> Yanjun.Zhu
>>
>>
>>>
>>> Applying: RDMA/rxe: fix null deref on srq->rq.queue after resize failure
>>> Patch failed at 0001 RDMA/rxe: fix null deref on srq->rq.queue after resize failure
>>> error: git diff header lacks filename information when removing 1 leading pathname component (line 6)
>>> hint: Use 'git am --show-current-patch=diff' to see the failed patch
>>> hint: When you have resolved this problem, run "git am --continue".
>>> hint: If you prefer to skip this patch, run "git am --skip" instead.
>>> hint: To restore the original branch and stop patching, run "git am --abort".
>>> hint: Disable this message with "git config set advice.mergeConflict false"
>>> Press any key to continue...
>>>
>>>
>>>> --
>>>> 2.34.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-10-28  4:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-21  2:20 [PATCH] RDMA/rxe: fix null deref on srq->rq.queue after resize failure Yi Liu
2025-10-21  3:48 ` Zhu Yanjun
2025-10-21 13:42 ` Junxian Huang
2025-10-21 18:06   ` yanjun.zhu
2025-10-27 13:30 ` Leon Romanovsky
2025-10-27 16:56   ` Yanjun.Zhu
2025-10-28  2:31     ` Yi Liu
2025-10-28  4:19       ` Zhu Yanjun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox