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, 10 Mar 2015 15:32:43 +0800
From:	Ming Lei <ming.lei@...onical.com>
To:	Zahari Doychev <zahari.doychev@...ux.com>
Cc:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] drivers: base: fw: fix ret value when loading fw

On Mon, Mar 9, 2015 at 11:49 PM, Zahari Doychev
<zahari.doychev@...ux.com> wrote:
> When using the user mode helper to load firmwares the function _request_firmware
> gets a positive return value from fw_load_from_user_helper and because of this
> the firmware buffer is not assigned. This happens only when the return value
> is zero. This patch fixes this problem in _request_firmware_load. When the
> completion is ready the return value is set to zero.
>
> Signed-off-by: Zahari Doychev <zahari.doychev@...ux.com>

Acked-by: Ming Lei <ming.lei@...onical.com>

> ---
>  drivers/base/firmware_class.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
> index 6c5c9ed..9642e5f 100644
> --- a/drivers/base/firmware_class.c
> +++ b/drivers/base/firmware_class.c
> @@ -920,6 +920,10 @@ static int _request_firmware_load(struct firmware_priv *fw_priv,
>         else if (!buf->data)
>                 retval = -ENOMEM;
>
> +       /* wait for completion was successful so return ok */
> +       if (retval > 0)
> +               retval = 0;

Suggest to move the check backward and handle return value
from wait_for_completion_interruptible_timeout() in one place, like below:

           if (retval == -ERESTARTSYS || !retval) {
               ...
           } else if (retval > 0) {
               retval = 0;
           }

> +
>         device_remove_file(f_dev, &dev_attr_loading);
>  err_del_bin_attr:
>         device_remove_bin_file(f_dev, &firmware_attr_data);
> --
> 2.3.0
>
--
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