Commit 9337c544 authored by Jesper Dangaard Brouer's avatar Jesper Dangaard Brouer Committed by Jakub Kicinski
Browse files

veth: prevent NULL pointer dereference in veth_xdp_rcv



The veth peer device is RCU protected, but when the peer device gets
deleted (veth_dellink) then the pointer is assigned NULL (via
RCU_INIT_POINTER).

This patch adds a necessary NULL check in veth_xdp_rcv when accessing
the veth peer net_device.

This fixes a bug introduced in commit dc82a332 ("veth: apply qdisc
backpressure on full ptr_ring to reduce TX drops"). The bug is a race
and only triggers when having inflight packets on a veth that is being
deleted.

Reported-by: default avatarIhor Solodrai <ihor.solodrai@linux.dev>
Closes: https://lore.kernel.org/all/fecfcad0-7a16-42b8-bff2-66ee83a6e5c4@linux.dev/


Reported-by: default avatar <syzbot+c4c7bf27f6b0c4bd97fe@syzkaller.appspotmail.com>
Closes: https://lore.kernel.org/all/683da55e.a00a0220.d8eae.0052.GAE@google.com/


Fixes: dc82a332 ("veth: apply qdisc backpressure on full ptr_ring to reduce TX drops")
Signed-off-by: default avatarJesper Dangaard Brouer <hawk@kernel.org>
Acked-by: default avatarIhor Solodrai <ihor.solodrai@linux.dev>
Link: https://patch.msgid.link/174964557873.519608.10855046105237280978.stgit@firesoul


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent a844b0c8
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment