[PATCH v6 04/11] mount: add support for __free(kern_unmount)
From: Thomas Weißschuh
Date: Mon May 04 2026 - 05:36:39 EST
Allow usage of kern_unmount from the automatic __free cleanup logic.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>
---
include/linux/mount.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/linux/mount.h b/include/linux/mount.h
index acfe7ef86a1b..d8689ce61a42 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -10,6 +10,7 @@
#ifndef _LINUX_MOUNT_H
#define _LINUX_MOUNT_H
+#include <linux/cleanup.h>
#include <linux/types.h>
#include <asm/barrier.h>
@@ -99,6 +100,7 @@ extern bool our_mnt(struct vfsmount *mnt);
extern struct vfsmount *kern_mount(struct file_system_type *);
extern void kern_unmount(struct vfsmount *mnt);
+DEFINE_FREE(kern_unmount, struct vfsmount *, if (_T) kern_unmount(_T));
extern int may_umount_tree(struct vfsmount *);
extern int may_umount(struct vfsmount *);
int do_mount(const char *, const char __user *,
--
2.53.0