Skip to content
Commit 9f8d0dc0 authored by David Howells's avatar David Howells Committed by Jakub Kicinski
Browse files

kcm: Fix unnecessary psock unreservation.



kcm_write_msgs() calls unreserve_psock() to release its hold on the
underlying TCP socket if it has run out of things to transmit, but if we
have nothing in the write queue on entry (e.g. because someone did a
zero-length sendmsg), we don't actually go into the transmission loop and
as a consequence don't call reserve_psock().

Fix this by skipping the call to unreserve_psock() if we didn't reserve a
psock.

Fixes: c31a25e1 ("kcm: Send multiple frags in one sendmsg()")
Reported-by: default avatar <syzbot+dd1339599f1840e4cc65@syzkaller.appspotmail.com>
Link: https://lore.kernel.org/r/000000000000a61ffe05fe0c3d08@google.com/


Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Tested-by: default avatar <syzbot+dd1339599f1840e4cc65@syzkaller.appspotmail.com>
cc: Tom Herbert <tom@herbertland.com>
cc: Tom Herbert <tom@quantonium.net>
cc: Jens Axboe <axboe@kernel.dk>
cc: Matthew Wilcox <willy@infradead.org>
Link: https://lore.kernel.org/r/20787.1686828722@warthog.procyon.org.uk


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 5a6f6873
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment