]> git.baikalelectronics.ru Git - kernel.git/commit
net/smc: add fallback check to connect()
authorUrsula Braun <ubraun@linux.ibm.com>
Thu, 12 Dec 2019 21:35:58 +0000 (22:35 +0100)
committerJakub Kicinski <jakub.kicinski@netronome.com>
Sun, 15 Dec 2019 19:10:30 +0000 (11:10 -0800)
commitc60c96f0f08f37832929e706811c85e3773fa701
tree120e896c94faf88d7f9ee4101d65eb31cbdc22fa
parent4e197314025d5d76c425cb1fe1e3d2761ef5f615
net/smc: add fallback check to connect()

FASTOPEN setsockopt() or sendmsg() may switch the SMC socket to fallback
mode. Once fallback mode is active, the native TCP socket functions are
called. Nevertheless there is a small race window, when FASTOPEN
setsockopt/sendmsg runs in parallel to a connect(), and switch the
socket into fallback mode before connect() takes the sock lock.
Make sure the SMC-specific connect setup is omitted in this case.

This way a syzbot-reported refcount problem is fixed, triggered by
different threads running non-blocking connect() and FASTOPEN_KEY
setsockopt.

Reported-by: syzbot+96d3f9ff6a86d37e44c8@syzkaller.appspotmail.com
Fixes: 7de7c8dc4564 ("net/smc: fix refcount non-blocking connect() -part 2")
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
net/smc/af_smc.c