Skip to content

Commit b6b227e

Browse files
committed
efivarfs: Revert "allow creation of zero length files"
As agreed with the fwupd/LVFS maintainer, this reverts commit fc20737 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>
1 parent 48140f8 commit b6b227e

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

fs/efivarfs/file.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,10 @@ static ssize_t efivarfs_file_write(struct file *file,
5757

5858
if (bytes == -ENOENT) {
5959
/*
60-
* FIXME: temporary workaround for fwupdate, signal
61-
* failed write with a 1 to keep created but not
62-
* written files
60+
* zero size signals to release that the write deleted
61+
* the variable
6362
*/
64-
i_size_write(inode, 1);
63+
i_size_write(inode, 0);
6564
} else {
6665
i_size_write(inode, datasize + sizeof(attributes));
6766
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)
125124
struct efivar_entry *var = inode->i_private;
126125

127126
inode_lock(inode);
128-
/* FIXME: temporary work around for fwupdate */
129-
var->removed = (--var->open_count == 0 && i_size_read(inode) == 1);
127+
var->removed = (--var->open_count == 0 && i_size_read(inode) == 0);
130128
inode_unlock(inode);
131129

132130
if (var->removed)

0 commit comments

Comments
 (0)