Skip to content

Commit

Permalink
pstore: Fail to unlink if a driver has not defined pstore_erase
Browse files Browse the repository at this point in the history
pstore_erase is used to erase the record from the persistent store.
So if a driver has not defined pstore_erase callback return
-EPERM instead of unlinking a file as deleting the file without
erasing its record in persistent store will give a wrong impression
to customers.

Signed-off-by: Aruna Balakrishnaiah <aruna@linux.vnet.ibm.com>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Tony Luck <tony.luck@intel.com>
  • Loading branch information
Aruna Balakrishnaiah authored and Tony Luck committed Jun 25, 2013
1 parent 2644665 commit bf28833
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/pstore/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ static int pstore_unlink(struct inode *dir, struct dentry *dentry)
if (p->psi->erase)
p->psi->erase(p->type, p->id, p->count,
dentry->d_inode->i_ctime, p->psi);
else
return -EPERM;

return simple_unlink(dir, dentry);
}
Expand Down

0 comments on commit bf28833

Please sign in to comment.