Commit bd4713d5 authored by Litao Jiao's avatar Litao Jiao
Browse files

net/smc: Send out the remaining data in sndbuf before close

mainline inclusion
from mainline-v5.18-rc1
commit 906b3d64
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I78OQ2
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/net/smc?id=906b3d64913c19a50d5c553f21b54d2f4ce3ded7



--------------------------------

The current autocork algorithms will delay the data transmission
in BH context to smc_release_cb() when sock_lock is hold by user.

So there is a possibility that when connection is being actively
closed (sock_lock is hold by user now), some corked data still
remains in sndbuf, waiting to be sent by smc_release_cb(). This
will cause:

- smc_close_stream_wait(), which is called under the sock_lock,
  has a high probability of timeout because data transmission is
  delayed until sock_lock is released.

- Unexpected data sends may happen after connction closed and use
  the rtoken which has been deleted by remote peer through
  LLC_DELETE_RKEY messages.

So this patch will try to send out the remaining corked data in
sndbuf before active close process, to ensure data integrity and
avoid unexpected data transmission after close.

Reported-by: default avatarGuangguan Wang <guangguan.wang@linux.alibaba.com>
Fixes: 6b88af83 ("net/smc: don't send in the BH context if sock_owned_by_user")
Signed-off-by: default avatarWen Gu <guwen@linux.alibaba.com>
Acked-by: default avatarKarsten Graul <kgraul@linux.ibm.com>
Link: https://lore.kernel.org/r/1648447836-111521-1-git-send-email-guwen@linux.alibaba.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarLitao Jiao <jiaolitao@sangfor.com.cn>
parent 9eef8c08
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment