If a lirc chardev is held open after a device is unplugged, rc_close()
will be called after rc_unregister_device(). The driver is not expecting
any calls at this point, and the iguanair driver causes an oops in
this scenario.

Signed-off-by: Sean Young <s...@mess.org>
---
 drivers/media/rc/rc-main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index 9ae60a5fa6d2..c0904fe1a6d4 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -871,7 +871,7 @@ void rc_close(struct rc_dev *rdev)
        if (rdev) {
                mutex_lock(&rdev->lock);
 
-               if (!--rdev->users && rdev->close != NULL)
+               if (!--rdev->users && rdev->close && rdev->registered)
                        rdev->close(rdev);
 
                mutex_unlock(&rdev->lock);
-- 
2.13.6

Reply via email to