lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250521143701.60625-1-yechey@ai-sast.com>
Date: Wed, 21 May 2025 22:37:01 +0800
From: Ye Chey <yechey@...sast.com>
To: idryomov@...il.com,
	xiubli@...hat.com
Cc: linux-kernel@...r.kernel.org,
	Ye Chey <yechey@...sast.com>
Subject: [PATCH] ceph: fix potential NULL pointer dereference in ceph_msgpool_get

Add NULL check for mempool_alloc return value in ceph_msgpool_get to prevent
potential NULL pointer dereference when memory allocation fails.

Signed-off-by: Ye Chey <yechey@...sast.com>
---
 net/ceph/msgpool.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/ceph/msgpool.c b/net/ceph/msgpool.c
index e3ecb80cd..e9d81c76d 100644
--- a/net/ceph/msgpool.c
+++ b/net/ceph/msgpool.c
@@ -74,6 +74,10 @@ struct ceph_msg *ceph_msgpool_get(struct ceph_msgpool *pool, int front_len,
 	}
 
 	msg = mempool_alloc(pool->pool, GFP_NOFS);
+	if (!msg) {
+		dout("msgpool_get %s failed\n", pool->name);
+		return NULL;
+	}
 	dout("msgpool_get %s %p\n", pool->name, msg);
 	return msg;
 }
-- 
2.44.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ