diff options
author | Ezequiel GarcĂa <elezegarcia@gmail.com> | 2012-07-26 06:59:04 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-07-30 20:11:35 -0400 |
commit | 8f695d3f07bf9fd2914d18d1d2f89e3574b809ff (patch) | |
tree | e512d4121aec36ca50392601fb35d26698bca041 /drivers/media | |
parent | cd779254f92f30cef8d43d0c4345cfeebfc94db8 (diff) |
[media] v4l2-dev.c: Move video_put() after debug printk
It is possible that video_put() releases video_device struct,
provoking a panic when debug printk wants to get video_device node name.
Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/v4l2-dev.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c index 625248585c85..07aeafca9eaa 100644 --- a/drivers/media/video/v4l2-dev.c +++ b/drivers/media/video/v4l2-dev.c | |||
@@ -478,12 +478,12 @@ static int v4l2_open(struct inode *inode, struct file *filp) | |||
478 | } | 478 | } |
479 | 479 | ||
480 | err: | 480 | err: |
481 | /* decrease the refcount in case of an error */ | ||
482 | if (ret) | ||
483 | video_put(vdev); | ||
484 | if (vdev->debug) | 481 | if (vdev->debug) |
485 | printk(KERN_DEBUG "%s: open (%d)\n", | 482 | printk(KERN_DEBUG "%s: open (%d)\n", |
486 | video_device_node_name(vdev), ret); | 483 | video_device_node_name(vdev), ret); |
484 | /* decrease the refcount in case of an error */ | ||
485 | if (ret) | ||
486 | video_put(vdev); | ||
487 | return ret; | 487 | return ret; |
488 | } | 488 | } |
489 | 489 | ||
@@ -500,12 +500,12 @@ static int v4l2_release(struct inode *inode, struct file *filp) | |||
500 | if (test_bit(V4L2_FL_LOCK_ALL_FOPS, &vdev->flags)) | 500 | if (test_bit(V4L2_FL_LOCK_ALL_FOPS, &vdev->flags)) |
501 | mutex_unlock(vdev->lock); | 501 | mutex_unlock(vdev->lock); |
502 | } | 502 | } |
503 | /* decrease the refcount unconditionally since the release() | ||
504 | return value is ignored. */ | ||
505 | video_put(vdev); | ||
506 | if (vdev->debug) | 503 | if (vdev->debug) |
507 | printk(KERN_DEBUG "%s: release\n", | 504 | printk(KERN_DEBUG "%s: release\n", |
508 | video_device_node_name(vdev)); | 505 | video_device_node_name(vdev)); |
506 | /* decrease the refcount unconditionally since the release() | ||
507 | return value is ignored. */ | ||
508 | video_put(vdev); | ||
509 | return ret; | 509 | return ret; |
510 | } | 510 | } |
511 | 511 | ||