From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: Douglas Bagnall <douglas@paradise.net.nz>
Cc: linux-media@vger.kernel.org
Subject: Re: [PATCH] Avoid sysfs oops when an rc_dev's raw device is absent
Date: Thu, 05 Jul 2012 23:24:32 -0300 [thread overview]
Message-ID: <4FF64C60.1070804@redhat.com> (raw)
In-Reply-To: <4FE7AA34.8090304@paradise.net.nz>
Em 24-06-2012 21:00, Douglas Bagnall escreveu:
> For some reason, when the lirc daemon learns that a usb remote control
> has been unplugged, it wants to read the sysfs attributes of the
> disappearing device. This is useful for uncovering transient
> inconsistencies, but less so for keeping the system running when such
> inconsistencies exist.
>
> Under some circumstances (like every time I unplug my dvb stick from
> my laptop), lirc catches an rc_dev whose raw event handler has been
> removed (presumably by ir_raw_event_unregister), and proceeds to
> interrogate the raw protocols supported by the NULL pointer.
>
> This patch avoids the NULL dereference, and ignores the issue of how
> this state of affairs came about in the first place.
Please add your Signed-off-by: as described at:
http://www.linuxtv.org/wiki/index.php/Development:_Submitting_Patches
> ---
> drivers/media/rc/rc-main.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
> index 6e16b09..58789c9 100644
> --- a/drivers/media/rc/rc-main.c
> +++ b/drivers/media/rc/rc-main.c
> @@ -775,10 +775,12 @@ static ssize_t show_protocols(struct device *device,
> if (dev->driver_type == RC_DRIVER_SCANCODE) {
> enabled = dev->rc_map.rc_type;
> allowed = dev->allowed_protos;
> - } else {
> + } else if (dev->raw) {
> enabled = dev->raw->enabled_protocols;
> allowed = ir_raw_get_allowed_protocols();
> }
> + else
> + return -EINVAL;
The return code there should be -ENODEV, as the device got removed.
Regards,
Mauro
next prev parent reply other threads:[~2012-07-06 2:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-25 0:00 [PATCH] Avoid sysfs oops when an rc_dev's raw device is absent Douglas Bagnall
2012-06-25 1:44 ` Douglas Bagnall
2012-07-06 2:29 ` Mauro Carvalho Chehab
2012-07-06 2:24 ` Mauro Carvalho Chehab [this message]
2012-07-07 3:27 ` [PATCH v2] " Douglas Bagnall
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=4FF64C60.1070804@redhat.com \
--to=mchehab@redhat.com \
--cc=douglas@paradise.net.nz \
--cc=linux-media@vger.kernel.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).