Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp1071095lqh; Fri, 29 Mar 2024 06:31:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXCIfaA2sRG8q+r2158ekvEaTuGKU1eFda6p3C+u8jMDJ9l4pK5PXbmYjgcIzF7i8xSYAxwtLC6DCe9um7DTNCJSlFuOUKnJszDjU4yEw== X-Google-Smtp-Source: AGHT+IGSkMhM+HQ9rvKfJ5YMZkH6UlNXJHez6FL5R6RQVmNxx7j/ePstJ+RwxdiBBGkJiGcadJLU X-Received: by 2002:a05:6a20:d80f:b0:1a5:6f8d:e578 with SMTP id iv15-20020a056a20d80f00b001a56f8de578mr2609922pzb.55.1711719098224; Fri, 29 Mar 2024 06:31:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711719098; cv=pass; d=google.com; s=arc-20160816; b=HLt3e7/AdPK03MMbhmSpPKofkjCjVlzGYdUaX+m3isWQtdgUsh0+JgoUqzF1W/+SLp MTxnRXyiAPaphb4geibDJoa52gi1XHBgNUn6mE1syn6qQLJR80gdr5CiWWD9BnQtxYm0 /aY8GySNljbNPa6Za21Jim1J6Az1h0jb+hSmfDLS1jUgKV0fvKIdUF9JCnGyod188G9m 1s+F8M7sXZNG5XF+V1jcQnHK+EIiCBTK4qPJp8pcaLHGKp/JiwbJM+0HTDmj/HfdHZkw QuAM3UT1m/r8PcwobaLnFpJrUQARn+N35Af3i7WijU6HgFRnG/6Mrn6LGRTTdNGokMQb 8+7g== 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=MSTIb+uxQSgT8AGPV+yV6ezhyxyse8aq/5yhrD9m8ac=; fh=WdXGPo2Ooj0DVr1dTGke4FPdW6uZL020L8RFtY6+Qeo=; b=m3yfN0bVTrP2D7ZBQizR1vKJ3SaSzX08Z9bCsQDzUd0V+17TddAzpgfQtiyWL5XG+T HNtCHZEe40RvjuPRBFRVoYbfdVcEL0ZPV/HoxRUUod1092EG8WJ5EkxwfedDTERxBo7i VeGYyXGdPsuxWj2yKki/sI1S+TcOvcDNbrlOEjbc8evlKRMTW+AsUZ6gibz3dPxwl0vP ZVf0tLgkGPCs0g5tfugtSh4uGmCklupQqyH9qwuM9F4oUf2oXWw3Z7RYqVBxIBQ5e2Sq StieEsTUvzQM4n30DPY5AZsWHDJmKbYUn5iCQAS+iaDL+jAoSdzPXj7PMY/r6iOMdztU x8Jw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OqNzNCqN; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-124713-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124713-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id j16-20020a634a50000000b005dc1bb540cesi3594965pgl.76.2024.03.29.06.31.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 06:31:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-124713-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OqNzNCqN; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-124713-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124713-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id B4CF9294421 for ; Fri, 29 Mar 2024 13:31:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 562FD144D34; Fri, 29 Mar 2024 12:39:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="OqNzNCqN" 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 701A3137765; Fri, 29 Mar 2024 12:39:28 +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=1711715968; cv=none; b=dE27jU/qpoTbvwppzTQt6GksQYONW69Uzl7zT2wy1xALvnuFUGJl6+IddRk7rgt8NfEWMgVZKzUMpgJ1biGH0somVZC3HAE3CSxmgRC4HhygPD9oUWkZO3UTefTBKN6tlJOb00tOfiOOLcp4z4FI8QXhOGKpjLo/4LB5HKofYcQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711715968; c=relaxed/simple; bh=V6Qx7IEjDNjanIBYd/aF19fx1kAFtwWrPFkYM5xzcCU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Is67bdZvcCV35G5YKYoofY8Bw0t0LvhNu7ZGMJ0Gk956A1X0eFZrJZQ46YTY/hJLWk2m0i2peCpB+8dLrUBx2GrjvEw3g2mmZA5uEAQpAUHvf2To/vnaZKlHR0DY0T4f2cQIUfZ0wXUp3pAGflNeknZF78d3wtbecVuqNjMJ1Mc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=OqNzNCqN; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46513C43390; Fri, 29 Mar 2024 12:39:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711715968; bh=V6Qx7IEjDNjanIBYd/aF19fx1kAFtwWrPFkYM5xzcCU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OqNzNCqN/vsZUyd1TvTQHzrB7kQ5G9j/v5rCCF9XM8Cg0bLpPrvtAiW6BKvff1grw btmh2htK+Wfl7ign9g+9+6i+i+ZafYBNCKRYKWXuzbGnVfQx5RtSw01cpwdR6LYs5G 0eC3uJYcoWiUndxnCSOBz3I8CwgoKraxzYCBGXfj4MF6102irbEE6tyGCmkE31LXjk mulrRuIQgOqpWIDGozntjy0Al1lmYGtHdKx9g59lOIbEZGFZX+Il2eib+yD1mxXD67 ElqOaBy7NzGDiUdqL69V+CaBE8KHbwC1+MLXIyvM/VWrOwgglbiU36tcFVBexBaBj3 1gaSYRFRSSYvA== 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.8 04/98] Input: synaptics-rmi4 - fail probing if memory allocation for "phys" fails Date: Fri, 29 Mar 2024 08:36:35 -0400 Message-ID: <20240329123919.3087149-4-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240329123919.3087149-1-sashal@kernel.org> References: <20240329123919.3087149-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.8.2 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 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