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>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200610172359.GB90634@mwanda>
Date:   Wed, 10 Jun 2020 20:23:59 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     Joshua Morris <josh.h.morris@...ibm.com>,
        Philip Kelleher <pjk1939@...ux.ibm.com>
Cc:     Jens Axboe <axboe@...nel.dk>, linux-block@...r.kernel.org,
        linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [PATCH 1/2] rsxx: Fix potential NULL dereference setting up debugfs

The "card->gendisk" pointer is allocated in rsxx_setup_dev() but there
is a module option "enable_blkdev" which lets people disable the block
device.  In that situation the "card->gendisk" pointer is NULL and it
would lead to a NULL dereference here.

Fixes: 36f988e978f8 ("rsxx: Adding in debugfs entries.")
Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
---
This patch is from static analysis.  The patch is obviously harmless.
So far as I can tell, the bug is real.  But maybe a different solution
is prefered?

 drivers/block/rsxx/core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c
index 10f6368117d81..6207449fa716f 100644
--- a/drivers/block/rsxx/core.c
+++ b/drivers/block/rsxx/core.c
@@ -228,6 +228,9 @@ static void rsxx_debugfs_dev_new(struct rsxx_cardinfo *card)
 	struct dentry *debugfs_pci_regs;
 	struct dentry *debugfs_cram;
 
+	if (!card->gendisk)
+		return;
+
 	card->debugfs_dir = debugfs_create_dir(card->gendisk->disk_name, NULL);
 	if (IS_ERR_OR_NULL(card->debugfs_dir))
 		goto failed_debugfs_dir;
-- 
2.26.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ