From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B6AB3250BEC; Thu, 26 Mar 2026 17:15:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774545333; cv=none; b=e+ExuRroWPKtY2GBOr/0nmVKpPtG+uOGrz5e8a/emyydH7Me4TEATIhn4EbaBPvWTF4iugL3w0xv67Z4OBeQu0JQBSHQyGM9iWoMGlViy8KkVeV7pWleKf8hlMZNLlt6CieTJo49DXl/xjZctEsSkGb8wwwrm5ktOSwJGpFjvSQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774545333; c=relaxed/simple; bh=jvkDS9tKLVeEgF0DgkEhc5+lTjNn80rqHLS3xCz8V0w=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jmjR7j7ZVif4PKm0MqW4zV8yaBEUjvECb7tKhOxnG+tyaru3FTCcRtPZow5WWDLgknXZ+Rxx3XaA43myhUe/oi0cJKemKh9Mkr29TgulJl5epPIM9KFO05fBnVQeMm9T1zK1H3h7Gz3DXIUyMcFsRU7mHIB43wICmTeAMGN/qBQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BDXTH51Q; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BDXTH51Q" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F717C19423; Thu, 26 Mar 2026 17:15:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774545333; bh=jvkDS9tKLVeEgF0DgkEhc5+lTjNn80rqHLS3xCz8V0w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BDXTH51QoJgCKUhhoHf42bamFgq+wwWwg1N9Yig9JfaQ3gADMfymF5+pKFJZBgewY scQZV+UZ1Twq7B/cvZGwTdphEYhvnqj1envTzFEZB1quSnoOAwsXV+D6CcgmWzSO3I sNcM4Q264pAZgFkDgmoFWNG3zPjLGLiYXClrgzo/dqjANPgJ6I821qS009NzZkAV9q b+e8Nh5yJ1KOp+KZ4C4oFIUMxq5q2iXPid9IYvcrcM057xWBWk36a+IR4lwec+qQBD B6/NkJ4vU61QMiR2zZKH3k+RXdBxUpvHeuWY70qvzZ2G2nc7UvS3pGLV12cmDjkCkT xJ1qQhQutGwmw== Date: Thu, 26 Mar 2026 17:15:27 +0000 From: Simon Horman To: "Sven Eckelmann (Plasma Cloud)" Cc: Felix Fietkau , Lorenzo Bianconi , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , Elad Yifee , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, stable@vger.kernel.org Subject: Re: [PATCH net] net: ethernet: mtk_ppe: avoid NULL deref when gmac0 is disabled Message-ID: <20260326171527.GO111839@horms.kernel.org> References: <20260324-wed-crash-gmac0-disabled-v1-1-3bc388aee565@simonwunderlich.de> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260324-wed-crash-gmac0-disabled-v1-1-3bc388aee565@simonwunderlich.de> On Tue, Mar 24, 2026 at 09:36:01AM +0100, Sven Eckelmann (Plasma Cloud) wrote: > If the gmac0 is disabled, the precheck for a valid ingress device will > cause a NULL pointer deref and crash the system. This happens because > eth->netdev[0] will be NULL but the code will directly try to access > netdev_ops. > > Instead of just checking for the first net_device, it must be checked if > any of the mtk_eth net_devices is matching the netdev_ops of the ingress > device. > > Cc: stable@vger.kernel.org > Fixes: 73cfd947dbdb ("net: ethernet: mtk_eth_soc: ppe: prevent ppe update for non-mtk devices") > Signed-off-by: Sven Eckelmann (Plasma Cloud) Reviewed-by: Simon Horman