summaryrefslogtreecommitdiffstats
path: root/drivers/misc/mei/client.h
diff options
context:
space:
mode:
authorAlexander Usyskin <alexander.usyskin@intel.com>2020-10-29 10:54:42 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-11-03 10:13:48 +0100
commitbcbc0b2e275f0a797de11a10eff495b4571863fc (patch)
tree4b5c88280d4194ac1ce38394bd943ccf623ac0b8 /drivers/misc/mei/client.h
parentLinux 5.10-rc2 (diff)
downloadlinux-bcbc0b2e275f0a797de11a10eff495b4571863fc.tar.xz
linux-bcbc0b2e275f0a797de11a10eff495b4571863fc.zip
mei: protect mei_cl_mtu from null dereference
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>
Diffstat (limited to 'drivers/misc/mei/client.h')
-rw-r--r--drivers/misc/mei/client.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/misc/mei/client.h b/drivers/misc/mei/client.h
index 64143d4ec758..9e08a9843bba 100644
--- a/drivers/misc/mei/client.h
+++ b/drivers/misc/mei/client.h
@@ -182,11 +182,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;
}
/**