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:	Tue, 12 May 2015 14:21:11 -0700
From:	Greg KH <greg@...ah.com>
To:	"Luis R. Rodriguez" <mcgrof@...not-panic.com>
Cc:	ming.lei@...onical.com, rusty@...tcorp.com.au, dhowells@...hat.com,
	seth.forshee@...onical.com, torvalds@...ux-foundation.org,
	linux-kernel@...r.kernel.org, pebolle@...cali.nl,
	linux-wireless@...r.kernel.org,
	"Luis R. Rodriguez" <mcgrof@...e.com>,
	Kyle McMartin <kyle@...nel.org>
Subject: Re: [PATCH v2 1/5] firmware: fix __getname() missing failure check

On Tue, May 12, 2015 at 11:30:53AM -0700, Luis R. Rodriguez wrote:
> From: "Luis R. Rodriguez" <mcgrof@...e.com>
> 
> The request_firmware*() APIs uses __getname() to iterate
> over the list of paths possible for firmware to be found,
> the code however never checked for failure on __getname().
> Although *very unlikely*, this can still happen. Add the
> missing check.
> 
> There is still no checks on the concatenation of the path
> and filename passed, that requires a bit more work and
> subsequent patches address this. The commit that introduced
> this is abb139e7 ("firmware: teach the kernel to load
> firmware files directly from the filesystem").
> 
> mcgrof@...on ~/linux (git::firmware-fixes) $ git describe --contains abb139e7
> v3.7-rc1~120
> 
> Cc: Linus Torvalds <torvalds@...ux-foundation.org>
> Cc: Ming Lei <ming.lei@...onical.com>
> Cc: Rusty Russell <rusty@...tcorp.com.au>
> Cc: David Howells <dhowells@...hat.com>
> Cc: Kyle McMartin <kyle@...nel.org>
> Signed-off-by: Luis R. Rodriguez <mcgrof@...e.com>
> ---
>  drivers/base/firmware_class.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
> index 171841a..bc6c8e6 100644
> --- a/drivers/base/firmware_class.c
> +++ b/drivers/base/firmware_class.c
> @@ -322,7 +322,11 @@ static int fw_get_filesystem_firmware(struct device *device,
>  {
>  	int i;
>  	int rc = -ENOENT;
> -	char *path = __getname();
> +	char *path;
> +
> +	path = __getname();
> +	if (unlikely(!path))

Please only use likely/unlikely on code paths that actually care about
it (i.e. you can measure the difference).  Otherwise it is pretty
useless, and people have determined that sometimes it is slower as
humans get this wrong a lot of time...

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ