From 0e9ee17642dbd0f66f6d5bbd58de31a8fe21b97a Mon Sep 17 00:00:00 2001 From: Ziye Yang Date: Tue, 9 Feb 2021 20:33:22 +0800 Subject: [PATCH] posix: Fix the NULL pointer issue of group. A single sock connection can call posix_sock_flush, and this sock may not belong to a polling group. So add the check in sock_check_zcopy to avoid such issue. Fixes #1788 Change-Id: Id0a2f80ad0f3cdb7fc736a3be3211e49513751b1 Signed-off-by: Ziye Yang Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6334 Reviewed-by: Reviewed-by: Aleksey Marchuk Reviewed-by: Karol Latecki Reviewed-by: Jim Harris Reviewed-by: Paul Luse Tested-by: SPDK CI Jenkins Community-CI: Mellanox Build Bot --- module/sock/posix/posix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/sock/posix/posix.c b/module/sock/posix/posix.c index 24a509cd3..f23039af2 100644 --- a/module/sock/posix/posix.c +++ b/module/sock/posix/posix.c @@ -724,7 +724,7 @@ _sock_check_zcopy(struct spdk_sock *sock) /* If we reaped buffer reclaim notification and sock is not in pending_recv list yet, * add it now. It allows to call socket callback and process completions */ - if (found && !psock->pending_recv) { + if (found && !psock->pending_recv && group) { psock->pending_recv = true; TAILQ_INSERT_TAIL(&group->pending_recv, psock, link); }