Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp3688778lfo; Mon, 23 May 2022 11:30:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4o/IQKmWr+yCPb4QAtK/rAh89sc0hEsapgbZUGPSS3IrRsLC3LKhfgoyJVE2UBlv14cgn X-Received: by 2002:a17:90b:4c4d:b0:1df:a164:7055 with SMTP id np13-20020a17090b4c4d00b001dfa1647055mr327619pjb.180.1653330615976; Mon, 23 May 2022 11:30:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653330615; cv=none; d=google.com; s=arc-20160816; b=0pGuTDx88eNBXrN1ujIhaF+UC+Y6hnngn+vGszKsKgnsCTFD8G2fohQoiMueLWsjtp PetvYA+e/69ymql/RDmGqXnM4I4OjTxvTXR3qQR8KZwdCGhOb3rFlqt0ns74TwIQErWm zL1TqtuvVEA/MF5gFCpRAoYI/dOVr2AY8bt0vt71QwW/LMQ6owIOSw+l0Cbwxs6anwK9 etOXzOVvLckzDWj6OekLPm7Ccg21YkSODH+y2mCwqVkQTkmyjtT0If9PZXg85wdauBgr Q+HtqhsCA6vZSvOpyIrtgJQ2PkzIp5BDXiMgQFnCmm+0PmOCp9+HaqF4eFuXpqRcmDZ0 hs1g== 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=BloMVJ4EO1WWYr7efT8jgv4BhlwBGdRPYlFyndzD9+g=; b=CPVvw8NzRUkQxehhAQgY3iAX3jcsiIc65NBSYa5j0UY1CjzxRRJq+krHWvEPaIUmke O8Otia8Pv/cRS3VLwU1axV2UZzzNsp2r6qTiBKC2PRSkL85fPBwfgL69QxICPGb5Njix Fww8vqYrMhEa7LOqYTmUmUVN8M+D8WQs1WXmG7nWm+S1IgD035/h4kcha5VoFAQGYcv7 3MhVz9Q94JAXyoG1IHom/DVyYDcTDjGgaSMbhgU7dspXbL35WmwXIwwp7SkF80OO7Syj bWAZ2u6Cg12W7sDqPYKAfKOjRUkskm9pboyl37zHTdO7xj1LRzt059Wesu5bxEBjh+5S /ACA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=p0nRWpmn; 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 ot9-20020a17090b3b4900b001cd5b0dcab5si127971pjb.12.2022.05.23.11.30.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 11:30: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=p0nRWpmn; 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 D5077DFF73; Mon, 23 May 2022 11:29:58 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244038AbiEWSCO (ORCPT + 99 others); Mon, 23 May 2022 14:02:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241646AbiEWRdu (ORCPT ); Mon, 23 May 2022 13:33:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11A497CB0C; Mon, 23 May 2022 10:28:00 -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 5A45F608C0; Mon, 23 May 2022 17:28:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5BAD3C385A9; Mon, 23 May 2022 17:27:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1653326879; bh=FLGBvZEt3C6XRU8TTupFkhcQcgUGvRduW1/jt4Oz7N0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p0nRWpmnPMbLZ6kokjBrweV3r28Xhc5bAsnLVNC4E5yyvw5LNcR9U8sQPLqKfQlEy K375Qofd0v8/Lud3vxa+fb76nqhhuJYkeEGKgRgPN+O8XqYgTR4eTcvfpUrIKDo0AQ a5sRtKoGkHcJqqFf1VaiqH48SXvCxt0eLtV3+X+U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Felix Fietkau , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 5.17 087/158] net: fix dev_fill_forward_path with pppoe + bridge Date: Mon, 23 May 2022 19:04:04 +0200 Message-Id: <20220523165845.565547962@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220523165830.581652127@linuxfoundation.org> References: <20220523165830.581652127@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=-2.6 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: Felix Fietkau [ Upstream commit cf2df74e202d81b09f09d84c2d8903e0e87e9274 ] When calling dev_fill_forward_path on a pppoe device, the provided destination address is invalid. In order for the bridge fdb lookup to succeed, the pppoe code needs to update ctx->daddr to the correct value. Fix this by storing the address inside struct net_device_path_ctx Fixes: f6efc675c9dd ("net: ppp: resolve forwarding path for bridge pppoe devices") Signed-off-by: Felix Fietkau Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin --- drivers/net/ppp/pppoe.c | 1 + include/linux/netdevice.h | 2 +- net/core/dev.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c index 3619520340b7..e172743948ed 100644 --- a/drivers/net/ppp/pppoe.c +++ b/drivers/net/ppp/pppoe.c @@ -988,6 +988,7 @@ static int pppoe_fill_forward_path(struct net_device_path_ctx *ctx, path->encap.proto = htons(ETH_P_PPP_SES); path->encap.id = be16_to_cpu(po->num); memcpy(path->encap.h_dest, po->pppoe_pa.remote, ETH_ALEN); + memcpy(ctx->daddr, po->pppoe_pa.remote, ETH_ALEN); path->dev = ctx->dev; ctx->dev = dev; diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index f53ea7038441..dadd4d2f6d8a 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -891,7 +891,7 @@ struct net_device_path_stack { struct net_device_path_ctx { const struct net_device *dev; - const u8 *daddr; + u8 daddr[ETH_ALEN]; int num_vlans; struct { diff --git a/net/core/dev.c b/net/core/dev.c index 91cf709c98b3..5f1ac4812277 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -663,11 +663,11 @@ int dev_fill_forward_path(const struct net_device *dev, const u8 *daddr, const struct net_device *last_dev; struct net_device_path_ctx ctx = { .dev = dev, - .daddr = daddr, }; struct net_device_path *path; int ret = 0; + memcpy(ctx.daddr, daddr, sizeof(ctx.daddr)); stack->num_paths = 0; while (ctx.dev && ctx.dev->netdev_ops->ndo_fill_forward_path) { last_dev = ctx.dev; -- 2.35.1