Skip to content

Commit

Permalink
scsi: libcxgbi: add a check for NULL pointer in cxgbi_check_route()
Browse files Browse the repository at this point in the history
ip_dev_find() can return NULL so add a check for NULL pointer.

Signed-off-by: Varun Prakash <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
  • Loading branch information
Varun Prakash authored and martinkpetersen committed May 30, 2019
1 parent 8acf608 commit cc55575
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/scsi/cxgbi/libcxgbi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit cc55575

Please sign in to comment.