diff options
author | Varun Prakash <varun@chelsio.com> | 2019-05-22 20:10:55 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-06-22 08:18:26 +0200 |
commit | a272035ea1bffc4760820859e6ce10688a5ea2c9 (patch) | |
tree | 935a1e9b6eefdfa8a7d1ff9f47aec9dd87ebe410 | |
parent | af8cd6101bf54e3b2d4223b4bea53850905f3ee8 (diff) | |
download | linux-stable-a272035ea1bffc4760820859e6ce10688a5ea2c9.tar.gz linux-stable-a272035ea1bffc4760820859e6ce10688a5ea2c9.tar.bz2 linux-stable-a272035ea1bffc4760820859e6ce10688a5ea2c9.zip |
scsi: libcxgbi: add a check for NULL pointer in cxgbi_check_route()
[ Upstream commit cc555759117e8349088e0c5d19f2f2a500bafdbd ]
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: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | drivers/scsi/cxgbi/libcxgbi.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c index f3bb7af4e984..5eaf14c15590 100644 --- a/drivers/scsi/cxgbi/libcxgbi.c +++ b/drivers/scsi/cxgbi/libcxgbi.c @@ -634,6 +634,10 @@ static struct cxgbi_sock *cxgbi_check_route(struct sockaddr *dst_addr) 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); |