mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-09-06 01:43:39 +00:00
hw/net/dp8393x: fix integer underflow in dp8393x_do_transmit_packets()
An integer underflow could occur during packet transmission due to 'tx_len' not being updated if SONIC_TFC register is set to zero. Check for negative 'tx_len' when removing existing FCS. RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1899722 Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com> Reported-by: Gaoning Pan <pgn@zju.edu.cn> Acked-by: Jason Wang <jasowang@redhat.com> Message-id: 20201124092445.658647-1-mcascell@redhat.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
944fdc5e27
commit
915976bd98
|
@ -495,6 +495,10 @@ static void dp8393x_do_transmit_packets(dp8393xState *s)
|
|||
} else {
|
||||
/* Remove existing FCS */
|
||||
tx_len -= 4;
|
||||
if (tx_len < 0) {
|
||||
SONIC_ERROR("tx_len is %d\n", tx_len);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (s->regs[SONIC_RCR] & (SONIC_RCR_LB1 | SONIC_RCR_LB0)) {
|
||||
|
|
Loading…
Reference in a new issue