linux-stable/drivers/net/can
Cong Wang 4832756676 rtnetlink: fix double call of rtnl_link_get_net_ifla()
Currently rtnl_link_get_net_ifla() gets called twice when we create
peer devices, once in rtnl_add_peer_net() and once in each ->newlink()
implementation.

This looks safer, however, it leads to a classic Time-of-Check to
Time-of-Use (TOCTOU) bug since IFLA_NET_NS_PID is very dynamic. And
because of the lack of checking error pointer of the second call, it
also leads to a kernel crash as reported by syzbot.

Fix this by getting rid of the second call, which already becomes
redudant after Kuniyuki's work. We have to propagate the result of the
first rtnl_link_get_net_ifla() down to each ->newlink().

Reported-by: syzbot+21ba4d5adff0b6a7cfc6@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=21ba4d5adff0b6a7cfc6
Fixes: 0eb87b02a7 ("veth: Set VETH_INFO_PEER to veth_link_ops.peer_type.")
Fixes: 6b84e558e9 ("vxcan: Set VXCAN_INFO_PEER to vxcan_link_ops.peer_type.")
Fixes: fefd5d0821 ("netkit: Set IFLA_NETKIT_PEER_INFO to netkit_link_ops.peer_type.")
Cc: Kuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: Cong Wang <cong.wang@bytedance.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Link: https://patch.msgid.link/20241129212519.825567-1-xiyou.wangcong@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2024-12-03 11:29:29 +01:00
..
c_can can: c_can: c_can_handle_bus_err(): update statistics if skb allocation fails 2024-11-26 10:49:21 +01:00
cc770 can: {cc770,sja1000}_isa: allow building on x86_64 2024-11-04 17:46:06 +01:00
ctucanfd can: Switch back to struct platform_driver::remove() 2024-09-11 09:37:16 +02:00
dev can: dev: can_set_termination(): allow sleeping GPIOs 2024-11-26 10:13:34 +01:00
esd can: esd_402_pci: Add support for one-shot mode 2024-08-05 17:32:00 +02:00
flexcan can: Switch back to struct platform_driver::remove() 2024-09-11 09:37:16 +02:00
ifi_canfd can: ifi_canfd: ifi_canfd_handle_lec_err(): fix {rx,tx}_errors statistics 2024-11-26 10:50:40 +01:00
m_can can: m_can: m_can_handle_lec_err(): fix {rx,tx}_errors statistics 2024-11-26 10:50:34 +01:00
mscan can: Switch back to struct platform_driver::remove() 2024-09-11 09:37:16 +02:00
peak_canfd can: peak_canfd: Remove setting of RX software timestamp 2024-09-03 15:17:47 -07:00
rcar can: Switch back to struct platform_driver::remove() 2024-09-11 09:37:16 +02:00
rockchip can: rockchip_canfd: Drop obsolete dependency on COMPILE_TEST 2024-11-04 18:01:06 +01:00
sja1000 can: sja1000: sja1000_err(): fix {rx,tx}_errors statistics 2024-11-26 10:50:54 +01:00
slcan tty: use u8 for flags 2023-08-11 21:12:45 +02:00
softing can: Switch back to struct platform_driver::remove() 2024-09-11 09:37:16 +02:00
spi can: mcp251xfd: mcp251xfd_get_tef_len(): work around erratum DS80000789E 6. 2024-11-26 11:42:32 +01:00
usb can: f81604: f81604_handle_can_bus_errors(): fix {rx,tx}_errors statistics 2024-11-26 10:51:12 +01:00
at91_can.c can: Switch back to struct platform_driver::remove() 2024-09-11 09:37:16 +02:00
bxcan.c can: Switch back to struct platform_driver::remove() 2024-09-11 09:37:16 +02:00
can327.c tty: use u8 for flags 2023-08-11 21:12:45 +02:00
grcan.c can: Switch back to struct platform_driver::remove() 2024-09-11 09:37:16 +02:00
janz-ican3.c can: Switch back to struct platform_driver::remove() 2024-09-11 09:37:16 +02:00
Kconfig can: rockchip_canfd: add driver for Rockchip CAN-FD controller 2024-09-04 14:41:51 +02:00
kvaser_pciefd.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2024-09-15 09:13:19 -07:00
Makefile can: rockchip_canfd: add driver for Rockchip CAN-FD controller 2024-09-04 14:41:51 +02:00
sun4i_can.c can: sun4i_can: sun4i_can_err(): fix {rx,tx}_errors statistics 2024-11-26 10:51:00 +01:00
ti_hecc.c can: Switch back to struct platform_driver::remove() 2024-09-11 09:37:16 +02:00
vcan.c net: annotate writes on dev->mtu from ndo_change_mtu() 2024-05-07 16:19:14 -07:00
vxcan.c rtnetlink: fix double call of rtnl_link_get_net_ifla() 2024-12-03 11:29:29 +01:00
xilinx_can.c can: Switch back to struct platform_driver::remove() 2024-09-11 09:37:16 +02:00