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: <20160206012426.GA12447@linux.intel.com>
Date:	Fri, 5 Feb 2016 18:24:26 -0700
From:	Ross Zwisler <ross.zwisler@...ux.intel.com>
To:	Toshi Kani <toshi.kani@....com>
Cc:	akpm@...ux-foundation.org, dan.j.williams@...el.com,
	linux-mm@...ck.org, linux-kernel@...r.kernel.org,
	linux-nvdimm@...ts.01.org
Subject: Re: [PATCH] devm_memremap: Fix error value when memremap failed

On Fri, Feb 05, 2016 at 06:40:27PM -0700, Toshi Kani wrote:
> devm_memremap() returns an ERR_PTR() value in case of error.
> However, it returns NULL when memremap() failed.  This causes
> the caller, such as the pmem driver, to proceed and oops later.
> 
> Change devm_memremap() to return ERR_PTR(-ENXIO) when memremap()
> failed.
> 
> Signed-off-by: Toshi Kani <toshi.kani@....com>
> Cc: Dan Williams <dan.j.williams@...el.com>
> Cc: Andrew Morton <akpm@...ux-foundation.org>

Yep, good catch.

Reviewed-by: Ross Zwisler <ross.zwisler@...ux.intel.com>

> ---
>  kernel/memremap.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/memremap.c b/kernel/memremap.c
> index 70ee377..3427cca 100644
> --- a/kernel/memremap.c
> +++ b/kernel/memremap.c
> @@ -136,8 +136,10 @@ void *devm_memremap(struct device *dev, resource_size_t offset,
>  	if (addr) {
>  		*ptr = addr;
>  		devres_add(dev, ptr);
> -	} else
> +	} else {
>  		devres_free(ptr);
> +		return ERR_PTR(-ENXIO);
> +	}
>  
>  	return addr;
>  }
> _______________________________________________
> Linux-nvdimm mailing list
> Linux-nvdimm@...ts.01.org
> https://lists.01.org/mailman/listinfo/linux-nvdimm

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ