Commit 51c9a1e6 authored by Linus Torvalds's avatar Linus Torvalds

Only truncate file types that can be truncated on minixfs.

Only regular files, directories and symbolic links can have any
blocks allocated to them - other types of files have different
metadata in their inodes and should not get to the truncation
paths. Enforce this in fs/minix/inode.c.

Without this, deleting a block or character device can cause
minix filesystem corruption. Noted by Konstantin Boldyshev.
parent 664dcb0c
......@@ -547,6 +547,8 @@ int minix_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *sta
*/
void minix_truncate(struct inode * inode)
{
if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)))
return;
if (INODE_VERSION(inode) == MINIX_V1)
V1_minix_truncate(inode);
else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment