Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2207432iof; Tue, 7 Jun 2022 23:13:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrpOiO7bqhaqHnlYaDuoaSF43K5GEB2CQKAy/MgN9AsZCaQ2MAbUnQL6r4vSlPf3QUmPgL X-Received: by 2002:a17:902:eb8d:b0:168:9498:a0b6 with SMTP id q13-20020a170902eb8d00b001689498a0b6mr1868267plg.24.1654668795567; Tue, 07 Jun 2022 23:13:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654668795; cv=none; d=google.com; s=arc-20160816; b=vdN3rmEi2AILT6GlGMTMs2/42gnRDqjZHrIQzGys5fGwVP0ShqWLGqRpq9xqwgtOsm gqNQ4ynE2i49pLhCk+Egdyb5yHxi6uTrxJ7C32j5kde2iA9jpVYInN6KgI5VB5dhxBBD eIg1WF3iihwKbzhpdQ8ge9Kg/BB4d5FozGT6Bu9emq7QgV2V9mnBZA53bscswiOLnK8m kKNYJjc/k7yBnfhDN37AqHQRxHUAFwTu/Y29p3TQ5DJwt8mVX37tHOEZtUf/f8igaoxq p1IX2PdSaMlKQMBset9H7Fi3eEiDEyhJo4ylsp6K/HRBw7YbJx0jqcJ93XaiJrtyD0hW DZAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JyxvQ2TrJ0UvY+NaGirPvSr4fAmMQB6x/ks/+G2Xtwc=; b=HubCSPkIS7rawHgwoCvGvtYMQ2x58DZqCzvJ/SHw3JLsUH2gO6vh/iuZez5sWDAFTk 7YCHO3TEVxWe/fYzMxaGggujjKYpL69YzeCS10CaN3LZgZUc62JmwHnb56Qxjwb7x2Uj HiRP5i6R1bnarAsFksBTyyGG0PSrDUHjpGvfLJj7hXJCc0TXDDvGXVwLEoQ3nJZ+cd4c UKzu7BWtCl7i4eNggM95AlU74CX0D5CVEn7mFz0HmK4ZuSysfRSGZhIvyxoBzPuZsFqr UN1xSlh+GRisvlrfzMeHfmLfg0S2/MK9RBx/jM30X9E/lPvVHQdydZEH8LAq2tLHvtnn JT4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LnMq1UdG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id jc20-20020a17090325d400b00153b2d16497si12334788plb.159.2022.06.07.23.13.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 23:13:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LnMq1UdG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 188DE3563B7; Tue, 7 Jun 2022 22:35:52 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1390521AbiFHBux (ORCPT + 99 others); Tue, 7 Jun 2022 21:50:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382552AbiFGVve (ORCPT ); Tue, 7 Jun 2022 17:51:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C400623CF69; Tue, 7 Jun 2022 12:09:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9F477618D3; Tue, 7 Jun 2022 19:09:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE517C34115; Tue, 7 Jun 2022 19:08:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628940; bh=tJbaS2XiW41GrXthoYwhtBy7BU2P4TIZhpW73nfPXUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LnMq1UdGyb8xxML1oTzinz3fXZ3XbQVxcn2insHCATp4iPJnXVXPQOIoFPbVNxf9k q9sRl8ZXo/fbTz+aoVATUD9nv5sVa+ForTQjpQ0FvC/aZ7XmuMF3WaCEop7cBtXyVJ viBGxMdtC6lebqsIkmnf02qjkXlFBEBddpbE0f8I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Taehee Yoo , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 512/879] amt: fix memory leak for advertisement message Date: Tue, 7 Jun 2022 19:00:30 +0200 Message-Id: <20220607165017.737618336@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Taehee Yoo [ 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 Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/amt.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/amt.c b/drivers/net/amt.c index 2b4ce3869f08..de4ea518c793 100644 --- a/drivers/net/amt.c +++ b/drivers/net/amt.c @@ -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"); -- 2.35.1