amt: fix possible memory leak in amt_rcv()
authorTaehee Yoo <ap420073@gmail.com>
Mon, 23 May 2022 16:17:08 +0000 (16:17 +0000)
committerJakub Kicinski <kuba@kernel.org>
Thu, 26 May 2022 04:36:16 +0000 (21:36 -0700)
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>
drivers/net/amt.c

index 635de07..ebee5f0 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;