diff options
author | Alexander Usyskin <alexander.usyskin@intel.com> | 2020-10-29 12:54:42 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-11-18 21:18:49 +0300 |
commit | 41fc5ddd35bb60f9ae316175866dc21088384b6f (patch) | |
tree | 75eaaaeaa00316886c944209de251d51ca65fc9d | |
parent | 83361a5464e28dde737b4d6c7730fc490233cdc7 (diff) | |
download | linux-41fc5ddd35bb60f9ae316175866dc21088384b6f.tar.xz |
mei: protect mei_cl_mtu from null dereference
commit bcbc0b2e275f0a797de11a10eff495b4571863fc upstream.
A receive callback is queued while the client is still connected
but can still be called after the client was disconnected. Upon
disconnect cl->me_cl is set to NULL, hence we need to check
that ME client is not-NULL in mei_cl_mtu to avoid
null dereference.
Cc: <stable@vger.kernel.org>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Link: https://lore.kernel.org/r/20201029095444.957924-2-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/misc/mei/client.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/misc/mei/client.h b/drivers/misc/mei/client.h index 64e318f589b4..0d23efcc74ff 100644 --- a/drivers/misc/mei/client.h +++ b/drivers/misc/mei/client.h @@ -138,11 +138,11 @@ static inline u8 mei_cl_me_id(const struct mei_cl *cl) * * @cl: host client * - * Return: mtu + * Return: mtu or 0 if client is not connected */ static inline size_t mei_cl_mtu(const struct mei_cl *cl) { - return cl->me_cl->props.max_msg_length; + return cl->me_cl ? cl->me_cl->props.max_msg_length : 0; } /** |