Skip to content

Commit 4aa748d

Browse files
committed
Merge tag 'mm-hotfixes-stable-2024-12-21-12-09' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull misc fixes from Andrew Morton: "25 hotfixes. 16 are cc:stable. 19 are MM and 6 are non-MM. The usual bunch of singletons and doubletons - please see the relevant changelogs for details" * tag 'mm-hotfixes-stable-2024-12-21-12-09' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (25 commits) mm: huge_memory: handle strsep not finding delimiter alloc_tag: fix set_codetag_empty() when !CONFIG_MEM_ALLOC_PROFILING_DEBUG alloc_tag: fix module allocation tags populated area calculation mm/codetag: clear tags before swap mm/vmstat: fix a W=1 clang compiler warning mm: convert partially_mapped set/clear operations to be atomic nilfs2: fix buffer head leaks in calls to truncate_inode_pages() vmalloc: fix accounting with i915 mm/page_alloc: don't call pfn_to_page() on possibly non-existent PFN in split_large_buddy() fork: avoid inappropriate uprobe access to invalid mm nilfs2: prevent use of deleted inode zram: fix uninitialized ZRAM not releasing backing device zram: refuse to use zero sized block device as backing device mm: use clear_user_(high)page() for arch with special user folio handling mm: introduce cpu_icache_is_aliasing() across all architectures mm: add RCU annotation to pte_offset_map(_lock) mm: correctly reference merged VMA mm: use aligned address in copy_user_gigantic_page() mm: use aligned address in clear_gigantic_page() mm: shmem: fix ShmemHugePages at swapout ...
2 parents e84a3bf + d3ac65d commit 4aa748d

File tree

30 files changed

+1049
-102
lines changed

30 files changed

+1049
-102
lines changed

.mailmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,7 @@ Wolfram Sang <wsa@kernel.org> <w.sang@pengutronix.de>
735735
Wolfram Sang <wsa@kernel.org> <wsa@the-dreams.de>
736736
Yakir Yang <kuankuan.y@gmail.com> <ykk@rock-chips.com>
737737
Yanteng Si <si.yanteng@linux.dev> <siyanteng@loongson.cn>
738+
Ying Huang <huang.ying.caritas@gmail.com> <ying.huang@intel.com>
738739
Yusuke Goda <goda.yusuke@renesas.com>
739740
Zack Rusin <zack.rusin@broadcom.com> <zackr@vmware.com>
740741
Zhu Yanjun <zyjzyj2000@gmail.com> <yanjunz@nvidia.com>

Documentation/mm/process_addrs.rst

Lines changed: 850 additions & 0 deletions
Large diffs are not rendered by default.

arch/arc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
config ARC
77
def_bool y
88
select ARC_TIMERS
9+
select ARCH_HAS_CPU_CACHE_ALIASING
910
select ARCH_HAS_CACHE_LINE_SIZE
1011
select ARCH_HAS_DEBUG_VM_PGTABLE
1112
select ARCH_HAS_DMA_PREP_COHERENT

arch/arc/include/asm/cachetype.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
#ifndef __ASM_ARC_CACHETYPE_H
3+
#define __ASM_ARC_CACHETYPE_H
4+
5+
#define cpu_dcache_is_aliasing() false
6+
#define cpu_icache_is_aliasing() true
7+
8+
#endif

drivers/block/zram/zram_drv.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,12 @@ static ssize_t backing_dev_store(struct device *dev,
614614
}
615615

616616
nr_pages = i_size_read(inode) >> PAGE_SHIFT;
617+
/* Refuse to use zero sized device (also prevents self reference) */
618+
if (!nr_pages) {
619+
err = -EINVAL;
620+
goto out;
621+
}
622+
617623
bitmap_sz = BITS_TO_LONGS(nr_pages) * sizeof(long);
618624
bitmap = kvzalloc(bitmap_sz, GFP_KERNEL);
619625
if (!bitmap) {
@@ -1438,12 +1444,16 @@ static void zram_meta_free(struct zram *zram, u64 disksize)
14381444
size_t num_pages = disksize >> PAGE_SHIFT;
14391445
size_t index;
14401446

1447+
if (!zram->table)
1448+
return;
1449+
14411450
/* Free all pages that are still in this zram device */
14421451
for (index = 0; index < num_pages; index++)
14431452
zram_free_page(zram, index);
14441453

14451454
zs_destroy_pool(zram->mem_pool);
14461455
vfree(zram->table);
1456+
zram->table = NULL;
14471457
}
14481458

14491459
static bool zram_meta_alloc(struct zram *zram, u64 disksize)
@@ -2320,11 +2330,6 @@ static void zram_reset_device(struct zram *zram)
23202330

23212331
zram->limit_pages = 0;
23222332

2323-
if (!init_done(zram)) {
2324-
up_write(&zram->init_lock);
2325-
return;
2326-
}
2327-
23282333
set_capacity_and_notify(zram->disk, 0);
23292334
part_stat_set_all(zram->disk->part0, 0);
23302335

fs/hugetlbfs/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset,
825825
error = PTR_ERR(folio);
826826
goto out;
827827
}
828-
folio_zero_user(folio, ALIGN_DOWN(addr, hpage_size));
828+
folio_zero_user(folio, addr);
829829
__folio_mark_uptodate(folio);
830830
error = hugetlb_add_to_page_cache(folio, mapping, index);
831831
if (unlikely(error)) {

fs/nilfs2/btnode.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ void nilfs_init_btnc_inode(struct inode *btnc_inode)
3535
ii->i_flags = 0;
3636
memset(&ii->i_bmap_data, 0, sizeof(struct nilfs_bmap));
3737
mapping_set_gfp_mask(btnc_inode->i_mapping, GFP_NOFS);
38+
btnc_inode->i_mapping->a_ops = &nilfs_buffer_cache_aops;
3839
}
3940

4041
void nilfs_btnode_cache_clear(struct address_space *btnc)

fs/nilfs2/gcinode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ int nilfs_init_gcinode(struct inode *inode)
163163

164164
inode->i_mode = S_IFREG;
165165
mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS);
166-
inode->i_mapping->a_ops = &empty_aops;
166+
inode->i_mapping->a_ops = &nilfs_buffer_cache_aops;
167167

168168
ii->i_flags = 0;
169169
nilfs_bmap_init_gc(ii->i_bmap);

fs/nilfs2/inode.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,10 @@ const struct address_space_operations nilfs_aops = {
276276
.is_partially_uptodate = block_is_partially_uptodate,
277277
};
278278

279+
const struct address_space_operations nilfs_buffer_cache_aops = {
280+
.invalidate_folio = block_invalidate_folio,
281+
};
282+
279283
static int nilfs_insert_inode_locked(struct inode *inode,
280284
struct nilfs_root *root,
281285
unsigned long ino)
@@ -544,8 +548,14 @@ struct inode *nilfs_iget(struct super_block *sb, struct nilfs_root *root,
544548
inode = nilfs_iget_locked(sb, root, ino);
545549
if (unlikely(!inode))
546550
return ERR_PTR(-ENOMEM);
547-
if (!(inode->i_state & I_NEW))
551+
552+
if (!(inode->i_state & I_NEW)) {
553+
if (!inode->i_nlink) {
554+
iput(inode);
555+
return ERR_PTR(-ESTALE);
556+
}
548557
return inode;
558+
}
549559

550560
err = __nilfs_read_inode(sb, root, ino, inode);
551561
if (unlikely(err)) {
@@ -675,6 +685,7 @@ struct inode *nilfs_iget_for_shadow(struct inode *inode)
675685
NILFS_I(s_inode)->i_flags = 0;
676686
memset(NILFS_I(s_inode)->i_bmap, 0, sizeof(struct nilfs_bmap));
677687
mapping_set_gfp_mask(s_inode->i_mapping, GFP_NOFS);
688+
s_inode->i_mapping->a_ops = &nilfs_buffer_cache_aops;
678689

679690
err = nilfs_attach_btree_node_cache(s_inode);
680691
if (unlikely(err)) {

fs/nilfs2/namei.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ nilfs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
6767
inode = NULL;
6868
} else {
6969
inode = nilfs_iget(dir->i_sb, NILFS_I(dir)->i_root, ino);
70+
if (inode == ERR_PTR(-ESTALE)) {
71+
nilfs_error(dir->i_sb,
72+
"deleted inode referenced: %lu", ino);
73+
return ERR_PTR(-EIO);
74+
}
7075
}
7176

7277
return d_splice_alias(inode, dentry);

0 commit comments

Comments
 (0)