Commit 8426fb30 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs

Pull UDF fix from Jan Kara:
 "A fix for UDF corruption when certain disk-format feature is enabled"

* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
  udf: Don't corrupt unalloc spacetable when writing it
parents 1ad474de 70f19f58
...@@ -1652,17 +1652,9 @@ static int udf_update_inode(struct inode *inode, int do_sync) ...@@ -1652,17 +1652,9 @@ static int udf_update_inode(struct inode *inode, int do_sync)
iinfo->i_ext.i_data, inode->i_sb->s_blocksize - iinfo->i_ext.i_data, inode->i_sb->s_blocksize -
sizeof(struct unallocSpaceEntry)); sizeof(struct unallocSpaceEntry));
use->descTag.tagIdent = cpu_to_le16(TAG_IDENT_USE); use->descTag.tagIdent = cpu_to_le16(TAG_IDENT_USE);
use->descTag.tagLocation = crclen = sizeof(struct unallocSpaceEntry);
cpu_to_le32(iinfo->i_location.logicalBlockNum);
crclen = sizeof(struct unallocSpaceEntry) +
iinfo->i_lenAlloc - sizeof(struct tag);
use->descTag.descCRCLength = cpu_to_le16(crclen);
use->descTag.descCRC = cpu_to_le16(crc_itu_t(0, (char *)use +
sizeof(struct tag),
crclen));
use->descTag.tagChecksum = udf_tag_checksum(&use->descTag);
goto out; goto finish;
} }
if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_UID_FORGET)) if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_UID_FORGET))
...@@ -1782,6 +1774,8 @@ static int udf_update_inode(struct inode *inode, int do_sync) ...@@ -1782,6 +1774,8 @@ static int udf_update_inode(struct inode *inode, int do_sync)
efe->descTag.tagIdent = cpu_to_le16(TAG_IDENT_EFE); efe->descTag.tagIdent = cpu_to_le16(TAG_IDENT_EFE);
crclen = sizeof(struct extendedFileEntry); crclen = sizeof(struct extendedFileEntry);
} }
finish:
if (iinfo->i_strat4096) { if (iinfo->i_strat4096) {
fe->icbTag.strategyType = cpu_to_le16(4096); fe->icbTag.strategyType = cpu_to_le16(4096);
fe->icbTag.strategyParameter = cpu_to_le16(1); fe->icbTag.strategyParameter = cpu_to_le16(1);
...@@ -1791,7 +1785,9 @@ static int udf_update_inode(struct inode *inode, int do_sync) ...@@ -1791,7 +1785,9 @@ static int udf_update_inode(struct inode *inode, int do_sync)
fe->icbTag.numEntries = cpu_to_le16(1); fe->icbTag.numEntries = cpu_to_le16(1);
} }
if (S_ISDIR(inode->i_mode)) if (iinfo->i_use)
fe->icbTag.fileType = ICBTAG_FILE_TYPE_USE;
else if (S_ISDIR(inode->i_mode))
fe->icbTag.fileType = ICBTAG_FILE_TYPE_DIRECTORY; fe->icbTag.fileType = ICBTAG_FILE_TYPE_DIRECTORY;
else if (S_ISREG(inode->i_mode)) else if (S_ISREG(inode->i_mode))
fe->icbTag.fileType = ICBTAG_FILE_TYPE_REGULAR; fe->icbTag.fileType = ICBTAG_FILE_TYPE_REGULAR;
...@@ -1828,7 +1824,6 @@ static int udf_update_inode(struct inode *inode, int do_sync) ...@@ -1828,7 +1824,6 @@ static int udf_update_inode(struct inode *inode, int do_sync)
crclen)); crclen));
fe->descTag.tagChecksum = udf_tag_checksum(&fe->descTag); fe->descTag.tagChecksum = udf_tag_checksum(&fe->descTag);
out:
set_buffer_uptodate(bh); set_buffer_uptodate(bh);
unlock_buffer(bh); unlock_buffer(bh);
......
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