linux/net
Wang Yufen eb0e7173d9 netlabel: fix out-of-bounds memory accesses
[ Upstream commit f22881de73 ]

In calipso_map_cat_ntoh(), in the for loop, if the return value of
netlbl_bitmap_walk() is equal to (net_clen_bits - 1), when
netlbl_bitmap_walk() is called next time, out-of-bounds memory accesses
of bitmap[byte_offset] occurs.

The bug was found during fuzzing. The following is the fuzzing report
 BUG: KASAN: slab-out-of-bounds in netlbl_bitmap_walk+0x3c/0xd0
 Read of size 1 at addr ffffff8107bf6f70 by task err_OH/252

 CPU: 7 PID: 252 Comm: err_OH Not tainted 5.17.0-rc7+ #17
 Hardware name: linux,dummy-virt (DT)
 Call trace:
  dump_backtrace+0x21c/0x230
  show_stack+0x1c/0x60
  dump_stack_lvl+0x64/0x7c
  print_address_description.constprop.0+0x70/0x2d0
  __kasan_report+0x158/0x16c
  kasan_report+0x74/0x120
  __asan_load1+0x80/0xa0
  netlbl_bitmap_walk+0x3c/0xd0
  calipso_opt_getattr+0x1a8/0x230
  calipso_sock_getattr+0x218/0x340
  calipso_sock_getattr+0x44/0x60
  netlbl_sock_getattr+0x44/0x80
  selinux_netlbl_socket_setsockopt+0x138/0x170
  selinux_socket_setsockopt+0x4c/0x60
  security_socket_setsockopt+0x4c/0x90
  __sys_setsockopt+0xbc/0x2b0
  __arm64_sys_setsockopt+0x6c/0x84
  invoke_syscall+0x64/0x190
  el0_svc_common.constprop.0+0x88/0x200
  do_el0_svc+0x88/0xa0
  el0_svc+0x128/0x1b0
  el0t_64_sync_handler+0x9c/0x120
  el0t_64_sync+0x16c/0x170

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wang Yufen <wangyufen@huawei.com>
Acked-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-04-13 20:59:10 +02:00
..
6lowpan
9p xen/9p: use alloc/free_pages_exact() 2022-03-11 12:22:36 +01:00
802
8021q
appletalk
atm
ax25 ax25: Fix NULL pointer dereference in ax25_kill_by_device 2022-03-16 14:23:38 +01:00
batman-adv ipv6: make mc_forwarding atomic 2022-04-13 20:59:03 +02:00
bluetooth Bluetooth: Fix use after free in hci_send_acl 2022-04-13 20:59:09 +02:00
bpf
bpfilter
bridge net: bridge: multicast: notify switchdev driver whenever MC processing gets disabled 2022-02-23 12:03:13 +01:00
caif
can can: isotp: set default value for N_As to 50 micro seconds 2022-04-13 20:59:08 +02:00
ceph
core net: limit altnames to 64k total 2022-04-13 20:59:09 +02:00
dcb net: dcb: disable softirqs in dcbnl_flush_dev() 2022-03-08 19:12:52 +01:00
dccp
decnet
dns_resolver
dsa net: dsa: fix panic on shutdown if multi-chip tree failed to probe 2022-04-08 14:23:43 +02:00
ethernet
ethtool
hsr
ieee802154 net: ieee802154: Return meaningful error codes from the netlink helpers 2022-02-08 18:34:09 +01:00
ife
ipv4 ipv4: Invalidate neighbour for broadcast address upon address addition 2022-04-13 20:59:05 +02:00
ipv6 tcp: Don't acquire inet_listen_hashbucket::lock with disabled BH. 2022-04-13 20:59:04 +02:00
iucv
kcm
key af_key: add __GFP_ZERO flag for compose_sadb_supported in function pfkey_register 2022-04-08 14:22:47 +02:00
l2tp
l3mdev
lapb
llc llc: only change llc->dev when bind() succeeds 2022-03-28 09:58:46 +02:00
mac80211 mac80211: limit bandwidth in HE capabilities 2022-04-08 14:23:28 +02:00
mac802154
mctp
mpls
mptcp mptcp: Correctly set DATA_FIN timeout when number of retransmits is large 2022-03-08 19:12:48 +01:00
ncsi
netfilter netfilter: conntrack: revisit gc autotuning 2022-04-13 20:59:10 +02:00
netlabel netlabel: fix out-of-bounds memory accesses 2022-04-13 20:59:10 +02:00
netlink af_netlink: Fix shift out of bounds in group mask calculation 2022-04-08 14:23:42 +02:00
netrom
nfc
nsh
openvswitch openvswitch: Fixed nd target mask field in the flow dump. 2022-04-08 14:24:16 +02:00
packet net/packet: fix slab-out-of-bounds access in packet_recvmsg() 2022-03-23 09:16:41 +01:00
phonet
psample
qrtr
rds
rfkill rfkill: make new event layout opt-in 2022-04-08 14:23:00 +02:00
rose
rxrpc rxrpc: Fix call timer start racing with call destruction 2022-04-08 14:24:10 +02:00
sched net/sched: act_ct: fix ref leak when switching zones 2022-04-08 14:23:53 +02:00
sctp sctp: fix kernel-infoleak for SCTP sockets 2022-03-16 14:23:39 +01:00
smc net/smc: correct settings of RMB window update limit 2022-04-13 20:59:07 +02:00
strparser
sunrpc SUNRPC don't resend a task on an offlined transport 2022-04-08 14:23:51 +02:00
switchdev
tipc tipc: fix the timer expires after interval 100ms 2022-04-08 14:23:43 +02:00
tls
unix af_unix: Support POLLPRI for OOB. 2022-04-08 14:24:14 +02:00
vmw_vsock vsock/virtio: enable VQs early on probe 2022-04-08 14:23:51 +02:00
wireless cfg80211: don't add non transmitted BSS to 6GHz scanned channels 2022-04-13 20:59:03 +02:00
x25 net/x25: Fix null-ptr-deref caused by x25_disconnect 2022-04-08 14:23:53 +02:00
xdp xsk: Fix race at socket teardown 2022-04-08 14:23:36 +02:00
xfrm xfrm: fix tunnel model fragmentation behavior 2022-04-08 14:22:46 +02:00
compat.c
devres.c
Kconfig
Makefile
socket.c
sysctl_net.c