]> git.baikalelectronics.ru Git - kernel.git/commit
net/smc: receive pending data after RCV_SHUTDOWN
authorKarsten Graul <kgraul@linux.ibm.com>
Thu, 10 Oct 2019 08:16:11 +0000 (10:16 +0200)
committerJakub Kicinski <jakub.kicinski@netronome.com>
Fri, 11 Oct 2019 02:08:41 +0000 (19:08 -0700)
commit68c164e3f75e159c835c025ab73c70c5713901db
treeefa404f6ebfcdca077aedf2b5c5eba7c68b6f049
parent67c13f7b16f0aa8a70ea4b50166c9767aa240bc3
net/smc: receive pending data after RCV_SHUTDOWN

smc_rx_recvmsg() first checks if data is available, and then if
RCV_SHUTDOWN is set. There is a race when smc_cdc_msg_recv_action() runs
in between these 2 checks, receives data and sets RCV_SHUTDOWN.
In that case smc_rx_recvmsg() would return from receive without to
process the available data.
Fix that with a final check for data available if RCV_SHUTDOWN is set.
Move the check for data into a function and call it twice.
And use the existing helper smc_rx_data_available().

Fixes: 7af079a7a4b6 ("smc: receive data from RMBE")
Reviewed-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/smc_rx.c