]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
efivarfs: Revert "allow creation of zero length files"
authorArd Biesheuvel <ardb@kernel.org>
Thu, 6 Mar 2025 13:08:27 +0000 (14:08 +0100)
committerArd Biesheuvel <ardb@kernel.org>
Fri, 7 Mar 2025 11:31:04 +0000 (12:31 +0100)
As agreed with the fwupd/LVFS maintainer, this reverts commit
fc20737d8b85691ecabab3739ed7d06c9b7bc00f again for the v6.15 cycle,
leaving them sufficient time to roll out a fix for the issue that the
reverted commit works around.

Link: https://lore.kernel.org/all/63837c36eceaf8cf2af7933dccca54ff4dd9f30d.camel@HansenPartnership.com/
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
fs/efivarfs/file.c

index c294a8fc566da5a351f22cf33084540edf68383b..cb1b6d0c34545c701ca36bc881ee922d1ff41bac 100644 (file)
@@ -57,11 +57,10 @@ static ssize_t efivarfs_file_write(struct file *file,
 
        if (bytes == -ENOENT) {
                /*
-                * FIXME: temporary workaround for fwupdate, signal
-                * failed write with a 1 to keep created but not
-                * written files
+                * zero size signals to release that the write deleted
+                * the variable
                 */
-               i_size_write(inode, 1);
+               i_size_write(inode, 0);
        } else {
                i_size_write(inode, datasize + sizeof(attributes));
                inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode));
@@ -125,8 +124,7 @@ static int efivarfs_file_release(struct inode *inode, struct file *file)
        struct efivar_entry *var = inode->i_private;
 
        inode_lock(inode);
-       /* FIXME: temporary work around for fwupdate */
-       var->removed = (--var->open_count == 0 && i_size_read(inode) == 1);
+       var->removed = (--var->open_count == 0 && i_size_read(inode) == 0);
        inode_unlock(inode);
 
        if (var->removed)