]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
amt: fix possible memory leak in amt_rcv()
authorTaehee Yoo <ap420073@gmail.com>
Mon, 23 May 2022 16:17:08 +0000 (16:17 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Jun 2022 16:41:20 +0000 (18:41 +0200)
[ Upstream commit 1a1a0e80e005cbdc2c250fc858e1d8570f4e4acb ]

If an amt receives packets and it finds socket.
If it can't find a socket, it should free a received skb.
But it doesn't.
So, a memory leak would possibly occur.

Fixes: cbc21dc1cfe9 ("amt: add data plane of amt interface")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/amt.c

index 6205282a09e59454c8dfcd0a7c23de2b1187d2a9..d23eac9ce858b56dc7de4c028c50ae5b73283c83 100644 (file)
@@ -2679,7 +2679,7 @@ static int amt_rcv(struct sock *sk, struct sk_buff *skb)
        amt = rcu_dereference_sk_user_data(sk);
        if (!amt) {
                err = true;
-               goto out;
+               goto drop;
        }
 
        skb->dev = amt->dev;