android_kernel_samsung_a7y1.../net/core
Subash Abhinov Kasiviswanathan c34a488174 net: Fix null de-reference of device refcount
[ Upstream commit 10cc514f451a0f239aa34f91bc9dc954a9397840 ]

In event of failure during register_netdevice, free_netdev is
invoked immediately. free_netdev assumes that all the netdevice
refcounts have been dropped prior to it being called and as a
result frees and clears out the refcount pointer.

However, this is not necessarily true as some of the operations
in the NETDEV_UNREGISTER notifier handlers queue RCU callbacks for
invocation after a grace period. The IPv4 callback in_dev_rcu_put
tries to access the refcount after free_netdev is called which
leads to a null de-reference-

44837.761523:   <6> Unable to handle kernel paging request at
                    virtual address 0000004a88287000
44837.761651:   <2> pc : in_dev_finish_destroy+0x4c/0xc8
44837.761654:   <2> lr : in_dev_finish_destroy+0x2c/0xc8
44837.762393:   <2> Call trace:
44837.762398:   <2>  in_dev_finish_destroy+0x4c/0xc8
44837.762404:   <2>  in_dev_rcu_put+0x24/0x30
44837.762412:   <2>  rcu_nocb_kthread+0x43c/0x468
44837.762418:   <2>  kthread+0x118/0x128
44837.762424:   <2>  ret_from_fork+0x10/0x1c

Fix this by waiting for the completion of the call_rcu() in
case of register_netdevice errors.

Fixes: 93ee31f14f6f ("[NET]: Fix free_netdev on register_netdev failure.")
Cc: Sean Tranchetti <stranche@codeaurora.org>
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-06 21:35:17 +02:00
..
datagram.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
dev_addr_lists.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
dev_ioctl.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
dev.c net: Fix null de-reference of device refcount 2020-04-06 21:35:17 +02:00
drop_monitor.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
dst_cache.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
dst.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ethtool.c ethtool: check the return value of get_regs_len 2020-04-06 18:48:01 +02:00
fib_rules.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
filter.c bpf: reject wrong sized filters earlier 2020-04-06 16:40:41 +02:00
flow_dissector.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
flow.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
gen_estimator.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
gen_stats.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
link_watch.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
lwtunnel.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
neighbour.c net: neigh: fix multiple neigh timer scheduling 2020-04-06 20:05:14 +02:00
net_namespace.c netns: provide pure entropy for net_hash_mix() 2020-04-06 15:08:06 +02:00
net-procfs.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
net-sysfs.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
net-sysfs.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
net-traces.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
netclassid_cgroup.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
netevent.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
netpoll.c net: fix skb use after free in netpoll 2020-04-06 21:34:43 +02:00
netprio_cgroup.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
pktgen.c pktgen: do not sleep with the thread lock held. 2020-04-06 18:45:08 +02:00
ptp_classifier.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
request_sock.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
rtnetlink.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
scm.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
secure_seq.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
skbuff.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
sock_diag.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
sock.c net : disable KNOX_NCM 2020-03-27 22:13:21 +05:30
stream.c tcp: make sure EPOLLOUT wont be missed 2020-04-06 21:33:22 +02:00
sysctl_net_core.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
timestamping.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
tso.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
utils.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30