Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3860604iob; Tue, 17 May 2022 08:38:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHIqgUMVp5lgdvOCvy7mmvgPckqOezb7A4CoKJHVndcKoBGEZ+c7gVoRyjncIVGPNauOlh X-Received: by 2002:a05:6a00:134f:b0:50e:10e0:ef82 with SMTP id k15-20020a056a00134f00b0050e10e0ef82mr23216350pfu.45.1652801912226; Tue, 17 May 2022 08:38:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652801912; cv=none; d=google.com; s=arc-20160816; b=MEOfSSAeZtpWFurEHzimIyTBl90k9oS6faTtYx/qFSBP7SgUAhsbG7n4OXDhwlC1Yj 0ylAAX8eNSrztkL44OH0yodkJQ1mF4pLmhrRQtSsxYpq7I4vtofi4WA9T7OHLNlkDkiQ 5lKfe5TjUvKeldSiniO69xRpqr4ZVwJNCAgGrqKYh5tonZS0j9tt7/WHxuLbTfZkjJpC S2wq40n0ym6g5X1QkctFAy43Uok8c6O1mIzj8OstEs+YyUnnVQBYw/cuSlOyk6fm59Y2 OfY0KpJH45lOkEKnLYd6aWwLdjDxwVkzgqA7k8dJmz32N9WcC3O6qTuPf+nY9ckIlNM4 IuIw== 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=/ZJXmJIxf1uzK9I0UJRK0QkWmXA6WJbp8eEYC4Wqkjg=; b=fwNdbHjO6Mj/VJGcTW8iHtyV8Va1Eaak+KPyVzHkS5zgmOHYVMVEU5XFnLNN7iWdWk V3Eps6DOv7J6gMGQBuXgx/uBozQvO0Swi6MqfwOaT1FQZNJmmlxOyd7e4owNWqIHeb0U neCHZ9UeC/Sd3T6ut2Op8kPkEITx/9okWowuY2/vdQENayV7a4Uh2IrAyABSMoyQs4u7 FJoPA0TNxcUfxnqB9Ay9SxZzZkWPL0dGzcY97CjcuUzEfu0taaP2/QeUMnDB5a/Gi/A6 IjJAfkGi7wC+YNra+s6rCskwlY95AfqSy7P+5SNsktW25gUBtD3njNNPcEI72t2IIrPi gX/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hxJOkrWW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f6-20020a056a00238600b0050dd820a060si71390pfc.61.2022.05.17.08.38.18; Tue, 17 May 2022 08:38:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hxJOkrWW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237830AbiEPU2Q (ORCPT + 99 others); Mon, 16 May 2022 16:28:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350037AbiEPUAp (ORCPT ); Mon, 16 May 2022 16:00:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BC1A44A1C; Mon, 16 May 2022 12:54:47 -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 49A1860A1C; Mon, 16 May 2022 19:53:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D5DCC385AA; Mon, 16 May 2022 19:53:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1652730825; bh=OY7ZwR9sMWRyWDjAT5nOLctSSRKNzgghfWhmkOvZy+4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hxJOkrWWxO5SvVJTdyIrALoz9go2v/AhECTE1HDqgPSGRRcEg0yOMlfDRxwoLDGPf RwLIk2tl/NGmUc5o3OrDXMsyFrDvYVrSupsmXdoSYLcmxzv1v++RHXB4xWO1nNXkOt I9pcXDrjU1/b2p8hJsGiiBjV6NT3eSSHf3hUuhCQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lokesh Dhoundiyal , Chris Packham , David Ahern , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.17 018/114] ipv4: drop dst in multicast routing path Date: Mon, 16 May 2022 21:35:52 +0200 Message-Id: <20220516193626.019507712@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220516193625.489108457@linuxfoundation.org> References: <20220516193625.489108457@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=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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: Lokesh Dhoundiyal [ Upstream commit 9e6c6d17d1d6a3f1515ce399f9a011629ec79aa0 ] kmemleak reports the following when routing multicast traffic over an ipsec tunnel. Kmemleak output: unreferenced object 0x8000000044bebb00 (size 256): comm "softirq", pid 0, jiffies 4294985356 (age 126.810s) hex dump (first 32 bytes): 00 00 00 00 00 00 00 00 80 00 00 00 05 13 74 80 ..............t. 80 00 00 00 04 9b bf f9 00 00 00 00 00 00 00 00 ................ backtrace: [<00000000f83947e0>] __kmalloc+0x1e8/0x300 [<00000000b7ed8dca>] metadata_dst_alloc+0x24/0x58 [<0000000081d32c20>] __ipgre_rcv+0x100/0x2b8 [<00000000824f6cf1>] gre_rcv+0x178/0x540 [<00000000ccd4e162>] gre_rcv+0x7c/0xd8 [<00000000c024b148>] ip_protocol_deliver_rcu+0x124/0x350 [<000000006a483377>] ip_local_deliver_finish+0x54/0x68 [<00000000d9271b3a>] ip_local_deliver+0x128/0x168 [<00000000bd4968ae>] xfrm_trans_reinject+0xb8/0xf8 [<0000000071672a19>] tasklet_action_common.isra.16+0xc4/0x1b0 [<0000000062e9c336>] __do_softirq+0x1fc/0x3e0 [<00000000013d7914>] irq_exit+0xc4/0xe0 [<00000000a4d73e90>] plat_irq_dispatch+0x7c/0x108 [<000000000751eb8e>] handle_int+0x16c/0x178 [<000000001668023b>] _raw_spin_unlock_irqrestore+0x1c/0x28 The metadata dst is leaked when ip_route_input_mc() updates the dst for the skb. Commit f38a9eb1f77b ("dst: Metadata destinations") correctly handled dropping the dst in ip_route_input_slow() but missed the multicast case which is handled by ip_route_input_mc(). Drop the dst in ip_route_input_mc() avoiding the leak. Fixes: f38a9eb1f77b ("dst: Metadata destinations") Signed-off-by: Lokesh Dhoundiyal Signed-off-by: Chris Packham Reviewed-by: David Ahern Link: https://lore.kernel.org/r/20220505020017.3111846-1-chris.packham@alliedtelesis.co.nz Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/ipv4/route.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/ipv4/route.c b/net/ipv4/route.c index d5d058de3664..eef07b62b2d8 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -1748,6 +1748,7 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr, #endif RT_CACHE_STAT_INC(in_slow_mc); + skb_dst_drop(skb); skb_dst_set(skb, &rth->dst); return 0; } -- 2.35.1