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)
committerDavid S. Miller <davem@davemloft.net>
Mon, 19 May 2025 11:12:54 +0000 (12:12 +0100)
commit239af1970bcb039a1551d2c438d113df0010c149
tree78075848cf47ecd99bbb39fb8ff82f98e4b81615
parentc46286fdd6aa1d0e33c245bcffe9ff2428a777bd
llc: fix data loss when reading from a socket in llc_ui_recvmsg()

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>
net/llc/af_llc.c