]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
llc: fix data loss when reading from a socket in llc_ui_recvmsg()
authorIlia Gavrilov <Ilia.Gavrilov@infotecs.ru>
Thu, 15 May 2025 12:20:15 +0000 (12:20 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 Jun 2025 12:38:06 +0000 (14:38 +0200)
commit0f5d93ee3f8b769b5da16cfb83647cb81a53e293
tree23ac8530839a7f90f552d7a1df60472201ca3ef6
parent10217da9644ae75cea7330f902c35fc5ba78bbbf
llc: fix data loss when reading from a socket in llc_ui_recvmsg()

commit 239af1970bcb039a1551d2c438d113df0010c149 upstream.

For SOCK_STREAM sockets, if user buffer size (len) is less
than skb size (skb->len), the remaining data from skb
will be lost after calling kfree_skb().

To fix this, move the statement for partial reading
above skb deletion.

Found by InfoTeCS on behalf of Linux Verification Center (linuxtesting.org)

Fixes: 30a584d944fb ("[LLX]: SOCK_DGRAM interface fixes")
Cc: stable@vger.kernel.org
Signed-off-by: Ilia Gavrilov <Ilia.Gavrilov@infotecs.ru>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/llc/af_llc.c