• Douglas Bagnall's avatar
    [media] Avoid sysfs oops when an rc_dev's raw device is absent · 720bb643
    Douglas Bagnall authored
    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.
    
    Version 2 incorporates changes recommended by Mauro Carvalho Chehab
    (-ENODEV instead of -EINVAL, and a signed-off-by).
    Signed-off-by: default avatarDouglas Bagnall <douglas@paradise.net.nz>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
    720bb643
rc-main.c 30.7 KB