Message ID | 20241208183415.21181-3-James.Bottomley@HansenPartnership.com |
---|---|
State | New |
Headers | show |
Series | efivarfs: bug fixes | expand |
diff --git a/fs/efivarfs/file.c b/fs/efivarfs/file.c index 23c51d62f902..41b2f5a7239c 100644 --- a/fs/efivarfs/file.c +++ b/fs/efivarfs/file.c @@ -48,6 +48,7 @@ static ssize_t efivarfs_file_write(struct file *file, drop_nlink(inode); d_delete(file->f_path.dentry); dput(file->f_path.dentry); + kfree(var); } else { inode_lock(inode); i_size_write(inode, datasize + sizeof(attributes)); diff --git a/fs/efivarfs/inode.c b/fs/efivarfs/inode.c index 586446e02ef7..37ff34fab9f7 100644 --- a/fs/efivarfs/inode.c +++ b/fs/efivarfs/inode.c @@ -143,6 +143,7 @@ static int efivarfs_unlink(struct inode *dir, struct dentry *dentry) drop_nlink(d_inode(dentry)); dput(dentry); + kfree(var); return 0; };
efivar_entry_delete() doesn't free the entry, it merely removes it from the list. Neither efivarfs_unlink(), nor efivarfs_file_write() free the variable entry meaning it remains as unreferenced but allocated memory. Fix by adding the correct kfree()'s. Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com> --- fs/efivarfs/file.c | 1 + fs/efivarfs/inode.c | 1 + 2 files changed, 2 insertions(+)