summaryrefslogtreecommitdiff
path: root/drivers/ieee1394/dv1394.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-11-06 15:55:34 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2008-11-06 15:55:34 -0800
commit6572a281cfd805dd54718597d6c33261b5be052b (patch)
tree9e61bf01db351d4371e2daf12fcf50213281572d /drivers/ieee1394/dv1394.c
parente252f4db187ef02d06c8551069d944d327b8bb9a (diff)
parent8449fc3ae58bf8ee5acbd2280754cde67b5db128 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6: ieee1394: dv1394: fix possible deadlock in multithreaded clients ieee1394: raw1394: fix possible deadlock in multithreaded clients ieee1394: struct device - replace bus_id with dev_name(), dev_set_name() firewire: struct device - replace bus_id with dev_name(), dev_set_name()
Diffstat (limited to 'drivers/ieee1394/dv1394.c')
-rw-r--r--drivers/ieee1394/dv1394.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/ieee1394/dv1394.c b/drivers/ieee1394/dv1394.c
index 965cfdb84ebc..c19f23267157 100644
--- a/drivers/ieee1394/dv1394.c
+++ b/drivers/ieee1394/dv1394.c
@@ -1270,8 +1270,14 @@ static int dv1394_mmap(struct file *file, struct vm_area_struct *vma)
struct video_card *video = file_to_video_card(file);
int retval = -EINVAL;
- /* serialize mmap */
- mutex_lock(&video->mtx);
+ /*
+ * We cannot use the blocking variant mutex_lock here because .mmap
+ * is called with mmap_sem held, while .ioctl, .read, .write acquire
+ * video->mtx and subsequently call copy_to/from_user which will
+ * grab mmap_sem in case of a page fault.
+ */
+ if (!mutex_trylock(&video->mtx))
+ return -EAGAIN;
if ( ! video_card_initialized(video) ) {
retval = do_dv1394_init_default(video);