android_kernel_motorola_sm6225/net
Ido Schimmel 1ed6495ff3 ipv4: Fix incorrect table ID in IOCTL path
[ Upstream commit 8a2618e14f81604a9b6ad305d57e0c8da939cd65 ]

Commit f96a3d74554d ("ipv4: Fix incorrect route flushing when source
address is deleted") started to take the table ID field in the FIB info
structure into account when determining if two structures are identical
or not. This field is initialized using the 'fc_table' field in the
route configuration structure, which is not set when adding a route via
IOCTL.

The above can result in user space being able to install two identical
routes that only differ in the table ID field of their associated FIB
info.

Fix by initializing the table ID field in the route configuration
structure in the IOCTL path.

Before the fix:

 # ip route add default via 192.0.2.2
 # route add default gw 192.0.2.2
 # ip -4 r show default
 # default via 192.0.2.2 dev dummy10
 # default via 192.0.2.2 dev dummy10

After the fix:

 # ip route add default via 192.0.2.2
 # route add default gw 192.0.2.2
 SIOCADDRT: File exists
 # ip -4 r show default
 default via 192.0.2.2 dev dummy10

Audited the code paths to ensure there are no other paths that do not
properly initialize the route configuration structure when installing a
route.

Fixes: 5a56a0b3a4 ("net: Don't delete routes in different VRFs")
Fixes: f96a3d74554d ("ipv4: Fix incorrect route flushing when source address is deleted")
Reported-by: gaoxingwang <gaoxingwang1@huawei.com>
Link: https://lore.kernel.org/netdev/20230314144159.2354729-1-gaoxingwang1@huawei.com/
Tested-by: gaoxingwang <gaoxingwang1@huawei.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Link: https://lore.kernel.org/r/20230315124009.4015212-1-idosch@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-03-22 13:27:10 +01:00
..
6lowpan 6lowpan: Off by one handling ->nexthdr 2020-01-27 14:50:41 +01:00
9p 9p/rdma: unmap receive dma buffer in rdma_request()/post_recv() 2023-03-11 16:31:59 +01:00
802 mrp: introduce active flags to prevent UAF when applicant uninit 2023-01-18 11:30:36 +01:00
8021q net: vlan: avoid leaks on register_vlan_dev() failures 2021-01-17 14:04:19 +01:00
appletalk appletalk: Fix skb allocation size in loopback case 2021-04-07 12:48:49 +02:00
atm net/atm: fix proc_mpc_write incorrect return value 2022-11-03 23:52:26 +09:00
ax25 ax25: Fix UAF bugs in ax25 timers 2022-04-27 13:39:46 +02:00
batman-adv batman-adv: Don't skb_split skbuffs with frag_list 2022-05-18 09:42:47 +02:00
bluetooth Bluetooth: hci_sock: purge socket queues in the destruct() callback 2023-03-11 16:32:01 +01:00
bpf bpf, test_run: Fix alignment problem in bpf_prog_test_run_skb() 2022-11-25 17:40:29 +01:00
bpfilter signal/bpfilter: Fix bpfilter_kernl to use send_sig not force_sig 2020-01-27 14:50:51 +01:00
bridge netfilter: ebtables: fix memory leak when blob is malformed 2022-09-28 11:02:56 +02:00
caif net: caif: Fix use-after-free in cfusbl_device_notify() 2023-03-17 08:31:44 +01:00
can can: bcm: check the result of can_send() in bcm_can_tx() 2022-10-26 13:19:37 +02:00
ceph libceph: clear con->out_msg on Policy::stateful_server faults 2020-11-05 11:08:53 +01:00
core net: fix __dev_kfree_skb_any() vs drop monitor 2023-03-11 16:31:58 +01:00
dcb net: dcb: disable softirqs in dcbnl_flush_dev() 2022-03-08 19:04:10 +01:00
dccp dccp/tcp: Avoid negative sk_forward_alloc by ipv6_pinfo.pktoptions. 2023-02-22 12:47:21 +01:00
decnet net: decnet: Fix sleeping inside in af_decnet 2021-07-28 11:13:48 +02:00
dns_resolver KEYS: Don't write out to userspace while holding key semaphore 2020-04-23 10:30:24 +02:00
dsa net: dsa: Add missing of_node_put() in dsa_port_parse_of 2022-03-23 09:10:44 +01:00
ethernet net: add annotations on hh->hh_len lockless accesses 2020-01-09 10:19:09 +01:00
hsr net: hsr: Fix potential use-after-free 2022-12-08 11:18:33 +01:00
ieee802154 net: ieee802154: fix error return code in dgram_bind() 2022-11-03 23:52:30 +09:00
ife
ipv4 ipv4: Fix incorrect table ID in IOCTL path 2023-03-22 13:27:10 +01:00
ipv6 net: tunnels: annotate lockless accesses to dev->needed_headroom 2023-03-22 13:27:09 +01:00
iucv net/af_iucv: set correct sk_protocol for child sockets 2020-12-08 10:18:52 +01:00
kcm kcm: close race conditions on sk_receive_queue 2022-11-25 17:40:29 +01:00
key af_key: Fix send_acquire race with pfkey_register 2022-12-08 11:18:29 +01:00
l2tp ipv6: Fix signed integer overflow in l2tp_ip6_sendmsg 2022-06-25 11:49:15 +02:00
l3mdev
lapb net: lapb: Copy the skb before sending a packet 2021-02-10 09:21:06 +01:00
llc llc: only change llc->dev when bind() succeeds 2022-03-28 08:41:44 +02:00
mac80211 wifi: mac80211: make rate u32 in sta_set_rate_info_rx() 2023-03-11 16:31:38 +01:00
mac802154 mac802154: fix missing INIT_LIST_HEAD in ieee802154_if_add() 2022-12-14 11:28:28 +01:00
mpls net: mpls: fix stale pointer if allocation fails during device rename 2023-02-22 12:47:21 +01:00
ncsi net/ncsi: Avoid channel_monitor hrtimer deadlock 2021-04-14 08:22:35 +02:00
netfilter netfilter: ctnetlink: fix possible refcount leak in ctnetlink_create_conntrack() 2023-03-11 16:31:58 +01:00
netlabel net: fix NULL pointer reference in cipso_v4_doi_free 2021-09-22 11:48:09 +02:00
netlink netlink: annotate data races around sk_state 2023-02-06 07:49:43 +01:00
netrom netrom: Fix use-after-free caused by accept on already connected socket 2023-02-22 12:47:12 +01:00
nfc nfc: change order inside nfc_se_io error path 2023-03-17 08:31:42 +01:00
nsh
openvswitch net: openvswitch: fix flow memory leak in ovs_flow_cmd_new 2023-02-22 12:47:12 +01:00
packet packet: do not set TP_STATUS_CSUM_VALID on CHECKSUM_COMPLETE 2022-12-08 11:18:33 +01:00
phonet phonet: refcount leak in pep_sock_accep 2022-01-11 13:58:50 +01:00
psample net: psample: fix skb_over_panic 2019-12-05 09:21:30 +01:00
qrtr net: qrtr: fix another OOB Read in qrtr_endpoint_post 2021-09-03 09:58:00 +02:00
rds rds: rds_rm_zerocopy_callback() correct order for list_add_tail() 2023-03-11 16:31:37 +01:00
rfkill rfkill: Fix incorrect check to avoid NULL pointer dereference 2020-01-12 12:17:17 +01:00
rose net/rose: Fix to not accept on connected socket 2023-02-22 12:47:19 +01:00
rxrpc rxrpc: Fix missing unlock in rxrpc_do_sendmsg() 2023-01-18 11:30:33 +01:00
sched net/sched: Retire tcindex classifier 2023-03-11 16:31:55 +01:00
sctp sctp: fail if no bound addresses can be used for a given scope 2023-02-06 07:49:43 +01:00
smc net/smc: Remove redundant refcount increase 2022-09-15 12:17:03 +02:00
strparser net: strparser: partially revert "strparser: Call skb_unclone conditionally" 2019-05-16 19:41:27 +02:00
sunrpc SUNRPC: ensure the matching upcall is in-flight upon downcall 2023-01-18 11:30:49 +01:00
switchdev
tipc tipc: improve function tipc_wait_for_cond() 2023-03-17 08:31:44 +01:00
tls net/tls: Fix race in TLS device down flow 2022-07-29 17:10:32 +02:00
unix af_unix: Fix a data-race in unix_dgram_peer_wake_me(). 2022-06-14 16:59:35 +02:00
vmw_vsock net: vmw_vsock: vmci: Check memcpy_from_msg() 2023-01-18 11:30:18 +01:00
wimax
wireless wifi: cfg80211: Partial revert "wifi: cfg80211: Fix use after free for wext" 2023-03-13 10:17:15 +01:00
x25 net/x25: Fix to not accept on connected socket 2023-02-22 12:47:12 +01:00
xdp xsk: Simplify detection of empty and full rings 2021-05-22 10:59:48 +02:00
xfrm xfrm: Update ipcomp_scratches with NULL when freed 2022-10-26 13:19:37 +02:00
compat.c net: Return the correct errno code 2021-06-30 08:48:13 -04:00
Kconfig
Makefile net: split out functions related to registering inflight socket files 2021-07-31 08:22:37 +02:00
socket.c net: Fix a data-race around sysctl_somaxconn. 2022-09-05 10:26:31 +02:00
sysctl_net.c