1
0
Fork 0

mei: protect mei_cl_mtu from null dereference

commit bcbc0b2e27 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>
5.4-rM2-2.2.x-imx-squashed
Alexander Usyskin 2020-10-29 11:54:42 +02:00 committed by Greg Kroah-Hartman
parent e2b2c390ec
commit 761fb68292
1 changed files with 2 additions and 2 deletions

View File

@ -128,11 +128,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;
}
/**