OSDN Git Service

media: vb2: be sure to unlock mutex on errors
authorMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Fri, 23 Nov 2018 12:05:58 +0000 (07:05 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 26 Jan 2019 08:42:52 +0000 (09:42 +0100)
commitda6c1b10ba4c5a3329e7df0f994fe90975e60613
tree82f4832c3019129f74657e7bdf6f8e6242a75be3
parente896840a8a6680e53dcaafc398010b0c6e40a213
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>
drivers/media/v4l2-core/videobuf2-core.c