diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2009-08-05 19:06:31 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-08-13 19:39:11 -0400 |
commit | 2dd54a54c19d0e5b50f4e1c591653772ead9d4a1 (patch) | |
tree | 3ab873ae09a4cc3f56906dbb4712e1331a078519 /drivers/media/video/mx3_camera.c | |
parent | 7d2e2e35fb50f381c9398e481aac1e1729765ae3 (diff) |
V4L/DVB (12424): soc-camera: fix recursive locking in .buf_queue()
The .buf_queue() V4L2 driver method is called under
spinlock_irqsave(q->irqlock,...), don't take the lock again inside the
function.
Reported-by: Antonio Ospite <ospite@studenti.unina.it>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/mx3_camera.c')
-rw-r--r-- | drivers/media/video/mx3_camera.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/media/video/mx3_camera.c b/drivers/media/video/mx3_camera.c index e605c076ed89..9770cb7932ca 100644 --- a/drivers/media/video/mx3_camera.c +++ b/drivers/media/video/mx3_camera.c | |||
@@ -332,7 +332,10 @@ static enum pixel_fmt fourcc_to_ipu_pix(__u32 fourcc) | |||
332 | } | 332 | } |
333 | } | 333 | } |
334 | 334 | ||
335 | /* Called with .vb_lock held */ | 335 | /* |
336 | * Called with .vb_lock mutex held and | ||
337 | * under spinlock_irqsave(&mx3_cam->lock, ...) | ||
338 | */ | ||
336 | static void mx3_videobuf_queue(struct videobuf_queue *vq, | 339 | static void mx3_videobuf_queue(struct videobuf_queue *vq, |
337 | struct videobuf_buffer *vb) | 340 | struct videobuf_buffer *vb) |
338 | { | 341 | { |
@@ -346,7 +349,8 @@ static void mx3_videobuf_queue(struct videobuf_queue *vq, | |||
346 | struct idmac_video_param *video = &ichan->params.video; | 349 | struct idmac_video_param *video = &ichan->params.video; |
347 | const struct soc_camera_data_format *data_fmt = icd->current_fmt; | 350 | const struct soc_camera_data_format *data_fmt = icd->current_fmt; |
348 | dma_cookie_t cookie; | 351 | dma_cookie_t cookie; |
349 | unsigned long flags; | 352 | |
353 | BUG_ON(!irqs_disabled()); | ||
350 | 354 | ||
351 | /* This is the configuration of one sg-element */ | 355 | /* This is the configuration of one sg-element */ |
352 | video->out_pixel_fmt = fourcc_to_ipu_pix(data_fmt->fourcc); | 356 | video->out_pixel_fmt = fourcc_to_ipu_pix(data_fmt->fourcc); |
@@ -359,8 +363,6 @@ static void mx3_videobuf_queue(struct videobuf_queue *vq, | |||
359 | memset((void *)vb->baddr, 0xaa, vb->bsize); | 363 | memset((void *)vb->baddr, 0xaa, vb->bsize); |
360 | #endif | 364 | #endif |
361 | 365 | ||
362 | spin_lock_irqsave(&mx3_cam->lock, flags); | ||
363 | |||
364 | list_add_tail(&vb->queue, &mx3_cam->capture); | 366 | list_add_tail(&vb->queue, &mx3_cam->capture); |
365 | 367 | ||
366 | if (!mx3_cam->active) { | 368 | if (!mx3_cam->active) { |
@@ -370,24 +372,23 @@ static void mx3_videobuf_queue(struct videobuf_queue *vq, | |||
370 | vb->state = VIDEOBUF_QUEUED; | 372 | vb->state = VIDEOBUF_QUEUED; |
371 | } | 373 | } |
372 | 374 | ||
373 | spin_unlock_irqrestore(&mx3_cam->lock, flags); | 375 | spin_unlock_irq(&mx3_cam->lock); |
374 | 376 | ||
375 | cookie = txd->tx_submit(txd); | 377 | cookie = txd->tx_submit(txd); |
376 | dev_dbg(&icd->dev, "Submitted cookie %d DMA 0x%08x\n", cookie, sg_dma_address(&buf->sg)); | 378 | dev_dbg(&icd->dev, "Submitted cookie %d DMA 0x%08x\n", cookie, sg_dma_address(&buf->sg)); |
379 | |||
380 | spin_lock_irq(&mx3_cam->lock); | ||
381 | |||
377 | if (cookie >= 0) | 382 | if (cookie >= 0) |
378 | return; | 383 | return; |
379 | 384 | ||
380 | /* Submit error */ | 385 | /* Submit error */ |
381 | vb->state = VIDEOBUF_PREPARED; | 386 | vb->state = VIDEOBUF_PREPARED; |
382 | 387 | ||
383 | spin_lock_irqsave(&mx3_cam->lock, flags); | ||
384 | |||
385 | list_del_init(&vb->queue); | 388 | list_del_init(&vb->queue); |
386 | 389 | ||
387 | if (mx3_cam->active == buf) | 390 | if (mx3_cam->active == buf) |
388 | mx3_cam->active = NULL; | 391 | mx3_cam->active = NULL; |
389 | |||
390 | spin_unlock_irqrestore(&mx3_cam->lock, flags); | ||
391 | } | 392 | } |
392 | 393 | ||
393 | /* Called with .vb_lock held */ | 394 | /* Called with .vb_lock held */ |