lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f313e0d9-b18e-5dd8-cadf-ee0a689f20ea@linux.intel.com>
Date:   Thu, 24 Jun 2021 15:06:02 -0400
From:   "Liang, Kan" <kan.liang@...ux.intel.com>
To:     13145886936@....com, tglx@...utronix.de, bp@...en8.de,
        x86@...nel.org
Cc:     linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
        gushengxian <gushengxian@...ong.com>,
        "Antonov, Alexander" <alexander.antonov@...ux.intel.com>,
        Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH] x86: eas should not be NULL when it is referenced


Oops, forgot to add Peter.

On 6/24/2021 3:03 PM, Liang, Kan wrote:
> 
> Hi Shengxian,
> 
> Thanks for the patch.
> 
> On 6/24/2021 3:04 AM, 13145886936@....com wrote:
>> From: gushengxian <gushengxian@...ong.com>
>>
>> "eas" should not be NULL when it is referenced.
>>
> 
> I think the NULL pointer dereference of eas should not happen, because 
> die is -1 if eas is NULL. But the whole error handling path looks fragile.
> 
> We already fixed one issue caused by it in commit ID f797f05d917f 
> ("perf/x86/intel/uncore: Fix for iio mapping on Skylake Server")
> https://lore.kernel.org/lkml/160149233331.7002.10919231011379055356.tip-bot2@tip-bot2/ 
> 
> 
> Maybe something as below?
> 
>  From 3de81ba3b04262ef3346297d82f6c4ffb4af7029 Mon Sep 17 00:00:00 2001
> From: Kan Liang <kan.liang@...ux.intel.com>
> Date: Thu, 24 Jun 2021 11:17:57 -0700
> Subject: [PATCH] perf/x86/intel/uncore: Clean up error handling path of 
> iio mapping
> 
> The error handling path of iio mapping looks fragile. We already fixed
> one issue caused by it, commit ID f797f05d917f ("perf/x86/intel/uncore:
> Fix for iio mapping on Skylake Server"). Clean up the error handling
> path and make the code robust.
> 
> Reported-by: gushengxian <gushengxian@...ong.com>
> Signed-off-by: Kan Liang <kan.liang@...ux.intel.com>
> ---
>   arch/x86/events/intel/uncore_snbep.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/events/intel/uncore_snbep.c 
> b/arch/x86/events/intel/uncore_snbep.c
> index 7622762..6d4a5a9 100644
> --- a/arch/x86/events/intel/uncore_snbep.c
> +++ b/arch/x86/events/intel/uncore_snbep.c
> @@ -3802,11 +3802,11 @@ pmu_iio_set_mapping(struct intel_uncore_type 
> *type, struct attribute_group *ag)
>       /* One more for NULL. */
>       attrs = kcalloc((uncore_max_dies() + 1), sizeof(*attrs), GFP_KERNEL);
>       if (!attrs)
> -        goto err;
> +        goto clear_topology;
> 
>       eas = kcalloc(uncore_max_dies(), sizeof(*eas), GFP_KERNEL);
>       if (!eas)
> -        goto err;
> +        goto clear_attrs;
> 
>       for (die = 0; die < uncore_max_dies(); die++) {
>           sprintf(buf, "die%ld", die);
> @@ -3827,7 +3827,9 @@ pmu_iio_set_mapping(struct intel_uncore_type 
> *type, struct attribute_group *ag)
>       for (; die >= 0; die--)
>           kfree(eas[die].attr.attr.name);
>       kfree(eas);
> +clear_attrs:
>       kfree(attrs);
> +clear_topology:
>       kfree(type->topology);
>   clear_attr_update:
>       type->attr_update = NULL;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ