aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorDavid Miller <davem@davemloft.net>2011-12-02 11:52:35 -0500
committerDavid S. Miller <davem@davemloft.net>2011-12-05 15:20:20 -0500
commita58b61e5b79bc9ce5f8d7b0cd03e8c6525c657f8 (patch)
tree301eb7294127bdbad53d4f4947cf4119819e97c9 /drivers/scsi
parent3786cf189f8b39cac870193368f9ad9f95fff9a4 (diff)
libcxgbi: Handle dst_get_neighbour_noref() returning NULL.
Signed-off-by: David S. Miller <davem@davemloft.net> Acked-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/cxgbi/libcxgbi.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
index a026a2f1262..1d25a87aa47 100644
--- a/drivers/scsi/cxgbi/libcxgbi.c
+++ b/drivers/scsi/cxgbi/libcxgbi.c
@@ -472,6 +472,7 @@ static struct cxgbi_sock *cxgbi_check_route(struct sockaddr *dst_addr)
472 struct net_device *ndev; 472 struct net_device *ndev;
473 struct cxgbi_device *cdev; 473 struct cxgbi_device *cdev;
474 struct rtable *rt = NULL; 474 struct rtable *rt = NULL;
475 struct neighbour *n;
475 struct flowi4 fl4; 476 struct flowi4 fl4;
476 struct cxgbi_sock *csk = NULL; 477 struct cxgbi_sock *csk = NULL;
477 unsigned int mtu = 0; 478 unsigned int mtu = 0;
@@ -493,7 +494,12 @@ static struct cxgbi_sock *cxgbi_check_route(struct sockaddr *dst_addr)
493 goto err_out; 494 goto err_out;
494 } 495 }
495 dst = &rt->dst; 496 dst = &rt->dst;
496 ndev = dst_get_neighbour_noref(dst)->dev; 497 n = dst_get_neighbour_noref(dst);
498 if (!n) {
499 err = -ENODEV;
500 goto rel_rt;
501 }
502 ndev = n->dev;
497 503
498 if (rt->rt_flags & (RTCF_MULTICAST | RTCF_BROADCAST)) { 504 if (rt->rt_flags & (RTCF_MULTICAST | RTCF_BROADCAST)) {
499 pr_info("multi-cast route %pI4, port %u, dev %s.\n", 505 pr_info("multi-cast route %pI4, port %u, dev %s.\n",
@@ -507,7 +513,7 @@ static struct cxgbi_sock *cxgbi_check_route(struct sockaddr *dst_addr)
507 ndev = ip_dev_find(&init_net, daddr->sin_addr.s_addr); 513 ndev = ip_dev_find(&init_net, daddr->sin_addr.s_addr);
508 mtu = ndev->mtu; 514 mtu = ndev->mtu;
509 pr_info("rt dev %s, loopback -> %s, mtu %u.\n", 515 pr_info("rt dev %s, loopback -> %s, mtu %u.\n",
510 dst_get_neighbour_noref(dst)->dev->name, ndev->name, mtu); 516 n->dev->name, ndev->name, mtu);
511 } 517 }
512 518
513 cdev = cxgbi_device_find_by_netdev(ndev, &port); 519 cdev = cxgbi_device_find_by_netdev(ndev, &port);