[PATCH v6 2/2] nbd: share nbd_put and return by goto put_nbd

2021-02-18 Thread Sun Ke
Replace the following two statements by the statement “goto put_nbd;” nbd_put(nbd); return 0; Suggested-by: Markus Elfring Signed-off-by: Sun Ke --- drivers/block/nbd.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/block/nbd.c b/drivers

[PATCH v6 0/2] fix a NULL pointer bug and simplify the code

2021-02-18 Thread Sun Ke
add put_nbd. v2: Use jump target unlock. Sun Ke (2): nbd: Fix NULL pointer in flush_workqueue nbd: share nbd_put and return by goto put_nbd drivers/block/nbd.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) -- 2.25.4

[PATCH v6 1/2] nbd: Fix NULL pointer in flush_workqueue

2021-02-18 Thread Sun Ke
] __x64_sys_sendmsg+0x23/0x30 [ 656.390751] do_syscall_64+0x45/0x70 [ 656.391017] entry_SYSCALL_64_after_hwframe+0x44/0xa9 To fix it, just add if (nbd->recv_workq) to nbd_disconnect_and_put(). Signed-off-by: Sun Ke --- v6: add if (nbd->recv_workq) to nbd_disconnect_and_put() v5: add “Sug

[PATCH v5 1/2] nbd: Fix NULL pointer in flush_workqueue

2021-02-04 Thread Sun Ke
] __x64_sys_sendmsg+0x23/0x30 [ 656.390751] do_syscall_64+0x45/0x70 [ 656.391017] entry_SYSCALL_64_after_hwframe+0x44/0xa9 Fixes: e9e006f5fcf2 ("nbd: fix max number of supported devs") Suggested-by: Markus Elfring Signed-off-by: Sun Ke --- v4: Share exception handling code for if branc

[PATCH v5 2/2] nbd: share nbd_put and return by goto put_nbd

2021-02-04 Thread Sun Ke
Replace the following two statements by the statement “goto put_nbd;” nbd_put(nbd); return 0; Suggested-by: Markus Elfring Signed-off-by: Sun Ke --- drivers/block/nbd.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/block/nbd.c b/drivers

[PATCH v5 0/2] fix a NULL pointer bug and simplify the code

2021-02-04 Thread Sun Ke
v5: Adjust the title and add “Suggested-by”. v4: Share exception handling code for if branches and move put_nbd adjustment to a separate patch. v3: Do not use unlock and add put_nbd. v2: Use jump target unlock. Sun Ke (2): nbd: Fix NULL pointer in flush_workqueue nbd: share nbd_put

[PATCH v4 2/2] nbd: share exception handling code by goto put_nbd

2021-02-03 Thread Sun Ke
Replace the following two statements by the statement “goto put_nbd;” nbd_put(nbd); return 0; Signed-off-by: Sun Ke --- drivers/block/nbd.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 3c9b3bf3f4c2

[PATCH v4 1/2] nbd: Fix NULL pointer in flush_workqueue

2021-02-03 Thread Sun Ke
] __x64_sys_sendmsg+0x23/0x30 [ 656.390751] do_syscall_64+0x45/0x70 [ 656.391017] entry_SYSCALL_64_after_hwframe+0x44/0xa9 Fixes: e9e006f5fcf2 ("nbd: fix max number of supported devs") Signed-off-by: Sun Ke --- v4: Share exception handling code for if branches v3: Do not use unlock and a

[PATCH v4 0/2] fix a NULL pointer bug and simplify the code

2021-02-03 Thread Sun Ke
v4: Share exception handling code for if branches and move put_nbd adjustment to a separate patch. v3: Do not use unlock and add put_nbd. v2: Use jump target unlock. Sun Ke (2): nbd: Fix NULL pointer in flush_workqueue nbd: share exception handling code by goto put_nbd drivers

[PATCH v3] nbd: Fix NULL pointer in flush_workqueue

2021-02-01 Thread Sun Ke
] __x64_sys_sendmsg+0x23/0x30 [ 656.390751] do_syscall_64+0x45/0x70 [ 656.391017] entry_SYSCALL_64_after_hwframe+0x44/0xa9 To fix it, just add a check for a non null task_recv in nbd_genl_disconnect. Fixes: e9e006f5fcf2 ("nbd: fix max number of supported devs") Signed-off-by: Sun Ke

Re: [PATCH v2] nbd: Fix NULL pointer in flush_workqueue

2021-02-01 Thread Sun Ke
-EINVAL; } It looks better,  thanks for your suggestion. By the way: Would you like to replace the following two statements by the statement “goto put_nbd;” in another update step for this function implementation? nbd_put(nbd); return 0; Sure, I will do it. Regards, Markus Thanks, Sun Ke .

[PATCH v2] nbd: Fix NULL pointer in flush_workqueue

2021-02-01 Thread Sun Ke
] __x64_sys_sendmsg+0x23/0x30 [ 656.390751] do_syscall_64+0x45/0x70 [ 656.391017] entry_SYSCALL_64_after_hwframe+0x44/0xa9 To fix it, just add a check for a non null task_recv in nbd_genl_disconnect. Fixes: e9e006f5fcf2 ("nbd: fix max number of supported devs") Signed-off-by: Sun Ke -

Re: [PATCH] nbd: Fix NULL pointer in flush_workqueue

2021-01-31 Thread Sun Ke
hi,Markus 在 2021/1/29 3:42, Markus Elfring 写道: … +++ b/drivers/block/nbd.c @@ -2011,12 +2011,20 @@ static int nbd_genl_disconnect(struct sk_buff *skb, struct genl_info *info) index); return -EINVAL; } + mutex_lock(>config_lock); if

[PATCH] nbd: Fix NULL pointer in flush_workqueue

2021-01-27 Thread Sun Ke
] __x64_sys_sendmsg+0x23/0x30 [ 656.390751] do_syscall_64+0x45/0x70 [ 656.391017] entry_SYSCALL_64_after_hwframe+0x44/0xa9 To fix it, just add a check for a non null task_recv in nbd_genl_disconnect. Fixes: e9e006f5fcf2 ("nbd: fix max number of supported devs") Signed-off-by: Sun Ke --

Re: [v3] nbd: fix potential NULL pointer fault in nbd_genl_disconnect

2020-06-01 Thread Sun Ke
在 2020/2/12 10:00, sunke (E) 写道: 在 2020/2/12 0:39, Mike Christie 写道: On 02/10/2020 10:12 PM, sunke (E) wrote: 在 2020/2/11 1:05, Mike Christie 写道: On 02/10/2020 01:32 AM, Sun Ke wrote: Open /dev/nbdX first, the config_refs will be 1 and the pointers in nbd_device are still null

[PATCH] nbd: add a missed nbd_config_put() in nbd_xmit_timeout()

2019-08-12 Thread Sun Ke
ce being setup by another task" in nbd_add_sock() and nbd device can not be reused. Fixes: 8f3ea35929a0 ("nbd: handle unexpected replies better") Signed-off-by: Sun Ke --- drivers/block/nbd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/block/nbd.