Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp999945pxb; Fri, 22 Apr 2022 16:23:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDgDMXShZH2Jxg1+MT87XaxT9KrlkwgkSEn18me0QuNKIEfIaOFL6QfH9CgEdncqXYBYFz X-Received: by 2002:a17:903:40c5:b0:158:d33e:28b4 with SMTP id t5-20020a17090340c500b00158d33e28b4mr6687682pld.96.1650669820227; Fri, 22 Apr 2022 16:23:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650669820; cv=none; d=google.com; s=arc-20160816; b=Ruku86AE44YIYW+sAFgL3RAx/TXMj1X/h4xX8QLI8/nQF12oJUNXCZlUDucgOU+cM+ 1V4QT1pDzVtSkmba5BTLsOiZ7bNWix4vBd7FPZqhW+HX5V6aO4Z7KyU5809VlXiFpJRP l37LmNmPtFS7QRoVv+dnXilRmQjemShK4L08xeP273dNmyd37c666uHf6YjIm8OusseA WJ+NJwNaxOatIgVYT/fLFUHQP0QL3WrAMM2Y5C7wNI7yKV3+qfJ5QX6U9T9WJnNbnDLw 6v+lkhFrh2x+lWeh9In4/l2kQ4EvfBFdWsTJoOQ8qVBZqTFCUkIT+XeijfcwE+lWXpMX KBcg== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=r4dUPIyR40mIsYDSdL51U1NIcZCS/EqtxK/AnDwXglw=; b=fXDiy2dsB/ZnF/YrozM57mIoEj2iPM9utwC3q5M6S9A59EjU71+VjCW0cUa87cXAfy K9i9yj+Xhn8CWc7y6/xjEke3Uw3VXn+bX6qzhEDkXSjlaOGkDRZQTInSYW7NSJmZp65Y bPpmH4a/wlIG5rARkg14Z37RKkgYflpxN4XOEBbBlNgQbbSk8UF3hwG5g3bUN1t5Fw0f oUj9C0QoiYPz4bQMGFWOGG1epzlvqxG5JDi1aspYSdUg5BAbgeb+6rfU6BSkM3sdwLZB QMzUom3594/+s3f31mvSKXiKhlYkk3/h9PCUDeNG0YcFDXYtsL8vuzzRdb4A+htNewpw OWEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Vxp3cZDo; 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=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id u12-20020a170902b28c00b001586f9a109fsi8566897plr.0.2022.04.22.16.23.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 16:23:40 -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=@kernel.org header.s=k20201202 header.b=Vxp3cZDo; 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=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 43C701725CA; Fri, 22 Apr 2022 15:50:12 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233699AbiDVWxA (ORCPT + 99 others); Fri, 22 Apr 2022 18:53:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233818AbiDVWwb (ORCPT ); Fri, 22 Apr 2022 18:52:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 717F93AA87B; Fri, 22 Apr 2022 15:15: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 ams.source.kernel.org (Postfix) with ESMTPS id 7465CB83272; Fri, 22 Apr 2022 22:14:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2762C385A4; Fri, 22 Apr 2022 22:14:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1650665667; bh=OBcxSR9xi8xcrAi/LuWUvS+xg1jLOhXBymc5euRWtvg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Vxp3cZDongmz0cuL/Uq7z3oAQEThdZyXloJYSjDrME+6Sc2UXKCBMT5RWtp9sZdEr ZA3VB5Xx6se4O0cDs4APAktjZ8Iv29pnuNCxF3Yx7eyE5zaMc4xWqFUEgTQN3fkJKJ rmR+aMwcDhFyY06JiVfwlv5mtEziLkJx++OnYV3pySFXCMA5/yP1R3MnrjbsC0s9cw fcYNvq0pySITAQMLZwj2Sv5oQ3LFHwk6OT8Kduspy+wCXCmejYTSgXqrqgt5b0cTRh 6cpYzTJuMTAGA82EuswOhRY9SwNryS8qgmfs66Au7Fx7fVWhlbjcQJQL+XLp7CCxjJ G4qaidBDIpgIQ== Date: Fri, 22 Apr 2022 15:14:25 -0700 From: Jakub Kicinski To: Nikolay Aleksandrov Cc: =?UTF-8?B?Q2zDqW1lbnQgTMOpZ2Vy?= , Roopa Prabhu , "David S. Miller" , Paolo Abeni , Tobias Waldekranz , bridge@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next] net: bridge: switchdev: check br_vlan_group() return value Message-ID: <20220422151425.7a3f90d4@kernel.org> In-Reply-To: References: <20220421101247.121896-1-clement.leger@bootlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE 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 On Thu, 21 Apr 2022 13:17:51 +0300 Nikolay Aleksandrov wrote: > On 21/04/2022 13:12, Cl=C3=A9ment L=C3=A9ger wrote: > > br_vlan_group() can return NULL and thus return value must be checked > > to avoid dereferencing a NULL pointer. > >=20 > > Fixes: 6284c723d9b9 ("net: bridge: mst: Notify switchdev drivers of VLA= N MSTI migrations") > > Signed-off-by: Cl=C3=A9ment L=C3=A9ger > > --- > > net/bridge/br_switchdev.c | 2 ++ > > 1 file changed, 2 insertions(+) > >=20 > > 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 =3D br_dev; > > =20 > > vg =3D br_vlan_group(br); > > + if (!vg) > > + return 0; > > =20 > > list_for_each_entry(v, &vg->vlan_list, vlist) { > > if (v->msti) { =20 >=20 > Acked-by: Nikolay Aleksandrov Thanks! Applying to net tho, the patch in question is already=20 in Linus's tree.