linux-stable/net/rxrpc
David Howells d9f4d60a23 rxrpc: Fix possible NULL pointer access in ICMP handling
[ Upstream commit f0308fb070 ]

If an ICMP packet comes in on the UDP socket backing an AF_RXRPC socket as
the UDP socket is being shut down, rxrpc_error_report() may get called to
deal with it after sk_user_data on the UDP socket has been cleared, leading
to a NULL pointer access when this local endpoint record gets accessed.

Fix this by just returning immediately if sk_user_data was NULL.

The oops looks like the following:

#PF: supervisor read access in kernel mode
#PF: error_code(0x0000) - not-present page
...
RIP: 0010:rxrpc_error_report+0x1bd/0x6a9
...
Call Trace:
 ? sock_queue_err_skb+0xbd/0xde
 ? __udp4_lib_err+0x313/0x34d
 __udp4_lib_err+0x313/0x34d
 icmp_unreach+0x1ee/0x207
 icmp_rcv+0x25b/0x28f
 ip_protocol_deliver_rcu+0x95/0x10e
 ip_local_deliver+0xe9/0x148
 __netif_receive_skb_one_core+0x52/0x6e
 process_backlog+0xdc/0x177
 net_rx_action+0xf9/0x270
 __do_softirq+0x1b6/0x39a
 ? smpboot_register_percpu_thread+0xce/0xce
 run_ksoftirqd+0x1d/0x42
 smpboot_thread_fn+0x19e/0x1b3
 kthread+0xf1/0xf6
 ? kthread_delayed_work_timer_fn+0x83/0x83
 ret_from_fork+0x24/0x30

Fixes: 17926a7932 ("[AF_RXRPC]: Provide secure RxRPC sockets for use by userspace and kernel both")
Reported-by: syzbot+611164843bd48cc2190c@syzkaller.appspotmail.com
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-01-09 10:19:08 +01:00
..
af_rxrpc.c rxrpc: Fix local endpoint refcounting 2019-08-29 08:28:59 +02:00
ar-internal.h rxrpc: Fix local endpoint refcounting 2019-08-29 08:28:59 +02:00
call_accept.c rxrpc: Fix an uninitialised variable 2018-10-15 22:07:36 -07:00
call_event.c rxrpc: Fix lockup due to no error backoff after ack transmit error 2018-11-23 08:17:07 +01:00
call_object.c rxrpc: Fix net namespace cleanup 2019-05-05 14:42:38 +02:00
conn_client.c rxrpc: Fix client call connect/disconnect race 2019-04-20 09:16:05 +02:00
conn_event.c rxrpc: Fix connection-level abort handling 2018-10-08 22:42:04 +01:00
conn_object.c rxrpc: Fix error distribution 2018-09-28 10:33:17 +01:00
conn_service.c rxrpc: Fix apparent leak of rxrpc_local objects 2018-03-30 21:05:33 +01:00
input.c rxrpc: Fix local endpoint refcounting 2019-08-29 08:28:59 +02:00
insecure.c
Kconfig
key.c
local_event.c rxrpc: Trace packet transmission 2018-08-01 13:28:23 +01:00
local_object.c rxrpc: Fix local refcounting 2019-08-29 08:28:59 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
misc.c rxrpc: Fix call timeouts 2017-11-24 10:18:41 +00:00
net_ns.c rxrpc: Fix the keepalive generator [ver #2] 2018-08-08 19:10:26 -07:00
output.c rxrpc: Fix lockup due to no error backoff after ack transmit error 2018-11-23 08:17:07 +01:00
peer_event.c rxrpc: Fix possible NULL pointer access in ICMP handling 2020-01-09 10:19:08 +01:00
peer_object.c rxrpc: Fix trace-after-put looking at the put peer record 2019-11-06 13:06:24 +01:00
proc.c rxrpc: Remove set but not used variable 'nowj' 2018-08-02 10:18:20 -07:00
protocol.h rxrpc: Improve up-front incoming packet checking 2018-09-28 10:32:31 +01:00
recvmsg.c rxrpc: bad unlock balance in rxrpc_recvmsg 2019-02-12 19:47:22 +01:00
rxkad.c Merge ra.kernel.org:/pub/scm/linux/kernel/git/davem/net 2018-08-09 11:52:36 -07:00
security.c rxrpc: remove unused static variables 2018-03-30 21:04:44 +01:00
sendmsg.c rxrpc: Fix call ref leak 2019-11-06 13:06:23 +01:00
skbuff.c
sysctl.c rxrpc: remove redundant static int 'zero' 2018-08-11 11:25:18 -07:00
utils.c rxrpc: Fix IPv6 support 2017-08-29 10:55:20 +01:00