WSL2-Linux-Kernel/drivers/net
Eric Dumazet 9132fa043f net: tun: call napi_schedule_prep() to ensure we own a napi
commit 07d120aa33 upstream.

A recent patch exposed another issue in napi_get_frags()
caught by syzbot [1]

Before feeding packets to GRO, and calling napi_complete()
we must first grab NAPI_STATE_SCHED.

[1]
WARNING: CPU: 0 PID: 3612 at net/core/dev.c:6076 napi_complete_done+0x45b/0x880 net/core/dev.c:6076
Modules linked in:
CPU: 0 PID: 3612 Comm: syz-executor408 Not tainted 6.1.0-rc3-syzkaller-00175-g1118b2049d77 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
RIP: 0010:napi_complete_done+0x45b/0x880 net/core/dev.c:6076
Code: c1 ea 03 0f b6 14 02 4c 89 f0 83 e0 07 83 c0 03 38 d0 7c 08 84 d2 0f 85 24 04 00 00 41 89 5d 1c e9 73 fc ff ff e8 b5 53 22 fa <0f> 0b e9 82 fe ff ff e8 a9 53 22 fa 48 8b 5c 24 08 31 ff 48 89 de
RSP: 0018:ffffc90003c4f920 EFLAGS: 00010293
RAX: 0000000000000000 RBX: 0000000000000030 RCX: 0000000000000000
RDX: ffff8880251c0000 RSI: ffffffff875a58db RDI: 0000000000000007
RBP: 0000000000000001 R08: 0000000000000007 R09: 0000000000000000
R10: 0000000000000001 R11: 0000000000000001 R12: ffff888072d02628
R13: ffff888072d02618 R14: ffff888072d02634 R15: 0000000000000000
FS: 0000555555f13300(0000) GS:ffff8880b9a00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055c44d3892b8 CR3: 00000000172d2000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
napi_complete include/linux/netdevice.h:510 [inline]
tun_get_user+0x206d/0x3a60 drivers/net/tun.c:1980
tun_chr_write_iter+0xdb/0x200 drivers/net/tun.c:2027
call_write_iter include/linux/fs.h:2191 [inline]
do_iter_readv_writev+0x20b/0x3b0 fs/read_write.c:735
do_iter_write+0x182/0x700 fs/read_write.c:861
vfs_writev+0x1aa/0x630 fs/read_write.c:934
do_writev+0x133/0x2f0 fs/read_write.c:977
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f37021a3c19

Fixes: 1118b2049d ("net: tun: Fix memory leaks of napi_get_frags")
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Wang Yufen <wangyufen@huawei.com>
Link: https://lore.kernel.org/r/20221107180011.188437-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-11-16 09:58:30 +01:00
..
appletalk
arcnet net: arcnet: com20020: Fix null-ptr-deref in com20020pci_probe() 2022-03-08 19:12:46 +01:00
bonding bonding: fix NULL deref in bond_rr_gen_slave_id 2022-09-28 11:11:53 +02:00
caif caif_virtio: fix race between virtio_device_ready() and ndo_open() 2022-07-07 17:53:27 +02:00
can can: rcar_canfd: rcar_canfd_handle_global_receive(): fix IRQ storm on global FIFO receive 2022-11-03 23:59:20 +09:00
dsa net: dsa: Fix possible memory leaks in dsa_loop_init() 2022-11-10 18:15:27 +01:00
ethernet ethernet: tundra: free irq when alloc ring failed in tsi108_open() 2022-11-16 09:58:23 +01:00
fddi
fjes
hamradio hamradio: fix issue of dev reference count leakage in bpq_device_event() 2022-11-16 09:58:18 +01:00
hippi drivers: net: hippi: Fix deadlock in rr_close() 2022-05-09 09:14:40 +02:00
hyperv hv_netvsc: Fix race between VF offering and VF association message from host 2022-10-26 12:34:18 +02:00
ieee802154 ieee802154: cc2520: add rc code in cc2520_tx() 2022-09-20 12:39:44 +02:00
ipa net: ipa: properly limit modem routing table use 2022-09-28 11:11:50 +02:00
ipvlan ipvlan: Fix out-of-bound bugs caused by unset skb->mac_header 2022-09-28 11:11:47 +02:00
mctp
mdio of: mdio: Add of_node_put() when breaking out of for_each_xx 2022-09-28 11:11:50 +02:00
netdevsim netdevsim: remove dir in nsim_dev_debugfs_init() when creating ports dir failed 2022-11-03 23:59:19 +09:00
pcs net: pcs: xpcs: propagate xpcs_read error to xpcs_get_state_c37_sgmii 2022-08-03 12:03:48 +02:00
phy net: phy: mscc: macsec: clear encryption keys when freeing a flow 2022-11-16 09:58:22 +01:00
plip plip: avoid rcu debug splat 2022-08-25 11:40:11 +02:00
ppp net: fix dev_fill_forward_path with pppoe + bridge 2022-05-25 09:57:31 +02:00
slip drivers: net: slip: fix NPD bug in sl_tx_timeout() 2022-04-20 09:34:17 +02:00
team net: team: Unsync device addresses on ndo_stop 2022-09-28 11:11:48 +02:00
usb r8152: add PID for the Lenovo OneLink+ Dock 2022-10-29 10:12:53 +02:00
vmxnet3 net: vmxnet3: fix possible NULL pointer dereference in vmxnet3_rq_cleanup() 2022-05-25 09:57:31 +02:00
wan net: lapbether: fix issue of invalid opcode in lapbeth_open() 2022-11-16 09:58:19 +01:00
wireguard wireguard: netlink: avoid variable-sized memcpy on sockaddr 2022-09-28 11:11:51 +02:00
wireless wifi: ath11k: avoid deadlock during regulatory update in ath11k_regd_update() 2022-11-16 09:58:27 +01:00
wwan net: wwan: iosm: fix memory leak in ipc_pcie_read_bios_cfg 2022-11-16 09:58:21 +01:00
xen-netback xen-netback: only remove 'hotplug-status' when the vif is actually destroyed 2022-09-15 11:30:05 +02:00
Kconfig lib/crypto: blake2s: include as built-in 2022-05-30 09:28:59 +02:00
LICENSE.SRC
Makefile
Space.c
bareudp.c bareudp: use ipv6_mod_enabled to check if IPv6 enabled 2022-04-08 14:23:41 +02:00
dummy.c
eql.c
geneve.c geneve: fix TOS inheriting for ipv4 2022-08-25 11:40:15 +02:00
gtp.c
ifb.c
loopback.c
macsec.c macsec: clear encryption keys from the stack after setting up offload 2022-11-16 09:58:16 +01:00
macvlan.c net: macvlan: fix memory leaks of macvlan_common_newlink 2022-11-16 09:58:23 +01:00
macvtap.c macvtap: advertise link netns via netlink 2022-04-13 20:59:07 +02:00
mdio.c
mhi_net.c
mii.c
net_failover.c
netconsole.c
nlmon.c
ntb_netdev.c
rionet.c
sb1000.c
sungem_phy.c net: sungem_phy: Add of_node_put() for reference returned by of_get_parent() 2022-08-03 12:03:48 +02:00
tap.c tuntap: add sanity checks about msg_controllen in sendmsg 2022-04-13 20:59:07 +02:00
thunderbolt.c net: thunderbolt: Enable DMA paths only after rings are enabled 2022-10-26 12:34:21 +02:00
tun.c net: tun: call napi_schedule_prep() to ensure we own a napi 2022-11-16 09:58:30 +01:00
veth.c veth: Ensure eth header is in skb's linear part 2022-04-20 09:34:10 +02:00
virtio_net.c virtio_net: fix memory leak inside XPD_TX with mergeable 2022-08-25 11:40:06 +02:00
vrf.c vrf: fix packet sniffing for traffic originating from ip tunnels 2022-04-13 20:59:15 +02:00
vsockmon.c
vxlan.c vxlan: fix error return code in vxlan_fdb_append 2022-04-27 14:38:55 +02:00
xen-netfront.c xen-netfront: restore __skb_queue_tail() positioning in xennet_get_responses() 2022-07-07 17:53:32 +02:00