]> git.baikalelectronics.ru Git - kernel.git/commit
smc: move unhash as early as possible in smc_release()
authorCong Wang <xiyou.wangcong@gmail.com>
Sun, 6 Jan 2019 07:45:26 +0000 (23:45 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 7 Jan 2019 19:40:27 +0000 (14:40 -0500)
commit01efeabb435699a06341ca4638c8183c48fce976
treee0233475d3922cc26be5157b077f62b5b31e2031
parent6c6f45644c06c2c0fe263102d4a3d2f54f1032c0
smc: move unhash as early as possible in smc_release()

In smc_release() we release smc->clcsock before unhash the smc
sock, but a parallel smc_diag_dump() may be still reading
smc->clcsock, therefore this could cause a use-after-free as
reported by syzbot.

Reported-and-tested-by: syzbot+fbd1e5476e4c94c7b34e@syzkaller.appspotmail.com
Fixes: f10ae57120c2 ("net/smc: replace sock_put worker by socket refcounting")
Cc: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Reported-by: syzbot+0bf2e01269f1274b4b03@syzkaller.appspotmail.com
Reported-by: syzbot+e3132895630f957306bc@syzkaller.appspotmail.com
Signed-off-by: David S. Miller <davem@davemloft.net>
net/smc/af_smc.c