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]
Date:   Thu, 14 Sep 2017 12:47:10 +0000
From:   Bart Van Assche <Bart.VanAssche@....com>
To:     "jejb@...ux.vnet.ibm.com" <jejb@...ux.vnet.ibm.com>,
        "martin.petersen@...cle.com" <martin.petersen@...cle.com>,
        "shuwang@...hat.com" <shuwang@...hat.com>,
        "kashyap.desai@...adcom.com" <kashyap.desai@...adcom.com>,
        "shivasharan.srikanteshwara@...adcom.com" 
        <shivasharan.srikanteshwara@...adcom.com>,
        "sumit.saxena@...adcom.com" <sumit.saxena@...adcom.com>
CC:     "linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "liwang@...hat.com" <liwang@...hat.com>,
        "catalin.marinas@....com" <catalin.marinas@....com>,
        "chuhu@...hat.com" <chuhu@...hat.com>,
        "megaraidlinux.pdl@...adcom.com" <megaraidlinux.pdl@...adcom.com>
Subject: Re: [PATCH] megaraid: kmemleak: Track page allocation for fusion

On Thu, 2017-09-14 at 14:16 +0800, shuwang@...hat.com wrote:
> diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> index 11bd2e698b84..621299edd8de 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> @@ -48,6 +48,7 @@
>  #include <linux/mutex.h>
>  #include <linux/poll.h>
>  #include <linux/vmalloc.h>
> +#include <linux/kmemleak.h>
>  
>  #include <scsi/scsi.h>
>  #include <scsi/scsi_cmnd.h>
> @@ -4512,7 +4513,9 @@ megasas_alloc_fusion_context(struct megasas_instance *instance)
>  			dev_err(&instance->pdev->dev, "Failed from %s %d\n", __func__, __LINE__);
>  			return -ENOMEM;
>  		}
> -	}
> +	} else
> +		kmemleak_alloc(instance->ctrl_context,
> +			sizeof(struct fusion_context), 1, GFP_KERNEL);
>  
>  	fusion = instance->ctrl_context;

Thank you for having tracked this down and for having shared this patch. But
please keep braces balanced to keep checkpatch happy and please also consider
adding a comment similar to the following above the kmemleak_alloc() call:

/* Allow kmemleak to scan these pages as they contain pointers to additional allocations. */

> @@ -4548,9 +4551,11 @@ megasas_free_fusion_context(struct megasas_instance *instance)
>  
>  		if (is_vmalloc_addr(fusion))
>  			vfree(fusion);
> -		else
> +		else {
>  			free_pages((ulong)fusion,
>  				instance->ctrl_context_pages);
> +			kmemleak_free(fusion);
> +		}
>  	}

Please keep braces balanced in the above code too.

Thanks,

Bart.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ