From: Mike Rapoport (Microsoft) Date: Sat, 23 May 2026 17:54:26 +0000 (+0300) Subject: fs/namespace: use __getname() to allocate mntpath buffer X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=aca4fd395d178b8f811db55797a8b3c773d61538;p=thirdparty%2Fkernel%2Flinux.git fs/namespace: use __getname() to allocate mntpath buffer mnt_warn_timestamp_expiry() allocates memory for a path with __get_free_page() although there is a dedicated helper for allocation of file paths: __getname(). Replace __get_free_page() for allocation of a path buffer with __getname(). Christian Brauner says: Pass PATH_MAX (not PAGE_SIZE) to d_path() to match the size that __getname() actually allocates, and drop the now-unnecessary NULL check around __putname() since __putname() handles NULL. Both per Jan Kara's review feedback, acked by the author. Signed-off-by: Mike Rapoport (Microsoft) Link: https://patch.msgid.link/20260523-b4-fs-v1-14-275e36a83f0e@kernel.org Signed-off-by: Christian Brauner (Amutable) --- diff --git a/fs/namespace.c b/fs/namespace.c index fe919abd2f011..d67c2f61b3dfd 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -3303,9 +3303,9 @@ static void mnt_warn_timestamp_expiry(const struct path *mountpoint, (ktime_get_real_seconds() + TIME_UPTIME_SEC_MAX > sb->s_time_max)) { char *buf, *mntpath; - buf = (char *)__get_free_page(GFP_KERNEL); + buf = __getname(); if (buf) - mntpath = d_path(mountpoint, buf, PAGE_SIZE); + mntpath = d_path(mountpoint, buf, PATH_MAX); else mntpath = ERR_PTR(-ENOMEM); if (IS_ERR(mntpath)) @@ -3318,8 +3318,7 @@ static void mnt_warn_timestamp_expiry(const struct path *mountpoint, (unsigned long long)sb->s_time_max); sb->s_iflags |= SB_I_TS_EXPIRY_WARNED; - if (buf) - free_page((unsigned long)buf); + __putname(buf); } }