Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp888329pxb; Fri, 22 Apr 2022 13:30:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9t8raJTyAG5mktZLHC+SZByuhKF5gONENouLy+4iqhmZenpk5kDB3vL5spFWnJVuv2Jqm X-Received: by 2002:a17:902:f608:b0:158:29e6:c88 with SMTP id n8-20020a170902f60800b0015829e60c88mr6256905plg.174.1650659416169; Fri, 22 Apr 2022 13:30:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650659416; cv=none; d=google.com; s=arc-20160816; b=Cbga03wZfrtnixptSdJOK8ZCv6T9wqAO6H2NkwAklwZsfCNf9Z3eSeTxcrWZkS95hK fInn/HM8XUMSYobcjgCud1ps6JfEoZ2YPuTLK4xd8l7iHnGR+F0DwBb+xgUSRyPgAPhh lld1h6Wm5pCCyaUbD60I5DNqxjiwoJsJfWkoe34w/TQDdBRiXw1qmoL8aGrLcms/PGhS zQfggfx5qInRRFsTCNufnhAh88Jfk/AJsWt0XFbH9nPr1gjj7wK/KTKM08ddw3kuD4Vb 59IxY+uQNpXKtagVC46dCc6ugT8tAktv4deqOglY4Ps3Bv5jxniR7NBO1hY/GLk4A13W jdkw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=an69hgvRkZo4fDphZoWRjZyAXfGzKRGmPZzwE3TFtww=; b=LW7WcB62k9q+3Qs7IihOU19i1+XDdIfFteujBPDZ0iiEXSXjK7Su6/7kIiIvmd58PC v+7UKyAk6AJtXAxXzznf5+iUNMS7RoLwbX59RQLMXqtFZTlQRc2S7TWKvTzGkAKczb0M ciFyhOk0s7s5MmM6PvT8+JU6bgCDQD2rvJPCKnM2mo8QlRXAdhIm6gjY4O7QTJM1ShM5 u90y3VdCMy92B1kj1u0OUUkeDexSyUIN2uegLM1e5lTLXab2iWWQ2P+hQ5FNkv8YdfXD nOae12qCGRbHeqpqndntbXJGrb0WhHl/U9e/CVVBhM4q5uUxPJNYVE30ZB5yD1hpzDlY 80DQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=UVU1MzSb; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id l22-20020a056a0016d600b0050a9644da4esi10230229pfc.335.2022.04.22.13.30.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 13:30:16 -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=@bootlin.com header.s=gm1 header.b=UVU1MzSb; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EA103C665C; Fri, 22 Apr 2022 12:17:09 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1388217AbiDUKR1 (ORCPT + 99 others); Thu, 21 Apr 2022 06:17:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1388288AbiDUKRR (ORCPT ); Thu, 21 Apr 2022 06:17:17 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::224]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E7A92CCA6; Thu, 21 Apr 2022 03:14:17 -0700 (PDT) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 544DEE000C; Thu, 21 Apr 2022 10:14:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1650536055; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=an69hgvRkZo4fDphZoWRjZyAXfGzKRGmPZzwE3TFtww=; b=UVU1MzSboPYmjJnNfcM3Qk71BBGbWaDl9mydrmQzASqiNP//6Bi6Fu7YwJTbLVt6SLIql3 2hUt6A5FNi+3wHF/DKZC3lnjDm378xiXMZKwensfWYZ7kwrQY1tBsq5+o1M0bNXD+WOp0l 0NKFeqwrqVqtEbBAcMb+LrMHJ7mb2mjJqnKBFspRVFslA63voqp+i1j0sS5AxTeGQWVolD S3OMLJ5aW690aZdHUX2lgVPqt20ErhXno7ixftgee6PvkgoWMEAj+rz6NbczFSA+n5f7/A 3gD59XFMH3ld/VwWT4vyP8YjlG3rdn4sdY2RvHOcQC88fE90XMBL+LBbzWNMGQ== From: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= To: Roopa Prabhu , Nikolay Aleksandrov , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Tobias Waldekranz Cc: bridge@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= Subject: [PATCH net-next] net: bridge: switchdev: check br_vlan_group() return value Date: Thu, 21 Apr 2022 12:12:47 +0200 Message-Id: <20220421101247.121896-1-clement.leger@bootlin.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=no 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 br_vlan_group() can return NULL and thus return value must be checked to avoid dereferencing a NULL pointer. Fixes: 6284c723d9b9 ("net: bridge: mst: Notify switchdev drivers of VLAN MSTI migrations") Signed-off-by: Clément Léger --- net/bridge/br_switchdev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/bridge/br_switchdev.c b/net/bridge/br_switchdev.c index 81400e0b26ac..8f3d76c751dd 100644 --- a/net/bridge/br_switchdev.c +++ b/net/bridge/br_switchdev.c @@ -354,6 +354,8 @@ static int br_switchdev_vlan_attr_replay(struct net_device *br_dev, attr.orig_dev = br_dev; vg = br_vlan_group(br); + if (!vg) + return 0; list_for_each_entry(v, &vg->vlan_list, vlist) { if (v->msti) { -- 2.34.1