Blob Blame History Raw
From: Laurie Barry <laurie.barry@emulex.com>
Subject: Correct scsi_host_lookup return value
References: bnc#456532
Patch-mainline: not yet

In the scsi_generic_msg_handler routine it make a call to scsi_host_lookup and
checks the return value for NULL, but the scsi_host_lookup routine can return
an error when it fails instead of NULL. So when the scsi_host_lookup fails the
scsi_generic_msg_handler crashes the kernel with "BUG: unable to handle kernel
NULL pointer dereference at 00000000000000aa"

Signed-off-by: Laurie Barry <laurie.barry@emulex.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>

---
 drivers/scsi/scsi_netlink.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/scsi/scsi_netlink.c
+++ b/drivers/scsi/scsi_netlink.c
@@ -259,7 +259,7 @@ scsi_generic_msg_handler(struct sk_buff
 
 		/* if successful, scsi_host_lookup takes a shost reference */
 		shost = scsi_host_lookup(msg->host_no);
-		if (!shost) {
+		if (IS_ERR(shost)) {
 			err = -ENODEV;
 			goto driver_exit;
 		}