Skip to content

Commit

Permalink
V4L/DVB (8544): gspca: probe/open race.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Oliver Neukum authored and Mauro Carvalho Chehab committed Jul 27, 2008
1 parent ee281b8 commit ee56a4d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/media/video/gspca/gspca.c
Original file line number Diff line number Diff line change
Expand Up @@ -1758,6 +1758,7 @@ int gspca_dev_probe(struct usb_interface *intf,
memcpy(&gspca_dev->fops, &dev_fops, sizeof gspca_dev->fops);
gspca_dev->vdev.fops = &gspca_dev->fops;
gspca_dev->fops.owner = module; /* module protection */
gspca_dev->present = 1;
ret = video_register_device(&gspca_dev->vdev,
VFL_TYPE_GRABBER,
video_nr);
Expand All @@ -1766,7 +1767,6 @@ int gspca_dev_probe(struct usb_interface *intf,
goto out;
}

gspca_dev->present = 1;
usb_set_intfdata(intf, gspca_dev);
PDEBUG(D_PROBE, "probe ok");
return 0;
Expand Down

0 comments on commit ee56a4d

Please sign in to comment.