Commit 214c5933 authored by Varun Prakash's avatar Varun Prakash Committed by Greg Kroah-Hartman

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: 's avatarVarun Prakash <varun@chelsio.com>
Signed-off-by: 's avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
parent 7b9e1094
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment