aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/virtio_net.c
diff options
context:
space:
mode:
authorAmos Kong <akong@redhat.com>2014-04-18 13:45:41 +0800
committerDavid S. Miller <davem@davemloft.net>2014-04-22 16:01:35 -0400
commitc18e9cd623b8aa88090615602c3db7f1386a139d (patch)
tree323cdee996e69c3d25862087585ac8125591a4b9 /drivers/net/virtio_net.c
parentarc_emac: write initial MAC address from devicetree to hw (diff)
downloadlinux-dev-c18e9cd623b8aa88090615602c3db7f1386a139d.tar.xz
linux-dev-c18e9cd623b8aa88090615602c3db7f1386a139d.zip
virtio_net: zero is an invald queue_pairs number
Execute "ethtool -L eth0 combined 0" in guest, if multiqueue is enabled, virtnet_send_command() will return -EINVAL error, there is a validation in QEMU. But if multiqueue is disabled, virtnet_set_queues() will just return zero (success). We should return error for this situation. Signed-off-by: Amos Kong <akong@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r--drivers/net/virtio_net.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 7b687469199b..8a852b5f215f 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -1285,7 +1285,7 @@ static int virtnet_set_channels(struct net_device *dev,
if (channels->rx_count || channels->tx_count || channels->other_count)
return -EINVAL;
- if (queue_pairs > vi->max_queue_pairs)
+ if (queue_pairs > vi->max_queue_pairs || queue_pairs == 0)
return -EINVAL;
get_online_cpus();