diff options
author | Guangguan Wang <guangguan.wang@linux.alibaba.com> | 2022-05-12 11:08:20 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-05-18 09:47:25 +0200 |
commit | e038c457bd12649730b9e8c330acfba83d0d3b77 (patch) | |
tree | 58fc081a61078f06364f1f5fcf648564d792c2af /net | |
parent | 2ec2dd7d51a9320151f275ddbb2b53260fb32ca1 (diff) | |
download | linux-stable-e038c457bd12649730b9e8c330acfba83d0d3b77.tar.gz linux-stable-e038c457bd12649730b9e8c330acfba83d0d3b77.tar.bz2 linux-stable-e038c457bd12649730b9e8c330acfba83d0d3b77.zip |
net/smc: non blocking recvmsg() return -EAGAIN when no data and signal_pending
[ Upstream commit f3c46e41b32b6266cf60b0985c61748f53bf1c61 ]
Non blocking sendmsg will return -EAGAIN when any signal pending
and no send space left, while non blocking recvmsg return -EINTR
when signal pending and no data received. This may makes confused.
As TCP returns -EAGAIN in the conditions described above. Align the
behavior of smc with TCP.
Fixes: 846e344eb722 ("net/smc: add receive timeout check")
Signed-off-by: Guangguan Wang <guangguan.wang@linux.alibaba.com>
Reviewed-by: Tony Lu <tonylu@linux.alibaba.com>
Acked-by: Karsten Graul <kgraul@linux.ibm.com>
Link: https://lore.kernel.org/r/20220512030820.73848-1-guangguan.wang@linux.alibaba.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/smc/smc_rx.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/smc/smc_rx.c b/net/smc/smc_rx.c index 97e8369002d7..9e89bd1f706b 100644 --- a/net/smc/smc_rx.c +++ b/net/smc/smc_rx.c @@ -348,12 +348,12 @@ int smc_rx_recvmsg(struct smc_sock *smc, struct msghdr *msg, } break; } + if (!timeo) + return -EAGAIN; if (signal_pending(current)) { read_done = sock_intr_errno(timeo); break; } - if (!timeo) - return -EAGAIN; } if (!smc_rx_data_available(conn)) { |