Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3343096ybl; Sun, 11 Aug 2019 21:38:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqwiL7sZ/PdXcZ38lUX+YxhBTRqESnqvhWr1HVx24hKOePCk9e8CcseLOpqcFkcewdEfhfzQ X-Received: by 2002:a17:90a:ad86:: with SMTP id s6mr21976146pjq.42.1565584712381; Sun, 11 Aug 2019 21:38:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565584712; cv=none; d=google.com; s=arc-20160816; b=ROGUEl06xMgrvvLqqpV49iDhr54aZGNRXReHaOnvNpHDyKnn6SGIpQBhvgp92rvLju o/CdD3PjmxXyCxBlZEeK3HkNuibL2XsU872o7GiNc6UtLAJi39OWRAQSr6M8NXDos8XY WSQcjADHBVgyluA0HOH43FMkgujasYklqufnqaGlk3HNq9LaKklGebppEfjcdxnAwtAh 0HEM1kiyi4eY6X4FITPkBWu4yFXRIIEqSSvehI3jkD4LbBu0tZoCAxm9o5BoKiSHQvg6 x+547S8+yT49l18CNg2hFwVi8NdUoaZSpo9msG7xtTLjsOd1ynaaNxN4v89aBJvmKvp/ bcDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date; bh=f6kogjv8EWnpVw9tDtIzgWnnkv7HUgaaW6Bq2dCjVu4=; b=Y6b4Tl1fXeox9WlIdxM8f+V+FvjVK9eVv3Z58BUQ/6hiOBkfoPKM5Svi3SHoG748lz mKJhoDvm9T4kNWDd1IoRukaZ/7pp554nxb1KLclMPxq5oE0oD9zZ9eG/w94UDzIIi/aY 5mKtvme3fOtemeC3UjO3Wr/9qy6pEII4h4DrPf/Qp613Y1kDKA3klTnyYxBt4ddrFmwu DGUIAYjfg125ZrdoElhajGcezy8uOXlcgcn8ZdEOwd2Hml9DU53I+Egeg59cPMyrMdrz fn4iZQd9I0n566vJyCqX5pAfQIsGpCLbSQBCpFakUiS8t/Ij7ZepWeFSQ2Giq7nuKMv7 sECA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j17si28069315pgn.433.2019.08.11.21.38.16; Sun, 11 Aug 2019 21:38:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726480AbfHLEhl (ORCPT + 99 others); Mon, 12 Aug 2019 00:37:41 -0400 Received: from shards.monkeyblade.net ([23.128.96.9]:38722 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725808AbfHLEhl (ORCPT ); Mon, 12 Aug 2019 00:37:41 -0400 Received: from localhost (unknown [IPv6:2601:601:9f80:35cd::d71]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id E40C014017D83; Sun, 11 Aug 2019 21:37:40 -0700 (PDT) Date: Sun, 11 Aug 2019 21:37:40 -0700 (PDT) Message-Id: <20190811.213740.2137488837577705437.davem@davemloft.net> To: wens@kernel.org Cc: andrew@lunn.ch, vivien.didelot@gmail.com, f.fainelli@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net v3] net: dsa: Check existence of .port_mdb_add callback before calling it From: David Miller In-Reply-To: <20190811141825.11566-1-wens@kernel.org> References: <20190811141825.11566-1-wens@kernel.org> X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Sun, 11 Aug 2019 21:37:41 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chen-Yu Tsai Date: Sun, 11 Aug 2019 22:18:25 +0800 > From: Chen-Yu Tsai > > The dsa framework has optional .port_mdb_{prepare,add,del} callback fields > for drivers to handle multicast database entries. When adding an entry, the > framework goes through a prepare phase, then a commit phase. Drivers not > providing these callbacks should be detected in the prepare phase. > > DSA core may still bypass the bridge layer and call the dsa_port_mdb_add > function directly with no prepare phase or no switchdev trans object, > and the framework ends up calling an undefined .port_mdb_add callback. > This results in a NULL pointer dereference, as shown in the log below. > > The other functions seem to be properly guarded. Do the same for > .port_mdb_add in dsa_switch_mdb_add_bitmap() as well. ... > Fixes: e6db98db8a95 ("net: dsa: add switch mdb bitmap functions") > Signed-off-by: Chen-Yu Tsai Applied and queued up for -stable, thanks.