Skip to content

Commit 901f84d

Browse files
octakoncomjic23
authored andcommitted
iio: core: fix ioctl handlers removal
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: 8dedcc3 ("iio: core: centralize ioctl() calls to the main chardev") Signed-off-by: Tomasz Duszynski <[email protected]> Acked-by: Alexandru Ardelean <[email protected]> Cc: <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
1 parent f73c730 commit 901f84d

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

drivers/iio/industrialio-core.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1926,9 +1926,6 @@ EXPORT_SYMBOL(__iio_device_register);
19261926
**/
19271927
void iio_device_unregister(struct iio_dev *indio_dev)
19281928
{
1929-
struct iio_dev_opaque *iio_dev_opaque = to_iio_dev_opaque(indio_dev);
1930-
struct iio_ioctl_handler *h, *t;
1931-
19321929
cdev_device_del(&indio_dev->chrdev, &indio_dev->dev);
19331930

19341931
mutex_lock(&indio_dev->info_exist_lock);
@@ -1939,9 +1936,6 @@ void iio_device_unregister(struct iio_dev *indio_dev)
19391936

19401937
indio_dev->info = NULL;
19411938

1942-
list_for_each_entry_safe(h, t, &iio_dev_opaque->ioctl_handlers, entry)
1943-
list_del(&h->entry);
1944-
19451939
iio_device_wakeup_eventset(indio_dev);
19461940
iio_buffer_wakeup_poll(indio_dev);
19471941

0 commit comments

Comments
 (0)