From: Smita Koralahalli Date: Sun, 22 Mar 2026 19:53:34 +0000 (+0000) Subject: dax/bus: Use dax_region_put() in alloc_dax_region() error path X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=14f2e2ebf31157a873536a7212502bd955b69647;p=thirdparty%2Fkernel%2Fstable.git dax/bus: Use dax_region_put() in alloc_dax_region() error path alloc_dax_region() calls kref_init() on the dax_region early in the function, but the error path for sysfs_create_groups() failure uses kfree() directly to free the dax_region. This bypasses the kref lifecycle. Use dax_region_put() instead to handle kref lifecycle correctly. Suggested-by: Jonathan Cameron Signed-off-by: Smita Koralahalli Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang Link: https://patch.msgid.link/20260322195343.206900-2-Smita.KoralahalliChannabasappa@amd.com Signed-off-by: Dan Williams Signed-off-by: Dave Jiang --- diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c index c94c09622516e..299134c9b2946 100644 --- a/drivers/dax/bus.c +++ b/drivers/dax/bus.c @@ -668,7 +668,7 @@ struct dax_region *alloc_dax_region(struct device *parent, int region_id, }; if (sysfs_create_groups(&parent->kobj, dax_region_attribute_groups)) { - kfree(dax_region); + dax_region_put(dax_region); return NULL; }