lkml.org 
[lkml]   [2020]   [Nov]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.14 041/125] ACPI: Add out of bounds and numa_off protections to pxm_to_node()
    Date
    From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

    [ Upstream commit 8a3decac087aa897df5af04358c2089e52e70ac4 ]

    The function should check the validity of the pxm value before using
    it to index the pxm_to_node_map[] array.

    Whilst hardening this code may be good in general, the main intent
    here is to enable following patches that use this function to replace
    acpi_map_pxm_to_node() for non SRAT usecases which should return
    NO_NUMA_NODE for PXM entries not matching with those in SRAT.

    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Reviewed-by: Barry Song <song.bao.hua@hisilicon.com>
    Reviewed-by: Hanjun Guo <guohanjun@huawei.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    drivers/acpi/numa.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c
    index a7907b58562a7..986712fe2a71c 100644
    --- a/drivers/acpi/numa.c
    +++ b/drivers/acpi/numa.c
    @@ -46,7 +46,7 @@ int acpi_numa __initdata;

    int pxm_to_node(int pxm)
    {
    - if (pxm < 0)
    + if (pxm < 0 || pxm >= MAX_PXM_DOMAINS || numa_off)
    return NUMA_NO_NODE;
    return pxm_to_node_map[pxm];
    }
    --
    2.27.0


    \
     
     \ /
      Last update: 2020-11-03 22:18    [W:4.088 / U:0.324 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site