]> git.baikalelectronics.ru Git - kernel.git/commit
bpf, sockmap: Fix potential memory leak on unlikely error case
authorJohn Fastabend <john.fastabend@gmail.com>
Mon, 12 Jul 2021 19:55:45 +0000 (12:55 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 15 Jul 2021 17:49:12 +0000 (19:49 +0200)
commit9c81c3e77930122b602993203a012224ade8d0b8
tree410c90ca2c317060d065ba411c7fd8821256ec23
parent4e2156e218fc460bfcc874718b060c8666cba3f3
bpf, sockmap: Fix potential memory leak on unlikely error case

If skb_linearize is needed and fails we could leak a msg on the error
handling. To fix ensure we kfree the msg block before returning error.
Found during code review.

Fixes: f6ee8d52239b5 ("bpf, sockmap: Avoid failures from skb_to_sgvec when skb has frag_list")
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Cong Wang <cong.wang@bytedance.com>
Link: https://lore.kernel.org/bpf/20210712195546.423990-2-john.fastabend@gmail.com
net/core/skmsg.c