diff options
author | Alexey Khoroshilov <khoroshilov@ispras.ru> | 2012-12-22 01:44:16 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-07 10:28:03 -0800 |
commit | e6028db0146cf5a68dbd1508225ea49840997880 (patch) | |
tree | b2eac067e893ad8ba588ae3e9a2625c8a7dec85f | |
parent | d1c3ed669a2d452cacfb48c2d171a1f364dae2ed (diff) | |
download | linux-3.10-e6028db0146cf5a68dbd1508225ea49840997880.tar.gz linux-3.10-e6028db0146cf5a68dbd1508225ea49840997880.tar.bz2 linux-3.10-e6028db0146cf5a68dbd1508225ea49840997880.zip |
mei: fix mismatch in mutex unlock-lock in mei_amthif_read()
Users of mei_amthif_read() expect it leaves dev->device_lock held,
while there is a path where mei_amthif_read() unlocks device_lock
and returns -ERESTARTSYS.
The patch move code locking device_lock back before the return.
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Cc: Sedat Dilek <sedat.dilek@gmail.com>
Acked-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/misc/mei/amthif.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/misc/mei/amthif.c b/drivers/misc/mei/amthif.c index 18794aea606..e40ffd9502d 100644 --- a/drivers/misc/mei/amthif.c +++ b/drivers/misc/mei/amthif.c @@ -187,13 +187,13 @@ int mei_amthif_read(struct mei_device *dev, struct file *file, wait_ret = wait_event_interruptible(dev->iamthif_cl.wait, (cb = mei_amthif_find_read_list_entry(dev, file))); + /* Locking again the Mutex */ + mutex_lock(&dev->device_lock); + if (wait_ret) return -ERESTARTSYS; dev_dbg(&dev->pdev->dev, "woke up from sleep\n"); - - /* Locking again the Mutex */ - mutex_lock(&dev->device_lock); } |