]> git.baikalelectronics.ru Git - kernel.git/commit
net/smc: fix fallback failed while sendmsg with fastopen
authorD. Wythe <alibuda@linux.alibaba.com>
Tue, 7 Mar 2023 03:23:46 +0000 (11:23 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Mar 2023 07:32:51 +0000 (08:32 +0100)
commit9cf1cd2e608a81b6d01d37e3ca18c8b6f87b1477
tree530bc55b7783a85dec0781a465f2aa1547bc48ac
parentcc5cf672809572905393656bba6cb9aea7462047
net/smc: fix fallback failed while sendmsg with fastopen

[ Upstream commit ce7ca794712f186da99719e8b4e97bd5ddbb04c3 ]

Before determining whether the msg has unsupported options, it has been
prematurely terminated by the wrong status check.

For the application, the general usages of MSG_FASTOPEN likes

fd = socket(...)
/* rather than connect */
sendto(fd, data, len, MSG_FASTOPEN)

Hence, We need to check the flag before state check, because the sock
state here is always SMC_INIT when applications tries MSG_FASTOPEN.
Once we found unsupported options, fallback it to TCP.

Fixes: ecf28acb843b ("net/smc: handle sockopts forcing fallback")
Signed-off-by: D. Wythe <alibuda@linux.alibaba.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
v2 -> v1: Optimize code style
Reviewed-by: Tony Lu <tonylu@linux.alibaba.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/smc/af_smc.c