Skip to content

Commit 97bf6f8

Browse files
lxinkuba-moo
authored andcommitted
tipc: fix a possible memleak in tipc_buf_append
__skb_linearize() doesn't free the skb when it fails, so move '*buf = NULL' after __skb_linearize(), so that the skb can be freed on the err path. Fixes: b7df21c ("tipc: skb_linearize the head skb when reassembling msgs") Reported-by: Paolo Abeni <[email protected]> Signed-off-by: Xin Long <[email protected]> Reviewed-by: Simon Horman <[email protected]> Reviewed-by: Tung Nguyen <[email protected]> Link: https://lore.kernel.org/r/90710748c29a1521efac4f75ea01b3b7e61414cf.1714485818.git.lucien.xin@gmail.com Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 080cbb8 commit 97bf6f8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/tipc/msg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,9 @@ int tipc_buf_append(struct sk_buff **headbuf, struct sk_buff **buf)
142142
if (fragid == FIRST_FRAGMENT) {
143143
if (unlikely(head))
144144
goto err;
145-
*buf = NULL;
146145
if (skb_has_frag_list(frag) && __skb_linearize(frag))
147146
goto err;
147+
*buf = NULL;
148148
frag = skb_unshare(frag, GFP_ATOMIC);
149149
if (unlikely(!frag))
150150
goto err;

0 commit comments

Comments
 (0)