Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp470383yba; Wed, 15 May 2019 04:42:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqxxymLyGgfiYHtI4qrufUgPbDGDtC2t9zgNXZ+/w5m9gE0tyVHroiOBbxUum63gdlGIqyTu X-Received: by 2002:a63:f212:: with SMTP id v18mr40649376pgh.231.1557920530125; Wed, 15 May 2019 04:42:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557920530; cv=none; d=google.com; s=arc-20160816; b=tNgqO1IbLSMnB0okJXpRL2SOah83kQ2YU0UrcNP14hoRT2C4N/GCkvhAdChO69zZZZ GrNnwg59gwU7uleyZ6qQIjZYzfxRbikdWUWzCUr9o78Ck2bvJSZS2Bwp4K5vHb5wZdaO 0BdjK+7O9P5Shw1SfdmuOChz68VpyTSQj0QzYJ2bsVdtRfGGVyPzAuxedJ+I5+8uXR3W qCWXd+uAAu4NUkRz7DaQjYkadLWJ9Sb7iKwr+JVsMP/OEXrCJc/wT0pY0Qcl8TDk+qU6 WFwE8nIBbFibFRPzLkRK2liWysxFkoTPG6zCEpAQ5tUUR7EHZ19dKlTEPf65qcPvvETr FO9Q== 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=+fhvbFOASOZRz56rh/5RAy1xree9DJvzyH/6CYFRQXE=; b=c51iPPwgrB7EgE3D3p9O6vMn2FwCMHulmVc21ygOe7rn967ll1ZVwyr7MSGqnzvlpR jSmckYs4gud3LWfGgEy1wIqXVL9kyLd/JFasga23R9llyJwL1w/pPFAxKHu3BrjxXn04 2aUobFuU2eSarBvQrlULAiN4W2tkWk0P1OqOvxB/W1OoWi20vVpisJuXl0VBTZI+RzLe TNb7HDxHo4BbCjOhwYGbkOMEFObXlMoqy2dmlQSXeaMdWXWSmmrw2Vs/rup1miEq09np 9tlw9twB9LaPPZUl2adjX1vwX4bwEJvlnpwYhAhAenyINzfJ+jD5uqyQJvTO1zTmA3u5 B5Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=k4xqxnIo; 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 f14si1726488pfd.228.2019.05.15.04.41.55; Wed, 15 May 2019 04:42:10 -0700 (PDT) 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=k4xqxnIo; 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 S1732600AbfEOL3l (ORCPT + 99 others); Wed, 15 May 2019 07:29:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:40998 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732589AbfEOL3j (ORCPT ); Wed, 15 May 2019 07:29:39 -0400 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 EFC0A206BF; Wed, 15 May 2019 11:29:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557919778; bh=oy2kEOxIb6zKFnVnzlNUiUlY5ldvM1xcaN4RpTUfQFc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k4xqxnIomJCOlPtUnVMUKPJCqS89JcFPwZPUfIZryY5eki+Aeos036xy2FqQwGTPH XU5/BsXzjiYFhSlY1ndBDQzl4eJRzYb1lGzKmK1vSyxeNvgYpOOqimTZP47TAyG+nD eshuT7m/pCOiBRgCCnOcIM4alGkbltLYWGWQW1rQ= 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.0 091/137] Input: synaptics-rmi4 - fix possible double free Date: Wed, 15 May 2019 12:56:12 +0200 Message-Id: <20190515090700.146221339@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190515090651.633556783@linuxfoundation.org> References: <20190515090651.633556783@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 [ Upstream commit bce1a78423961fce676ac65540a31b6ffd179e6d ] The RMI4 function structure has been released in rmi_register_function if error occurs. However, it will be released again in the function rmi_create_function, which may result in a double-free bug. Signed-off-by: Pan Bian Signed-off-by: Dmitry Torokhov Signed-off-by: Sasha Levin --- drivers/input/rmi4/rmi_driver.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c index fc3ab93b7aea4..7fb358f961957 100644 --- a/drivers/input/rmi4/rmi_driver.c +++ b/drivers/input/rmi4/rmi_driver.c @@ -860,7 +860,7 @@ static int rmi_create_function(struct rmi_device *rmi_dev, error = rmi_register_function(fn); if (error) - goto err_put_fn; + return error; if (pdt->function_number == 0x01) data->f01_container = fn; @@ -870,10 +870,6 @@ static int rmi_create_function(struct rmi_device *rmi_dev, list_add_tail(&fn->node, &data->function_list); return RMI_SCAN_CONTINUE; - -err_put_fn: - put_device(&fn->dev); - return error; } void rmi_enable_irq(struct rmi_device *rmi_dev, bool clear_wake) -- 2.20.1