net: introduce qemu_receive_packet()
authorJason Wang <jasowang@redhat.com>
Wed, 24 Feb 2021 03:44:36 +0000 (11:44 +0800)
committerSoonKyu Park <sk7.park@samsung.com>
Tue, 23 Nov 2021 04:45:35 +0000 (13:45 +0900)
commitd084c6df7b2184c132893e173b1aa4b8b5a3dea6
treee49ed7d9b9cb469a684463067593d505a1a6d3e1
parent147cb10b23d842d3504c15046e8ec9ee524d0936
net: introduce qemu_receive_packet()

Git-commit: 705df5466c98f3efdd2b68d3b31dad86858acad7
References: bsc#1182968, CVE-2021-3416
Some NIC supports loopback mode and this is done by calling
nc->info->receive() directly which in fact suppresses the effort of
reentrancy check that is done in qemu_net_queue_send().

Unfortunately we can't use qemu_net_queue_send() here since for
loopback there's no sender as peer, so this patch introduce a
qemu_receive_packet() which is used for implementing loopback mode
for a NIC with this check.

NIC that supports loopback mode will be converted to this helper.

This is intended to address CVE-2021-3416.

Cc: Prasad J Pandit <ppandit@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Bruce Rogers <brogers@suse.com>
include/net/net.h
include/net/queue.h
net/net.c
net/queue.c