android_kernel_motorola_sm6375/drivers/net
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Zekun Shen c27a523211 rsi: Fix out-of-bounds read in rsi_read_pkt()
[ Upstream commit f1cb3476e48b60c450ec3a1d7da0805bffc6e43a ]

rsi_get_* functions rely on an offset variable from usb
input. The size of usb input is RSI_MAX_RX_USB_PKT_SIZE(3000),
while 2-byte offset can be up to 0xFFFF. Thus a large offset
can cause out-of-bounds read.

The patch adds a bound checking condition when rcv_pkt_len is 0,
indicating it's USB. It's unclear whether this is triggerable
from other type of bus. The following check might help in that case.
offset > rcv_pkt_len - FRAME_DESC_SZ

The bug is trigerrable with conpromised/malfunctioning USB devices.
I tested the patch with the crashing input and got no more bug report.

Attached is the KASAN report from fuzzing.

BUG: KASAN: slab-out-of-bounds in rsi_read_pkt+0x42e/0x500 [rsi_91x]
Read of size 2 at addr ffff888019439fdb by task RX-Thread/227

CPU: 0 PID: 227 Comm: RX-Thread Not tainted 5.6.0 #66
Call Trace:
 dump_stack+0x76/0xa0
 print_address_description.constprop.0+0x16/0x200
 ? rsi_read_pkt+0x42e/0x500 [rsi_91x]
 ? rsi_read_pkt+0x42e/0x500 [rsi_91x]
 __kasan_report.cold+0x37/0x7c
 ? rsi_read_pkt+0x42e/0x500 [rsi_91x]
 kasan_report+0xe/0x20
 rsi_read_pkt+0x42e/0x500 [rsi_91x]
 rsi_usb_rx_thread+0x1b1/0x2fc [rsi_usb]
 ? rsi_probe+0x16a0/0x16a0 [rsi_usb]
 ? _raw_spin_lock_irqsave+0x7b/0xd0
 ? _raw_spin_trylock_bh+0x120/0x120
 ? __wake_up_common+0x10b/0x520
 ? rsi_probe+0x16a0/0x16a0 [rsi_usb]
 kthread+0x2b5/0x3b0
 ? kthread_create_on_node+0xd0/0xd0
 ret_from_fork+0x22/0x40

Reported-by: Brendan Dolan-Gavitt <brendandg@nyu.edu>
Signed-off-by: Zekun Shen <bruceshenzk@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/YXxXS4wgu2OsmlVv@10-18-43-117.dynapool.wireless.nyu.edu
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-01-27 09:19:42 +01:00
..
appletalk
arcnet
bonding bonding: fix ad_actor_system option setting to default 2021-12-29 12:23:35 +01:00
caif
can can: xilinx_can: xcan_probe(): check for error irq 2022-01-27 09:19:37 +01:00
dsa net: dsa: rtl8366rb: Fix off-by-one bug 2021-11-17 09:48:34 +01:00
ethernet mlxsw: pci: Add shutdown method in PCI driver 2022-01-27 09:19:41 +01:00
fddi
fjes fjes: Check for error irq 2021-12-29 12:23:35 +01:00
hamradio hamradio: improve the incomplete fix to avoid NPD 2021-12-29 12:23:38 +01:00
hippi
hyperv
ieee802154 ieee802154: atusb: fix uninit value in atusb_set_extended_addr 2022-01-11 15:23:31 +01:00
ipvlan
netdevsim netdevsim: Zero-initialize memory for new map's value in function nsim_bpf_map_alloc 2021-12-22 09:29:38 +01:00
phy net: phy: micrel: set soft_reset callback to genphy_soft_reset for KSZ8081 2022-01-11 15:23:32 +01:00
plip
ppp ppp: ensure minimum packet size in ppp_write() 2022-01-27 09:19:35 +01:00
slip
team
usb net: mcs7830: handle usb read errors properly 2022-01-27 09:19:37 +01:00
vmxnet3 vmxnet3: do not stop tx queues after netif_device_detach() 2021-11-17 09:48:21 +01:00
wan
wimax
wireless rsi: Fix out-of-bounds read in rsi_read_pkt() 2022-01-27 09:19:42 +01:00
xen-netback xen/netback: don't queue unlimited number of packages 2021-12-22 09:29:41 +01:00
dummy.c
eql.c
geneve.c
gtp.c
ifb.c
Kconfig
LICENSE.SRC
loopback.c
macsec.c
macvlan.c
macvtap.c
Makefile
mdio.c
mii.c
net_failover.c
netconsole.c
nlmon.c
ntb_netdev.c
rionet.c
sb1000.c
Space.c
sungem_phy.c
tap.c
thunderbolt.c
tun.c tun: fix bonding active backup with arp monitoring 2021-11-26 10:47:21 +01:00
veth.c veth: Do not record rx queue hint in veth_xmit 2022-01-16 09:15:38 +01:00
virtio_net.c
vrf.c vrf: don't run conntrack on vrf with !dflt qdisc 2021-12-14 14:48:59 +01:00
vsockmon.c
vxlan.c
xen-netfront.c xen/netfront: harden netfront against event channel storms 2021-12-22 09:29:40 +01:00