diff options
| author | Victoria Votokina <Victoria.Votokina@kaspersky.com> | 2025-10-10 13:52:41 +0300 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-10-29 14:10:30 +0100 |
| commit | 4af0eedbdb4df7936bf43a28e31af232744d2620 (patch) | |
| tree | df719c5b70c55a31846dd1de5f9852e6ac8f6721 | |
| parent | 3a3b8e89c7201c5b3b76ac4a4069d1adde1477d6 (diff) | |
| download | linux-4af0eedbdb4df7936bf43a28e31af232744d2620.tar.gz linux-4af0eedbdb4df7936bf43a28e31af232744d2620.tar.bz2 linux-4af0eedbdb4df7936bf43a28e31af232744d2620.zip | |
most: usb: hdm_probe: Fix calling put_device() before device initialization
commit a8cc9e5fcb0e2eef21513a4fec888f5712cb8162 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: 97a6f772f36b ("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>
| -rw-r--r-- | drivers/most/most_usb.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/most/most_usb.c b/drivers/most/most_usb.c index 3d8163bb7b46..10064d7b7249 100644 --- a/drivers/most/most_usb.c +++ b/drivers/most/most_usb.c @@ -1097,7 +1097,7 @@ err_free_cap: err_free_conf: kfree(mdev->conf); err_free_mdev: - put_device(&mdev->dev); + kfree(mdev); return ret; } |
