Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp33933lqz; Fri, 29 Mar 2024 07:47:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXC7JTkR6n3Sv3hrjw0kg0/jCJVddX3tkEPkG6Tubp7KZ0FGEQ5V7s+q3gHNCTQEaTxC/HatN39zitbe/rDt5wrZ/+MtFoIYqzrCW/Cbg== X-Google-Smtp-Source: AGHT+IGcaAcINTh29/+fpHQlyeBj6ydUh/F60bgoHOGkvTfT3x1V4QNeCdkYBltY/Zg9cZ4vg6/8 X-Received: by 2002:a05:6a21:339d:b0:1a5:6a94:7641 with SMTP id yy29-20020a056a21339d00b001a56a947641mr8197381pzb.7.1711723629486; Fri, 29 Mar 2024 07:47:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711723629; cv=pass; d=google.com; s=arc-20160816; b=iGmJueFdkKG0A9lpnffgPnWsx/hmA5rax7RtkalgyjpMZ9jUvx5i7OFESjmq2Cd7jh 2+49QKQ7k3S76uaBLWubI0GNNuhCofPdYEqGPlFgiB7PLg4fzKV9Ug4MoBUbkp2AGIw/ sDYhnQgG1g8T5Koon/sUhhn61quLwnLngmGBJYiERHpCtGTWd79HtlBb+5VzWCdATHZG vJ9bpq6SghFvmJaT4VhWUfo4BprGyZlbiBS2kMCN7ymCHe8iLmsbSq/YxsZbyBvECc0J AIc1AoyrAyMGi4Gsqr8ne6OPVtT2sndnqZ+rG779CDLTbQC53IrCLV9HkagkbvKMFjqb +h+A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=/+VReKPN3xD/MC140WLwr3u1H6NnQgkJ7ftz8WAQUAE=; fh=WdXGPo2Ooj0DVr1dTGke4FPdW6uZL020L8RFtY6+Qeo=; b=g73ev/Bvf96Iw67NXFQF8n+jfFn3tUUmS4F9XkVy5VEC6PwOjcvfZKaGntstrqaXWP 7x5vFb4NYaDl6drICQH8gyyh7hosJiO0EW7EkhzTNBebYF/PokJUgUJzhxDdCyhhjPPh az1Y8KqWCm43Ul0HgDJ0CkG8mO9c1/oNUIXVNlFqXrKmKSFQQoPGcAOSTvN4YCLrLuun fpgXHT7qlTHicKt7QGPC9FL1lex8P4zdRZlKpAp9HBfuilqs794jWv9FDv5Z/78GOiSi FHRxawYAqQI1XPOJFeLbz5SuhoLjxEe5X0GQIkZtgGZZTrUvcwVWywpC8uajBumWj2Yy Z3JA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pn5aI97U; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-124886-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124886-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id g18-20020a63fa52000000b005dc42014e30si3768258pgk.692.2024.03.29.07.47.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 07:47:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-124886-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pn5aI97U; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-124886-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124886-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id E143EB278FE for ; Fri, 29 Mar 2024 14:18:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9EFA921C19D; Fri, 29 Mar 2024 12:46:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pn5aI97U" 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 C2F2D14AD22; Fri, 29 Mar 2024 12:46:08 +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=1711716368; cv=none; b=GD3ceJeYucyYgMPX3GgmEqhjSd2kmmV7ud2zhvCuekEk1Pmu5aE9X9veC9FhTeNoluV1uGrCE0Qulb2rFyP/1WYivL/muM4OTk39VQKydOqxVUslB2iy5wYSl36Hy7fEjrDNo2gHxDlQrRZWKReQMfqUvaJF/xg2WyADA77IOAo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711716368; c=relaxed/simple; bh=KrtLP2+xQcj9c07YWsMGvUeNakHzSGnJr64CquHleek=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=t6f3n799c6tkZpP4LcngqNucz4mh+bZiO71pzpzPxQFk8CFkIyEV9+i+yUBkiqDTbW0Jqc0kdK1eynddE6BSKbPAy0LC7LQFhs5Hemdhl1ScxBpAJC6IevVuMja585jMe102RqGMS8ZlIpfg1T33Nku6ufEjun7SYGwp8kFeR/w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pn5aI97U; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC96DC4166B; Fri, 29 Mar 2024 12:46:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711716368; bh=KrtLP2+xQcj9c07YWsMGvUeNakHzSGnJr64CquHleek=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pn5aI97UgpuTaw03E/mMdtMViJyTVjJrWD0X0Tri5YLbUVG1GHzYZ6Qq06UOsLZS0 UdMYxmtJJrddhQxGg5WAtzCF6kFlbb6jv6G4mXIDin7Dbn4BanefvjHSuY9gm5X2w1 8F8LSb6F0d+rfmZlPwsTRyeNtybLkhh5SlRMwY0ZtijgTUP0pAn1DxDf7Rr9LWU0JA FMHG+zhcevPMMnLmm+KK1wHT9jhTV/8ZDvEGFxs3D3p7imoCvy80ZerXvLiA9+k/8x AXGVszP2roaL+l97JVOnSmpfKnJzGtjrD567i2Eoq4jnzQYJLLSOpIwL8P6KZZlzql k3o8DgzGLi/PA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Kunwu Chan , Dmitry Torokhov , Sasha Levin , minipli@grsecurity.net, linux-input@vger.kernel.org Subject: [PATCH AUTOSEL 6.1 02/52] Input: synaptics-rmi4 - fail probing if memory allocation for "phys" fails Date: Fri, 29 Mar 2024 08:44:56 -0400 Message-ID: <20240329124605.3091273-2-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240329124605.3091273-1-sashal@kernel.org> References: <20240329124605.3091273-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.1.83 Content-Transfer-Encoding: 8bit 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 258d5fe3d395c..aa32371f04af6 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