lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220203135418.2252624-1-o.rempel@pengutronix.de>
Date:   Thu,  3 Feb 2022 14:54:18 +0100
From:   Oleksij Rempel <o.rempel@...gutronix.de>
To:     William Breathitt Gray <vilhelm.gray@...il.com>
Cc:     Oleksij Rempel <o.rempel@...gutronix.de>,
        linux-kernel@...r.kernel.org,
        Pengutronix Kernel Team <kernel@...gutronix.de>,
        David Jander <david@...tonic.nl>,
        Robin van der Gracht <robin@...tonic.nl>,
        linux-iio@...r.kernel.org, Jonathan Cameron <jic23@...nel.org>
Subject: [PATCH v1] counter: fix NULL pointer dereference on counter_comp_u8_store()

Current kernel will report NULL pointer dereference with following
back trace:
  interrupt_cnt_enable_write from counter_comp_u8_store+0xc0/0xf4
  counter_comp_u8_store from dev_attr_store+0x24/0x30
  dev_attr_store from sysfs_kf_write+0x48/0x54
  sysfs_kf_write from kernfs_fop_write_iter+0x128/0x1c8
  kernfs_fop_write_iter from vfs_write+0x124/0x1b4
  vfs_write from ksys_write+0x88/0xe0
  ksys_write from sys_write+0x18/0x1c
  sys_write from ret_fast_syscall+0x0/0x1c

Add missing dev_set_drvdata() to fix it.

Signed-off-by: Oleksij Rempel <o.rempel@...gutronix.de>
---
 drivers/counter/counter-core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/counter/counter-core.c b/drivers/counter/counter-core.c
index 7e0957eea094..1de16d5e9fbc 100644
--- a/drivers/counter/counter-core.c
+++ b/drivers/counter/counter-core.c
@@ -98,6 +98,8 @@ struct counter_device *counter_alloc(size_t sizeof_priv)
 	counter = &ch->counter;
 	dev = &counter->dev;
 
+	dev_set_drvdata(dev, counter);
+
 	/* Acquire unique ID */
 	err = ida_alloc(&counter_ida, GFP_KERNEL);
 	if (err < 0)
-- 
2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ