summaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorVarun Prakash <varun@chelsio.com>2019-05-22 20:10:55 +0530
committerMartin K. Petersen <martin.petersen@oracle.com>2019-05-29 21:48:59 -0400
commitcc555759117e8349088e0c5d19f2f2a500bafdbd (patch)
treeb4a4e72205ba9b735f86a9030f5fe8bf63a0947d /drivers/scsi
parent8acf608e602f6ec38b7cc37b04c80f1ce9a1a6cc (diff)
downloadlinux-cc555759117e8349088e0c5d19f2f2a500bafdbd.tar.bz2
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')
-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);