linux/drivers/most
Victoria Votokina ad2be44882 most: usb: hdm_probe: Fix calling put_device() before device initialization
commit a8cc9e5fcb upstream.

The early error path in hdm_probe() can jump to err_free_mdev before
&mdev->dev has been initialized with device_initialize(). Calling
put_device(&mdev->dev) there triggers a device core WARN and ends up
invoking kref_put(&kobj->kref, kobject_release) on an uninitialized
kobject.

In this path the private struct was only kmalloc'ed and the intended
release is effectively kfree(mdev) anyway, so free it directly instead
of calling put_device() on an uninitialized device.

This removes the WARNING and fixes the pre-initialization error path.

Fixes: 97a6f772f3 ("drivers: most: add USB adapter driver")
Cc: stable <stable@kernel.org>
Signed-off-by: Victoria Votokina <Victoria.Votokina@kaspersky.com>
Link: https://patch.msgid.link/20251010105241.4087114-3-Victoria.Votokina@kaspersky.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2025-10-29 14:03:13 +01:00
..
configfs.c staging: most: move core files out of the staging area 2020-03-24 13:42:44 +01:00
core.c most: core: Drop device reference after usage in get_channel() 2025-08-28 16:24:35 +02:00
Kconfig drivers: most: add ALSA sound driver 2021-03-23 10:03:13 +01:00
Makefile drivers: most: add ALSA sound driver 2021-03-23 10:03:13 +01:00
most_cdev.c MOST: cdev: rename 'mod_init' & 'mod_exit' functions to be module-specific 2021-07-21 15:46:22 +02:00
most_snd.c drivers: most: add ALSA sound driver 2021-03-23 10:03:13 +01:00
most_usb.c most: usb: hdm_probe: Fix calling put_device() before device initialization 2025-10-29 14:03:13 +01:00