From: Laurie Barry Subject: Correct scsi_host_lookup return value References: bnc#456532 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 Signed-off-by: Hannes Reinecke diff --git a/drivers/scsi/scsi_netlink.c b/drivers/scsi/scsi_netlink.c index b37e133..760bd23 100644 --- a/drivers/scsi/scsi_netlink.c +++ b/drivers/scsi/scsi_netlink.c @@ -261,7 +261,7 @@ scsi_generic_msg_handler(struct sk_buff *skb) /* 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; }