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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 28 Sep 2018 11:47:24 -0700
From:   Dave Jiang <dave.jiang@...el.com>
To:     Dan Williams <dan.j.williams@...el.com>, linux-nvdimm@...ts.01.org
Cc:     stable@...r.kernel.org, Johannes Thumshirn <jthumshirn@...e.de>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] libnvdimm, region: Fail badblocks listing for inactive
 regions



On 09/28/2018 11:04 AM, Dan Williams wrote:
> While experimenting with region driver loading the following backtrace
> was triggered:
> 
>  INFO: trying to register non-static key.
>  the code is fine but needs lockdep annotation.
>  turning off the locking correctness validator.
>  [..]
>  Call Trace:
>   dump_stack+0x85/0xcb
>   register_lock_class+0x571/0x580
>   ? __lock_acquire+0x2ba/0x1310
>   ? kernfs_seq_start+0x2a/0x80
>   __lock_acquire+0xd4/0x1310
>   ? dev_attr_show+0x1c/0x50
>   ? __lock_acquire+0x2ba/0x1310
>   ? kernfs_seq_start+0x2a/0x80
>   ? lock_acquire+0x9e/0x1a0
>   lock_acquire+0x9e/0x1a0
>   ? dev_attr_show+0x1c/0x50
>   badblocks_show+0x70/0x190
>   ? dev_attr_show+0x1c/0x50
>   dev_attr_show+0x1c/0x50
> 
> This results from a missing successful call to devm_init_badblocks()
> from nd_region_probe(). Block attempts to show badblocks while the
> region is not enabled.
> 
> Fixes: 6a6bef90425e ("libnvdimm: add mechanism to publish badblocks...")
> Cc: <stable@...r.kernel.org>
> Cc: Dave Jiang <dave.jiang@...el.com>
> Cc: Johannes Thumshirn <jthumshirn@...e.de>
> Signed-off-by: Dan Williams <dan.j.williams@...el.com>

Reviewed-by: Dave Jiang <dave.jiang@...el.com>

> ---
>  drivers/nvdimm/region_devs.c |   11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c
> index fa37afcd43ff..174a418cb171 100644
> --- a/drivers/nvdimm/region_devs.c
> +++ b/drivers/nvdimm/region_devs.c
> @@ -560,10 +560,17 @@ static ssize_t region_badblocks_show(struct device *dev,
>  		struct device_attribute *attr, char *buf)
>  {
>  	struct nd_region *nd_region = to_nd_region(dev);
> +	ssize_t rc;
>  
> -	return badblocks_show(&nd_region->bb, buf, 0);
> -}
> +	device_lock(dev);
> +	if (dev->driver)
> +		rc = badblocks_show(&nd_region->bb, buf, 0);
> +	else
> +		rc = -ENXIO;
> +	device_unlock(dev);
>  
> +	return rc;
> +}
>  static DEVICE_ATTR(badblocks, 0444, region_badblocks_show, NULL);
>  
>  static ssize_t resource_show(struct device *dev,
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ