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: <1400429255-10899-1-git-send-email-rickard_strandqvist@spectrumdigital.se>
Date:	Sun, 18 May 2014 18:07:35 +0200
From:	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
To:	Eddie Wai <eddie.wai@...adcom.com>,
	"James E.J. Bottomley" <JBottomley@...allels.com>
Cc:	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>,
	linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] scsi: bnx2i: bnx2i_iscsi.c:  Fix for possible null pointer dereference

There is otherwise a risk of a possible null pointer dereference.

Was largely found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
---
 drivers/scsi/bnx2i/bnx2i_iscsi.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c
index 166543f..3df26ac 100644
--- a/drivers/scsi/bnx2i/bnx2i_iscsi.c
+++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c
@@ -237,7 +237,10 @@ static int bnx2i_bind_conn_to_iscsi_cid(struct bnx2i_hba *hba,
 					struct bnx2i_conn *bnx2i_conn,
 					u32 iscsi_cid)
 {
-	if (hba && hba->cid_que.conn_cid_tbl[iscsi_cid]) {
+	if(!hba)
+		return -EFAULT;
+
+	if (hba->cid_que.conn_cid_tbl[iscsi_cid]) {
 		iscsi_conn_printk(KERN_ALERT, bnx2i_conn->cls_conn->dd_data,
 				 "conn bind - entry #%d not free\n", iscsi_cid);
 		return -EBUSY;
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ