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: <20170920132541.13691-1-colin.king@canonical.com>
Date:   Wed, 20 Sep 2017 14:25:41 +0100
From:   Colin King <colin.king@...onical.com>
To:     Johannes Thumshirn <jth@...nel.org>,
        "James E . J . Bottomley" <jejb@...ux.vnet.ibm.com>,
        "Martin K . Petersen" <martin.petersen@...cle.com>,
        fcoe-devel@...n-fcoe.org, linux-scsi@...r.kernel.org
Cc:     kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] scsi: libfc: fix potential null lport dereference

From: Colin Ian King <colin.king@...onical.com>

Don't pass a null lport to FC_LPORT_DBG as this causes a null pointer
dereference when accessing lport->host and lport->port_id. Instead
use the FC_CHECK_LOGGING macro to print the kernel message via pr_info.

Detected by CoverityScan, CID#113198 ("Dereference after null check")

Signed-off-by: Colin Ian King <colin.king@...onical.com>
---
 drivers/scsi/libfc/fc_exch.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c
index 42bcf7f3a0f9..46d842d238f1 100644
--- a/drivers/scsi/libfc/fc_exch.c
+++ b/drivers/scsi/libfc/fc_exch.c
@@ -2603,8 +2603,8 @@ void fc_exch_recv(struct fc_lport *lport, struct fc_frame *fp)
 
 	/* lport lock ? */
 	if (!lport || lport->state == LPORT_ST_DISABLED) {
-		FC_LPORT_DBG(lport, "Receiving frames for an lport that "
-			     "has not been initialized correctly\n");
+		FC_CHECK_LOGGING(FC_LPORT_LOGGING,
+				 pr_info("Receiving frames for an lport that has not been initialized correctly\n"));
 		fc_frame_free(fp);
 		return;
 	}
-- 
2.14.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ