Skip to content

Commit

Permalink
mei: bus: check if the device is enabled before data transfer
Browse files Browse the repository at this point in the history
The bus data transfer interface was missing the check if the device is
in enabled state, this may lead to stack corruption during link reset.

Cc: <stable@vger.kernel.org> #4.0
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
ausyskin authored and gregkh committed Feb 7, 2016
1 parent 850f894 commit 15c13df
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/misc/mei/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ ssize_t __mei_cl_send(struct mei_cl *cl, u8 *buf, size_t length,
bus = cl->dev;

mutex_lock(&bus->device_lock);
if (bus->dev_state != MEI_DEV_ENABLED) {
rets = -ENODEV;
goto out;
}

if (!mei_cl_is_connected(cl)) {
rets = -ENODEV;
goto out;
Expand Down Expand Up @@ -109,6 +114,10 @@ ssize_t __mei_cl_recv(struct mei_cl *cl, u8 *buf, size_t length)
bus = cl->dev;

mutex_lock(&bus->device_lock);
if (bus->dev_state != MEI_DEV_ENABLED) {
rets = -ENODEV;
goto out;
}

cb = mei_cl_read_cb(cl, NULL);
if (cb)
Expand Down

0 comments on commit 15c13df

Please sign in to comment.