> __virtnet_get_hw_stats() only checks that each record of the statistics > reply starts within the reply buffer, while virtnet_fill_stats() reads > the whole payload of the record's type, so a record near the end of the > buffer can make the driver read past it and report the heap bytes > through ethtool -S and the per-queue netlink statistics. > > Fix this by reserving zeroed space of the largest ctx->size[] after the > reply, so the buffer can hold any type of payload. > > Records of an unexpected size are still parsed, since every record > starts within the reply and cannot cause out-of-bounds reads, and > rejecting them with checks per type was judged costly to maintain [1]. > > Claude Opus 5.5 was used to audit the driver and draft this patch. To > reproduce, the virtio-net device in QEMU was modified to offer device > [ ... ] > Reported-by: Jakub Kicinski <[email protected]> > Link: https://lore.kernel.org/all/[email protected]/ > Fixes: 941168f8b40e ("virtio_net: support device stats") > Cc: [email protected] > Signed-off-by: Lianjie Wang <[email protected]>
Sashiko has reviewed this patch and found no issues. -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=3
