scsi: libcxgbi: add a check for NULL pointer in cxgbi_check_route()
[ Upstream commit cc55575911 ]
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>
This commit is contained in:
parent
7b9e10944f
commit
214c5933ff
1 changed files with 4 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue