V4L/DVB (13639): ir-sysfs: Properly protect rc_tab changes with a lock
authorMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 14 Dec 2009 05:56:15 +0000 (02:56 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 26 Feb 2010 18:10:24 +0000 (15:10 -0300)
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/IR/ir-sysfs.c

index a96738135bb09e6dad37f706b602dedde3e6f5f6..d73589ad55e6acf5b8f9103d5b6f8c63df71cb61 100644 (file)
@@ -79,6 +79,7 @@ static ssize_t store_protocol(struct device *d,
        struct ir_input_dev *ir_dev = dev_get_drvdata(d);
        enum ir_type ir_type = IR_TYPE_UNKNOWN;
        int rc = -EINVAL;
+       unsigned long flags;
        char *buf;
 
        buf = strsep((char **) &data, "\n");
@@ -104,7 +105,9 @@ static ssize_t store_protocol(struct device *d,
                return -EINVAL;
        }
 
+       spin_lock_irqsave(&ir_dev->rc_tab.lock, flags);
        ir_dev->rc_tab.ir_type = ir_type;
+       spin_unlock_irqrestore(&ir_dev->rc_tab.lock, flags);
 
        IR_dprintk(1, "Current protocol is %ld\n", ir_type);