]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - rpmsg/rpmsg.git/commit
llc: set SOCK_RCU_FREE in llc_sap_add_socket()
authorCong Wang <xiyou.wangcong@gmail.com>
Thu, 11 Oct 2018 18:15:13 +0000 (11:15 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 4 Nov 2018 13:52:48 +0000 (14:52 +0100)
commit6bb1381cc8650c9b86e41ea639db4dfaed750ad4
tree8613fa1508e3b28a2c8b67790c44fbed7471c6f6
parent1e42e97af9832848bbeba5c1f7f35dbcffec5642
llc: set SOCK_RCU_FREE in llc_sap_add_socket()

[ Upstream commit 5a8e7aea953bdb6d4da13aff6f1e7f9c62023499 ]

WHen an llc sock is added into the sk_laddr_hash of an llc_sap,
it is not marked with SOCK_RCU_FREE.

This causes that the sock could be freed while it is still being
read by __llc_lookup_established() with RCU read lock. sock is
refcounted, but with RCU read lock, nothing prevents the readers
getting a zero refcnt.

Fix it by setting SOCK_RCU_FREE in llc_sap_add_socket().

Reported-by: syzbot+11e05f04c15e03be5254@syzkaller.appspotmail.com
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/llc/llc_conn.c