diff --git a/src/net/aoe.c b/src/net/aoe.c index fec8d33f0..b959a00a1 100644 --- a/src/net/aoe.c +++ b/src/net/aoe.c @@ -647,8 +647,16 @@ static struct aoe_command * aoecmd_create ( struct aoe_device *aoedev, static int aoedev_ata_command ( struct aoe_device *aoedev, struct interface *parent, struct ata_cmd *command ) { + struct net_device *netdev = aoedev->netdev; struct aoe_command *aoecmd; + /* Fail immediately if net device is closed */ + if ( ! netdev_is_open ( netdev ) ) { + DBGC ( aoedev, "AoE %s cannot issue command while net device " + "is closed\n", aoedev_name ( aoedev ) ); + return -EWOULDBLOCK; + } + /* Create command */ aoecmd = aoecmd_create ( aoedev, &aoecmd_ata ); if ( ! aoecmd )