Patch "drivers/perf: thunderx2_pmu: Fix memory resource error handling" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    drivers/perf: thunderx2_pmu: Fix memory resource error handling

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     drivers-perf-thunderx2_pmu-fix-memory-resource-error.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 993c06745f0508c17f68a3c77f3afc704e6c399a
Author: Mark Salter <msalter@xxxxxxxxxx>
Date:   Tue Sep 15 16:41:10 2020 -0400

    drivers/perf: thunderx2_pmu: Fix memory resource error handling
    
    [ Upstream commit 688494a407d1419a6b158c644b262c61cde39f48 ]
    
    In tx2_uncore_pmu_init_dev(), a call to acpi_dev_get_resources() is used
    to create a list _CRS resources which is searched for the device base
    address. There is an error check following this:
    
       if (!rentry->res)
               return NULL
    
    In no case, will rentry->res be NULL, so the test is useless. Even
    if the test worked, it comes before the resource list memory is
    freed. None of this really matters as long as the ACPI table has
    the memory resource. Let's clean it up so that it makes sense and
    will give a meaningful error should firmware leave out the memory
    resource.
    
    Fixes: 69c32972d593 ("drivers/perf: Add Cavium ThunderX2 SoC UNCORE PMU driver")
    Signed-off-by: Mark Salter <msalter@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20200915204110.326138-2-msalter@xxxxxxxxxx
    Signed-off-by: Will Deacon <will@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/perf/thunderx2_pmu.c b/drivers/perf/thunderx2_pmu.c
index 9e1c3c7eeba9b..170ccb164c604 100644
--- a/drivers/perf/thunderx2_pmu.c
+++ b/drivers/perf/thunderx2_pmu.c
@@ -627,14 +627,17 @@ static struct tx2_uncore_pmu *tx2_uncore_pmu_init_dev(struct device *dev,
 	list_for_each_entry(rentry, &list, node) {
 		if (resource_type(rentry->res) == IORESOURCE_MEM) {
 			res = *rentry->res;
+			rentry = NULL;
 			break;
 		}
 	}
+	acpi_dev_free_resource_list(&list);
 
-	if (!rentry->res)
+	if (rentry) {
+		dev_err(dev, "PMU type %d: Fail to find resource\n", type);
 		return NULL;
+	}
 
-	acpi_dev_free_resource_list(&list);
 	base = devm_ioremap_resource(dev, &res);
 	if (IS_ERR(base)) {
 		dev_err(dev, "PMU type %d: Fail to map resource\n", type);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux