From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F8BE144D34; Thu, 11 Apr 2024 10:11:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712830287; cv=none; b=aaw60pdfBZ/k4UA5FCujMAxlCeAMMSsCopRx5CCz2IuCNDleDhV7eyUurXo0RDaKVSpOqm+MZFJlWAm8uI4Q1h1cgjrWsJ718+sQUi2mO93GdZtDboi0DMqzCC7RUrSbjQuWb0CTDFfZUluEKTMffAHe3fXuw0oaenQ2eWyrFQI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712830287; c=relaxed/simple; bh=7YcsASw4lNY4zzy3mzHQUl4CJRalH4wlewE9DWO1qOs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=os32v0/3cu58uGUwxZrtjKBwX16o0FXdUZa2L3CUUFtSnrFtxIxJmu7ZHEpUExDkT3Giv1XfZZK0zWOt4jNP1+NNAVVkEclAIAHQSE1X2vsXkXAX2mGLCxBnnn8s0sHACHig60TVjp5pOzDmVnyXdeQIVmm1//jkO8Kk82KtZ3k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=pORajXCb; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="pORajXCb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9AA7C433C7; Thu, 11 Apr 2024 10:11:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1712830287; bh=7YcsASw4lNY4zzy3mzHQUl4CJRalH4wlewE9DWO1qOs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pORajXCbNmrDU9f4ovJk1O5k6mnuuC05zXzdQTCeCq4CU1g8Q0U/1rVysa0+feqlS MmLhOZ5dGLrHAiUldACmYZFYd7vGlk0HlWPGTl21kEe1LkPa4Kwz3NKYQYC8Va/Sjm TRjGdaam0zslZZT1hjimvWJ+/OOvIEr3U4nt1PGM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Kunwu Chan , Dmitry Torokhov , Sasha Levin Subject: [PATCH 6.8 060/143] Input: synaptics-rmi4 - fail probing if memory allocation for "phys" fails Date: Thu, 11 Apr 2024 11:55:28 +0200 Message-ID: <20240411095422.723246812@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240411095420.903937140@linuxfoundation.org> References: <20240411095420.903937140@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.8-stable review patch. If anyone has any objections, please let me know. ------------------ From: Kunwu Chan [ Upstream commit bc4996184d56cfaf56d3811ac2680c8a0e2af56e ] While input core can work with input->phys set to NULL userspace might depend on it, so better fail probing if allocation fails. The system must be in a pretty bad shape for it to happen anyway. Signed-off-by: Kunwu Chan Link: https://lore.kernel.org/r/20240117073124.143636-1-chentao@kylinos.cn Signed-off-by: Dmitry Torokhov Signed-off-by: Sasha Levin --- drivers/input/rmi4/rmi_driver.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c index 42eaebb3bf5cc..ef9ea295f9e03 100644 --- a/drivers/input/rmi4/rmi_driver.c +++ b/drivers/input/rmi4/rmi_driver.c @@ -1196,7 +1196,11 @@ static int rmi_driver_probe(struct device *dev) } rmi_driver_set_input_params(rmi_dev, data->input); data->input->phys = devm_kasprintf(dev, GFP_KERNEL, - "%s/input0", dev_name(dev)); + "%s/input0", dev_name(dev)); + if (!data->input->phys) { + retval = -ENOMEM; + goto err; + } } retval = rmi_init_functions(data); -- 2.43.0