linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Frank Schäfer" <fschaefer.oss@googlemail.com>
To: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>
Subject: Re: [PATCH] em28xx: input: fix oops on device removal
Date: Fri, 21 Dec 2012 16:32:54 +0100	[thread overview]
Message-ID: <50D48126.8050307@googlemail.com> (raw)
In-Reply-To: <1355416457-19692-1-git-send-email-fschaefer.oss@googlemail.com>

Am 13.12.2012 17:34, schrieb Frank Schäfer:
> When em28xx_ir_init() fails du to an error in em28xx_ir_change_protocol(), it
> frees the memory of struct em28xx_IR *ir, but doesn't set the corresponding
> pointer in the device struct to NULL.
> On device removal, em28xx_ir_fini() gets called, which then calls
> rc_unregister_device() with a pointer to freed memory.
>
> Fixes bug 26572 (http://bugzilla.kernel.org/show_bug.cgi?id=26572)
>
> Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
>
> Cc: stable@kernel.org	# at least all kernels since 2.6.32 (incl.)
> ---
>  drivers/media/usb/em28xx/em28xx-input.c |    9 ++++-----
>  1 Datei geändert, 4 Zeilen hinzugefügt(+), 5 Zeilen entfernt(-)
>
> diff --git a/drivers/media/usb/em28xx/em28xx-input.c b/drivers/media/usb/em28xx/em28xx-input.c
> index 660bf80..5c7d768 100644
> --- a/drivers/media/usb/em28xx/em28xx-input.c
> +++ b/drivers/media/usb/em28xx/em28xx-input.c
> @@ -538,7 +538,7 @@ static int em28xx_ir_init(struct em28xx *dev)
>  	ir = kzalloc(sizeof(*ir), GFP_KERNEL);
>  	rc = rc_allocate_device();
>  	if (!ir || !rc)
> -		goto err_out_free;
> +		goto error;
>  
>  	/* record handles to ourself */
>  	ir->dev = dev;
> @@ -559,7 +559,7 @@ static int em28xx_ir_init(struct em28xx *dev)
>  	rc_type = RC_BIT_UNKNOWN;
>  	err = em28xx_ir_change_protocol(rc, &rc_type);
>  	if (err)
> -		goto err_out_free;
> +		goto error;
>  
>  	/* This is how often we ask the chip for IR information */
>  	ir->polling = 100; /* ms */
> @@ -584,7 +584,7 @@ static int em28xx_ir_init(struct em28xx *dev)
>  	/* all done */
>  	err = rc_register_device(rc);
>  	if (err)
> -		goto err_out_stop;
> +		goto error;
>  
>  	em28xx_register_i2c_ir(dev);
>  
> @@ -597,9 +597,8 @@ static int em28xx_ir_init(struct em28xx *dev)
>  
>  	return 0;
>  
> - err_out_stop:
> +error:
>  	dev->ir = NULL;
> - err_out_free:
>  	rc_free_device(rc);
>  	kfree(ir);
>  	return err;

Ping !?
Mauro, this patch is really easy to review and it fixes a 2 years old bug...
Isn't this one of those patches that should be applied immediately ?

Regards,
Frank






       reply	other threads:[~2012-12-21 15:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1355416457-19692-1-git-send-email-fschaefer.oss@googlemail.com>
2012-12-21 15:32 ` Frank Schäfer [this message]
2012-12-21 23:35   ` [PATCH] em28xx: input: fix oops on device removal Mauro Carvalho Chehab
2012-12-22 14:03     ` Frank Schäfer
2012-12-22 16:53       ` Mauro Carvalho Chehab

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=50D48126.8050307@googlemail.com \
    --to=fschaefer.oss@googlemail.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@redhat.com \
    /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).