linux/drivers/net/can
Jakub Kicinski f534f6581e net: validate veth and vxcan peer ifindexes
veth and vxcan need to make sure the ifindexes of the peer
are not negative, core does not validate this.

Using iproute2 with user-space-level checking removed:

Before:

  # ./ip link add index 10 type veth peer index -1
  # ip link show
  1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
  2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:74:b2:03 brd ff:ff:ff:ff:ff:ff
  10: veth1@veth0: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 8a:90:ff:57:6d:5d brd ff:ff:ff:ff:ff:ff
  -1: veth0@veth1: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether ae:ed:18:e6:fa:7f brd ff:ff:ff:ff:ff:ff

Now:

  $ ./ip link add index 10 type veth peer index -1
  Error: ifindex can't be negative.

This problem surfaced in net-next because an explicit WARN()
was added, the root cause is older.

Fixes: e6f8f1a739 ("veth: Allow to create peer link with given ifindex")
Fixes: a8f820a380 ("can: add Virtual CAN Tunnel driver (vxcan)")
Reported-by: syzbot+5ba06978f34abb058571@syzkaller.appspotmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2023-08-20 11:40:03 +01:00
..
c_can can: c_can: Convert to platform remove callback returning void 2023-05-15 22:53:49 +02:00
cc770 can: cc770_platform: Convert to platform remove callback returning void 2023-05-15 22:53:49 +02:00
ctucanfd can: ctucanfd: Convert to platform remove callback returning void 2023-05-15 22:53:50 +02:00
dev can: length: refactor frame lengths definition to add size in bits 2023-06-22 09:43:40 +02:00
flexcan can: flexcan: Convert to platform remove callback returning void 2023-05-15 22:53:50 +02:00
ifi_canfd can: ifi_canfd: Convert to platform remove callback returning void 2023-05-15 22:53:50 +02:00
m_can can: m_can: fix coding style 2023-06-22 09:42:28 +02:00
mscan can: mscan: mpc5xxx_can: Convert to platform remove callback returning void 2023-05-15 22:53:50 +02:00
peak_canfd can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
rcar can: rcar: Convert to platform remove callback returning void 2023-05-15 22:53:50 +02:00
sja1000 can: sja1000: Prevent overrun stalls with a soft reset on Renesas SoCs 2023-06-22 09:41:32 +02:00
slcan can: slcan: fix freed work crash 2022-12-07 10:32:24 +01:00
softing can: softing: Convert to platform remove callback returning void 2023-05-15 22:53:51 +02:00
spi can: mcp251xfd: __mcp251xfd_chip_set_mode(): increase poll timeout 2023-07-17 19:54:51 +02:00
usb can: gs_usb: gs_can_close(): add missing set of CAN state to CAN_STATE_STOPPED 2023-07-20 11:12:45 +02:00
at91_can.c can: at91_can: Convert to platform remove callback returning void 2023-05-15 22:53:49 +02:00
bxcan.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2023-05-18 14:39:34 -07:00
can327.c can: can327: flush TX_work on ldisc .close() 2022-12-07 10:32:36 +01:00
grcan.c can: grcan: Convert to platform remove callback returning void 2023-05-15 22:53:50 +02:00
janz-ican3.c can: janz-ican3: Convert to platform remove callback returning void 2023-05-15 22:53:50 +02:00
Kconfig can: kvaser_pciefd: Remove SPI flash parameter read functionality 2023-06-22 09:44:29 +02:00
kvaser_pciefd.c can: kvaser_pciefd: Use TX FIFO size read from CAN controller 2023-06-22 09:44:30 +02:00
Makefile can: bxcan: add support for ST bxCAN controller 2023-03-28 11:43:36 +02:00
sun4i_can.c can: sun4i_can: Convert to platform remove callback returning void 2023-05-15 22:53:51 +02:00
ti_hecc.c can: ti_hecc: fix coding style 2023-06-22 09:42:28 +02:00
vcan.c can: dev: add CAN XL support to virtual CAN 2022-09-15 09:08:09 +02:00
vxcan.c net: validate veth and vxcan peer ifindexes 2023-08-20 11:40:03 +01:00
xilinx_can.c can: dev: add transceiver capabilities to xilinx_can 2023-05-22 20:21:30 +02:00