aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/gspca.c
diff options
context:
space:
mode:
authorOliver Neukum <oneukum@suse.de>2008-07-27 13:01:59 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-07-27 17:07:57 -0400
commitee56a4d3e39c2baafd06aaf26d975a7c9b05e3a2 (patch)
treec33575d547a0613eeaaa5c289956cf79925d53fb /drivers/media/video/gspca/gspca.c
parentee281b856d4e4921da24387ab116bb0855c2efaa (diff)
V4L/DVB (8544): gspca: probe/open race.
The device is flagged present after it is registered. During that window calls to open() that should work fail with -ENODEV. Reversing the order fixes the race. Signed-off-by: Oliver Neukum <oneukum@suse.de> Acked-by: Hans de Goede <j.w.r.degoede@hhs.nl> Signed-off-by: Jean-Francois Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/gspca/gspca.c')
-rw-r--r--drivers/media/video/gspca/gspca.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c
index bc301bae0482..3a051c925ff6 100644
--- a/drivers/media/video/gspca/gspca.c
+++ b/drivers/media/video/gspca/gspca.c
@@ -1758,6 +1758,7 @@ int gspca_dev_probe(struct usb_interface *intf,
1758 memcpy(&gspca_dev->fops, &dev_fops, sizeof gspca_dev->fops); 1758 memcpy(&gspca_dev->fops, &dev_fops, sizeof gspca_dev->fops);
1759 gspca_dev->vdev.fops = &gspca_dev->fops; 1759 gspca_dev->vdev.fops = &gspca_dev->fops;
1760 gspca_dev->fops.owner = module; /* module protection */ 1760 gspca_dev->fops.owner = module; /* module protection */
1761 gspca_dev->present = 1;
1761 ret = video_register_device(&gspca_dev->vdev, 1762 ret = video_register_device(&gspca_dev->vdev,
1762 VFL_TYPE_GRABBER, 1763 VFL_TYPE_GRABBER,
1763 video_nr); 1764 video_nr);
@@ -1766,7 +1767,6 @@ int gspca_dev_probe(struct usb_interface *intf,
1766 goto out; 1767 goto out;
1767 } 1768 }
1768 1769
1769 gspca_dev->present = 1;
1770 usb_set_intfdata(intf, gspca_dev); 1770 usb_set_intfdata(intf, gspca_dev);
1771 PDEBUG(D_PROBE, "probe ok"); 1771 PDEBUG(D_PROBE, "probe ok");
1772 return 0; 1772 return 0;