virtio_net: Fix out of bounds access of sq
authorToshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
Tue, 29 Jan 2019 00:45:56 +0000 (09:45 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 6 Feb 2019 16:30:10 +0000 (17:30 +0100)
commit0921dd505d30a4028425abf7e02e961a1c45cba0
tree44aea963f92907658f575b23e0e3b1c4a51ef097
parentd97117bd077d9396cb9c6d4e263d074a5c91fd15
virtio_net: Fix out of bounds access of sq

[ Upstream commit 1667c08a9d31c7cdf09f4890816bfbf20b685495 ]

When XDP is disabled, curr_queue_pairs + smp_processor_id() can be
larger than max_queue_pairs.
There is no guarantee that we have enough XDP send queues dedicated for
each cpu when XDP is disabled, so do not count drops on sq in that case.

Fixes: 5b8f3c8d30a6 ("virtio_net: Add XDP related stats")
Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
Acked-by: Jason Wang <jasowang@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/virtio_net.c