lkml.org 
[lkml]   [2017]   [Jan]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] firmware: Prevent oops on delayed abort
On Wed, Jan 4, 2017 at 5:31 PM, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> If the firmware load is slow and cancelled, we may call fw_load_abort()
> twice and promptly oops on the second with a NULL dereference.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Ming Lei <ming.lei@canonical.com>
> Cc: "Luis R. Rodriguez" <mcgrof@kernel.org>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> drivers/base/firmware_class.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
> index 4497d263209f..d03e21c1d2f3 100644
> --- a/drivers/base/firmware_class.c
> +++ b/drivers/base/firmware_class.c
> @@ -557,6 +557,9 @@ static void fw_load_abort(struct firmware_priv *fw_priv)
> {
> struct firmware_buf *buf = fw_priv->buf;
>
> + if (!buf)
> + return;
> +
> __fw_load_abort(buf);
>
> /* avoid user action after loading abort */
> --
> 2.11.0
>

Looks fine,

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

Thanks,
Ming

\
 
 \ /
  Last update: 2017-01-04 12:30    [W:0.044 / U:0.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site