stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Luis R. Rodriguez" <mcgrof@kernel.org>
To: Yves-Alexis Perez <corsac@corsac.net>
Cc: linux-kernel@vger.kernel.org,
	Yves-Alexis Perez <corsac@debian.org>,
	Ming Lei <ming.lei@canonical.com>,
	"Luis R. Rodriguez" <mcgrof@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Johannes Berg <johannes@sipsolutions.net>,
	Jouni Malinen <j@w1.fi>, Kees Cook <keescook@chromium.org>,
	Jiri Kosina <jkosina@suse.cz>, Jiri Slaby <jslaby@suse.com>,
	Tom Gundersen <teg@jklm.no>, Kay Sievers <kay@vrfy.org>,
	Josh Boyer <jwboyer@fedoraproject.org>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Andy Lutomirski <luto@amacapital.net>,
	Harald Hoyer <harald@redhat.com>,
	Seth Forshee <seth.forshee@canonical.com>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Daniel Wagner <wagi@monom.org>,
	stable@vger.kernel.org
Subject: Re: [PATCH] firmware: fix async/manual firmware loading
Date: Wed, 9 Nov 2016 21:39:21 +0100	[thread overview]
Message-ID: <20161109203921.GH13978@wotan.suse.de> (raw)
In-Reply-To: <20161030145048.6291-2-corsac@corsac.net>

On Sun, Oct 30, 2016 at 03:50:48PM +0100, Yves-Alexis Perez wrote:
> From: Yves-Alexis Perez <corsac@debian.org>
> 
> wait_for_completion_interruptible_timeout() return value is either
> -ERESTARTSYS (in case it was interrupted), 0 (in case the timeout expired)
> or the number of jiffies left until timeout. The return value is stored in
> a long, but in _request_firmware_load() it's silently casted to an int,
> which can overflow and give a negative value, indicating an error.
> 
> Fix this by re-using the timeout variable and only set retval when it's
> safe.

Please amend the commit log as I noted in the previous response, and
resend.

> Signed-off-by: Yves-Alexis Perez <corsac@corsac.net>
> Cc: Ming Lei <ming.lei@canonical.com>
> Cc: "Luis R. Rodriguez" <mcgrof@kernel.org>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Other than the commit log you can add on you resend:

Acked-by: Luis R. Rodriguez.

Modulo I don't personally thing this this is sable material but I'll let
Greg decide.

  Luis

> Cc: stable@vger.kernel.org
> 
> ---
>  drivers/base/firmware_class.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
> index 22d1760..a95e1e5 100644
> --- a/drivers/base/firmware_class.c
> +++ b/drivers/base/firmware_class.c
> @@ -955,13 +955,14 @@ static int _request_firmware_load(struct firmware_priv *fw_priv,
>  		timeout = MAX_JIFFY_OFFSET;
>  	}
>  
> -	retval = wait_for_completion_interruptible_timeout(&buf->completion,
> +	timeout = wait_for_completion_interruptible_timeout(&buf->completion,
>  			timeout);
> -	if (retval == -ERESTARTSYS || !retval) {
> +	if (timeout == -ERESTARTSYS || !timeout) {
> +		retval = timeout;
>  		mutex_lock(&fw_lock);
>  		fw_load_abort(fw_priv);
>  		mutex_unlock(&fw_lock);
> -	} else if (retval > 0) {
> +	} else if (timeout > 0) {
>  		retval = 0;
>  	}
>  
> -- 
> 2.10.1
> 
> 

-- 
Luis Rodriguez, SUSE LINUX GmbH
Maxfeldstrasse 5; D-90409 Nuernberg

  parent reply	other threads:[~2016-11-09 20:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20161030145048.6291-1-corsac@corsac.net>
2016-10-30 14:50 ` [PATCH] firmware: fix async/manual firmware loading Yves-Alexis Perez
2016-10-30 17:28   ` Yves-Alexis Perez
2016-11-09 20:36     ` Luis R. Rodriguez
2016-11-09 22:02       ` Luis R. Rodriguez
2016-11-10  6:57         ` Yves-Alexis Perez
2016-11-09 20:39   ` Luis R. Rodriguez [this message]
2016-11-10 15:55     ` Greg Kroah-Hartman
2016-11-10 16:07       ` Luis R. Rodriguez
2016-11-10 18:52         ` Bjorn Andersson
2016-11-10 19:48           ` Luis R. Rodriguez
2016-11-10 21:04             ` Yves-Alexis Perez
2016-11-10 21:22               ` Luis R. Rodriguez
2016-11-10 19:18         ` Greg Kroah-Hartman
2016-11-10 19:49           ` Luis R. Rodriguez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161109203921.GH13978@wotan.suse.de \
    --to=mcgrof@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=corsac@corsac.net \
    --cc=corsac@debian.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=harald@redhat.com \
    --cc=j@w1.fi \
    --cc=jkosina@suse.cz \
    --cc=johannes@sipsolutions.net \
    --cc=jslaby@suse.com \
    --cc=jwboyer@fedoraproject.org \
    --cc=kay@vrfy.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=ming.lei@canonical.com \
    --cc=seth.forshee@canonical.com \
    --cc=stable@vger.kernel.org \
    --cc=teg@jklm.no \
    --cc=wagi@monom.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).