]>
Commit | Line | Data |
---|---|---|
00e5a55c BS |
1 | From: Laurie Barry <laurie.barry@emulex.com> |
2 | Subject: Correct scsi_host_lookup return value | |
3 | References: bnc#456532 | |
4 | ||
5 | In the scsi_generic_msg_handler routine it make a call to scsi_host_lookup and | |
6 | checks the return value for NULL, but the scsi_host_lookup routine can return | |
7 | an error when it fails instead of NULL. So when the scsi_host_lookup fails the | |
8 | scsi_generic_msg_handler crashes the kernel with "BUG: unable to handle kernel | |
9 | NULL pointer dereference at 00000000000000aa" | |
10 | ||
11 | Signed-off-by: Laurie Barry <laurie.barry@emulex.com> | |
12 | Signed-off-by: Hannes Reinecke <hare@suse.de> | |
13 | ||
14 | diff --git a/drivers/scsi/scsi_netlink.c b/drivers/scsi/scsi_netlink.c | |
15 | index b37e133..760bd23 100644 | |
16 | --- a/drivers/scsi/scsi_netlink.c | |
17 | +++ b/drivers/scsi/scsi_netlink.c | |
18 | @@ -261,7 +261,7 @@ scsi_generic_msg_handler(struct sk_buff *skb) | |
19 | ||
20 | /* if successful, scsi_host_lookup takes a shost reference */ | |
21 | shost = scsi_host_lookup(msg->host_no); | |
22 | - if (!shost) { | |
23 | + if (IS_ERR(shost)) { | |
24 | err = -ENODEV; | |
25 | goto driver_exit; | |
26 | } |