From: Wang Ming <machel@vivo.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH v1] fs:dlm:Fix NULL pointer dereference bug in accept_from_sock()
Date: Tue, 4 Jul 2023 18:47:16 +0800 [thread overview]
Message-ID: <20230704104725.2510-1-machel@vivo.com> (raw)
newcon -> sock is NULL but dereferenced.
First check newcon. Whether sock is a null pointer.
If so, the subsequent operations are skipped.
If it is not empty, perform subsequent operations.
Signed-off-by: Wang Ming <machel@vivo.com>
---
fs/dlm/lowcomms.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 9f14ea9f6..ea18b9478 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -1081,9 +1081,12 @@ static int accept_from_sock(void)
add_sock(newsock, newcon);
/* check if we receved something while adding */
- lock_sock(newcon->sock->sk);
- lowcomms_queue_rwork(newcon);
- release_sock(newcon->sock->sk);
+ if (newcon->sock) {
+ lock_sock(newcon->sock->sk);
+ lowcomms_queue_rwork(newcon);
+ release_sock(newcon->sock->sk);
+ }
+
}
up_write(&newcon->sock_lock);
srcu_read_unlock(&connections_srcu, idx);
--
2.25.1
next reply other threads:[~2023-07-04 10:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-04 10:47 Wang Ming [this message]
2023-07-04 16:22 ` [Cluster-devel] [PATCH v1] fs:dlm:Fix NULL pointer dereference bug in accept_from_sock() Alexander Aring
2023-07-05 1:16 ` [Cluster-devel] 回复: " 王明-软件底层技术部
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230704104725.2510-1-machel@vivo.com \
--to=machel@vivo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).