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 F016432E729 for ; Thu, 26 Feb 2026 23:52:54 +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=1772149975; cv=none; b=CcXYhQD1sMEv/vtBdRyu2EmfPBtnKzsrsZc6rJV0S1eem5ul30YxiPYJBnPB1gZaClpScJC9cpFONudYeEjzKpjfbAxvHHvsCjPupxzPaVv5LH4m5G+AyAzpKGW9YBQeAiQY6d8JbDle45N689nST5fZX34cWKOXL7KFKktEyjs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772149975; c=relaxed/simple; bh=ppreC3OdAbzLJ4YgGpv9hvE2peAy5uNspHXrHS6qXDY=; h=Subject:To:From:Date:Message-ID:MIME-Version:Content-Type; b=V9PGy+IfAcbuDOQ+74jki92TU84A4dRUXpuAWAvP/SQkvKe82EQFpK6gewGozmsw0rgGIyokn+JfcfX1T8Y+zsv/gRwKQsSKM/U/NrHbrq+msCF6MLMerbHew3X65ND4Ebe0k/AnlyHeHUc84UQLGNgpunYLWuMG8E7pzYb5Plw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=cz0mZ5LC; 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="cz0mZ5LC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8567C116C6; Thu, 26 Feb 2026 23:52:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1772149974; bh=ppreC3OdAbzLJ4YgGpv9hvE2peAy5uNspHXrHS6qXDY=; h=Subject:To:From:Date:From; b=cz0mZ5LCS7J1Hl3GJTmciL0kN5W4VzAAhMb0K4L8L/2C6+sK5wWF++pa2Rf0GoUPD iLVkHtnEP6jYlV1SS+b0nFO64gY8sazyngTffn0dNFNqeitxyRpMAmXO5TUXYbWK7q MlQNwwwr7rMuSZqnFS4pmDa7YFDe1LlXL/9wZnyk= Subject: patch "iio: imu: adis: Fix NULL pointer dereference in adis_init" added to char-misc-linus To: radu.sabau@analog.com,Jonathan.Cameron@huawei.com,Stable@vger.kernel.org,andriy.shevchenko@intel.com,antoniu.miclaus@analog.com From: Date: Thu, 26 Feb 2026 15:52:37 -0800 Message-ID: <2026022637-custodian-much-8918@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit This is a note to let you know that I've just added the patch titled iio: imu: adis: Fix NULL pointer dereference in adis_init to my char-misc git tree which can be found at git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git in the char-misc-linus branch. The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.) The patch will hopefully also be merged in Linus's tree for the next -rc kernel release. If you have any questions about this process, please let me know. >From 9990cd4f8827bd1ae3fb6eb7407630d8d463c430 Mon Sep 17 00:00:00 2001 From: Radu Sabau Date: Fri, 20 Feb 2026 16:16:41 +0200 Subject: iio: imu: adis: Fix NULL pointer dereference in adis_init The adis_init() function dereferences adis->ops to check if the individual function pointers (write, read, reset) are NULL, but does not first check if adis->ops itself is NULL. Drivers like adis16480, adis16490, adis16545 and others do not set custom ops and rely on adis_init() assigning the defaults. Since struct adis is zero-initialized by devm_iio_device_alloc(), adis->ops is NULL when adis_init() is called, causing a NULL pointer dereference: Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000 pc : adis_init+0xc0/0x118 Call trace: adis_init+0xc0/0x118 adis16480_probe+0xe0/0x670 Fix this by checking if adis->ops is NULL before dereferencing it, falling through to assign the default ops in that case. Fixes: 3b29bcee8f6f ("iio: imu: adis: Add custom ops struct") Signed-off-by: Radu Sabau Reviewed-by: Andy Shevchenko Reviewed-by: Antoniu Miclaus Cc: Signed-off-by: Jonathan Cameron --- drivers/iio/imu/adis.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/imu/adis.c b/drivers/iio/imu/adis.c index d160147cce0b..a2bc1d14ed91 100644 --- a/drivers/iio/imu/adis.c +++ b/drivers/iio/imu/adis.c @@ -526,7 +526,7 @@ int adis_init(struct adis *adis, struct iio_dev *indio_dev, adis->spi = spi; adis->data = data; - if (!adis->ops->write && !adis->ops->read && !adis->ops->reset) + if (!adis->ops) adis->ops = &adis_default_ops; else if (!adis->ops->write || !adis->ops->read || !adis->ops->reset) return -EINVAL; -- 2.53.0