kernel-fxtec-pro1x/net/sctp
Xin Long 4de506d511 sctp: use sk_wmem_queued to check for writable space
[ Upstream commit cd305c74b0f8b49748a79a8f67fc8e5e3e0c4794 ]

sk->sk_wmem_queued is used to count the size of chunks in out queue
while sk->sk_wmem_alloc is for counting the size of chunks has been
sent. sctp is increasing both of them before enqueuing the chunks,
and using sk->sk_wmem_alloc to check for writable space.

However, sk_wmem_alloc is also increased by 1 for the skb allocked
for sending in sctp_packet_transmit() but it will not wake up the
waiters when sk_wmem_alloc is decreased in this skb's destructor.

If msg size is equal to sk_sndbuf and sendmsg is waiting for sndbuf,
the check 'msg_len <= sctp_wspace(asoc)' in sctp_wait_for_sndbuf()
will keep waiting if there's a skb allocked in sctp_packet_transmit,
and later even if this skb got freed, the waiting thread will never
get waked up.

This issue has been there since very beginning, so we change to use
sk->sk_wmem_queued to check for writable space as sk_wmem_queued is
not increased for the skb allocked for sending, also as TCP does.

SOCK_SNDBUF_LOCK check is also removed here as it's for tx buf auto
tuning which I will add in another patch.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-01 09:16:39 +01:00
..
associola.c
auth.c
bind_addr.c
chunk.c
debug.c
diag.c
endpointola.c sctp: change to hold sk after auth shkey is created successfully 2019-07-03 13:14:47 +02:00
input.c
inqueue.c
ipv6.c
Kconfig
Makefile
objcnt.c
offload.c
output.c
outqueue.c
primitive.c
proc.c
protocol.c sctp: Fix the link time qualifier of 'sctp_ctrlsock_exit()' 2019-09-19 09:09:32 +02:00
sm_make_chunk.c sctp: Free cookie before we memdup a new one 2019-06-22 08:15:14 +02:00
sm_sideeffect.c sctp: use transport pf_retrans in sctp_do_8_2_transport_strike 2019-09-19 09:09:32 +02:00
sm_statefuns.c sctp: avoid running the sctp state machine recursively 2019-05-05 14:42:39 +02:00
sm_statetable.c
socket.c sctp: use sk_wmem_queued to check for writable space 2019-12-01 09:16:39 +01:00
stream.c sctp: fix memleak in sctp_send_reset_streams 2019-08-25 10:48:04 +02:00
stream_interleave.c
stream_sched.c
stream_sched_prio.c
stream_sched_rr.c
sysctl.c
transport.c
tsnmap.c
ulpevent.c
ulpqueue.c