net: bcmgenet: unshare the skb before writing the control block
Impact
In the Linux kernel, the following vulnerability has been resolved:
Source excerpt · LinuxAffected packages
Affected products
Vendor version evidence. Product records are separate from automatic dependency matching.
Linux · Linux
Other versions: unaffected
| Version / range | Source status |
|---|---|
| f48bed16a756f5bc0244acd581f61968f7d7c2a4 to before 40c04abcbc34e3afe338f41dae851ecbd72852ac | affected |
| f48bed16a756f5bc0244acd581f61968f7d7c2a4 to before 7939ad3b4db9eadf45a64f0524f38337a9494672 | affected |
| f48bed16a756f5bc0244acd581f61968f7d7c2a4 to before 89771ce4f8f67dcffae561b2ccac95c0f6e3aa01 | affected |
| fb4ca2b4bc6712a6ad635df5b9b41131846589f9 | affected |
| 3.16.50 to before 3.17 | affected |
Linux · Linux
Other versions: affected
| Version / range | Source status |
|---|---|
| 4.13 | affected |
| 0 to before 4.13 | unaffected |
| 6.18.59 through 6.18.* (inclusive) | unaffected |
| 7.2.13 through 7.2.* (inclusive) | unaffected |
| 7.3 through * (inclusive) | unaffected |
Original source description
In the Linux kernel, the following vulnerability has been resolved:
net: bcmgenet: unshare the skb before writing the control block
bcmgenet stores first_cb, last_cb and bytes_sent in the skb control block and reads them back on completion to free the skb and credit BQL. ether_setup() leaves IFF_TX_SKB_SHARING set, so the stack can resubmit a shared skb that is still in the ring. The next transmit overwrites last_cb, so the earlier slots complete without crediting their bytes and BQL stalls the queue until the watchdog resets it.
Unshare the skb before writing the control block.
Reproduce with pktgen in clone_skb mode, which hands the driver the same skb while earlier copies are still in the ring:
modprobe pktgen pg=/proc/net/pktgen echo "add_device eth0" > $pg/kpktgend_0 echo "dst_mac AA:BB:CC:DD:EE:FF" > $pg/eth0 echo "dst 192.0.2.1" > $pg/eth0 echo "clone_skb 8" > $pg/eth0 echo "count 0" > $pg/eth0 echo start > $pg/pgctrl & sleep 5 echo stop > $pg/pgctrl wait cat /sys/class/net/eth0/queues/tx-0/byte_queue_limits/inflight
inflight stays nonzero on the now idle queue. clone_skb 0 leaves it at zero.