Message ID | 20230714093146.2253438-2-leitao@debian.org |
---|---|
State | Accepted |
Commit | 0e99e96b85fc2c608a65d05063f40c671214b2da |
Headers | show |
Series | [v3,1/2] cxl/acpi: Fix UAF in the error path | expand |
On Fri, Jul 14, 2023 at 02:31:46AM -0700, Breno Leitao wrote: > Driver initialization is returning success (return 0) even if the > initialization (cxl_decoder_add() or acpi_table_parse_cedt()) failed, > and the hardware was already released (put_device()). > > Return the error instead of swallowing it. > > Fixes: f4ce1f766f1e ("cxl/acpi: Convert CFMWS parsing to ACPI sub-table helpers") > > Signed-off-by: Breno Leitao <leitao@debian.org> Reviewed-by: Alison Schofield <alison.schofield@intel.com> > --- > drivers/cxl/acpi.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/cxl/acpi.c b/drivers/cxl/acpi.c > index 642983da01cb..815b43859c16 100644 > --- a/drivers/cxl/acpi.c > +++ b/drivers/cxl/acpi.c > @@ -298,7 +298,7 @@ static int cxl_parse_cfmws(union acpi_subtable_headers *header, void *arg, > if (rc) { > dev_err(dev, "Failed to add decode range [%#llx - %#llx]\n", > res->start, res->end); > - return 0; > + return rc; > } > dev_dbg(dev, "add: %s node: %d range [%#llx - %#llx]\n", > dev_name(&cxld->dev), > -- > 2.34.1 >
On Fri, 2023-07-14 at 02:31 -0700, Breno Leitao wrote: > Driver initialization is returning success (return 0) even if the > initialization (cxl_decoder_add() or acpi_table_parse_cedt()) failed, > and the hardware was already released (put_device()). > > Return the error instead of swallowing it. > > Fixes: f4ce1f766f1e ("cxl/acpi: Convert CFMWS parsing to ACPI sub-table helpers") > > Signed-off-by: Breno Leitao <leitao@debian.org> FYI there should not be a blank line between the Fixes tag and other tags (Patch 1 has it right). This can break git's view of the trailers. I fixed this up while applying and while at it did a bit of commit message massaging for both patches. > --- > drivers/cxl/acpi.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/cxl/acpi.c b/drivers/cxl/acpi.c > index 642983da01cb..815b43859c16 100644 > --- a/drivers/cxl/acpi.c > +++ b/drivers/cxl/acpi.c > @@ -298,7 +298,7 @@ static int cxl_parse_cfmws(union acpi_subtable_headers *header, void *arg, > if (rc) { > dev_err(dev, "Failed to add decode range [%#llx - %#llx]\n", > res->start, res->end); > - return 0; > + return rc; > } > dev_dbg(dev, "add: %s node: %d range [%#llx - %#llx]\n", > dev_name(&cxld->dev),
diff --git a/drivers/cxl/acpi.c b/drivers/cxl/acpi.c index 642983da01cb..815b43859c16 100644 --- a/drivers/cxl/acpi.c +++ b/drivers/cxl/acpi.c @@ -298,7 +298,7 @@ static int cxl_parse_cfmws(union acpi_subtable_headers *header, void *arg, if (rc) { dev_err(dev, "Failed to add decode range [%#llx - %#llx]\n", res->start, res->end); - return 0; + return rc; } dev_dbg(dev, "add: %s node: %d range [%#llx - %#llx]\n", dev_name(&cxld->dev),
Driver initialization is returning success (return 0) even if the initialization (cxl_decoder_add() or acpi_table_parse_cedt()) failed, and the hardware was already released (put_device()). Return the error instead of swallowing it. Fixes: f4ce1f766f1e ("cxl/acpi: Convert CFMWS parsing to ACPI sub-table helpers") Signed-off-by: Breno Leitao <leitao@debian.org> --- drivers/cxl/acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)