Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3868588pxb; Tue, 17 Nov 2020 05:48:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJzUD3fulUBMwWqZDkqMHUNrgJB3v5mF+ToDll25r3g44IQhjjha7tsZP1aNQVbGixwi5ZlL X-Received: by 2002:a17:906:48a:: with SMTP id f10mr19814389eja.5.1605620931846; Tue, 17 Nov 2020 05:48:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605620931; cv=none; d=google.com; s=arc-20160816; b=U0+mkHgu4WP5qMOsUfoaOOOV0U/VqywkA5QW/xbRM2Th7Pqs6yogYs2JPn45PRp64N YvWFFG1w8GcopAsUiT7dSjAJnqzC8UFL1rxSbP3aXoAR6MtlcWCJbw/gnj6JWBGBf+St ErADWoOuXY8bTEt6o/k2mSulgYueAyLsxHbB4qJ2I2q4qBW/bEusTHzMw+xzYyukf4YK mcLMdV2y6lL26p4E2pMGJinNfqGJvbfF7aVKSbElqIz32Lv4q1aEnpnz2auA4wYBKgrm +8BPKNPAwQ1wfm201v47fiau4qL22KQJCCh4dKEiBJOJHcnW0++3uPanxBmKW9JyKV03 v6gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pOuPzhvva84H5RAqdd/D+UKGiWXtLf0nJymTe2Hsw2o=; b=OdlXCOZL74xNXX7jviFM5O/owBeZHm7p3wrn+S19H4jGYHKwP4DRzw/cnuOYRWM1C2 IGPYuSjDgeUMB3CSQcXA9acAsjEk7IvR7RfPrv1I5660mC1tSysgARvyde4NDM3XRX5D ZzaHitK6YnICK/oslVRdAryPHyDFhuUNh0DZnOl/gyvpG6A7f/OAS/nojarLN67gAQld dvznbjynIO1rGr7jqCqA8xksk5f/WlKox2XaK7j9SYEspNZb1jUAcc9oCVOdPbqa0mr9 y00LB1JXbbe15s56zim+82SSzxTYeJgU+Mmgtx8ftvYA6vHbqv7pxetWb3b+f9t4ksH0 379Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fLSLB2CY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r9si4152472ejr.645.2020.11.17.05.48.29; Tue, 17 Nov 2020 05:48:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fLSLB2CY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732698AbgKQNo4 (ORCPT + 99 others); Tue, 17 Nov 2020 08:44:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:51828 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732808AbgKQNj5 (ORCPT ); Tue, 17 Nov 2020 08:39:57 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 71A882465E; Tue, 17 Nov 2020 13:39:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605620397; bh=0lyIzkdCbUXab2zMjc4molrmvH2nayG/50E2rSZXsng=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fLSLB2CYU7MgE3SBBTcYLaU2q2ZEZ50dCc72KBgBqHG6aiPMRua2t5mOJ3oW3DjpN gPyHThbwUFuZGP5i6RT9KIfriXhhx7EXoeuBAgIb5Isdg2eEXT+951wBpnlSBD3Kz3 Jv1bL7y+WjqywZALvORv/RkDbQIN2Bflamz3UGnU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Usyskin , Tomas Winkler Subject: [PATCH 5.9 205/255] mei: protect mei_cl_mtu from null dereference Date: Tue, 17 Nov 2020 14:05:45 +0100 Message-Id: <20201117122148.910493109@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122138.925150709@linuxfoundation.org> References: <20201117122138.925150709@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexander Usyskin 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: Signed-off-by: Alexander Usyskin Signed-off-by: Tomas Winkler Link: https://lore.kernel.org/r/20201029095444.957924-2-tomas.winkler@intel.com Signed-off-by: Greg Kroah-Hartman --- drivers/misc/mei/client.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/misc/mei/client.h +++ b/drivers/misc/mei/client.h @@ -164,11 +164,11 @@ static inline u8 mei_cl_me_id(const stru * * @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; } /**