summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2026-10-30 10:54:00 +0000
committerMark Brown <broonie@kernel.org>2026-10-30 10:54:00 +0000
commit145c5ffdb167a5b3d3406cedec410d4fd0b2bf52 (patch)
treec7ae6530ff740fa126350561b62039ed5851a64a
parent73012c2f5e1ed23dc5027f057d3ffee82cc54ada (diff)
parenta344542d9f26d44a5ebf597220ccac84c536467e (diff)
downloadlinux-next-145c5ffdb167a5b3d3406cedec410d4fd0b2bf52.tar.gz
linux-next-145c5ffdb167a5b3d3406cedec410d4fd0b2bf52.zip
Merge branch 'for_next' of https://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs.git
-rw-r--r--fs/dcache.c2
-rw-r--r--fs/ext2/inode.c4
-rw-r--r--fs/ext2/super.c9
-rw-r--r--fs/notify/fanotify/fanotify.h2
-rw-r--r--fs/notify/fsnotify.c2
-rw-r--r--fs/quota/dquot.c10
-rw-r--r--fs/udf/inode.c5
-rw-r--r--fs/udf/super.c14
-rw-r--r--include/linux/fsnotify.h4
-rw-r--r--include/linux/fsnotify_backend.h6
-rw-r--r--include/linux/quotaops.h5
11 files changed, 44 insertions, 19 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index 56798ad0c798..e9ddbba8df01 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -33,6 +33,7 @@
#include <linux/rculist_bl.h>
#include <linux/list_lru.h>
#include <linux/namei.h>
+#include <linux/quotaops.h>
#include "internal.h"
#include "mount.h"
@@ -3706,6 +3707,7 @@ void __init vfs_caches_init(void)
inode_init();
files_init();
files_maxfiles_init();
+ dquot_cache_init();
mnt_init();
bdev_cache_init();
chrdev_init();
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index 12ac4cfe1500..723b31dc7dac 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -58,8 +58,10 @@ void ext2_write_failed(struct address_space *mapping, loff_t to)
struct inode *inode = mapping->host;
if (to > inode->i_size) {
+ filemap_invalidate_lock(mapping);
truncate_pagecache(inode, inode->i_size);
ext2_truncate_blocks(inode, inode->i_size);
+ filemap_invalidate_unlock(mapping);
}
}
@@ -1236,9 +1238,7 @@ static void ext2_truncate_blocks(struct inode *inode, loff_t offset)
if (ext2_inode_is_fast_symlink(inode))
return;
- filemap_invalidate_lock(inode->i_mapping);
__ext2_truncate_blocks(inode, offset);
- filemap_invalidate_unlock(inode->i_mapping);
}
static int ext2_setsize(struct inode *inode, loff_t newsize)
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index fb217ef2d69f..bde5b433776c 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -883,17 +883,18 @@ static int ext2_fill_super(struct super_block *sb, struct fs_context *fc)
__le32 features;
int err;
- sbi = kzalloc_obj(*sbi);
- if (!sbi)
+ sb->s_fs_info = kzalloc_obj(*sbi);
+ if (!sb->s_fs_info)
return -ENOMEM;
+ sbi = EXT2_SB(sb);
sbi->s_blockgroup_lock =
kzalloc_obj(struct blockgroup_lock);
if (!sbi->s_blockgroup_lock) {
- kfree(sbi);
+ kfree(sb->s_fs_info);
+ sb->s_fs_info = NULL;
return -ENOMEM;
}
- sb->s_fs_info = sbi;
sbi->s_sb_block = sb_block;
guard(spinlock_init)(&EXT2_SB(sb)->s_lock);
diff --git a/fs/notify/fanotify/fanotify.h b/fs/notify/fanotify/fanotify.h
index 87ba788574bf..c25cf5c1fc70 100644
--- a/fs/notify/fanotify/fanotify.h
+++ b/fs/notify/fanotify/fanotify.h
@@ -444,7 +444,7 @@ struct fanotify_perm_event {
struct fanotify_event fae;
struct path path;
loff_t pos; /* FANOTIFY_NO_RANGE if unavailable */
- size_t count;
+ u64 count;
u32 response; /* userspace answer to the event */
unsigned short state; /* state of the event */
unsigned short watchdog_cnt; /* already scanned by watchdog? */
diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c
index 7e2f330fd283..8657bb94dfa8 100644
--- a/fs/notify/fsnotify.c
+++ b/fs/notify/fsnotify.c
@@ -157,7 +157,7 @@ static inline __u32 fsnotify_object_watched(struct inode *inode, __u32 mnt_mask,
/* Report pre-content event with optional range info */
int fsnotify_pre_content(const struct path *path, const loff_t *ppos,
- size_t count)
+ u64 count)
{
struct file_range range;
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 3ad19d7e472f..a3d503591871 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -2958,7 +2958,7 @@ static const struct ctl_table fs_dqstats_table[] = {
},
};
-static int __init dquot_init(void)
+void __init dquot_cache_init(void)
{
int i, ret;
unsigned long nr_hash;
@@ -2966,8 +2966,6 @@ static int __init dquot_init(void)
printk(KERN_NOTICE "VFS: Disk quotas %s\n", __DQUOT_VERSION__);
- register_sysctl_init("fs/quota", fs_dqstats_table);
-
dquot_cachep = kmem_cache_create("dquot",
sizeof(struct dquot), sizeof(unsigned long) * 4,
(SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|
@@ -3008,7 +3006,11 @@ static int __init dquot_init(void)
WQ_UNBOUND | WQ_MEM_RECLAIM, WQ_MAX_ACTIVE);
if (!quota_unbound_wq)
panic("Cannot create quota_unbound_wq\n");
+}
+static int __init init_fs_dquot_sysctls(void)
+{
+ register_sysctl_init("fs/quota", fs_dqstats_table);
return 0;
}
-fs_initcall(dquot_init);
+fs_initcall(init_fs_dquot_sysctls);
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index bacf2a86161e..88b1c7d351e1 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -1607,6 +1607,11 @@ reread:
*/
if (iinfo->i_lenEAttr > bs || iinfo->i_lenAlloc > bs)
goto out;
+ /* We need to have space at least for generic descriptor */
+ if (iinfo->i_lenEAttr && iinfo->i_lenEAttr <
+ sizeof(struct extendedAttrHeaderDesc))
+ goto out;
+
/* Now do exact checks */
if (udf_file_entry_alloc_offset(inode) + iinfo->i_lenAlloc > bs)
goto out;
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 5351755aca3e..2335c31cde31 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -1252,6 +1252,12 @@ static int udf_load_vat(struct super_block *sb, int p_index, int type1_index)
(sbi->s_vat_inode->i_size - 36) >> 2;
} else if (map->s_partition_type == UDF_VIRTUAL_MAP20) {
vati = UDF_I(sbi->s_vat_inode);
+ if (sbi->s_vat_inode->i_size <
+ sizeof(struct virtualAllocationTable20)) {
+ udf_err(sb, "Too short VAT inode size %lld\n",
+ sbi->s_vat_inode->i_size);
+ return -EFSCORRUPTED;
+ }
if (vati->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB) {
int err = 0;
@@ -1269,8 +1275,12 @@ static int udf_load_vat(struct super_block *sb, int p_index, int type1_index)
map->s_type_specific.s_virtual.s_start_offset =
le16_to_cpu(vat20->lengthHeader);
- if (map->s_type_specific.s_virtual.s_start_offset
- > sbi->s_vat_inode->i_size) {
+ if (map->s_type_specific.s_virtual.s_start_offset <
+ sizeof(struct virtualAllocationTable20) ||
+ map->s_type_specific.s_virtual.s_start_offset >
+ sb->s_blocksize ||
+ map->s_type_specific.s_virtual.s_start_offset >
+ sbi->s_vat_inode->i_size) {
udf_err(sb, "Corrupted VAT header length %u (VAT inode size %lld)\n",
map->s_type_specific.s_virtual.s_start_offset,
sbi->s_vat_inode->i_size);
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index bda798bc67bc..a4a29b365008 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -135,7 +135,7 @@ int fsnotify_open_perm_and_set_mode(struct file *file);
* fsnotify_file_area_perm - permission hook before access to file range
*/
static inline int fsnotify_file_area_perm(struct file *file, int perm_mask,
- const loff_t *ppos, size_t count)
+ const loff_t *ppos, u64 count)
{
/*
* filesystem may be modified in the context of permission events
@@ -213,7 +213,7 @@ static inline int fsnotify_open_perm_and_set_mode(struct file *file)
}
static inline int fsnotify_file_area_perm(struct file *file, int perm_mask,
- const loff_t *ppos, size_t count)
+ const loff_t *ppos, u64 count)
{
return 0;
}
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h
index a6d5c1a89cff..faf21564380d 100644
--- a/include/linux/fsnotify_backend.h
+++ b/include/linux/fsnotify_backend.h
@@ -323,7 +323,7 @@ struct fs_error_report {
struct file_range {
const struct path *path;
loff_t pos;
- size_t count;
+ u64 count;
};
static inline const struct path *file_range_path(const struct file_range *range)
@@ -946,12 +946,12 @@ static inline void fsnotify_init_event(struct fsnotify_event *event)
INIT_LIST_HEAD(&event->list);
}
int fsnotify_pre_content(const struct path *path, const loff_t *ppos,
- size_t count);
+ u64 count);
#else
static inline int fsnotify_pre_content(const struct path *path,
- const loff_t *ppos, size_t count)
+ const loff_t *ppos, u64 count)
{
return 0;
}
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index 0c64ca674e77..7346efc85d43 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -40,6 +40,7 @@ void __quota_error(struct super_block *sb, const char *func,
/*
* declaration of quota_function calls in kernel.
*/
+void dquot_cache_init(void);
int dquot_initialize(struct inode *inode);
bool dquot_initialize_needed(struct inode *inode);
void dquot_drop(struct inode *inode);
@@ -206,6 +207,10 @@ static inline int sb_has_quota_active(struct super_block *sb, int type)
return 0;
}
+static inline void dquot_cache_init(void)
+{
+}
+
static inline int dquot_initialize(struct inode *inode)
{
return 0;