summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/cxgbi
diff options
context:
space:
mode:
authorVarun Prakash <varun@chelsio.com>2019-05-22 16:40:55 +0200
committerMartin K. Petersen <martin.petersen@oracle.com>2019-05-30 03:48:59 +0200
commitcc555759117e8349088e0c5d19f2f2a500bafdbd (patch)
treeb4a4e72205ba9b735f86a9030f5fe8bf63a0947d /drivers/scsi/cxgbi
parentRevert "scsi: sd: Keep disk read-only when re-reading partition" (diff)
downloadlinux-cc555759117e8349088e0c5d19f2f2a500bafdbd.tar.xz
linux-cc555759117e8349088e0c5d19f2f2a500bafdbd.zip
scsi: libcxgbi: add a check for NULL pointer in cxgbi_check_route()
ip_dev_find() can return NULL so add a check for NULL pointer. Signed-off-by: Varun Prakash <varun@chelsio.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/cxgbi')
-rw-r--r--drivers/scsi/cxgbi/libcxgbi.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
index 8b915d4ed98d..7d43e014bd21 100644
--- a/drivers/scsi/cxgbi/libcxgbi.c
+++ b/drivers/scsi/cxgbi/libcxgbi.c
@@ -639,6 +639,10 @@ cxgbi_check_route(struct sockaddr *dst_addr, int ifindex)
if (ndev->flags & IFF_LOOPBACK) {
ndev = ip_dev_find(&init_net, daddr->sin_addr.s_addr);
+ if (!ndev) {
+ err = -ENETUNREACH;
+ goto rel_neigh;
+ }
mtu = ndev->mtu;
pr_info("rt dev %s, loopback -> %s, mtu %u.\n",
n->dev->name, ndev->name, mtu);