Skip to content

Commit

Permalink
mei: fix mismatch in mutex unlock-lock in mei_amthif_read()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alexey Khoroshilov authored and Greg Kroah-Hartman committed Jan 7, 2013
1 parent d1c3ed6 commit e6028db
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/misc/mei/amthif.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}


Expand Down

0 comments on commit e6028db

Please sign in to comment.