]> git.baikalelectronics.ru Git - kernel.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)
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: 19284cc854b3 ("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 635de07b2e406eadd52b81b726d45465542b72d9..ebee5f07a208eb17e71352ff653d114119d4efb7 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;