Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

vxlan: Make vxlan_fdb_find_uc() more robust against NPDs

first_remote_rcu() can return NULL if the FDB entry points to an FDB
nexthop group instead of a remote destination. However, unlike other
users of first_remote_rcu(), NPD cannot currently happen in
vxlan_fdb_find_uc() as it is only invoked by one driver which vetoes the
creation of FDB nexthops.

Make the function more robust by making sure the remote destination is
only dereferenced if it is not NULL.

Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Wang Liang <wangliang74@huawei.com>
Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
Link: https://patch.msgid.link/20250908075141.125087-1-idosch@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Ido Schimmel and committed by
Jakub Kicinski
ce6adea1 051b62b7

+4 -3
+4 -3
drivers/net/vxlan/vxlan_core.c
··· 446 446 { 447 447 struct vxlan_dev *vxlan = netdev_priv(dev); 448 448 u8 eth_addr[ETH_ALEN + 2] = { 0 }; 449 - struct vxlan_rdst *rdst; 449 + struct vxlan_rdst *rdst = NULL; 450 450 struct vxlan_fdb *f; 451 451 int rc = 0; 452 452 ··· 459 459 rcu_read_lock(); 460 460 461 461 f = vxlan_find_mac_rcu(vxlan, eth_addr, vni); 462 - if (!f) { 462 + if (f) 463 + rdst = first_remote_rcu(f); 464 + if (!rdst) { 463 465 rc = -ENOENT; 464 466 goto out; 465 467 } 466 468 467 - rdst = first_remote_rcu(f); 468 469 vxlan_fdb_switchdev_notifier_info(vxlan, f, rdst, NULL, fdb_info); 469 470 470 471 out: