[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aFwUWPZo3skIU_mn@rric.localdomain>
Date: Wed, 25 Jun 2025 17:23:04 +0200
From: Robert Richter <rrichter@....com>
To: Nathan Fontenot <nathan.fontenot@....com>
Cc: Dave Jiang <dave.jiang@...el.com>,
Smita Koralahalli <Smita.KoralahalliChannabasappa@....com>,
linux-cxl@...r.kernel.org, linux-kernel@...r.kernel.org,
nvdimm@...ts.linux.dev, linux-fsdevel@...r.kernel.org,
linux-pm@...r.kernel.org, Davidlohr Bueso <dave@...olabs.net>,
Jonathan Cameron <jonathan.cameron@...wei.com>,
Alison Schofield <alison.schofield@...el.com>,
Vishal Verma <vishal.l.verma@...el.com>,
Ira Weiny <ira.weiny@...el.com>,
Dan Williams <dan.j.williams@...el.com>,
Matthew Wilcox <willy@...radead.org>, Jan Kara <jack@...e.cz>,
"Rafael J . Wysocki" <rafael@...nel.org>,
Len Brown <len.brown@...el.com>, Pavel Machek <pavel@...nel.org>,
Li Ming <ming.li@...omail.com>,
Jeff Johnson <jeff.johnson@....qualcomm.com>,
Ying Huang <huang.ying.caritas@...il.com>,
Yao Xingtao <yaoxt.fnst@...itsu.com>,
Peter Zijlstra <peterz@...radead.org>,
Greg KH <gregkh@...uxfoundation.org>,
Terry Bowman <terry.bowman@....com>,
Benjamin Cheatham <benjamin.cheatham@....com>,
PradeepVineshReddy Kodamati <PradeepVineshReddy.Kodamati@....com>,
Zhijian Li <lizhijian@...itsu.com>
Subject: Re: [PATCH v4 1/7] cxl/region: Avoid null pointer dereference in
is_cxl_region()
On 04.06.25 14:56:22, Nathan Fontenot wrote:
> On 6/3/2025 6:49 PM, Dave Jiang wrote:
> >
> >
> > On 6/3/25 3:19 PM, Smita Koralahalli wrote:
> >> Add a NULL check in is_cxl_region() to prevent potential null pointer
> >> dereference if a caller passes a NULL device. This change ensures the
> >> function safely returns false instead of triggering undefined behavior
> >> when dev is NULL.
> >
> > Don't think this change is necessary. The code paths should not be hitting any NULL region devices unless it's a programming error.
>
> I originally added this to the patchset during some initial development to handle possible
> NULL dev pointers when updating soft reserve resources, see cxl_region_softreserv_update()
> in patch 5/7.
>
> In the current form of the that routine it appears we shouldn't execute the while loop
> if dev is NULL so this could get from the patch set.
With the suggested change to use bus_for_each_dev() in patch #5 this
patch should be dropped.
-Robert
Powered by blists - more mailing lists