Skip to content

Commit a8cc9e5

Browse files
Victoria Votokinagregkh
authored andcommitted
most: usb: hdm_probe: Fix calling put_device() before device initialization
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: 97a6f77 ("drivers: most: add USB adapter driver") Cc: stable <[email protected]> Signed-off-by: Victoria Votokina <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 4b12709 commit a8cc9e5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/most/most_usb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,7 @@ hdm_probe(struct usb_interface *interface, const struct usb_device_id *id)
10971097
err_free_conf:
10981098
kfree(mdev->conf);
10991099
err_free_mdev:
1100-
put_device(&mdev->dev);
1100+
kfree(mdev);
11011101
return ret;
11021102
}
11031103

0 commit comments

Comments
 (0)