]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.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)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Mon, 14 Jan 2019 09:28:55 +0000 (09:28 +0000)
commitbca018b3e1bddfe61023c9879b68c900f69efdc3
tree57b0b133ad3d749cd15c44d5af55b93b73f22a04
parentcd361e6577142d3ee0e618e789627f7992e4df8a
media: dvb_frontend: fix locking issues at dvb_frontend_get_event()

BugLink: http://bugs.launchpad.net/bugs/1807469
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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/media/dvb-core/dvb_frontend.c