diff options
author | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2018-11-23 15:05:58 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-01-22 23:40:38 +0300 |
commit | 685cc9c3ee488ed5a1218b9c8294f65000bbbc86 (patch) | |
tree | 6b5cdcc5c64ba32ed7827083f708a992751d7aa5 /drivers | |
parent | 7696248f9b5a4670f1e66c26f88a61669f0f95c9 (diff) | |
download | linux-685cc9c3ee488ed5a1218b9c8294f65000bbbc86.tar.xz |
media: vb2: be sure to unlock mutex on errors
commit c06ef2e9acef4cda1feee2ce055b8086e33d251a upstream.
As reported by smatch:
drivers/media/common/videobuf2/videobuf2-core.c: drivers/media/common/videobuf2/videobuf2-core.c:2159 vb2_mmap() warn: inconsistent returns 'mutex:&q->mmap_lock'.
Locked on: line 2148
Unlocked on: line 2100
line 2108
line 2113
line 2118
line 2156
line 2159
There is one error condition that doesn't unlock a mutex.
Fixes: cd26d1c4d1bc ("media: vb2: vb2_mmap: move lock up")
Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/common/videobuf2/videobuf2-core.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c index 07629e7c15be..6889c25c62cb 100644 --- a/drivers/media/common/videobuf2/videobuf2-core.c +++ b/drivers/media/common/videobuf2/videobuf2-core.c @@ -1960,7 +1960,8 @@ int vb2_mmap(struct vb2_queue *q, struct vm_area_struct *vma) if (length < (vma->vm_end - vma->vm_start)) { dprintk(1, "MMAP invalid, as it would overflow buffer length\n"); - return -EINVAL; + ret = -EINVAL; + goto unlock; } ret = call_memop(vb, mmap, vb->planes[plane].mem_priv, vma); |