]> git.baikalelectronics.ru Git - 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)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Tue, 17 Apr 2018 09:49:58 +0000 (05:49 -0400)
commit65f680ea08c3b10df0948c774dcc8edbc194ff83
treee964364b17392bfc509abee06a2d3da935a357c1
parent59fb10489af336611147a56cd544a12a8f392cfe
media: dvb_frontend: fix locking issues at dvb_frontend_get_event()

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>
drivers/media/dvb-core/dvb_frontend.c