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: <20131023124333.356d0e15@ipc1.ka-ro>
Date:	Wed, 23 Oct 2013 12:43:33 +0200
From:	Lothar Waßmann <LW@...O-electronics.de>
To:	Ming Lei <ming.lei@...onical.com>
Cc:	tj@...nel.org, linux-kernel@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org, tom.leiming@...il.com,
	gregkh@...uxfoundation.org
Subject: Re: userspace firmware load fails with current linux-next

Hi,

Ming Lei wrote:
> On Wed, 23 Oct 2013 11:06:18 +0200
> Lothar Waßmann <LW@...O-electronics.de> wrote:
> 
[...]
> > Or is it an unintended side effect of some recent change?
> 
> Maybe yes, could you test below patch?
> 
> Tejun, looks we need to keep special attention on zero size of bin file
> as before, could you comment at the patch?
> 
> --
> diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
> index 5d818df..366ae8d 100644
> --- a/fs/sysfs/file.c
> +++ b/fs/sysfs/file.c
> @@ -277,7 +277,7 @@ static ssize_t sysfs_write_file(struct file *file, const char __user *user_buf,
>  	ssize_t len = min_t(size_t, count, PAGE_SIZE);
>  	char *buf;
>  
> -	if (sysfs_is_bin(of->sd)) {
> +	if (sysfs_is_bin(of->sd) && size) {
>  		loff_t size = file_inode(file)->i_size;
>  
>  		if (size <= *ppos)
> 
> 
> 
The patch as is produces a build error, because 'size' is only defined
after the 'if' statement.

The modified patch below works for me.

diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index 5d818df..709d6f5 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -277,7 +277,7 @@ static ssize_t sysfs_write_file(struct file *file, const char __user *user_buf,
 	ssize_t len = min_t(size_t, count, PAGE_SIZE);
 	char *buf;
 
-	if (sysfs_is_bin(of->sd)) {
+	if (sysfs_is_bin(of->sd) && file_inode(file)->i_size) {
 		loff_t size = file_inode(file)->i_size;
 
 		if (size <= *ppos)



Lothar Waßmann
-- 
___________________________________________________________

Ka-Ro electronics GmbH | Pascalstraße 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Geschäftsführer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | info@...o-electronics.de
___________________________________________________________
--
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