summaryrefslogtreecommitdiff
path: root/drivers/scsi/cxgbi/libcxgbi.c
diff options
context:
space:
mode:
authorVarun Prakash <varun@chelsio.com>2016-12-09 12:10:07 +0300
committerMartin K. Petersen <martin.petersen@oracle.com>2016-12-14 23:11:53 +0300
commit165ae50e450bc7de6c741bf2c27ed0920a40a9af (patch)
treef39f9d08913d59828084be709315cb2e39336713 /drivers/scsi/cxgbi/libcxgbi.c
parent1fe1fdb04b92f54b58eb8b71d2f28cf73fd9801c (diff)
downloadlinux-165ae50e450bc7de6c741bf2c27ed0920a40a9af.tar.xz
scsi: libcxgbi: return error if interface is not up
Do not post hw active open cmd if IFF_UP is not set or link is down on the interface, return -ENETDOWN in this case. Signed-off-by: Varun Prakash <varun@chelsio.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/cxgbi/libcxgbi.c')
-rw-r--r--drivers/scsi/cxgbi/libcxgbi.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
index 9f4fde9b12e3..9167bcd9fffe 100644
--- a/drivers/scsi/cxgbi/libcxgbi.c
+++ b/drivers/scsi/cxgbi/libcxgbi.c
@@ -642,6 +642,12 @@ static struct cxgbi_sock *cxgbi_check_route(struct sockaddr *dst_addr)
n->dev->name, ndev->name, mtu);
}
+ if (!(ndev->flags & IFF_UP) || !netif_carrier_ok(ndev)) {
+ pr_info("%s interface not up.\n", ndev->name);
+ err = -ENETDOWN;
+ goto rel_neigh;
+ }
+
cdev = cxgbi_device_find_by_netdev(ndev, &port);
if (!cdev) {
pr_info("dst %pI4, %s, NOT cxgbi device.\n",
@@ -736,6 +742,12 @@ static struct cxgbi_sock *cxgbi_check_route6(struct sockaddr *dst_addr)
}
ndev = n->dev;
+ if (!(ndev->flags & IFF_UP) || !netif_carrier_ok(ndev)) {
+ pr_info("%s interface not up.\n", ndev->name);
+ err = -ENETDOWN;
+ goto rel_rt;
+ }
+
if (ipv6_addr_is_multicast(&daddr6->sin6_addr)) {
pr_info("multi-cast route %pI6 port %u, dev %s.\n",
daddr6->sin6_addr.s6_addr,