e1000: fail early for evil descriptor
authorJason Wang <jasowang@redhat.com>
Wed, 24 Feb 2021 05:45:28 +0000 (13:45 +0800)
committerSoonKyu Park <sk7.park@samsung.com>
Tue, 23 Nov 2021 04:45:35 +0000 (13:45 +0900)
commit147cb10b23d842d3504c15046e8ec9ee524d0936
tree0f8d1223dd70ab4e2cdd939040cd26f6de3bf5e2
parent2acb431b732a026ab66fd3ffcba31feb9c335723
e1000: fail early for evil descriptor

Git-commit: 3de46e6fc489c52c9431a8a832ad8170a7569bd8
References: bsc#1182577, CVE-2021-20257

During procss_tx_desc(), driver can try to chain data descriptor with
legacy descriptor, when will lead underflow for the following
calculation in process_tx_desc() for bytes:

            if (tp->size + bytes > msh)
                bytes = msh - tp->size;

This will lead a infinite loop. So check and fail early if tp->size if
greater or equal to msh.

Reported-by: Alexander Bulekov <alxndr@bu.edu>
Reported-by: Cheolwoo Myung <cwmyung@snu.ac.kr>
Reported-by: Ruhr-University Bochum <bugs-syssec@rub.de>
Cc: Prasad J Pandit <ppandit@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Bruce Rogers <brogers@suse.com>
hw/net/e1000.c