Skip to content

Commit

Permalink
[media] rc: double unlock in rc_register_device()
Browse files Browse the repository at this point in the history
If change_protocol() fails and we goto out_raw, then it calls unlock
twice.  I noticed that the other time we called change_protocol() we
held the &dev->lock, so I changed it to hold it here too.

Reviewed-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Dan Carpenter authored and Mauro Carvalho Chehab committed Jul 27, 2011
1 parent ec05a64 commit 0528f35
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/media/rc/rc-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1099,14 +1099,15 @@ int rc_register_device(struct rc_dev *dev)
if (rc < 0)
goto out_input;
}
mutex_unlock(&dev->lock);

if (dev->change_protocol) {
rc = dev->change_protocol(dev, rc_map->rc_type);
if (rc < 0)
goto out_raw;
}

mutex_unlock(&dev->lock);

IR_dprintk(1, "Registered rc%ld (driver: %s, remote: %s, mode %s)\n",
dev->devno,
dev->driver_name ? dev->driver_name : "unknown",
Expand Down

0 comments on commit 0528f35

Please sign in to comment.