]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
media: dvb_frontend: fix locking issues at dvb_frontend_get_event()
authorMauro Carvalho Chehab <mchehab@s-opensource.com>
Thu, 5 Apr 2018 09:30:52 +0000 (05:30 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 3 Jul 2018 09:18:48 +0000 (11:18 +0200)
commitea5c4686be7fc4d6d618529910e06d1b5255fcc2
tree5aa0471d80d9e04f10c6a038fdc28613554a7157
parent098a472585c694d03d5da564e34687f14bcdd612
media: dvb_frontend: fix locking issues at dvb_frontend_get_event()

commit 76d81243a487c09619822ef8e7201a756e58a87d upstream.

As warned by smatch:
drivers/media/dvb-core/dvb_frontend.c:314 dvb_frontend_get_event() warn: inconsistent returns 'sem:&fepriv->sem'.
  Locked on:   line 288
               line 295
               line 306
               line 314
  Unlocked on: line 303

The lock implementation for get event is wrong, as, if an
interrupt occurs, down_interruptible() will fail, and the
routine will call up() twice when userspace calls the ioctl
again.

The bad code is there since when Linux migrated to git, in
2005.

Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/media/dvb-core/dvb_frontend.c