From: Salah Triki <salah.triki@gmail.com>
To: "Md. Haris Iqbal" <haris.iqbal@ionos.com>,
Jack Wang <jinpu.wang@ionos.com>, Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2] block: rnbd: add .release to rnbd_dev_ktype
Date: Mon, 28 Apr 2025 06:27:31 +0100 [thread overview]
Message-ID: <aA8Rw1GzSSEs78Us@pc> (raw)
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 <salah.triki@gmail.com>
---
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(+)
diff --git a/drivers/block/rnbd/rnbd-clt-sysfs.c b/drivers/block/rnbd/rnbd-clt-sysfs.c
index 6ea7c12e3a87..144aea1466a4 100644
--- a/drivers/block/rnbd/rnbd-clt-sysfs.c
+++ b/drivers/block/rnbd/rnbd-clt-sysfs.c
@@ -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)
--
2.43.0
reply other threads:[~2025-04-28 5:27 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aA8Rw1GzSSEs78Us@pc \
--to=salah.triki@gmail.com \
--cc=axboe@kernel.dk \
--cc=haris.iqbal@ionos.com \
--cc=jinpu.wang@ionos.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.