]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iio: core: fix ioctl handlers removal
authorTomasz Duszynski <tomasz.duszynski@octakon.com>
Fri, 23 Apr 2021 08:02:44 +0000 (10:02 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 May 2021 08:29:55 +0000 (10:29 +0200)
commit11e1cae5da4096552f7c091476cbadbc0d1817da
tree7fcc5376b686489f0961af406254c6541fd52db0
parent4f33f7b3210fdcd3117e3ef23f32ce5e5d319b66
iio: core: fix ioctl handlers removal

commit 901f84de0e16bde10a72d7eb2f2eb73fcde8fa1a upstream.

Currently ioctl handlers are removed twice. For the first time during
iio_device_unregister() then later on inside
iio_device_unregister_eventset() and iio_buffers_free_sysfs_and_mask().
Double free leads to kernel panic.

Fix this by not touching ioctl handlers list directly but rather
letting code responsible for registration call the matching cleanup
routine itself.

Fixes: 8dedcc3eee3ac ("iio: core: centralize ioctl() calls to the main chardev")
Signed-off-by: Tomasz Duszynski <tomasz.duszynski@octakon.com>
Acked-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Cc: <Stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210423080244.2790-1-tomasz.duszynski@octakon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/industrialio-core.c