Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4

Pull ext4 fixes from Ted Ts'o:
"Some bug fixes, and an update to the URL's for the final version of
Unicode 12.1.0"

* tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
ext4: avoid panic during forced reboot due to aborted journal
ext4: fix block validity checks for journal inodes using indirect blocks
unicode: update to Unicode 12.1.0 final
unicode: add missing check for an error return from utf8lookup()
ext4: fix miscellaneous sparse warnings
ext4: unsigned int compared against zero
ext4: fix use-after-free in dx_release()
ext4: fix data corruption caused by overlapping unaligned and aligned IO
jbd2: fix potential double free
ext4: zero out the unused memory region in the extent tree block

+109 -67
+7 -1
fs/ext4/block_validity.c
··· 142 142 struct inode *inode; 143 143 struct ext4_sb_info *sbi = EXT4_SB(sb); 144 144 struct ext4_map_blocks map; 145 - u32 i = 0, err = 0, num, n; 145 + u32 i = 0, num; 146 + int err = 0, n; 146 147 147 148 if ((ino < EXT4_ROOT_INO) || 148 149 (ino > le32_to_cpu(sbi->s_es->s_inodes_count))) ··· 276 275 struct ext4_super_block *es = EXT4_SB(inode->i_sb)->s_es; 277 276 __le32 *bref = p; 278 277 unsigned int blk; 278 + 279 + if (ext4_has_feature_journal(inode->i_sb) && 280 + (inode->i_ino == 281 + le32_to_cpu(EXT4_SB(inode->i_sb)->s_es->s_journal_inum))) 282 + return 0; 279 283 280 284 while (bref < p+max) { 281 285 blk = le32_to_cpu(*bref++);
+15 -2
fs/ext4/extents.c
··· 1035 1035 __le32 border; 1036 1036 ext4_fsblk_t *ablocks = NULL; /* array of allocated blocks */ 1037 1037 int err = 0; 1038 + size_t ext_size = 0; 1038 1039 1039 1040 /* make decision: where to split? */ 1040 1041 /* FIXME: now decision is simplest: at current extent */ ··· 1127 1126 le16_add_cpu(&neh->eh_entries, m); 1128 1127 } 1129 1128 1129 + /* zero out unused area in the extent block */ 1130 + ext_size = sizeof(struct ext4_extent_header) + 1131 + sizeof(struct ext4_extent) * le16_to_cpu(neh->eh_entries); 1132 + memset(bh->b_data + ext_size, 0, inode->i_sb->s_blocksize - ext_size); 1130 1133 ext4_extent_block_csum_set(inode, neh); 1131 1134 set_buffer_uptodate(bh); 1132 1135 unlock_buffer(bh); ··· 1210 1205 sizeof(struct ext4_extent_idx) * m); 1211 1206 le16_add_cpu(&neh->eh_entries, m); 1212 1207 } 1208 + /* zero out unused area in the extent block */ 1209 + ext_size = sizeof(struct ext4_extent_header) + 1210 + (sizeof(struct ext4_extent) * le16_to_cpu(neh->eh_entries)); 1211 + memset(bh->b_data + ext_size, 0, 1212 + inode->i_sb->s_blocksize - ext_size); 1213 1213 ext4_extent_block_csum_set(inode, neh); 1214 1214 set_buffer_uptodate(bh); 1215 1215 unlock_buffer(bh); ··· 1280 1270 ext4_fsblk_t newblock, goal = 0; 1281 1271 struct ext4_super_block *es = EXT4_SB(inode->i_sb)->s_es; 1282 1272 int err = 0; 1273 + size_t ext_size = 0; 1283 1274 1284 1275 /* Try to prepend new index to old one */ 1285 1276 if (ext_depth(inode)) ··· 1306 1295 goto out; 1307 1296 } 1308 1297 1298 + ext_size = sizeof(EXT4_I(inode)->i_data); 1309 1299 /* move top-level index/leaf into new block */ 1310 - memmove(bh->b_data, EXT4_I(inode)->i_data, 1311 - sizeof(EXT4_I(inode)->i_data)); 1300 + memmove(bh->b_data, EXT4_I(inode)->i_data, ext_size); 1301 + /* zero out unused area in the extent block */ 1302 + memset(bh->b_data + ext_size, 0, inode->i_sb->s_blocksize - ext_size); 1312 1303 1313 1304 /* set size of new block */ 1314 1305 neh = ext_block_hdr(bh);
+7
fs/ext4/file.c
··· 264 264 } 265 265 266 266 ret = __generic_file_write_iter(iocb, from); 267 + /* 268 + * Unaligned direct AIO must be the only IO in flight. Otherwise 269 + * overlapping aligned IO after unaligned might result in data 270 + * corruption. 271 + */ 272 + if (ret == -EIOCBQUEUED && unaligned_aio) 273 + ext4_unwritten_wait(inode); 267 274 inode_unlock(inode); 268 275 269 276 if (ret > 0)
+1 -1
fs/ext4/fsmap.c
··· 626 626 { 627 627 struct ext4_fsmap dkeys[2]; /* per-dev keys */ 628 628 struct ext4_getfsmap_dev handlers[EXT4_GETFSMAP_DEVS]; 629 - struct ext4_getfsmap_info info = {0}; 629 + struct ext4_getfsmap_info info = { NULL }; 630 630 int i; 631 631 int error = 0; 632 632
+1 -1
fs/ext4/ioctl.c
··· 608 608 static int ext4_ioc_getfsmap(struct super_block *sb, 609 609 struct fsmap_head __user *arg) 610 610 { 611 - struct getfsmap_info info = {0}; 611 + struct getfsmap_info info = { NULL }; 612 612 struct ext4_fsmap_head xhead = {0}; 613 613 struct fsmap_head head; 614 614 bool aborted = false;
+4 -1
fs/ext4/namei.c
··· 872 872 { 873 873 struct dx_root_info *info; 874 874 int i; 875 + unsigned int indirect_levels; 875 876 876 877 if (frames[0].bh == NULL) 877 878 return; 878 879 879 880 info = &((struct dx_root *)frames[0].bh->b_data)->info; 880 - for (i = 0; i <= info->indirect_levels; i++) { 881 + /* save local copy, "info" may be freed after brelse() */ 882 + indirect_levels = info->indirect_levels; 883 + for (i = 0; i <= indirect_levels; i++) { 881 884 if (frames[i].bh == NULL) 882 885 break; 883 886 brelse(frames[i].bh);
+2 -2
fs/ext4/super.c
··· 699 699 jbd2_journal_abort(EXT4_SB(sb)->s_journal, -EIO); 700 700 save_error_info(sb, function, line); 701 701 } 702 - if (test_opt(sb, ERRORS_PANIC)) { 702 + if (test_opt(sb, ERRORS_PANIC) && !system_going_down()) { 703 703 if (EXT4_SB(sb)->s_journal && 704 704 !(EXT4_SB(sb)->s_journal->j_flags & JBD2_REC_ERR)) 705 705 return; ··· 4661 4661 4662 4662 #ifdef CONFIG_QUOTA 4663 4663 for (i = 0; i < EXT4_MAXQUOTAS; i++) 4664 - kfree(sbi->s_qf_names[i]); 4664 + kfree(get_qf_name(sb, sbi, i)); 4665 4665 #endif 4666 4666 ext4_blkdev_remove(sbi); 4667 4667 brelse(bh);
+33 -20
fs/jbd2/journal.c
··· 2375 2375 static atomic_t nr_journal_heads = ATOMIC_INIT(0); 2376 2376 #endif 2377 2377 2378 - static int jbd2_journal_init_journal_head_cache(void) 2378 + static int __init jbd2_journal_init_journal_head_cache(void) 2379 2379 { 2380 - int retval; 2381 - 2382 - J_ASSERT(jbd2_journal_head_cache == NULL); 2380 + J_ASSERT(!jbd2_journal_head_cache); 2383 2381 jbd2_journal_head_cache = kmem_cache_create("jbd2_journal_head", 2384 2382 sizeof(struct journal_head), 2385 2383 0, /* offset */ 2386 2384 SLAB_TEMPORARY | SLAB_TYPESAFE_BY_RCU, 2387 2385 NULL); /* ctor */ 2388 - retval = 0; 2389 2386 if (!jbd2_journal_head_cache) { 2390 - retval = -ENOMEM; 2391 2387 printk(KERN_EMERG "JBD2: no memory for journal_head cache\n"); 2388 + return -ENOMEM; 2392 2389 } 2393 - return retval; 2390 + return 0; 2394 2391 } 2395 2392 2396 2393 static void jbd2_journal_destroy_journal_head_cache(void) ··· 2633 2636 2634 2637 struct kmem_cache *jbd2_handle_cache, *jbd2_inode_cache; 2635 2638 2636 - static int __init jbd2_journal_init_handle_cache(void) 2639 + static int __init jbd2_journal_init_inode_cache(void) 2637 2640 { 2638 - jbd2_handle_cache = KMEM_CACHE(jbd2_journal_handle, SLAB_TEMPORARY); 2639 - if (jbd2_handle_cache == NULL) { 2640 - printk(KERN_EMERG "JBD2: failed to create handle cache\n"); 2641 - return -ENOMEM; 2642 - } 2641 + J_ASSERT(!jbd2_inode_cache); 2643 2642 jbd2_inode_cache = KMEM_CACHE(jbd2_inode, 0); 2644 - if (jbd2_inode_cache == NULL) { 2645 - printk(KERN_EMERG "JBD2: failed to create inode cache\n"); 2646 - kmem_cache_destroy(jbd2_handle_cache); 2643 + if (!jbd2_inode_cache) { 2644 + pr_emerg("JBD2: failed to create inode cache\n"); 2647 2645 return -ENOMEM; 2648 2646 } 2649 2647 return 0; 2648 + } 2649 + 2650 + static int __init jbd2_journal_init_handle_cache(void) 2651 + { 2652 + J_ASSERT(!jbd2_handle_cache); 2653 + jbd2_handle_cache = KMEM_CACHE(jbd2_journal_handle, SLAB_TEMPORARY); 2654 + if (!jbd2_handle_cache) { 2655 + printk(KERN_EMERG "JBD2: failed to create handle cache\n"); 2656 + return -ENOMEM; 2657 + } 2658 + return 0; 2659 + } 2660 + 2661 + static void jbd2_journal_destroy_inode_cache(void) 2662 + { 2663 + kmem_cache_destroy(jbd2_inode_cache); 2664 + jbd2_inode_cache = NULL; 2650 2665 } 2651 2666 2652 2667 static void jbd2_journal_destroy_handle_cache(void) 2653 2668 { 2654 2669 kmem_cache_destroy(jbd2_handle_cache); 2655 2670 jbd2_handle_cache = NULL; 2656 - kmem_cache_destroy(jbd2_inode_cache); 2657 - jbd2_inode_cache = NULL; 2658 2671 } 2659 2672 2660 2673 /* ··· 2675 2668 { 2676 2669 int ret; 2677 2670 2678 - ret = jbd2_journal_init_revoke_caches(); 2671 + ret = jbd2_journal_init_revoke_record_cache(); 2672 + if (ret == 0) 2673 + ret = jbd2_journal_init_revoke_table_cache(); 2679 2674 if (ret == 0) 2680 2675 ret = jbd2_journal_init_journal_head_cache(); 2681 2676 if (ret == 0) 2682 2677 ret = jbd2_journal_init_handle_cache(); 2678 + if (ret == 0) 2679 + ret = jbd2_journal_init_inode_cache(); 2683 2680 if (ret == 0) 2684 2681 ret = jbd2_journal_init_transaction_cache(); 2685 2682 return ret; ··· 2691 2680 2692 2681 static void jbd2_journal_destroy_caches(void) 2693 2682 { 2694 - jbd2_journal_destroy_revoke_caches(); 2683 + jbd2_journal_destroy_revoke_record_cache(); 2684 + jbd2_journal_destroy_revoke_table_cache(); 2695 2685 jbd2_journal_destroy_journal_head_cache(); 2696 2686 jbd2_journal_destroy_handle_cache(); 2687 + jbd2_journal_destroy_inode_cache(); 2697 2688 jbd2_journal_destroy_transaction_cache(); 2698 2689 jbd2_journal_destroy_slabs(); 2699 2690 }
+20 -12
fs/jbd2/revoke.c
··· 178 178 return NULL; 179 179 } 180 180 181 - void jbd2_journal_destroy_revoke_caches(void) 181 + void jbd2_journal_destroy_revoke_record_cache(void) 182 182 { 183 183 kmem_cache_destroy(jbd2_revoke_record_cache); 184 184 jbd2_revoke_record_cache = NULL; 185 + } 186 + 187 + void jbd2_journal_destroy_revoke_table_cache(void) 188 + { 185 189 kmem_cache_destroy(jbd2_revoke_table_cache); 186 190 jbd2_revoke_table_cache = NULL; 187 191 } 188 192 189 - int __init jbd2_journal_init_revoke_caches(void) 193 + int __init jbd2_journal_init_revoke_record_cache(void) 190 194 { 191 195 J_ASSERT(!jbd2_revoke_record_cache); 192 - J_ASSERT(!jbd2_revoke_table_cache); 193 - 194 196 jbd2_revoke_record_cache = KMEM_CACHE(jbd2_revoke_record_s, 195 197 SLAB_HWCACHE_ALIGN|SLAB_TEMPORARY); 196 - if (!jbd2_revoke_record_cache) 197 - goto record_cache_failure; 198 198 199 + if (!jbd2_revoke_record_cache) { 200 + pr_emerg("JBD2: failed to create revoke_record cache\n"); 201 + return -ENOMEM; 202 + } 203 + return 0; 204 + } 205 + 206 + int __init jbd2_journal_init_revoke_table_cache(void) 207 + { 208 + J_ASSERT(!jbd2_revoke_table_cache); 199 209 jbd2_revoke_table_cache = KMEM_CACHE(jbd2_revoke_table_s, 200 210 SLAB_TEMPORARY); 201 - if (!jbd2_revoke_table_cache) 202 - goto table_cache_failure; 203 - return 0; 204 - table_cache_failure: 205 - jbd2_journal_destroy_revoke_caches(); 206 - record_cache_failure: 211 + if (!jbd2_revoke_table_cache) { 212 + pr_emerg("JBD2: failed to create revoke_table cache\n"); 207 213 return -ENOMEM; 214 + } 215 + return 0; 208 216 } 209 217 210 218 static struct jbd2_revoke_table_s *jbd2_journal_init_revoke_table(int hash_size)
+5 -3
fs/jbd2/transaction.c
··· 42 42 0, 43 43 SLAB_HWCACHE_ALIGN|SLAB_TEMPORARY, 44 44 NULL); 45 - if (transaction_cache) 46 - return 0; 47 - return -ENOMEM; 45 + if (!transaction_cache) { 46 + pr_emerg("JBD2: failed to create transaction cache\n"); 47 + return -ENOMEM; 48 + } 49 + return 0; 48 50 } 49 51 50 52 void jbd2_journal_destroy_transaction_cache(void)
+7 -21
fs/unicode/README.utf8data
··· 5 5 6 6 http://www.unicode.org/Public/12.1.0/ucd/ 7 7 8 - Note! 9 - 10 - The URL's listed below are not stable. That's because Unicode 12.1.0 11 - has not been officially released yet; it is scheduled to be released 12 - on May 8, 2019. We taking Unicode 12.1.0 a few weeks early because it 13 - contains a new Japanese character which is required in order to 14 - specify Japenese dates after May 1, 2019, when Crown Prince Naruhito 15 - ascends to the Chrysanthemum Throne. (Isn't internationalization fun? 16 - The abdication of Emperor Akihito of Japan is requiring dozens of 17 - software packages to be updated with only a month's notice. :-) 18 - 19 - We will update the URL's (and any needed changes to the checksums) 20 - after the final Unicode 12.1.0 is released. 21 - 22 8 Individual source links: 23 9 24 - https://www.unicode.org/Public/12.1.0/ucd/CaseFolding-12.1.0d2.txt 25 - https://www.unicode.org/Public/12.1.0/ucd/DerivedAge-12.1.0d3.txt 26 - https://www.unicode.org/Public/12.1.0/ucd/extracted/DerivedCombiningClass-12.1.0d2.txt 27 - https://www.unicode.org/Public/12.1.0/ucd/DerivedCoreProperties-12.1.0d2.txt 28 - https://www.unicode.org/Public/12.1.0/ucd/NormalizationCorrections-12.1.0d1.txt 29 - https://www.unicode.org/Public/12.1.0/ucd/NormalizationTest-12.1.0d3.txt 30 - https://www.unicode.org/Public/12.1.0/ucd/UnicodeData-12.1.0d2.txt 10 + https://www.unicode.org/Public/12.1.0/ucd/CaseFolding.txt 11 + https://www.unicode.org/Public/12.1.0/ucd/DerivedAge.txt 12 + https://www.unicode.org/Public/12.1.0/ucd/extracted/DerivedCombiningClass.txt 13 + https://www.unicode.org/Public/12.1.0/ucd/DerivedCoreProperties.txt 14 + https://www.unicode.org/Public/12.1.0/ucd/NormalizationCorrections.txt 15 + https://www.unicode.org/Public/12.1.0/ucd/NormalizationTest.txt 16 + https://www.unicode.org/Public/12.1.0/ucd/UnicodeData.txt 31 17 32 18 md5sums (verify by running "md5sum -c README.utf8data"): 33 19
+2
fs/unicode/utf8-norm.c
··· 714 714 } 715 715 716 716 leaf = utf8lookup(u8c->data, u8c->hangul, u8c->s); 717 + if (!leaf) 718 + return -1; 717 719 ccc = LEAF_CCC(leaf); 718 720 } 719 721
+5 -3
include/linux/jbd2.h
··· 1318 1318 1319 1319 /* Transaction cache support */ 1320 1320 extern void jbd2_journal_destroy_transaction_cache(void); 1321 - extern int jbd2_journal_init_transaction_cache(void); 1321 + extern int __init jbd2_journal_init_transaction_cache(void); 1322 1322 extern void jbd2_journal_free_transaction(transaction_t *); 1323 1323 1324 1324 /* ··· 1446 1446 /* Primary revoke support */ 1447 1447 #define JOURNAL_REVOKE_DEFAULT_HASH 256 1448 1448 extern int jbd2_journal_init_revoke(journal_t *, int); 1449 - extern void jbd2_journal_destroy_revoke_caches(void); 1450 - extern int jbd2_journal_init_revoke_caches(void); 1449 + extern void jbd2_journal_destroy_revoke_record_cache(void); 1450 + extern void jbd2_journal_destroy_revoke_table_cache(void); 1451 + extern int __init jbd2_journal_init_revoke_record_cache(void); 1452 + extern int __init jbd2_journal_init_revoke_table_cache(void); 1451 1453 1452 1454 extern void jbd2_journal_destroy_revoke(journal_t *); 1453 1455 extern int jbd2_journal_revoke (handle_t *, unsigned long long, struct buffer_head *);