public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] RDMA/cma: Fix null pointer issue
@ 2018-02-02  6:42 Guanglei Li
       [not found] ` <1517553759-12272-1-git-send-email-guanglei.li-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Guanglei Li @ 2018-02-02  6:42 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, jgg-VPRAkNaXOzVWk0Htik3J/w
  Cc: guanglei.li-QHcLZuEGTsvQT0dZR+AlfA,
	junxiao.bi-QHcLZuEGTsvQT0dZR+AlfA,
	honglei.wang-QHcLZuEGTsvQT0dZR+AlfA

Scenario:
1. Port down and do fail over
2. Ap do rds_bind syscall

PID: 47039  TASK: ffff89887e2fe640  CPU: 47  COMMAND: "kworker/u:6"
 #0 [ffff898e35f159f0] machine_kexec at ffffffff8103abf9
 #1 [ffff898e35f15a60] crash_kexec at ffffffff810b96e3
 #2 [ffff898e35f15b30] oops_end at ffffffff8150f518
 #3 [ffff898e35f15b60] no_context at ffffffff8104854c
 #4 [ffff898e35f15ba0] __bad_area_nosemaphore at ffffffff81048675
 #5 [ffff898e35f15bf0] bad_area_nosemaphore at ffffffff810487d3
 #6 [ffff898e35f15c00] do_page_fault at ffffffff815120b8
 #7 [ffff898e35f15d10] page_fault at ffffffff8150ea95
    [exception RIP: unknown or invalid address]
    RIP: 0000000000000000  RSP: ffff898e35f15dc8  RFLAGS: 00010282
    RAX: 00000000fffffffe  RBX: ffff889b77f6fc00  RCX:ffffffff81c99d88
    RDX: 0000000000000000  RSI: ffff896019ee08e8  RDI:ffff889b77f6fc00
    RBP: ffff898e35f15df0   R8: ffff896019ee08c8  R9:0000000000000000
    R10: 0000000000000400  R11: 0000000000000000  R12:ffff896019ee08c0
    R13: ffff889b77f6fe68  R14: ffffffff81c99d80  R15: ffffffffa022a1e0
    ORIG_RAX: ffffffffffffffff  CS: 0010 SS: 0018
 #8 [ffff898e35f15dc8] cma_ndev_work_handler at ffffffffa022a228 [rdma_cm]
 #9 [ffff898e35f15df8] process_one_work at ffffffff8108a7c6
 #10 [ffff898e35f15e58] worker_thread at ffffffff8108bda0
 #11 [ffff898e35f15ee8] kthread at ffffffff81090fe6

PID: 45659  TASK: ffff880d313d2500  CPU: 31  COMMAND: "oracle_45659_ap"
 #0 [ffff881024ccfc98] __schedule at ffffffff8150bac4
 #1 [ffff881024ccfd40] schedule at ffffffff8150c2cf
 #2 [ffff881024ccfd50] __mutex_lock_slowpath at ffffffff8150cee7
 #3 [ffff881024ccfdc0] mutex_lock at ffffffff8150cdeb
 #4 [ffff881024ccfde0] rdma_destroy_id at ffffffffa022a027 [rdma_cm]
 #5 [ffff881024ccfe10] rds_ib_laddr_check at ffffffffa0357857 [rds_rdma]
 #6 [ffff881024ccfe50] rds_trans_get_preferred at ffffffffa0324c2a [rds]
 #7 [ffff881024ccfe80] rds_bind at ffffffffa031d690 [rds]
 #8 [ffff881024ccfeb0] sys_bind at ffffffff8142a670

PID: 45659                          PID: 47039
rds_ib_laddr_check
  /* create id_priv with a null event_handler */
  rdma_create_id
  rdma_bind_addr
    cma_acquire_dev
      /* add id_priv to cma_dev->id_list */
      cma_attach_to_dev
                                    cma_ndev_work_handler
                                      /* event_hanlder is null */
                                      id_priv->id.event_handler

Signed-off-by: Guanglei Li <guanglei.li-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Honglei Wang <honglei.wang-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Reviewed-by: Junxiao Bi <junxiao.bi-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
---
 net/rds/ib.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/rds/ib.c b/net/rds/ib.c
index b2a5067..8d68c95 100644
--- a/net/rds/ib.c
+++ b/net/rds/ib.c
@@ -345,7 +345,8 @@ static int rds_ib_laddr_check(struct net *net, __be32 addr)
 	/* Create a CMA ID and try to bind it. This catches both
 	 * IB and iWARP capable NICs.
 	 */
-	cm_id = rdma_create_id(&init_net, NULL, NULL, RDMA_PS_TCP, IB_QPT_RC);
+	cm_id = rdma_create_id(&init_net, rds_rdma_cm_event_handler,
+			NULL, RDMA_PS_TCP, IB_QPT_RC);
 	if (IS_ERR(cm_id))
 		return PTR_ERR(cm_id);
 
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2] RDMA/cma: Fix null pointer issue
       [not found] ` <1517553759-12272-1-git-send-email-guanglei.li-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
@ 2018-02-02  7:22   ` yanjzhu
       [not found]     ` <c7f0ebf5-6e67-18d4-c04f-088bb558621d-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: yanjzhu @ 2018-02-02  7:22 UTC (permalink / raw)
  To: Guanglei Li, dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, jgg-VPRAkNaXOzVWk0Htik3J/w
  Cc: junxiao.bi-QHcLZuEGTsvQT0dZR+AlfA,
	honglei.wang-QHcLZuEGTsvQT0dZR+AlfA

Hi, Guanglei

The checkpatch checks your patch. The followings are the result.

CHECK: Alignment should match open parenthesis
#148: FILE: net/rds/ib.c:349:
+    cm_id = rdma_create_id(&init_net, rds_rdma_cm_event_handler,
+            NULL, RDMA_PS_TCP, IB_QPT_RC);

total: 2 errors, 0 warnings, 1 checks, 9 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
       mechanically convert to the typical style using --fix or 
--fix-inplace.

1.patch has style problems, please review.

Zhu Yanjun


On 02/02/2018 02:42 PM, Guanglei Li wrote:
> Scenario:
> 1. Port down and do fail over
> 2. Ap do rds_bind syscall
>
> PID: 47039  TASK: ffff89887e2fe640  CPU: 47  COMMAND: "kworker/u:6"
>   #0 [ffff898e35f159f0] machine_kexec at ffffffff8103abf9
>   #1 [ffff898e35f15a60] crash_kexec at ffffffff810b96e3
>   #2 [ffff898e35f15b30] oops_end at ffffffff8150f518
>   #3 [ffff898e35f15b60] no_context at ffffffff8104854c
>   #4 [ffff898e35f15ba0] __bad_area_nosemaphore at ffffffff81048675
>   #5 [ffff898e35f15bf0] bad_area_nosemaphore at ffffffff810487d3
>   #6 [ffff898e35f15c00] do_page_fault at ffffffff815120b8
>   #7 [ffff898e35f15d10] page_fault at ffffffff8150ea95
>      [exception RIP: unknown or invalid address]
>      RIP: 0000000000000000  RSP: ffff898e35f15dc8  RFLAGS: 00010282
>      RAX: 00000000fffffffe  RBX: ffff889b77f6fc00  RCX:ffffffff81c99d88
>      RDX: 0000000000000000  RSI: ffff896019ee08e8  RDI:ffff889b77f6fc00
>      RBP: ffff898e35f15df0   R8: ffff896019ee08c8  R9:0000000000000000
>      R10: 0000000000000400  R11: 0000000000000000  R12:ffff896019ee08c0
>      R13: ffff889b77f6fe68  R14: ffffffff81c99d80  R15: ffffffffa022a1e0
>      ORIG_RAX: ffffffffffffffff  CS: 0010 SS: 0018
>   #8 [ffff898e35f15dc8] cma_ndev_work_handler at ffffffffa022a228 [rdma_cm]
>   #9 [ffff898e35f15df8] process_one_work at ffffffff8108a7c6
>   #10 [ffff898e35f15e58] worker_thread at ffffffff8108bda0
>   #11 [ffff898e35f15ee8] kthread at ffffffff81090fe6
>
> PID: 45659  TASK: ffff880d313d2500  CPU: 31  COMMAND: "oracle_45659_ap"
>   #0 [ffff881024ccfc98] __schedule at ffffffff8150bac4
>   #1 [ffff881024ccfd40] schedule at ffffffff8150c2cf
>   #2 [ffff881024ccfd50] __mutex_lock_slowpath at ffffffff8150cee7
>   #3 [ffff881024ccfdc0] mutex_lock at ffffffff8150cdeb
>   #4 [ffff881024ccfde0] rdma_destroy_id at ffffffffa022a027 [rdma_cm]
>   #5 [ffff881024ccfe10] rds_ib_laddr_check at ffffffffa0357857 [rds_rdma]
>   #6 [ffff881024ccfe50] rds_trans_get_preferred at ffffffffa0324c2a [rds]
>   #7 [ffff881024ccfe80] rds_bind at ffffffffa031d690 [rds]
>   #8 [ffff881024ccfeb0] sys_bind at ffffffff8142a670
>
> PID: 45659                          PID: 47039
> rds_ib_laddr_check
>    /* create id_priv with a null event_handler */
>    rdma_create_id
>    rdma_bind_addr
>      cma_acquire_dev
>        /* add id_priv to cma_dev->id_list */
>        cma_attach_to_dev
>                                      cma_ndev_work_handler
>                                        /* event_hanlder is null */
>                                        id_priv->id.event_handler
>
> Signed-off-by: Guanglei Li <guanglei.li-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> Signed-off-by: Honglei Wang <honglei.wang-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> Reviewed-by: Junxiao Bi <junxiao.bi-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> ---
>   net/rds/ib.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/rds/ib.c b/net/rds/ib.c
> index b2a5067..8d68c95 100644
> --- a/net/rds/ib.c
> +++ b/net/rds/ib.c
> @@ -345,7 +345,8 @@ static int rds_ib_laddr_check(struct net *net, __be32 addr)
>   	/* Create a CMA ID and try to bind it. This catches both
>   	 * IB and iWARP capable NICs.
>   	 */
> -	cm_id = rdma_create_id(&init_net, NULL, NULL, RDMA_PS_TCP, IB_QPT_RC);
> +	cm_id = rdma_create_id(&init_net, rds_rdma_cm_event_handler,
> +			NULL, RDMA_PS_TCP, IB_QPT_RC);
>   	if (IS_ERR(cm_id))
>   		return PTR_ERR(cm_id);
>   

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2] RDMA/cma: Fix null pointer issue
       [not found]     ` <c7f0ebf5-6e67-18d4-c04f-088bb558621d-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
@ 2018-02-02 18:38       ` Jason Gunthorpe
  0 siblings, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2018-02-02 18:38 UTC (permalink / raw)
  To: yanjzhu
  Cc: Guanglei Li, dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	junxiao.bi-QHcLZuEGTsvQT0dZR+AlfA,
	honglei.wang-QHcLZuEGTsvQT0dZR+AlfA

On Fri, Feb 02, 2018 at 03:22:18PM +0800, yanjzhu wrote:
> Hi, Guanglei
> 
> The checkpatch checks your patch. The followings are the result.
> 
> CHECK: Alignment should match open parenthesis
> #148: FILE: net/rds/ib.c:349:
> +    cm_id = rdma_create_id(&init_net, rds_rdma_cm_event_handler,
> +            NULL, RDMA_PS_TCP, IB_QPT_RC);
> 
> total: 2 errors, 0 warnings, 1 checks, 9 lines checked
> 
> NOTE: For some of the reported defects, checkpatch may be able to
>       mechanically convert to the typical style using --fix or
> 
> 1.patch has style problems, please review.

Also please try to write a more detailed commit message about what can
trigger this.. Is it userspace or remote network?

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2018-02-02 18:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-02  6:42 [PATCH v2] RDMA/cma: Fix null pointer issue Guanglei Li
     [not found] ` <1517553759-12272-1-git-send-email-guanglei.li-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2018-02-02  7:22   ` yanjzhu
     [not found]     ` <c7f0ebf5-6e67-18d4-c04f-088bb558621d-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2018-02-02 18:38       ` Jason Gunthorpe

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