Skip to content

Commit 67c433c

Browse files
ausyskingregkh
authored andcommitted
mei: protect mei_cl_mtu from null dereference
commit bcbc0b2 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>
1 parent 1ce7fd4 commit 67c433c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎drivers/misc/mei/client.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,11 @@ static inline u8 mei_cl_me_id(const struct mei_cl *cl)
164164
*
165165
* @cl: host client
166166
*
167-
* Return: mtu
167+
* Return: mtu or 0 if client is not connected
168168
*/
169169
static inline size_t mei_cl_mtu(const struct mei_cl *cl)
170170
{
171-
return cl->me_cl->props.max_msg_length;
171+
return cl->me_cl ? cl->me_cl->props.max_msg_length : 0;
172172
}
173173

174174
/**

0 commit comments

Comments
 (0)