Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp832726ybl; Wed, 11 Dec 2019 08:10:52 -0800 (PST) X-Google-Smtp-Source: APXvYqz0JKwpBK0psfkIhL+bv3fI5gYOg/8tT91N4aZEdel1X0R4aeIpL6RhZL07DtuShnHyuT8P X-Received: by 2002:aca:1c0d:: with SMTP id c13mr3239902oic.44.1576080652492; Wed, 11 Dec 2019 08:10:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576080652; cv=none; d=google.com; s=arc-20160816; b=c9FJFRhNDIvcLubJ1AotV0TO1lZHmZx7gYrKpOJbZwq2v3UcMvZ0HIbZtfjH2lo9Bq tCs6XmGNouIaWdISH/eQI4GeteY727xGSyJtRBkcmCjBTILkKAC0m7XR5yuH5uolE1o3 zWxhv5RQakDUhNOd0ZKR7Tv5E+ZnFEJVjLAxzpRQxcLlu70Ct37vtjRRRtK4YNcYt1br YT0XhtOompYIAXMPzG0u5pqNAY47W3KRJSH2yqvQWOo9Y9TNl3xZmfAglbvHocY6dDg0 iTq9dmv32Lz35bNSTwAz6xf3i45dBcHUE50oMorKFovb6VpbXYYL4cG5ga8ngLqCTpiQ 4n6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wEUi62kHZyn9kcCBa1zmPNvg3rvpXeam/uxXg9yTu8I=; b=jhEkohqAJ32Uikel4BxVuJy2f/7KQ2Ioc6B41M2kB8ayeDJJKxPLraDBXVeW3u69bK euXVb+QpOesa7KBdyzcKRuak35kdRXbt/FLz3fj2f0KjRWEDpYqk/3vTSY7Dkc7GW5QH A1EpUPDSTT56o9+XvreHlkyFqcpVzkZFnvrySrBf0PnCbHQDQfJBopOdYEyL+CQlWyVF Rj6I7KRw76v4rBmET9xKPCTJC6BP5NtVLHBgX2y78z/sYf9zn0om9/ubLeORtBx9+u2i 8GGuHBFv/Hp65HQU1HssE7tZzF9tAZfDRn5seswlVlYl/35TrOIuAvXiMJgJdtXSJ2iU BD1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KO4Xvi7D; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v8si1193863otn.221.2019.12.11.08.10.39; Wed, 11 Dec 2019 08:10:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KO4Xvi7D; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388932AbfLKQIv (ORCPT + 99 others); Wed, 11 Dec 2019 11:08:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:33324 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731064AbfLKPMM (ORCPT ); Wed, 11 Dec 2019 10:12:12 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 272252465A; Wed, 11 Dec 2019 15:12:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576077131; bh=Nzzp9hIMZ7NzxvxCDwnBAX1leUi0Wk+JreeDjHwiWRA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KO4Xvi7DvTlYGREUVB5Slvr7Ls63iUdKE6Yx980dYhRFvyM55XwODAku9ETJzrciw 7qQyl40UDQ/21Tulo3+lcELAaSxHUDd0oUExn5zvtw6EHgqofGmtYsBqE0n+CoC+Gb 3AKxM2EktGx99oCA6Nse+8ZGR7Mrx6zMVzXUTgbQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pan Bian , Dmitry Torokhov , Sasha Levin Subject: [PATCH 5.3 028/105] Input: cyttsp4_core - fix use after free bug Date: Wed, 11 Dec 2019 16:05:17 +0100 Message-Id: <20191211150229.738315143@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191211150221.153659747@linuxfoundation.org> References: <20191211150221.153659747@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pan Bian [ Upstream commit 79aae6acbef16f720a7949f8fc6ac69816c79d62 ] The device md->input is used after it is released. Setting the device data to NULL is unnecessary as the device is never used again. Instead, md->input should be assigned NULL to avoid accessing the freed memory accidently. Besides, checking md->si against NULL is superfluous as it points to a variable address, which cannot be NULL. Signed-off-by: Pan Bian Link: https://lore.kernel.org/r/1572936379-6423-1-git-send-email-bianpan2016@163.com Signed-off-by: Dmitry Torokhov Signed-off-by: Sasha Levin --- drivers/input/touchscreen/cyttsp4_core.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/input/touchscreen/cyttsp4_core.c b/drivers/input/touchscreen/cyttsp4_core.c index 4b22d49a0f49a..6bcffc930384a 100644 --- a/drivers/input/touchscreen/cyttsp4_core.c +++ b/drivers/input/touchscreen/cyttsp4_core.c @@ -1990,11 +1990,6 @@ static int cyttsp4_mt_probe(struct cyttsp4 *cd) /* get sysinfo */ md->si = &cd->sysinfo; - if (!md->si) { - dev_err(dev, "%s: Fail get sysinfo pointer from core p=%p\n", - __func__, md->si); - goto error_get_sysinfo; - } rc = cyttsp4_setup_input_device(cd); if (rc) @@ -2004,8 +1999,6 @@ static int cyttsp4_mt_probe(struct cyttsp4 *cd) error_init_input: input_free_device(md->input); -error_get_sysinfo: - input_set_drvdata(md->input, NULL); error_alloc_failed: dev_err(dev, "%s failed.\n", __func__); return rc; -- 2.20.1