From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-179.mta0.migadu.com (out-179.mta0.migadu.com [91.218.175.179]) (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 0F5E143BDA9 for ; Tue, 4 Aug 2026 08:29:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785832178; cv=none; b=OBNkhXceOT1Bw1A6zTdy6Tcl4BtFlGr32Z64p2SyHYwP8eUeiBOllIu44YFwaomYie8j43M4QQmRAc9aihdoUCBZqB/wTtwPMCMgV4/gImTyW8Jpj9kzoNA7b6OabUZRVkRmKoSSe/37mtPCl2EyZB2odqzcp5dN1NkixTLa3fM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785832178; c=relaxed/simple; bh=ghUKjuywlxz/hCPWTzHl6aHjG7cd3I+aDHphLy6uZJI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=iXshNoWycTACMT6a+cySG+liMmUHNZ32e8Ccta21Jp0BJfNrkQjdAeoFQc7RYZtp5tbtfrSZOBKGmJY2jLXPnjEsJ3xkGygfVi/IU7snM93tvkjt9IwUxiMZ0c2NcRFVWJhjuVmVHRcp7CSlpQsJxtFdBpTGRrurcvm6fNOQZSw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=TDaxdUbI; arc=none smtp.client-ip=91.218.175.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="TDaxdUbI" Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1785832174; 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: in-reply-to:in-reply-to:references:references; bh=RU8+Nz4vCEQS2uwrNX9QR2iiYmR7A0o4uhtyvH7UwVI=; b=TDaxdUbI2eDi69mU4KlARvdYfEDOm1IOWZKh0EtLYsatPhSBj8ePEhfWqisgoBdGwq0oSk hRiw0yXAPDtzyVmpbYy0bVhtN6gHFlrg3NbKZbk/MD61q9LLuK3KjdQA4hSC6daBr4wO9M h7E5bffe1y4KQqCKD8q3OHAqq++hX1k= Date: Tue, 4 Aug 2026 16:28:43 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH net] net: pppoe: check register_netdevice_notifier() error in pppoe_init() To: Minhong He , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org Cc: Kees Cook , Eric Woudstra , Felix Fietkau , linux-kernel@vger.kernel.org References: <20260803085957.142386-1-heminhong@kylinos.cn> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Qingfang Deng In-Reply-To: <20260803085957.142386-1-heminhong@kylinos.cn> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT Hi, On 2026/8/3 16:59, Minhong He wrote: > pppoe_init() ignores register_netdevice_notifier() errors and always > returns success after installing packet handlers, which can leave the > module loaded without its netdev notifier registered. > > Check the error and unwind the packet handlers and protocol registration > on failure. A patch for the net tree requires a Fixes tag. As the notifier has been present since day 1 of the Linux git repository, you can use: Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") > Signed-off-by: Minhong He > --- > drivers/net/ppp/pppoe.c | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c > index 4a018acb5262..035795b120e0 100644 > --- a/drivers/net/ppp/pppoe.c > +++ b/drivers/net/ppp/pppoe.c > @@ -1278,10 +1278,19 @@ static int __init pppoe_init(void) > dev_add_offload(&pppoe_packet_offload); > dev_add_pack(&pppoes_ptype); > dev_add_pack(&pppoed_ptype); > - register_netdevice_notifier(&pppoe_notifier); > + > + err = register_netdevice_notifier(&pppoe_notifier); > + if (err) > + goto out_unregister_packs; You can move the registration above the dev_add_offload(), so that the unwind path is cleaner. > > return 0; > > +out_unregister_packs: > + dev_remove_pack(&pppoed_ptype); > + dev_remove_pack(&pppoes_ptype); > + if (IS_ENABLED(CONFIG_INET)) > + dev_remove_offload(&pppoe_packet_offload); > + unregister_pppox_proto(PX_PROTO_OE); > out_unregister_pppoe_proto: > proto_unregister(&pppoe_sk_proto); > out_unregister_net_ops: Best regards, Qingfang