mei: fix double freeing of a cb during link reset
Fix double freeing of the cb that can happen if link reset kicks in the middle of blocked write from a device on the cl bus. Free cb inside mei_cl_write function on failure and drop cb free operation from callers, during a link reset the mei_cl_write function returns with an error, but the caller doesn't know if the cb was already queued or not so it doesn't know if the cb will be freed upon queue reclaim or it has to free it itself. 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>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
3ca9b1ac28
commit
6cbb097fd3
@@ -44,7 +44,7 @@ ssize_t __mei_cl_send(struct mei_cl *cl, u8 *buf, size_t length,
|
||||
bool blocking)
|
||||
{
|
||||
struct mei_device *bus;
|
||||
struct mei_cl_cb *cb = NULL;
|
||||
struct mei_cl_cb *cb;
|
||||
ssize_t rets;
|
||||
|
||||
if (WARN_ON(!cl || !cl->dev))
|
||||
@@ -86,8 +86,6 @@ ssize_t __mei_cl_send(struct mei_cl *cl, u8 *buf, size_t length,
|
||||
|
||||
out:
|
||||
mutex_unlock(&bus->device_lock);
|
||||
if (rets < 0)
|
||||
mei_io_cb_free(cb);
|
||||
|
||||
return rets;
|
||||
}
|
||||
|
Reference in New Issue
Block a user