aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb
diff options
context:
space:
mode:
authorAndrew de Quincey <adq_dvb@lidskialf.net>2006-04-04 08:41:47 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-05-12 18:54:37 -0400
commitf47f4763cde162656448fcd1ada9d5e8101a00d2 (patch)
tree0c97ba901c2df64d1cd7e28567464351c9f6b3a1 /drivers/media/dvb
parent3203f94a25ea04b3052d22c7be9518538862d88f (diff)
V4L/DVB (3725): Fix mutex in dvb_register_device to work.
This mutex is meant to stop two devices getting the same ID. dvbdev_get_free_id() scans the list of already allocated devices to find a free id. Unfortunately, since the mutex is unlocked before the card is added to the above list, it is still possible for two of them to get the same id. Its debatable whether this mutex lock is actually needed, but I'm unwilling to just remove it in case something does depend on it. Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r--drivers/media/dvb/dvb-core/dvbdev.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/media/dvb/dvb-core/dvbdev.c b/drivers/media/dvb/dvb-core/dvbdev.c
index 96fe0ecae250..3852430d0260 100644
--- a/drivers/media/dvb/dvb-core/dvbdev.c
+++ b/drivers/media/dvb/dvb-core/dvbdev.c
@@ -219,8 +219,6 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
219 return -ENOMEM; 219 return -ENOMEM;
220 } 220 }
221 221
222 mutex_unlock(&dvbdev_register_lock);
223
224 memcpy(dvbdev, template, sizeof(struct dvb_device)); 222 memcpy(dvbdev, template, sizeof(struct dvb_device));
225 dvbdev->type = type; 223 dvbdev->type = type;
226 dvbdev->id = id; 224 dvbdev->id = id;
@@ -231,6 +229,8 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
231 229
232 list_add_tail (&dvbdev->list_head, &adap->device_list); 230 list_add_tail (&dvbdev->list_head, &adap->device_list);
233 231
232 mutex_unlock(&dvbdev_register_lock);
233
234 devfs_mk_cdev(MKDEV(DVB_MAJOR, nums2minor(adap->num, type, id)), 234 devfs_mk_cdev(MKDEV(DVB_MAJOR, nums2minor(adap->num, type, id)),
235 S_IFCHR | S_IRUSR | S_IWUSR, 235 S_IFCHR | S_IRUSR | S_IWUSR,
236 "dvb/adapter%d/%s%d", adap->num, dnames[type], id); 236 "dvb/adapter%d/%s%d", adap->num, dnames[type], id);