aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVarun Prakash <varun@chelsio.com>2019-05-22 20:10:55 +0530
committerPaul Gortmaker <paul.gortmaker@windriver.com>2019-09-16 12:21:43 -0400
commitd00ca2d9a1ebb8b86d3237315415bb359d5616d1 (patch)
tree319d17dd3e968210993824b53123e67418aa6e59
parent9336b513408375b2eb1ff7a6d30421c90cd90f7e (diff)
downloadlinux-yocto-d00ca2d9a1ebb8b86d3237315415bb359d5616d1.tar.gz
linux-yocto-d00ca2d9a1ebb8b86d3237315415bb359d5616d1.tar.bz2
linux-yocto-d00ca2d9a1ebb8b86d3237315415bb359d5616d1.zip
scsi: libcxgbi: add a check for NULL pointer in cxgbi_check_route()
commit cc555759117e8349088e0c5d19f2f2a500bafdbd upstream. 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> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
-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 f2c561ca731a..cd2c247d6d0c 100644
--- a/drivers/scsi/cxgbi/libcxgbi.c
+++ b/drivers/scsi/cxgbi/libcxgbi.c
@@ -641,6 +641,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);