[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230704104725.2510-1-machel@vivo.com>
Date: Tue, 4 Jul 2023 18:47:16 +0800
From: Wang Ming <machel@...o.com>
To: Christine Caulfield <ccaulfie@...hat.com>,
David Teigland <teigland@...hat.com>, cluster-devel@...hat.com,
linux-kernel@...r.kernel.org
Cc: opensource.kernel@...o.com, Wang Ming <machel@...o.com>
Subject: [PATCH v1] fs:dlm:Fix NULL pointer dereference bug in accept_from_sock()
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@...o.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
Powered by blists - more mailing lists