Skip to contentSkip to conversation

FAILED: patch "[PATCH] fs: prepare for adding LSM blob to backing_file" failed to apply to 6.12-stable tree

PATCH Applied [email protected] 2 participants 3 messages May 1 – May 12

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x 880bd496ec72a6dcb00cb70c430ef752ba242ae7
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026050104-spotter-moody-9d29@gregkh' --subject-prefix 'PATCH 6.12.y' HEAD^..

Possible dependencies:

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 880bd496ec72a6dcb00cb70c430ef752ba242ae7 Mon Sep 17 00:00:00 2001
From: Amir Goldstein <[email protected]>
Date: Mon, 30 Mar 2026 10:27:51 +0200
Subject: [PATCH] fs: prepare for adding LSM blob to backing_file

In preparation to adding LSM blob to backing_file struct, factor out helpers init_backing_file() and backing_file_free().

[PM: use the term "LSM blob", fix comment style to match file]
fs/file_table.c +20 -2
index aaa5faaace1e..3b3792903185 100644
@@ -66,6 +66,12 @@ void backing_file_set_user_path(struct file *f, const struct path *path)
 }
 EXPORT_SYMBOL_GPL(backing_file_set_user_path);
 
+static inline void backing_file_free(struct backing_file *ff)
+{
+	path_put(&ff->user_path);
+	kmem_cache_free(bfilp_cachep, ff);
+}
+
 static inline void file_free(struct file *f)
 {
 	security_file_free(f);
@@ -73,8 +79,7 @@ static inline void file_free(struct file *f)
 		percpu_counter_dec(&nr_files);
 	put_cred(f->f_cred);
 	if (unlikely(f->f_mode & FMODE_BACKING)) {
-		path_put(backing_file_user_path(f));
-		kmem_cache_free(bfilp_cachep, backing_file(f));
+		backing_file_free(backing_file(f));
 	} else {
 		kmem_cache_free(filp_cachep, f);
 	}
@@ -283,6 +288,12 @@ struct file *alloc_empty_file_noaccount(int flags, const struct cred *cred)
 	return f;
 }
 
+static int init_backing_file(struct backing_file *ff)
+{
+	memset(&ff->user_path, 0, sizeof(ff->user_path));
+	return 0;
+}
+
 /*
  * Variant of alloc_empty_file() that allocates a backing_file container
  * and doesn't check and modify nr_files.
@@ -305,7 +316,14 @@ struct file *alloc_empty_backing_file(int flags, const struct cred *cred)
 		return ERR_PTR(error);
 	}
 
+	/* The f_mode flags must be set before fput(). */
 	ff->file.f_mode |= FMODE_BACKING | FMODE_NOACCOUNT;
+	error = init_backing_file(ff);
+	if (unlikely(error)) {
+		fput(&ff->file);
+		return ERR_PTR(error);
+	}
+
 	return &ff->file;
 }
 EXPORT_SYMBOL_GPL(alloc_empty_backing_file);
maintainer
#1 lore raw

PATCH 1/1 fs: prepare for adding LSM blob to backing_file

From: Amir Goldstein <[email protected]>

[ Upstream commit 880bd496ec72a6dcb00cb70c430ef752ba242ae7 ]

In preparation to adding LSM blob to backing_file struct, factor out helpers init_backing_file() and backing_file_free().

[PM: use the term "LSM blob", fix comment style to match file]
[ Used kfree() instead of kmem_cache_free(bfilp_cachep, ff) ]
---
 fs/file_table.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)
fs/file_table.c +20 -2
index cf3422edf737c..f7661a7087464 100644
@@ -60,6 +60,12 @@ struct path *backing_file_user_path(struct file *f)
 }
 EXPORT_SYMBOL_GPL(backing_file_user_path);
 
+static inline void backing_file_free(struct backing_file *ff)
+{
+	path_put(&ff->user_path);
+	kfree(ff);
+}
+
 static inline void file_free(struct file *f)
 {
 	security_file_free(f);
@@ -67,8 +73,7 @@ static inline void file_free(struct file *f)
 		percpu_counter_dec(&nr_files);
 	put_cred(f->f_cred);
 	if (unlikely(f->f_mode & FMODE_BACKING)) {
-		path_put(backing_file_user_path(f));
-		kfree(backing_file(f));
+		backing_file_free(backing_file(f));
 	} else {
 		kmem_cache_free(filp_cachep, f);
 	}
@@ -255,6 +260,12 @@ struct file *alloc_empty_file_noaccount(int flags, const struct cred *cred)
 	return f;
 }
 
+static int init_backing_file(struct backing_file *ff)
+{
+	memset(&ff->user_path, 0, sizeof(ff->user_path));
+	return 0;
+}
+
 /*
  * Variant of alloc_empty_file() that allocates a backing_file container
  * and doesn't check and modify nr_files.
@@ -277,7 +288,14 @@ struct file *alloc_empty_backing_file(int flags, const struct cred *cred)
 		return ERR_PTR(error);
 	}
 
+	/* The f_mode flags must be set before fput(). */
 	ff->file.f_mode |= FMODE_BACKING | FMODE_NOACCOUNT;
+	error = init_backing_file(ff);
+	if (unlikely(error)) {
+		fput(&ff->file);
+		return ERR_PTR(error);
+	}
+
 	return &ff->file;
 }
 
Signature · 1 line
2.53.0
author maintainer Applied
#2 lore raw

Patch "fs: prepare for adding LSM blob to backing_file" has been added to the 6.12-stable tree

This is a note to let you know that I've just added the patch titled

fs: prepare for adding LSM blob to backing_file

to the 6.12-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
fs-prepare-for-adding-lsm-blob-to-backing_file.patch
and it can be found in the queue-6.12 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

From [email protected] Tue May 5 02:16:25 2026
From: Sasha Levin <[email protected]>
Date: Mon, 4 May 2026 20:16:14 -0400
Subject: fs: prepare for adding LSM blob to backing_file
To: [email protected]
Cc: Amir Goldstein <[email protected]>, [email protected], [email protected], [email protected], Serge Hallyn <[email protected]>, Paul Moore <[email protected]>, Sasha Levin <[email protected]>
Message-ID: <[email protected]>

From: Amir Goldstein <[email protected]>

[ Upstream commit 880bd496ec72a6dcb00cb70c430ef752ba242ae7 ]

In preparation to adding LSM blob to backing_file struct, factor out helpers init_backing_file() and backing_file_free().

[PM: use the term "LSM blob", fix comment style to match file]
[ Used kfree() instead of kmem_cache_free(bfilp_cachep, ff) ]
---
 fs/file_table.c |   22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)
fs/file_table.c +20 -2
@@ -60,6 +60,12 @@ struct path *backing_file_user_path(stru
 }
 EXPORT_SYMBOL_GPL(backing_file_user_path);
 
+static inline void backing_file_free(struct backing_file *ff)
+{
+	path_put(&ff->user_path);
+	kfree(ff);
+}
+
 static inline void file_free(struct file *f)
 {
 	security_file_free(f);
@@ -67,8 +73,7 @@ static inline void file_free(struct file
 		percpu_counter_dec(&nr_files);
 	put_cred(f->f_cred);
 	if (unlikely(f->f_mode & FMODE_BACKING)) {
-		path_put(backing_file_user_path(f));
-		kfree(backing_file(f));
+		backing_file_free(backing_file(f));
 	} else {
 		kmem_cache_free(filp_cachep, f);
 	}
@@ -255,6 +260,12 @@ struct file *alloc_empty_file_noaccount(
 	return f;
 }
 
+static int init_backing_file(struct backing_file *ff)
+{
+	memset(&ff->user_path, 0, sizeof(ff->user_path));
+	return 0;
+}
+
 /*
  * Variant of alloc_empty_file() that allocates a backing_file container
  * and doesn't check and modify nr_files.
@@ -277,7 +288,14 @@ struct file *alloc_empty_backing_file(in
 		return ERR_PTR(error);
 	}
 
+	/* The f_mode flags must be set before fput(). */
 	ff->file.f_mode |= FMODE_BACKING | FMODE_NOACCOUNT;
+	error = init_backing_file(ff);
+	if (unlikely(error)) {
+		fput(&ff->file);
+		return ERR_PTR(error);
+	}
+
 	return &ff->file;
 }
 

Patches currently in stable-queue which might be from [email protected] are

queue-6.12/rxrpc-also-unshare-data-response-packets-when-paged-.patch queue-6.12/mm-convert-mm_lock_seq-to-a-proper-seqcount.patch queue-6.12/fs-prepare-for-adding-lsm-blob-to-backing_file.patch queue-6.12/dma-mapping-drop-unneeded-includes-from-dma-mapping.h.patch queue-6.12/mmc-core-optimize-time-for-secure-erase-trim-for-some-kingston-emmcs.patch queue-6.12/x86-shadow-stacks-proper-error-handling-for-mmap-loc.patch queue-6.12/net-txgbe-fix-rtnl-assertion-warning-when-remove-mod.patch queue-6.12/erofs-move-in-out-pages-into-struct-z_erofs_decompress_req.patch queue-6.12/dma-mapping-add-__dma_from_device_group_begin-end.patch queue-6.12/rxrpc-fix-conn-level-packet-handling-to-unshare-resp.patch queue-6.12/iommu-amd-use-atomic64_inc_return-in-iommu.c.patch queue-6.12/crypto-nx-migrate-to-scomp-api.patch queue-6.12/alsa-aloop-fix-peer-runtime-uaf-during-format-change-stop.patch queue-6.12/udf-fix-partition-descriptor-append-bookkeeping.patch queue-6.12/bluetooth-l2cap-fix-deadlock-in-l2cap_conn_del.patch queue-6.12/kvm-x86-fix-shadow-paging-use-after-free-due-to-unex.patch queue-6.12/hfsplus-fix-uninit-value-by-validating-catalog-record-size.patch queue-6.12/crypto-nx-fix-bounce-buffer-leaks-in-nx842_crypto_-alloc-free-_ctx.patch queue-6.12/gtp-disable-bh-before-calling-udp_tunnel_xmit_skb.patch queue-6.12/net-stmmac-avoid-shadowing-global-buf_sz.patch queue-6.12/crypto-caam-guard-hmac-key-hex-dumps-in-hash_digest_key.patch queue-6.12/hfsplus-fix-held-lock-freed-on-hfsplus_fill_super.patch queue-6.12/octeon_ep_vf-add-null-check-for-napi_build_skb.patch queue-6.12/printk-add-print_hex_dump_devel.patch queue-6.12/net-af_key-zero-aligned-sockaddr-tail-in-pf_key-expo.patch queue-6.12/tracepoint-balance-regfunc-on-func_add-failure-in-tracepoint_add_func.patch queue-6.12/flow_dissector-do-not-dissect-pppoe-pfc-frames.patch queue-6.12/fbdev-defio-disconnect-deferred-i-o-from-the-lifetime-of-struct-fb_info.patch queue-6.12/erofs-tidy-up-z_erofs_lz4_handle_overlap.patch queue-6.12/iommu-amd-serialize-sequence-allocation-under-concur.patch queue-6.12/x86-shstk-prevent-deadlock-during-shstk-sigreturn.patch queue-6.12/erofs-fix-unsigned-underflow-in-z_erofs_lz4_handle_overlap.patch queue-6.12/net-stmmac-prevent-null-deref-when-rx-memory-exhausted.patch queue-6.12/net-stmmac-rename-stmmac_get_entry-stmmac_next_entry.patch queue-6.12/mtd-spinand-winbond-declare-the-qe-bit-on-w25nxxjw.patch queue-6.12/hwmon-powerz-avoid-cacheline-sharing-for-dma-buffer.patch queue-6.12/wifi-mt76-mt7925-fix-incorrect-tlv-length-in-clc-command.patch