]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
amt: fix memory leak for advertisement message
authorTaehee Yoo <ap420073@gmail.com>
Thu, 19 May 2022 03:15:55 +0000 (03:15 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jun 2022 08:25:57 +0000 (10:25 +0200)
[ Upstream commit fe29794c3585d039fefebaa2b5a4932a627ad4fd ]

When a gateway receives an advertisement message, it extracts relay
information and then it should be freed.
But the advertisement handler doesn't free it.
So, memory leak would 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 96a2f6a505c305b821be1566e28bd60e9d8061e4..fb774d568baab6f96f7830087c0ed773463f6171 100644 (file)
@@ -2698,9 +2698,8 @@ static int amt_rcv(struct sock *sk, struct sk_buff *skb)
                                err = true;
                                goto drop;
                        }
-                       if (amt_advertisement_handler(amt, skb))
-                               amt->dev->stats.rx_dropped++;
-                       goto out;
+                       err = amt_advertisement_handler(amt, skb);
+                       break;
                case AMT_MSG_MULTICAST_DATA:
                        if (iph->saddr != amt->remote_ip) {
                                netdev_dbg(amt->dev, "Invalid Relay IP\n");