> genlmsg_reply() consumes the reply skb on every outcome: netlink_unicast()
> frees it whether it queues it, drops it, or bails out early.
> vdpa_nl_cmd_dev_config_get_doit() lets its return value fall through to the
> shared error label, which calls nlmsg_free(msg) again and double-frees the
> sk_buff on any reply failure. The failure is reachable unprivileged:
> VDPA_CMD_DEV_CONFIG_GET carries no GENL_ADMIN_PERM, so batching several
> requests into one sendto() on a socket with a shrunken SO_RCVBUF fills the
> receive queue, and netlink_attachskb() then takes its MSG_DONTWAIT path,
> freeing the skb and returning -EAGAIN.
> 
> Set msg to NULL once genlmsg_reply() has consumed it so the shared exit
> path frees the skb only on the early error gotos that still own it;
> nlmsg_free(NULL) is a no-op.
> 
>   BUG: KASAN: slab-use-after-free in sk_skb_reason_drop 
> (net/core/skbuff.c:1220)
> [ ... ]
> Fixes: ad69dd0bf26b ("vdpa: Introduce query of device config layout")
> Reported-by: [email protected]
> Closes: 
> https://lore.kernel.org/all/ILTHcT8oe1HP47sY25JVxssvKmkCTjYlX9Hs%40bugs.sh/
> Assisted-by: Claude:claude-opus-5
> Signed-off-by: Xiang Mei <[email protected]>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=1


Reply via email to