block: rnbd: add .release to rnbd_dev_ktype
Subsystems (2)
PATCH v2 1/1 block: rnbd: add .release to rnbd_dev_ktype
After the last kobject_put the .release function of the ktype is called. If this function is not defined the behavior is unpredictable.
Fixes 1eb54f8f5dd8a ("block/rnbd: client: sysfs interface functions")
Signed-off-by Salah Triki <[email protected]>
---
Changes in v2:
- Make the commit message more clearer
- Add a Fixes tag
drivers/block/rnbd/rnbd-clt-sysfs.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/block/rnbd/rnbd-clt-sysfs.c +8 -0
@@ -475,9 +475,17 @@ void rnbd_clt_remove_dev_symlink(struct rnbd_clt_dev *dev) } } +static void rnbd_dev_release (struct kobject *kobj) +{ + struct rnbd_clt_dev *dev = container_of(kobj, struct rnbd_clt_dev, kobj); + +kfree (dev); +} +static const struct kobj_type rnbd_dev_ktype = { .sysfs_ops = &kobj_sysfs_ops, .default_groups = rnbd_dev_groups, + .release = rnbd_dev_release, };static int rnbd_clt_add_dev_kobj (struct rnbd_clt_dev *dev)
Signature · 1 line
2.43.0