aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2010-10-20 12:49:20 -0400
committerJan Kara <jack@suse.cz>2011-01-06 11:03:55 -0500
commit949f4a7c08bc4a050eae7aeeac3e6d019d1feafb (patch)
treec017198a51ce2404c119fbe5bd8f497154efb0bc /fs/udf
parentd664b6af609ecf5e7dcedf92f0bf188e3a29b3e0 (diff)
udf: Protect all modifications of LVID with s_alloc_mutex
udf_open_lvid() and udf_close_lvid() were modifying LVID without s_alloc_mutex. Since they can be called from remount, the modification could race with other filesystem modifications of LVID so protect them by s_alloc_mutex just to be sure. Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/udf')
-rw-r--r--fs/udf/super.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 948e1aca0f34..e54960c0e960 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -1773,6 +1773,8 @@ static void udf_open_lvid(struct super_block *sb)
1773 1773
1774 if (!bh) 1774 if (!bh)
1775 return; 1775 return;
1776
1777 mutex_lock(&sbi->s_alloc_mutex);
1776 lvid = (struct logicalVolIntegrityDesc *)bh->b_data; 1778 lvid = (struct logicalVolIntegrityDesc *)bh->b_data;
1777 lvidiu = udf_sb_lvidiu(sbi); 1779 lvidiu = udf_sb_lvidiu(sbi);
1778 1780
@@ -1789,6 +1791,7 @@ static void udf_open_lvid(struct super_block *sb)
1789 lvid->descTag.tagChecksum = udf_tag_checksum(&lvid->descTag); 1791 lvid->descTag.tagChecksum = udf_tag_checksum(&lvid->descTag);
1790 mark_buffer_dirty(bh); 1792 mark_buffer_dirty(bh);
1791 sbi->s_lvid_dirty = 0; 1793 sbi->s_lvid_dirty = 0;
1794 mutex_unlock(&sbi->s_alloc_mutex);
1792} 1795}
1793 1796
1794static void udf_close_lvid(struct super_block *sb) 1797static void udf_close_lvid(struct super_block *sb)
@@ -1801,6 +1804,7 @@ static void udf_close_lvid(struct super_block *sb)
1801 if (!bh) 1804 if (!bh)
1802 return; 1805 return;
1803 1806
1807 mutex_lock(&sbi->s_alloc_mutex);
1804 lvid = (struct logicalVolIntegrityDesc *)bh->b_data; 1808 lvid = (struct logicalVolIntegrityDesc *)bh->b_data;
1805 lvidiu = udf_sb_lvidiu(sbi); 1809 lvidiu = udf_sb_lvidiu(sbi);
1806 lvidiu->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; 1810 lvidiu->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX;
@@ -1821,6 +1825,7 @@ static void udf_close_lvid(struct super_block *sb)
1821 lvid->descTag.tagChecksum = udf_tag_checksum(&lvid->descTag); 1825 lvid->descTag.tagChecksum = udf_tag_checksum(&lvid->descTag);
1822 mark_buffer_dirty(bh); 1826 mark_buffer_dirty(bh);
1823 sbi->s_lvid_dirty = 0; 1827 sbi->s_lvid_dirty = 0;
1828 mutex_unlock(&sbi->s_alloc_mutex);
1824} 1829}
1825 1830
1826u64 lvid_get_unique_id(struct super_block *sb) 1831u64 lvid_get_unique_id(struct super_block *sb)