]> 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>
Thu, 29 May 2025 09:14:02 +0000 (11:14 +0200)
commitc590660172800dd9eb93c426ff19dc5de26b1035
tree4d7ec98682ba88fa230211ba31869738a13ef507
parent5be7c31cbdd9b5f6d5c4f445ae4cc56346251cb5
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