From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 221A1236A73 for ; Tue, 26 May 2026 23:27:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779838059; cv=none; b=iX7xDPH5c5N5is/x7KI/pwsxWKwNgcgAWbuIF9VQGAf11wskzzT6r6KX2gweFDe7z3gHdCHMC0Vxw8RajlZ4gbcWsSV7SD99h/Alm3WjjqUJbSogtPAp943KOEiufZfmKGhTjYav0LuQ8mGKj3KxfdVtfoaGt2lH/riPNgz3aOQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779838059; c=relaxed/simple; bh=XWKRugdBCbif77kQ32/usUUQ8ogLQokJ6R2uYwHANV8=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=sEW0MQlWZQHHgyQTS/k7SZvo+bRdc96yMccmbhLOc1QGsvE5ZiaVC4H7p4g4QsjJ9EXEFkJhKb6ZH1vM9Eeg4dnyzClGllU7vdvcFPVXFBW03/FFIwVNeSpEuYtfXmRkNTos9g9z8KqhlZZUmVlhfNKMc+zMWRHdLUgw9IoqJvY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WAwRHmmj; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WAwRHmmj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73BCD1F000E9; Tue, 26 May 2026 23:27:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1779838057; bh=a3/WNsXLG/efdLWwGaD+Ah5amorSSkLH88yA5nIIbBU=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=WAwRHmmjI17Nfyf0gAQBHmUZ33+5IUC80Ba8gEJKVVHkap3/NJz72Gvfhf1OVnnGd sr72Jr7LKXbS1+mTIwUTz5T6QsgssH6M0ofKVZ8RqobKX0qM6D9YhOrzoEf0I4XBsw IIRr88ZXnNrfS/QzeaY328UVWsiieeFJiSNdk16WjB3lTFx+nwuowb/12lNqmaXXHc 2Y1arUYIAPTaRLn1CG/cCPE0jlpFjDmMvHVo4oTf67ckpAIq0/Skp0gA3ZjlCTHcsV cxE3W+16LliY+FQkooWMNorkC96KXdF/g8VGQHTAiwNiujZlluQFv/ILeOgSXJyHdp /eglcrpUBslpQ== Date: Tue, 26 May 2026 16:27:36 -0700 From: Jakub Kicinski To: Alexander Lobakin Cc: Zhao Dongdong , , , , , Zhao Dongdong Subject: Re: [PATCH] net: page_pool: check nla_nest_start() return value in page_pool_nl_stats_fill() Message-ID: <20260526162736.5e95b928@kernel.org> In-Reply-To: <3a16e1ec-313d-431e-8960-abf55701ac5a@intel.com> References: <3a16e1ec-313d-431e-8960-abf55701ac5a@intel.com> 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-Transfer-Encoding: 7bit On Tue, 26 May 2026 18:04:44 +0200 Alexander Lobakin wrote: > From: Zhao Dongdong > Date: Tue, 26 May 2026 14:51:56 +0800 > > > From: Zhao Dongdong > > > > nla_nest_start() can return NULL if the skb runs out of space. > > page_pool_nl_stats_fill() does not check the return value before > > calling nla_nest_end(), which can lead to a NULL pointer dereference. > > Add a NULL check after nla_nest_start() and abort the message if it fails. > > > > Fixes: d49010adae73 ("net: page_pool: expose page pool stats via netlink") > > A "Cc: stable@vger.kernel.org" candidate? Not really, the thinking is that if nla_nest_start() failed then the very next nla_put* will also fail (nla_nest_start() is a zero-length attr, any attr we put after must be >= in length). IOW the commit message is lying, there's no way for us to reach nla_nest_end(). We will jump to nla_nest_cancel() which handles nest=NULL just fine. Zhao Dongdong please confirm this and respin the patch without a Fixes tag and with an updated commit message. I think we got such a patch in the past, so we should merge it to avoid confusing bots. But please make it very clear that this code can't crash.. -- pw-bot: cr