From: Ard Biesheuvel Date: Thu, 6 Mar 2025 13:08:27 +0000 (+0100) Subject: efivarfs: Revert "allow creation of zero length files" X-Git-Tag: v6.15-rc1~114^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b6b227e36b5ad878260f5a3a1838f2d79d5e68e9;p=thirdparty%2Fkernel%2Flinux.git efivarfs: Revert "allow creation of zero length files" 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 --- diff --git a/fs/efivarfs/file.c b/fs/efivarfs/file.c index c294a8fc566da..cb1b6d0c34545 100644 --- a/fs/efivarfs/file.c +++ b/fs/efivarfs/file.c @@ -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)