hw/net/net_tx_pkt: fix assertion failure in net_tx_pkt_add_raw_fragment()
PATCH v2 1/1 hw/net/net_tx_pkt: fix assertion failure in net_tx_pkt_add_raw_fragment()
An assertion failure issue was found in the code that processes network packets while adding data fragments into the packet context. It could be abused by a malicious guest to abort the QEMU process on the host. This patch replaces the affected assert() with a conditional statement, returning false if the current data fragment exceeds max_raw_frags.
--- hw/net/net_tx_pkt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
hw/net/net_tx_pkt.c +4 -1
@@ -379,7 +379,10 @@ bool net_tx_pkt_add_raw_fragment(struct NetTxPkt *pkt, hwaddr pa,hwaddr mapped_len =0 ;struct iovec *ventry;assert (pkt); -assert (pkt->max_raw_frags > pkt->raw_frags); + +if (pkt->raw_frags >= pkt->max_raw_frags) { +return false; + }if (!len) {return true;
Signature · 1 line
2.26.2
Quoted 9 lines · Mauro Matteo Cascella
An assertion failure issue was found in the code that processes network packets while adding data fragments into the packet context. It could be abused by a malicious guest to abort the QEMU process on the host. This patch replaces the affected
assert()with a conditional statement, returning false if the current data fragment exceedsmax_raw_frags.
Quoted 26 lines
Reported-by Alexander Bulekov <[email protected]>Reported-by Ziming Zhang <[email protected]>Signed-off-by Mauro Matteo Cascella <[email protected]>---
hw/net/net_tx_pkt.c| 5 ++++-1 file changed, 4 insertions(+), 1 deletion(-)hw/net/net_tx_pkt.c +4
-1@@ -379,7 +379,10 @@ bool net_tx_pkt_add_raw_fragment(struct NetTxPkt *pkt, hwaddr pa,hwaddr mapped_len =0 ;struct iovec *ventry;assert (pkt); -assert (pkt->max_raw_frags > pkt->raw_frags); + +if (pkt->raw_frags >= pkt->max_raw_frags) { +return false; + }if (!len) {return true;Signature · 1 line
2.26.2
Jason Wang
AppliedQuoted 19 lines · Mauro Matteo Cascella
An assertion failure issue was found in the code that processes network packets while adding data fragments into the packet context. It could be abused by a malicious guest to abort the QEMU process on the host. This patch replaces the affected
assert()with a conditional statement, returning false if the current data fragment exceedsmax_raw_frags.Reported-by Alexander Bulekov <[email protected]>Reported-by Ziming Zhang <[email protected]>Signed-off-by Mauro Matteo Cascella <[email protected]>--- hw/net/net_tx_pkt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)hw/net/net_tx_pkt.c +0
-0@@ -379,7 +379,10 @@ bool net_tx_pkt_add_raw_fragment(struct NetTxPkt *pkt, hwaddr pa,hwaddr mapped_len =0 ;
hw/net/net_tx_pkt.c bool net_tx_pkt_add_raw_fragment(struct NetTxPkt *pkt, hwaddr pa, · line 388
Quoted 10 lines
hw/net/net_tx_pkt.c +4
-1struct iovec *ventry;assert (pkt); -assert (pkt->max_raw_frags > pkt->raw_frags); + +if (pkt->raw_frags >= pkt->max_raw_frags) { +return false; + }if (!len) {return true;
Applied.
Thanks