Re: [syzbot] Re: [syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all

syzbot
2024-07-21T10:45:17Z

#syz test git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

---
kernel/bpf/devmap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c
index 9e0e3b0a18e4..bca00badc0f8 100644
--- a/kernel/bpf/devmap.c
+++ b/kernel/bpf/devmap.c
@@ -465,7 +465,7 @@ static void bq_enqueue(struct net_device *dev, struct xdp_frame *xdpf,
* Do the same with xdp_prog and flush_list since these fields
* are only ever modified together.
*/
- if (!bq->dev_rx) {
+ if (!bq->dev_rx && bq->count <= DEV_MAP_BULK_SIZE) {
struct list_head *flush_list = bpf_net_ctx_get_dev_flush_list();

bq->dev_rx = dev_rx;
--