Skip to content

Commit 2dcab59

Browse files
marceloleitnerdavem330
authored andcommitted
sctp: avoid BUG_ON on sctp_wait_for_sndbuf
Alexander Popov reported that an application may trigger a BUG_ON in sctp_wait_for_sndbuf if the socket tx buffer is full, a thread is waiting on it to queue more data and meanwhile another thread peels off the association being used by the first thread. This patch replaces the BUG_ON call with a proper error handling. It will return -EPIPE to the original sendmsg call, similarly to what would have been done if the association wasn't found in the first place. Acked-by: Alexander Popov <[email protected]> Signed-off-by: Marcelo Ricardo Leitner <[email protected]> Reviewed-by: Xin Long <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent bd4ce94 commit 2dcab59

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/sctp/socket.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7426,7 +7426,8 @@ static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p,
74267426
*/
74277427
release_sock(sk);
74287428
current_timeo = schedule_timeout(current_timeo);
7429-
BUG_ON(sk != asoc->base.sk);
7429+
if (sk != asoc->base.sk)
7430+
goto do_error;
74307431
lock_sock(sk);
74317432

74327433
*timeo_p = current_timeo;

0 commit comments

Comments
 (0)