Skip to content

Commit 165ae50

Browse files
Varun Prakashmartinkpetersen
authored andcommitted
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>
1 parent 1fe1fdb commit 165ae50

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

drivers/scsi/cxgbi/libcxgbi.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,12 @@ static struct cxgbi_sock *cxgbi_check_route(struct sockaddr *dst_addr)
642642
n->dev->name, ndev->name, mtu);
643643
}
644644

645+
if (!(ndev->flags & IFF_UP) || !netif_carrier_ok(ndev)) {
646+
pr_info("%s interface not up.\n", ndev->name);
647+
err = -ENETDOWN;
648+
goto rel_neigh;
649+
}
650+
645651
cdev = cxgbi_device_find_by_netdev(ndev, &port);
646652
if (!cdev) {
647653
pr_info("dst %pI4, %s, NOT cxgbi device.\n",
@@ -736,6 +742,12 @@ static struct cxgbi_sock *cxgbi_check_route6(struct sockaddr *dst_addr)
736742
}
737743
ndev = n->dev;
738744

745+
if (!(ndev->flags & IFF_UP) || !netif_carrier_ok(ndev)) {
746+
pr_info("%s interface not up.\n", ndev->name);
747+
err = -ENETDOWN;
748+
goto rel_rt;
749+
}
750+
739751
if (ipv6_addr_is_multicast(&daddr6->sin6_addr)) {
740752
pr_info("multi-cast route %pI6 port %u, dev %s.\n",
741753
daddr6->sin6_addr.s6_addr,

0 commit comments

Comments
 (0)