linux/net
Gerd Bayer ddebdaec1a net/smc: Use correct buffer sizes when switching between TCP and SMC
commit 30c3c4a449 upstream.

Tuning of the effective buffer size through setsockopts was working for
SMC traffic only but not for TCP fall-back connections even before
commit 0227f058aa ("net/smc: Unbind r/w buffer size from clcsock and
make them tunable"). That change made it apparent that TCP fall-back
connections would use net.smc.[rw]mem as buffer size instead of
net.ipv4_tcp_[rw]mem.

Amend the code that copies attributes between the (TCP) clcsock and the
SMC socket and adjust buffer sizes appropriately:
- Copy over sk_userlocks so that both sockets agree on whether tuning
  via setsockopt is active.
- When falling back to TCP use sk_sndbuf or sk_rcvbuf as specified with
  setsockopt. Otherwise, use the sysctl value for TCP/IPv4.
- Likewise, use either values from setsockopt or from sysctl for SMC
  (duplicated) on successful SMC connect.

In smc_tcp_listen_work() drop the explicit copy of buffer sizes as that
is taken care of by the attribute copy.

Fixes: 0227f058aa ("net/smc: Unbind r/w buffer size from clcsock and make them tunable")
Reviewed-by: Wenjia Zhang <wenjia@linux.ibm.com>
Reviewed-by: Tony Lu <tonylu@linux.alibaba.com>
Signed-off-by: Gerd Bayer <gbayer@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-08-16 18:27:26 +02:00
..
6lowpan
9p
802
8021q
appletalk
atm
ax25
batman-adv
bluetooth Bluetooth: L2CAP: Fix use-after-free in l2cap_sock_ready_cb 2023-08-11 12:08:23 +02:00
bpf
bpfilter
bridge
caif
can
ceph libceph: fix potential hang in ceph_osdc_notify() 2023-08-11 12:08:19 +02:00
core bpf, sockmap: Fix bug that strp_done cannot be called 2023-08-16 18:27:26 +02:00
dcb net: dcb: choose correct policy to parse DCB_ATTR_BCN 2023-08-11 12:08:17 +02:00
dccp net: annotate data-races around sk->sk_mark 2023-08-11 12:08:14 +02:00
dns_resolver
dsa
ethernet
ethtool
hsr
ieee802154
ife
ipv4 tcp_metrics: fix data-race in tcpm_suck_dst() vs fastopen 2023-08-11 12:08:18 +02:00
ipv6 ipv6: adjust ndisc_is_useropt() to also return true for PIO 2023-08-16 18:27:21 +02:00
iucv
kcm
key
l2tp net: annotate data-races around sk->sk_mark 2023-08-11 12:08:14 +02:00
l3mdev
lapb
llc
mac80211
mac802154
mctp
mpls
mptcp mptcp: fix the incorrect judgment for msk->cb_flags 2023-08-16 18:27:26 +02:00
ncsi
netfilter net: annotate data-races around sk->sk_mark 2023-08-11 12:08:14 +02:00
netlabel
netlink
netrom
nfc
nsh
openvswitch
packet net/packet: annotate data-races around tp->status 2023-08-16 18:27:26 +02:00
phonet
psample
qrtr
rds
rfkill
rose
rxrpc
sched net/sched: cls_route: No longer copy tcf_result on update to avoid use-after-free 2023-08-11 12:08:16 +02:00
sctp
smc net/smc: Use correct buffer sizes when switching between TCP and SMC 2023-08-16 18:27:26 +02:00
strparser
sunrpc
switchdev
tipc
tls
unix net: add missing data-race annotations around sk->sk_peek_off 2023-08-11 12:08:14 +02:00
vmw_vsock
wireless wifi: nl80211: fix integer overflow in nl80211_parse_mbssid_elems() 2023-08-16 18:27:20 +02:00
x25
xdp net: annotate data-races around sk->sk_mark 2023-08-11 12:08:14 +02:00
xfrm net: annotate data-races around sk->sk_mark 2023-08-11 12:08:14 +02:00
compat.c
devres.c
Kconfig
Kconfig.debug
Makefile
socket.c
sysctl_net.c