]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commit
input: misc: inv: fix race in shutdown and suspend
authorSang-Hun Lee <sanlee@nvidia.com>
Tue, 8 Oct 2013 21:14:24 +0000 (14:14 -0700)
committerMitch Luban <mluban@nvidia.com>
Wed, 18 Dec 2013 05:58:38 +0000 (21:58 -0800)
commit5d381a4a377dbbd57917b877d7ac1730a23fd7f6
treebf338ac6bb4e0667d3b38c05263181221a80fd76
parentb37f50f5798fc7e8b1324286b8892c2a4d41f332
input: misc: inv: fix race in shutdown and suspend

Problem description:
 - Write to shutdown flag is not mutex protected
 - nvi_work_func may be scheduled after shutdown or suspend
 - kfifo is being freed for shutdown, which could
   corrupt memory if there is a further access to
   kfifo by nvi_pm_exit and its function calls

Fix description:
 - Encapsulate write to shutdown flag with a mutex,
   to ensure readers get valid information
 - Wait for nvi_work_func to complete during shutdown and suspend
 - Free kfifo only during remove

Bug 1361923

Change-Id: I64dabfb21a289354e7f7c58ac408dc48bcff9267
Signed-off-by: Sang-Hun Lee <sanlee@nvidia.com>
Reviewed-on: http://git-master/r/283813
Reviewed-on: http://git-master/r/330859
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Robert Collins <rcollins@nvidia.com>
Reviewed-by: Erik Lilliebjerg <elilliebjerg@nvidia.com>
Reviewed-by: Mitch Luban <mluban@nvidia.com>
drivers/input/misc/mpu/inv_gyro.c