Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp739542rdb; Fri, 26 Jan 2024 09:10:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IFTrp7yOkBl0AfiTsHoK9FPPwK3R6dsh6tAJ+bITXh3XbgxS5n+tdh4oTlXG75UxEjYbROj X-Received: by 2002:a05:6a20:6709:b0:19c:54dc:3268 with SMTP id q9-20020a056a20670900b0019c54dc3268mr1305534pzh.74.1706289050968; Fri, 26 Jan 2024 09:10:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706289050; cv=pass; d=google.com; s=arc-20160816; b=TalNehbrxxYIAFqHzmBTMjEHrK4d9gqkLRItNvbuQqXMyR9vF9+9/CgyMz9DrVJwyM E2BmwXYGy0rJ/iUz+uhreDwxsUPfugQpKgXKniSMPthgXHgwkuGAJEjert9DA3RjrJyK yLTNQWLeVpq4Sh0ECq5Y7aRissWkBTa9BlH/KHrr4G1JbZmGzHxUm3EWS8/zFz3Zd+pf kebwn1av0QpnlnSAZhxKrjJATpuNLkBSrlogt55f0CGQDI0e5bH5C1gcT4NcnAm1VpdX kfsCUCPFMaPzFzbu0W3Al74ud6KwJ43a8C1P2vGL0cAJ8wGR2ZqoONwSOeMJJ4EQktcf K/cQ== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=bg3HH+ThJMyAJlUJhLVGp/Wx+XTnNSpgZ6Bzxcok+uc=; fh=nIUXLC4LIPgPybkziEgAGgezA+RhgdKLdgPiv8R2fEQ=; b=pYgIc2rjUVSdGB9xPvtL05sZCpJaNMtWdElajRdYqrnFOdlfPq9wktHCfuAGRjtN3l YsLakhkzyyOaZ4+D4Ei772R/YqsCXyLp/G84+1tcm3gEWWG3E9SnGp5XHOU/vblOrtd+ kklwBIW6u285nSesp/W+P7+/9enB0cvzaRVSet12d407YXODRutbUcM0qZvlvTcvDCc5 TmqoIRrD7quD0WK/ycFjtfrSMnta46tNi8H9ux1KNglw+jrxTbks9jKeWN4I7Duicwh6 i18oMZtEEwwGlsgLRiHeURKRF1dGcp7+3364fiZPdxcjLjguvN/Ow0eJo8DKumN8VGk3 1shA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=c73abWvK; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-40399-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40399-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 q5-20020a056a00084500b006de0a16bcf0si400012pfk.167.2024.01.26.09.10.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 09:10:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-40399-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=c73abWvK; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-40399-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40399-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 9ABF4281F36 for ; Fri, 26 Jan 2024 17:10:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 77867200C9; Fri, 26 Jan 2024 17:10:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="c73abWvK" 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 97E8C200A6; Fri, 26 Jan 2024 17:10:33 +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=1706289033; cv=none; b=LJOwKs+yVHR4qx+Y8AHEVOhlEpT4I2wcpZEoyZhNtF82yXglGkImRvwSzNJYWarAQSlYMVKrbgiwva5wzsf+iikrGTW1RKCGymo+ds4gVFLECYX1gKzrZzvc71sFBqlrgWyGyiFFTOgfftAwWZHS76xwlRMOw/R1oo53VYabbhM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706289033; c=relaxed/simple; bh=DEHxLqizhVae7GfdD+IYf2Qhwx8aaBFy0kmp5GGvB3M=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=h4Bastt7cVJrUyFIif2UWuoTsugGg8zqIpYg20AboMoDJiuyeme4Zw4GF6MqTTxDbyuGIuQ6tiTErpr3Y+RX8HbDmBMdOivzUF4pe7f9XsvnZGXlhAjYMLYENyBOAYeXztYnnNhj96rURy11mpPk77vqbRlNH2rT4TsrmxvfWsw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=c73abWvK; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69CB1C433C7; Fri, 26 Jan 2024 17:10:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706289033; bh=DEHxLqizhVae7GfdD+IYf2Qhwx8aaBFy0kmp5GGvB3M=; h=From:To:Cc:Subject:Date:From; b=c73abWvKtRcIGlcqIFirNK8ljnzEEB6kiz37s998Hb9Vw0N9xH+v3zXLmRk3Tqyac W3W+4bLnAhkJiG+rCT00MOouACTON12NsDin4kcvSlu8Cm2mvvtB7q1roMj1etB0SZ urBAu1y1mKHVP+ex3XjuPvy4n5R2kzQgWMnNv4DSgqUnICBvu4EANwrwhfAvksmFyE +bQpw7L0KZNXSyRPEV/62g8MFLt30tdHDWjZDfz+ABIUHx1EFZX3iUNbbEMbk8+7zo 4hreBHGf+RMtIKbWcAsf17NBb9lVBjEPQz0xi+29jD1aBMMkk/o2A6uarh2CKlsJqu qi5pR8SDswMAg== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1rTPj4-000000000YW-0YGh; Fri, 26 Jan 2024 18:10:46 +0100 From: Johan Hovold To: Jiri Kosina , Benjamin Tissoires Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org, Douglas Anderson Subject: [PATCH] HID: i2c-hid-of: fix NULL-deref on failed power up Date: Fri, 26 Jan 2024 18:09:01 +0100 Message-ID: <20240126170901.893-1-johan+linaro@kernel.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit A while back the I2C HID implementation was split in an ACPI and OF part, but the new OF driver never initialises the client pointer which is dereferenced on power-up failures. Fixes: b33752c30023 ("HID: i2c-hid: Reorganize so ACPI and OF are separate modules") Cc: stable@vger.kernel.org # 5.12 Cc: Douglas Anderson Signed-off-by: Johan Hovold --- drivers/hid/i2c-hid/i2c-hid-of.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/hid/i2c-hid/i2c-hid-of.c b/drivers/hid/i2c-hid/i2c-hid-of.c index c4e1fa0273c8..8be4d576da77 100644 --- a/drivers/hid/i2c-hid/i2c-hid-of.c +++ b/drivers/hid/i2c-hid/i2c-hid-of.c @@ -87,6 +87,7 @@ static int i2c_hid_of_probe(struct i2c_client *client) if (!ihid_of) return -ENOMEM; + ihid_of->client = client; ihid_of->ops.power_up = i2c_hid_of_power_up; ihid_of->ops.power_down = i2c_hid_of_power_down; -- 2.43.0