Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp824268ybl; Wed, 11 Dec 2019 08:04:24 -0800 (PST) X-Google-Smtp-Source: APXvYqyWv0JkMxMVBNUOKGpTWTn5xfT1/UuZVkBAcE53tlZ+JoFCqFtfF3MOfnWfH2L+9wgehEqs X-Received: by 2002:a9d:f61:: with SMTP id 88mr2717878ott.234.1576080264795; Wed, 11 Dec 2019 08:04:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576080264; cv=none; d=google.com; s=arc-20160816; b=TdRTnmbPR5EjiNoeB+2OuzRjZvPvOyYjTLaNe6BUCtfMKhfy6KH1NNCc4tvzrQhLQU 4fs/wv9XgOu993632xfrTEd6xpnR0uva/C4XVT0EUm68ZoUemXxpcS3qAD8xz5TOmeDg O8NIXgbd10RmTXVxihl/WByhXyR2HAHEgtsO7+a4LtxD1er5W49Yo+2+jjI5LvJxyesb NvSx8LnbdIHu8TbdlDjEwvoSVio6w66VoNhBxpx5yvDAQWNnoolljTWFBqwr1oRLEVm8 q+pyzUe0OMefM4VjGz2bJXAaMS2tJ0WboA8WZbgcvJKidWepLxQV4tZ7hh3ggrXn/eqB pqXA== 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=NXtZpmPGnXI60cYURmHVPbonWFSQdRVUFr8Jo6ifXvE=; b=GQmHS8fKAZmNQRO3y6BNfh9vZRFp5j3e0mT0kXM9V4FuF1EcyJCtLB305XPF8YmzE6 Rnt1BoSemlFLqSTa6vQATI2FACRDgDHqrA2GrRNV+B/cN8uxXUvkH+ArDSRHmWBb1qpD khoPMRit6gJRLsQG56KWxaj/jjwAUA7cOaOpcsMdATyWQvGwgsvHX6VBEQZ8LJw+WB/z VQL6uKb2mIR5hbFhl/T8Ac6FlB8XQ6CHT1PclIA0NxHyPnfoLkcU9EBp/c3UJb7+YogV c2GMw7/6LhHkgU+mTHRRLqhe4fiWi9PKLFXKv5r2IaQwUUy3Ixbz3T7xOUhAxav3htZo lEqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vkOScIML; 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 t18si1386681oij.133.2019.12.11.08.04.06; Wed, 11 Dec 2019 08:04:24 -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=vkOScIML; 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 S2387860AbfLKQBV (ORCPT + 99 others); Wed, 11 Dec 2019 11:01:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:37290 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730970AbfLKPNd (ORCPT ); Wed, 11 Dec 2019 10:13:33 -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 0608424654; Wed, 11 Dec 2019 15:13:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576077213; bh=YEsL8fnV5oRLJ3Z306dsBmpxsyykbyKz9/Cdu3UFYAE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vkOScIMLeoZq1mxGQybnWTGoGngPfkMhvQ1RKyCPx98Wll8FBrAzp05T4X0gOnRi6 bpDrHv1R/Arv2OxiJ/Foh0fIEQDX2qeqR+YJuTmG8z818KgK2ru1uyLuyG4JsyFfb1 CzeBzy/KEtQLV/oNG9jI/sjPV2FAQhDlsG3pn6YQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, emamd001@umn.edu, Navid Emamdoost , Dmitry Torokhov Subject: [PATCH 5.3 060/105] Input: Fix memory leak in psxpad_spi_probe Date: Wed, 11 Dec 2019 16:05:49 +0100 Message-Id: <20191211150245.026703773@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: Navid Emamdoost In the implementation of psxpad_spi_probe() the allocated memory for pdev is leaked if psxpad_spi_init_ff() or input_register_polled_device() fail. The solution is using device managed allocation, like the one used for pad. Perform the allocation using devm_input_allocate_polled_device(). Fixes: 8be193c7b1f4 ("Input: add support for PlayStation 1/2 joypads connected via SPI") Signed-off-by: Navid Emamdoost Acked-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/joystick/psxpad-spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/input/joystick/psxpad-spi.c +++ b/drivers/input/joystick/psxpad-spi.c @@ -292,7 +292,7 @@ static int psxpad_spi_probe(struct spi_d if (!pad) return -ENOMEM; - pdev = input_allocate_polled_device(); + pdev = devm_input_allocate_polled_device(&spi->dev); if (!pdev) { dev_err(&spi->dev, "failed to allocate input device\n"); return -ENOMEM;