Commit 911a2997 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'fs_for_v5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs

Pull misc fs updates from Jan Kara:
 "The new quotactl_fd() syscall (remake of quotactl_path() syscall that
  got introduced & disabled in 5.13 cycle), and couple of udf, reiserfs,
  isofs, and writeback fixes and cleanups"

* tag 'fs_for_v5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
  writeback: fix obtain a reference to a freeing memcg css
  quota: remove unnecessary oom message
  isofs: remove redundant continue statement
  quota: Wire up quotactl_fd syscall
  quota: Change quotactl_path() systcall to an fd-based one
  reiserfs: Remove unneed check in reiserfs_write_full_page()
  udf: Fix NULL pointer dereference in udf_symlink function
  reiserfs: add check for invalid 1st journal block
parents a6ecc2a4 8b0ed844
...@@ -482,7 +482,7 @@ ...@@ -482,7 +482,7 @@
550 common process_madvise sys_process_madvise 550 common process_madvise sys_process_madvise
551 common epoll_pwait2 sys_epoll_pwait2 551 common epoll_pwait2 sys_epoll_pwait2
552 common mount_setattr sys_mount_setattr 552 common mount_setattr sys_mount_setattr
# 553 reserved for quotactl_path 553 common quotactl_fd sys_quotactl_fd
554 common landlock_create_ruleset sys_landlock_create_ruleset 554 common landlock_create_ruleset sys_landlock_create_ruleset
555 common landlock_add_rule sys_landlock_add_rule 555 common landlock_add_rule sys_landlock_add_rule
556 common landlock_restrict_self sys_landlock_restrict_self 556 common landlock_restrict_self sys_landlock_restrict_self
...@@ -456,7 +456,7 @@ ...@@ -456,7 +456,7 @@
440 common process_madvise sys_process_madvise 440 common process_madvise sys_process_madvise
441 common epoll_pwait2 sys_epoll_pwait2 441 common epoll_pwait2 sys_epoll_pwait2
442 common mount_setattr sys_mount_setattr 442 common mount_setattr sys_mount_setattr
# 443 reserved for quotactl_path 443 common quotactl_fd sys_quotactl_fd
444 common landlock_create_ruleset sys_landlock_create_ruleset 444 common landlock_create_ruleset sys_landlock_create_ruleset
445 common landlock_add_rule sys_landlock_add_rule 445 common landlock_add_rule sys_landlock_add_rule
446 common landlock_restrict_self sys_landlock_restrict_self 446 common landlock_restrict_self sys_landlock_restrict_self
...@@ -893,7 +893,8 @@ __SYSCALL(__NR_process_madvise, sys_process_madvise) ...@@ -893,7 +893,8 @@ __SYSCALL(__NR_process_madvise, sys_process_madvise)
__SYSCALL(__NR_epoll_pwait2, compat_sys_epoll_pwait2) __SYSCALL(__NR_epoll_pwait2, compat_sys_epoll_pwait2)
#define __NR_mount_setattr 442 #define __NR_mount_setattr 442
__SYSCALL(__NR_mount_setattr, sys_mount_setattr) __SYSCALL(__NR_mount_setattr, sys_mount_setattr)
/* 443 is reserved for quotactl_path */ #define __NR_quotactl_fd 443
__SYSCALL(__NR_quotactl_fd, sys_quotactl_fd)
#define __NR_landlock_create_ruleset 444 #define __NR_landlock_create_ruleset 444
__SYSCALL(__NR_landlock_create_ruleset, sys_landlock_create_ruleset) __SYSCALL(__NR_landlock_create_ruleset, sys_landlock_create_ruleset)
#define __NR_landlock_add_rule 445 #define __NR_landlock_add_rule 445
......
...@@ -363,7 +363,7 @@ ...@@ -363,7 +363,7 @@
440 common process_madvise sys_process_madvise 440 common process_madvise sys_process_madvise
441 common epoll_pwait2 sys_epoll_pwait2 441 common epoll_pwait2 sys_epoll_pwait2
442 common mount_setattr sys_mount_setattr 442 common mount_setattr sys_mount_setattr
# 443 reserved for quotactl_path 443 common quotactl_fd sys_quotactl_fd
444 common landlock_create_ruleset sys_landlock_create_ruleset 444 common landlock_create_ruleset sys_landlock_create_ruleset
445 common landlock_add_rule sys_landlock_add_rule 445 common landlock_add_rule sys_landlock_add_rule
446 common landlock_restrict_self sys_landlock_restrict_self 446 common landlock_restrict_self sys_landlock_restrict_self
...@@ -442,7 +442,7 @@ ...@@ -442,7 +442,7 @@
440 common process_madvise sys_process_madvise 440 common process_madvise sys_process_madvise
441 common epoll_pwait2 sys_epoll_pwait2 441 common epoll_pwait2 sys_epoll_pwait2
442 common mount_setattr sys_mount_setattr 442 common mount_setattr sys_mount_setattr
# 443 reserved for quotactl_path 443 common quotactl_fd sys_quotactl_fd
444 common landlock_create_ruleset sys_landlock_create_ruleset 444 common landlock_create_ruleset sys_landlock_create_ruleset
445 common landlock_add_rule sys_landlock_add_rule 445 common landlock_add_rule sys_landlock_add_rule
446 common landlock_restrict_self sys_landlock_restrict_self 446 common landlock_restrict_self sys_landlock_restrict_self
...@@ -448,7 +448,7 @@ ...@@ -448,7 +448,7 @@
440 common process_madvise sys_process_madvise 440 common process_madvise sys_process_madvise
441 common epoll_pwait2 sys_epoll_pwait2 441 common epoll_pwait2 sys_epoll_pwait2
442 common mount_setattr sys_mount_setattr 442 common mount_setattr sys_mount_setattr
# 443 reserved for quotactl_path 443 common quotactl_fd sys_quotactl_fd
444 common landlock_create_ruleset sys_landlock_create_ruleset 444 common landlock_create_ruleset sys_landlock_create_ruleset
445 common landlock_add_rule sys_landlock_add_rule 445 common landlock_add_rule sys_landlock_add_rule
446 common landlock_restrict_self sys_landlock_restrict_self 446 common landlock_restrict_self sys_landlock_restrict_self
...@@ -381,7 +381,7 @@ ...@@ -381,7 +381,7 @@
440 n32 process_madvise sys_process_madvise 440 n32 process_madvise sys_process_madvise
441 n32 epoll_pwait2 compat_sys_epoll_pwait2 441 n32 epoll_pwait2 compat_sys_epoll_pwait2
442 n32 mount_setattr sys_mount_setattr 442 n32 mount_setattr sys_mount_setattr
# 443 reserved for quotactl_path 443 n32 quotactl_fd sys_quotactl_fd
444 n32 landlock_create_ruleset sys_landlock_create_ruleset 444 n32 landlock_create_ruleset sys_landlock_create_ruleset
445 n32 landlock_add_rule sys_landlock_add_rule 445 n32 landlock_add_rule sys_landlock_add_rule
446 n32 landlock_restrict_self sys_landlock_restrict_self 446 n32 landlock_restrict_self sys_landlock_restrict_self
...@@ -357,7 +357,7 @@ ...@@ -357,7 +357,7 @@
440 n64 process_madvise sys_process_madvise 440 n64 process_madvise sys_process_madvise
441 n64 epoll_pwait2 sys_epoll_pwait2 441 n64 epoll_pwait2 sys_epoll_pwait2
442 n64 mount_setattr sys_mount_setattr 442 n64 mount_setattr sys_mount_setattr
# 443 reserved for quotactl_path 443 n64 quotactl_fd sys_quotactl_fd
444 n64 landlock_create_ruleset sys_landlock_create_ruleset 444 n64 landlock_create_ruleset sys_landlock_create_ruleset
445 n64 landlock_add_rule sys_landlock_add_rule 445 n64 landlock_add_rule sys_landlock_add_rule
446 n64 landlock_restrict_self sys_landlock_restrict_self 446 n64 landlock_restrict_self sys_landlock_restrict_self
...@@ -430,7 +430,7 @@ ...@@ -430,7 +430,7 @@
440 o32 process_madvise sys_process_madvise 440 o32 process_madvise sys_process_madvise
441 o32 epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2 441 o32 epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2
442 o32 mount_setattr sys_mount_setattr 442 o32 mount_setattr sys_mount_setattr
# 443 reserved for quotactl_path 443 o32 quotactl_fd sys_quotactl_fd
444 o32 landlock_create_ruleset sys_landlock_create_ruleset 444 o32 landlock_create_ruleset sys_landlock_create_ruleset
445 o32 landlock_add_rule sys_landlock_add_rule 445 o32 landlock_add_rule sys_landlock_add_rule
446 o32 landlock_restrict_self sys_landlock_restrict_self 446 o32 landlock_restrict_self sys_landlock_restrict_self
...@@ -440,7 +440,7 @@ ...@@ -440,7 +440,7 @@
440 common process_madvise sys_process_madvise 440 common process_madvise sys_process_madvise
441 common epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2 441 common epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2
442 common mount_setattr sys_mount_setattr 442 common mount_setattr sys_mount_setattr
# 443 reserved for quotactl_path 443 common quotactl_fd sys_quotactl_fd
444 common landlock_create_ruleset sys_landlock_create_ruleset 444 common landlock_create_ruleset sys_landlock_create_ruleset
445 common landlock_add_rule sys_landlock_add_rule 445 common landlock_add_rule sys_landlock_add_rule
446 common landlock_restrict_self sys_landlock_restrict_self 446 common landlock_restrict_self sys_landlock_restrict_self
...@@ -522,7 +522,7 @@ ...@@ -522,7 +522,7 @@
440 common process_madvise sys_process_madvise 440 common process_madvise sys_process_madvise
441 common epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2 441 common epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2
442 common mount_setattr sys_mount_setattr 442 common mount_setattr sys_mount_setattr
# 443 reserved for quotactl_path 443 common quotactl_fd sys_quotactl_fd
444 common landlock_create_ruleset sys_landlock_create_ruleset 444 common landlock_create_ruleset sys_landlock_create_ruleset
445 common landlock_add_rule sys_landlock_add_rule 445 common landlock_add_rule sys_landlock_add_rule
446 common landlock_restrict_self sys_landlock_restrict_self 446 common landlock_restrict_self sys_landlock_restrict_self
...@@ -445,7 +445,7 @@ ...@@ -445,7 +445,7 @@
440 common process_madvise sys_process_madvise sys_process_madvise 440 common process_madvise sys_process_madvise sys_process_madvise
441 common epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2 441 common epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2
442 common mount_setattr sys_mount_setattr sys_mount_setattr 442 common mount_setattr sys_mount_setattr sys_mount_setattr
# 443 reserved for quotactl_path 443 common quotactl_fd sys_quotactl_fd sys_quotactl_fd
444 common landlock_create_ruleset sys_landlock_create_ruleset sys_landlock_create_ruleset 444 common landlock_create_ruleset sys_landlock_create_ruleset sys_landlock_create_ruleset
445 common landlock_add_rule sys_landlock_add_rule sys_landlock_add_rule 445 common landlock_add_rule sys_landlock_add_rule sys_landlock_add_rule
446 common landlock_restrict_self sys_landlock_restrict_self sys_landlock_restrict_self 446 common landlock_restrict_self sys_landlock_restrict_self sys_landlock_restrict_self
...@@ -445,7 +445,7 @@ ...@@ -445,7 +445,7 @@
440 common process_madvise sys_process_madvise 440 common process_madvise sys_process_madvise
441 common epoll_pwait2 sys_epoll_pwait2 441 common epoll_pwait2 sys_epoll_pwait2
442 common mount_setattr sys_mount_setattr 442 common mount_setattr sys_mount_setattr
# 443 reserved for quotactl_path 443 common quotactl_fd sys_quotactl_fd
444 common landlock_create_ruleset sys_landlock_create_ruleset 444 common landlock_create_ruleset sys_landlock_create_ruleset
445 common landlock_add_rule sys_landlock_add_rule 445 common landlock_add_rule sys_landlock_add_rule
446 common landlock_restrict_self sys_landlock_restrict_self 446 common landlock_restrict_self sys_landlock_restrict_self
...@@ -488,7 +488,7 @@ ...@@ -488,7 +488,7 @@
440 common process_madvise sys_process_madvise 440 common process_madvise sys_process_madvise
441 common epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2 441 common epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2
442 common mount_setattr sys_mount_setattr 442 common mount_setattr sys_mount_setattr
# 443 reserved for quotactl_path 443 common quotactl_fd sys_quotactl_fd
444 common landlock_create_ruleset sys_landlock_create_ruleset 444 common landlock_create_ruleset sys_landlock_create_ruleset
445 common landlock_add_rule sys_landlock_add_rule 445 common landlock_add_rule sys_landlock_add_rule
446 common landlock_restrict_self sys_landlock_restrict_self 446 common landlock_restrict_self sys_landlock_restrict_self
...@@ -447,7 +447,7 @@ ...@@ -447,7 +447,7 @@
440 i386 process_madvise sys_process_madvise 440 i386 process_madvise sys_process_madvise
441 i386 epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2 441 i386 epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2
442 i386 mount_setattr sys_mount_setattr 442 i386 mount_setattr sys_mount_setattr
# 443 reserved for quotactl_path 443 i386 quotactl_fd sys_quotactl_fd
444 i386 landlock_create_ruleset sys_landlock_create_ruleset 444 i386 landlock_create_ruleset sys_landlock_create_ruleset
445 i386 landlock_add_rule sys_landlock_add_rule 445 i386 landlock_add_rule sys_landlock_add_rule
446 i386 landlock_restrict_self sys_landlock_restrict_self 446 i386 landlock_restrict_self sys_landlock_restrict_self
...@@ -364,7 +364,7 @@ ...@@ -364,7 +364,7 @@
440 common process_madvise sys_process_madvise 440 common process_madvise sys_process_madvise
441 common epoll_pwait2 sys_epoll_pwait2 441 common epoll_pwait2 sys_epoll_pwait2
442 common mount_setattr sys_mount_setattr 442 common mount_setattr sys_mount_setattr
# 443 reserved for quotactl_path 443 common quotactl_fd sys_quotactl_fd
444 common landlock_create_ruleset sys_landlock_create_ruleset 444 common landlock_create_ruleset sys_landlock_create_ruleset
445 common landlock_add_rule sys_landlock_add_rule 445 common landlock_add_rule sys_landlock_add_rule
446 common landlock_restrict_self sys_landlock_restrict_self 446 common landlock_restrict_self sys_landlock_restrict_self
......
...@@ -413,7 +413,7 @@ ...@@ -413,7 +413,7 @@
440 common process_madvise sys_process_madvise 440 common process_madvise sys_process_madvise
441 common epoll_pwait2 sys_epoll_pwait2 441 common epoll_pwait2 sys_epoll_pwait2
442 common mount_setattr sys_mount_setattr 442 common mount_setattr sys_mount_setattr
# 443 reserved for quotactl_path 443 common quotactl_fd sys_quotactl_fd
444 common landlock_create_ruleset sys_landlock_create_ruleset 444 common landlock_create_ruleset sys_landlock_create_ruleset
445 common landlock_add_rule sys_landlock_add_rule 445 common landlock_add_rule sys_landlock_add_rule
446 common landlock_restrict_self sys_landlock_restrict_self 446 common landlock_restrict_self sys_landlock_restrict_self
...@@ -567,9 +567,14 @@ static void inode_switch_wbs(struct inode *inode, int new_wb_id) ...@@ -567,9 +567,14 @@ static void inode_switch_wbs(struct inode *inode, int new_wb_id)
/* find and pin the new wb */ /* find and pin the new wb */
rcu_read_lock(); rcu_read_lock();
memcg_css = css_from_id(new_wb_id, &memory_cgrp_subsys); memcg_css = css_from_id(new_wb_id, &memory_cgrp_subsys);
if (memcg_css) if (memcg_css && !css_tryget(memcg_css))
isw->new_wb = wb_get_create(bdi, memcg_css, GFP_ATOMIC); memcg_css = NULL;
rcu_read_unlock(); rcu_read_unlock();
if (!memcg_css)
goto out_free;
isw->new_wb = wb_get_create(bdi, memcg_css, GFP_ATOMIC);
css_put(memcg_css);
if (!isw->new_wb) if (!isw->new_wb)
goto out_free; goto out_free;
......
...@@ -235,8 +235,6 @@ static int do_isofs_readdir(struct inode *inode, struct file *file, ...@@ -235,8 +235,6 @@ static int do_isofs_readdir(struct inode *inode, struct file *file,
break; break;
} }
ctx->pos += de_len; ctx->pos += de_len;
continue;
} }
if (bh) if (bh)
brelse(bh); brelse(bh);
......
...@@ -968,31 +968,30 @@ SYSCALL_DEFINE4(quotactl, unsigned int, cmd, const char __user *, special, ...@@ -968,31 +968,30 @@ SYSCALL_DEFINE4(quotactl, unsigned int, cmd, const char __user *, special,
return ret; return ret;
} }
SYSCALL_DEFINE4(quotactl_path, unsigned int, cmd, const char __user *, SYSCALL_DEFINE4(quotactl_fd, unsigned int, fd, unsigned int, cmd,
mountpoint, qid_t, id, void __user *, addr) qid_t, id, void __user *, addr)
{ {
struct super_block *sb; struct super_block *sb;
struct path mountpath;
unsigned int cmds = cmd >> SUBCMDSHIFT; unsigned int cmds = cmd >> SUBCMDSHIFT;
unsigned int type = cmd & SUBCMDMASK; unsigned int type = cmd & SUBCMDMASK;
struct fd f;
int ret; int ret;
if (type >= MAXQUOTAS) f = fdget_raw(fd);
return -EINVAL; if (!f.file)
return -EBADF;
ret = user_path_at(AT_FDCWD, mountpoint, ret = -EINVAL;
LOOKUP_FOLLOW | LOOKUP_AUTOMOUNT, &mountpath); if (type >= MAXQUOTAS)
if (ret) goto out;
return ret;
sb = mountpath.mnt->mnt_sb;
if (quotactl_cmd_write(cmds)) { if (quotactl_cmd_write(cmds)) {
ret = mnt_want_write(mountpath.mnt); ret = mnt_want_write(f.file->f_path.mnt);
if (ret) if (ret)
goto out; goto out;
} }
sb = f.file->f_path.mnt->mnt_sb;
if (quotactl_cmd_onoff(cmds)) if (quotactl_cmd_onoff(cmds))
down_write(&sb->s_umount); down_write(&sb->s_umount);
else else
...@@ -1006,9 +1005,8 @@ SYSCALL_DEFINE4(quotactl_path, unsigned int, cmd, const char __user *, ...@@ -1006,9 +1005,8 @@ SYSCALL_DEFINE4(quotactl_path, unsigned int, cmd, const char __user *,
up_read(&sb->s_umount); up_read(&sb->s_umount);
if (quotactl_cmd_write(cmds)) if (quotactl_cmd_write(cmds))
mnt_drop_write(mountpath.mnt); mnt_drop_write(f.file->f_path.mnt);
out: out:
path_put(&mountpath); fdput(f);
return ret; return ret;
} }
...@@ -47,15 +47,6 @@ static int qtree_dqstr_in_blk(struct qtree_mem_dqinfo *info) ...@@ -47,15 +47,6 @@ static int qtree_dqstr_in_blk(struct qtree_mem_dqinfo *info)
/ info->dqi_entry_size; / info->dqi_entry_size;
} }
static char *getdqbuf(size_t size)
{
char *buf = kmalloc(size, GFP_NOFS);
if (!buf)
printk(KERN_WARNING
"VFS: Not enough memory for quota buffers.\n");
return buf;
}
static ssize_t read_blk(struct qtree_mem_dqinfo *info, uint blk, char *buf) static ssize_t read_blk(struct qtree_mem_dqinfo *info, uint blk, char *buf)
{ {
struct super_block *sb = info->dqi_sb; struct super_block *sb = info->dqi_sb;
...@@ -83,7 +74,7 @@ static ssize_t write_blk(struct qtree_mem_dqinfo *info, uint blk, char *buf) ...@@ -83,7 +74,7 @@ static ssize_t write_blk(struct qtree_mem_dqinfo *info, uint blk, char *buf)
/* Remove empty block from list and return it */ /* Remove empty block from list and return it */
static int get_free_dqblk(struct qtree_mem_dqinfo *info) static int get_free_dqblk(struct qtree_mem_dqinfo *info)
{ {
char *buf = getdqbuf(info->dqi_usable_bs); char *buf = kmalloc(info->dqi_usable_bs, GFP_NOFS);
struct qt_disk_dqdbheader *dh = (struct qt_disk_dqdbheader *)buf; struct qt_disk_dqdbheader *dh = (struct qt_disk_dqdbheader *)buf;
int ret, blk; int ret, blk;
...@@ -132,7 +123,7 @@ static int put_free_dqblk(struct qtree_mem_dqinfo *info, char *buf, uint blk) ...@@ -132,7 +123,7 @@ static int put_free_dqblk(struct qtree_mem_dqinfo *info, char *buf, uint blk)
static int remove_free_dqentry(struct qtree_mem_dqinfo *info, char *buf, static int remove_free_dqentry(struct qtree_mem_dqinfo *info, char *buf,
uint blk) uint blk)
{ {
char *tmpbuf = getdqbuf(info->dqi_usable_bs); char *tmpbuf = kmalloc(info->dqi_usable_bs, GFP_NOFS);
struct qt_disk_dqdbheader *dh = (struct qt_disk_dqdbheader *)buf; struct qt_disk_dqdbheader *dh = (struct qt_disk_dqdbheader *)buf;
uint nextblk = le32_to_cpu(dh->dqdh_next_free); uint nextblk = le32_to_cpu(dh->dqdh_next_free);
uint prevblk = le32_to_cpu(dh->dqdh_prev_free); uint prevblk = le32_to_cpu(dh->dqdh_prev_free);
...@@ -179,7 +170,7 @@ static int remove_free_dqentry(struct qtree_mem_dqinfo *info, char *buf, ...@@ -179,7 +170,7 @@ static int remove_free_dqentry(struct qtree_mem_dqinfo *info, char *buf,
static int insert_free_dqentry(struct qtree_mem_dqinfo *info, char *buf, static int insert_free_dqentry(struct qtree_mem_dqinfo *info, char *buf,
uint blk) uint blk)
{ {
char *tmpbuf = getdqbuf(info->dqi_usable_bs); char *tmpbuf = kmalloc(info->dqi_usable_bs, GFP_NOFS);
struct qt_disk_dqdbheader *dh = (struct qt_disk_dqdbheader *)buf; struct qt_disk_dqdbheader *dh = (struct qt_disk_dqdbheader *)buf;
int err; int err;
...@@ -227,7 +218,7 @@ static uint find_free_dqentry(struct qtree_mem_dqinfo *info, ...@@ -227,7 +218,7 @@ static uint find_free_dqentry(struct qtree_mem_dqinfo *info,
{ {
uint blk, i; uint blk, i;
struct qt_disk_dqdbheader *dh; struct qt_disk_dqdbheader *dh;
char *buf = getdqbuf(info->dqi_usable_bs); char *buf = kmalloc(info->dqi_usable_bs, GFP_NOFS);
char *ddquot; char *ddquot;
*err = 0; *err = 0;
...@@ -298,7 +289,7 @@ static uint find_free_dqentry(struct qtree_mem_dqinfo *info, ...@@ -298,7 +289,7 @@ static uint find_free_dqentry(struct qtree_mem_dqinfo *info,
static int do_insert_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot, static int do_insert_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot,
uint *treeblk, int depth) uint *treeblk, int depth)
{ {
char *buf = getdqbuf(info->dqi_usable_bs); char *buf = kmalloc(info->dqi_usable_bs, GFP_NOFS);
int ret = 0, newson = 0, newact = 0; int ret = 0, newson = 0, newact = 0;
__le32 *ref; __le32 *ref;
uint newblk; uint newblk;
...@@ -375,7 +366,7 @@ int qtree_write_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot) ...@@ -375,7 +366,7 @@ int qtree_write_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot)
int type = dquot->dq_id.type; int type = dquot->dq_id.type;
struct super_block *sb = dquot->dq_sb; struct super_block *sb = dquot->dq_sb;
ssize_t ret; ssize_t ret;
char *ddquot = getdqbuf(info->dqi_entry_size); char *ddquot = kmalloc(info->dqi_entry_size, GFP_NOFS);
if (!ddquot) if (!ddquot)
return -ENOMEM; return -ENOMEM;
...@@ -414,7 +405,7 @@ static int free_dqentry(struct qtree_mem_dqinfo *info, struct dquot *dquot, ...@@ -414,7 +405,7 @@ static int free_dqentry(struct qtree_mem_dqinfo *info, struct dquot *dquot,
uint blk) uint blk)
{ {
struct qt_disk_dqdbheader *dh; struct qt_disk_dqdbheader *dh;
char *buf = getdqbuf(info->dqi_usable_bs); char *buf = kmalloc(info->dqi_usable_bs, GFP_NOFS);
int ret = 0; int ret = 0;
if (!buf) if (!buf)
...@@ -474,7 +465,7 @@ static int free_dqentry(struct qtree_mem_dqinfo *info, struct dquot *dquot, ...@@ -474,7 +465,7 @@ static int free_dqentry(struct qtree_mem_dqinfo *info, struct dquot *dquot,
static int remove_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot, static int remove_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot,
uint *blk, int depth) uint *blk, int depth)
{ {
char *buf = getdqbuf(info->dqi_usable_bs); char *buf = kmalloc(info->dqi_usable_bs, GFP_NOFS);
int ret = 0; int ret = 0;
uint newblk; uint newblk;
__le32 *ref = (__le32 *)buf; __le32 *ref = (__le32 *)buf;
...@@ -533,7 +524,7 @@ EXPORT_SYMBOL(qtree_delete_dquot); ...@@ -533,7 +524,7 @@ EXPORT_SYMBOL(qtree_delete_dquot);
static loff_t find_block_dqentry(struct qtree_mem_dqinfo *info, static loff_t find_block_dqentry(struct qtree_mem_dqinfo *info,
struct dquot *dquot, uint blk) struct dquot *dquot, uint blk)
{ {
char *buf = getdqbuf(info->dqi_usable_bs); char *buf = kmalloc(info->dqi_usable_bs, GFP_NOFS);
loff_t ret = 0; loff_t ret = 0;
int i; int i;
char *ddquot; char *ddquot;
...@@ -571,7 +562,7 @@ static loff_t find_block_dqentry(struct qtree_mem_dqinfo *info, ...@@ -571,7 +562,7 @@ static loff_t find_block_dqentry(struct qtree_mem_dqinfo *info,
static loff_t find_tree_dqentry(struct qtree_mem_dqinfo *info, static loff_t find_tree_dqentry(struct qtree_mem_dqinfo *info,
struct dquot *dquot, uint blk, int depth) struct dquot *dquot, uint blk, int depth)
{ {
char *buf = getdqbuf(info->dqi_usable_bs); char *buf = kmalloc(info->dqi_usable_bs, GFP_NOFS);
loff_t ret = 0; loff_t ret = 0;
__le32 *ref = (__le32 *)buf; __le32 *ref = (__le32 *)buf;
...@@ -635,7 +626,7 @@ int qtree_read_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot) ...@@ -635,7 +626,7 @@ int qtree_read_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot)
} }
dquot->dq_off = offset; dquot->dq_off = offset;
} }
ddquot = getdqbuf(info->dqi_entry_size); ddquot = kmalloc(info->dqi_entry_size, GFP_NOFS);
if (!ddquot) if (!ddquot)
return -ENOMEM; return -ENOMEM;
ret = sb->s_op->quota_read(sb, type, ddquot, info->dqi_entry_size, ret = sb->s_op->quota_read(sb, type, ddquot, info->dqi_entry_size,
...@@ -679,7 +670,7 @@ EXPORT_SYMBOL(qtree_release_dquot); ...@@ -679,7 +670,7 @@ EXPORT_SYMBOL(qtree_release_dquot);
static int find_next_id(struct qtree_mem_dqinfo *info, qid_t *id, static int find_next_id(struct qtree_mem_dqinfo *info, qid_t *id,
unsigned int blk, int depth) unsigned int blk, int depth)
{ {
char *buf = getdqbuf(info->dqi_usable_bs); char *buf = kmalloc(info->dqi_usable_bs, GFP_NOFS);
__le32 *ref = (__le32 *)buf; __le32 *ref = (__le32 *)buf;
ssize_t ret; ssize_t ret;
unsigned int epb = info->dqi_usable_bs >> 2; unsigned int epb = info->dqi_usable_bs >> 2;
......
...@@ -2584,9 +2584,7 @@ static int reiserfs_write_full_page(struct page *page, ...@@ -2584,9 +2584,7 @@ static int reiserfs_write_full_page(struct page *page,
clear_buffer_dirty(bh); clear_buffer_dirty(bh);
set_buffer_uptodate(bh); set_buffer_uptodate(bh);
} else if ((checked || buffer_dirty(bh)) && } else if ((checked || buffer_dirty(bh)) &&
(!buffer_mapped(bh) || (buffer_mapped(bh) (!buffer_mapped(bh) || bh->b_blocknr == 0)) {
&& bh->b_blocknr ==
0))) {
/* /*
* not mapped yet, or it points to a direct item, search * not mapped yet, or it points to a direct item, search
* the btree for the mapping info, and log any direct * the btree for the mapping info, and log any direct
......
...@@ -2758,6 +2758,20 @@ int journal_init(struct super_block *sb, const char *j_dev_name, ...@@ -2758,6 +2758,20 @@ int journal_init(struct super_block *sb, const char *j_dev_name,
goto free_and_return; goto free_and_return;
} }
/*
* Sanity check to see if journal first block is correct.
* If journal first block is invalid it can cause
* zeroing important superblock members.
*/
if (!SB_ONDISK_JOURNAL_DEVICE(sb) &&
SB_ONDISK_JOURNAL_1st_BLOCK(sb) < SB_JOURNAL_1st_RESERVED_BLOCK(sb)) {
reiserfs_warning(sb, "journal-1393",
"journal 1st super block is invalid: 1st reserved block %d, but actual 1st block is %d",
SB_JOURNAL_1st_RESERVED_BLOCK(sb),
SB_ONDISK_JOURNAL_1st_BLOCK(sb));
goto free_and_return;
}
if (journal_init_dev(sb, journal, j_dev_name) != 0) { if (journal_init_dev(sb, journal, j_dev_name) != 0) {
reiserfs_warning(sb, "sh-462", reiserfs_warning(sb, "sh-462",
"unable to initialize journal device"); "unable to initialize journal device");
......
...@@ -934,6 +934,10 @@ static int udf_symlink(struct user_namespace *mnt_userns, struct inode *dir, ...@@ -934,6 +934,10 @@ static int udf_symlink(struct user_namespace *mnt_userns, struct inode *dir,
iinfo->i_location.partitionReferenceNum, iinfo->i_location.partitionReferenceNum,
0); 0);
epos.bh = udf_tgetblk(sb, block); epos.bh = udf_tgetblk(sb, block);
if (unlikely(!epos.bh)) {
err = -ENOMEM;
goto out_no_entry;
}
lock_buffer(epos.bh); lock_buffer(epos.bh);
memset(epos.bh->b_data, 0x00, bsize); memset(epos.bh->b_data, 0x00, bsize);
set_buffer_uptodate(epos.bh); set_buffer_uptodate(epos.bh);
......
...@@ -485,8 +485,8 @@ asmlinkage long sys_pipe2(int __user *fildes, int flags); ...@@ -485,8 +485,8 @@ asmlinkage long sys_pipe2(int __user *fildes, int flags);
/* fs/quota.c */ /* fs/quota.c */
asmlinkage long sys_quotactl(unsigned int cmd, const char __user *special, asmlinkage long sys_quotactl(unsigned int cmd, const char __user *special,
qid_t id, void __user *addr); qid_t id, void __user *addr);
asmlinkage long sys_quotactl_path(unsigned int cmd, const char __user *mountpoint, asmlinkage long sys_quotactl_fd(unsigned int fd, unsigned int cmd, qid_t id,
qid_t id, void __user *addr); void __user *addr);
/* fs/readdir.c */ /* fs/readdir.c */
asmlinkage long sys_getdents64(unsigned int fd, asmlinkage long sys_getdents64(unsigned int fd,
......
...@@ -863,7 +863,8 @@ __SYSCALL(__NR_process_madvise, sys_process_madvise) ...@@ -863,7 +863,8 @@ __SYSCALL(__NR_process_madvise, sys_process_madvise)
__SC_COMP(__NR_epoll_pwait2, sys_epoll_pwait2, compat_sys_epoll_pwait2) __SC_COMP(__NR_epoll_pwait2, sys_epoll_pwait2, compat_sys_epoll_pwait2)
#define __NR_mount_setattr 442 #define __NR_mount_setattr 442
__SYSCALL(__NR_mount_setattr, sys_mount_setattr) __SYSCALL(__NR_mount_setattr, sys_mount_setattr)
/* 443 is reserved for quotactl_path */ #define __NR_quotactl_fd 443
__SYSCALL(__NR_quotactl_fd, sys_quotactl_fd)
#define __NR_landlock_create_ruleset 444 #define __NR_landlock_create_ruleset 444
__SYSCALL(__NR_landlock_create_ruleset, sys_landlock_create_ruleset) __SYSCALL(__NR_landlock_create_ruleset, sys_landlock_create_ruleset)
......
...@@ -99,7 +99,7 @@ COND_SYSCALL(flock); ...@@ -99,7 +99,7 @@ COND_SYSCALL(flock);
/* fs/quota.c */ /* fs/quota.c */
COND_SYSCALL(quotactl); COND_SYSCALL(quotactl);
COND_SYSCALL(quotactl_path); COND_SYSCALL(quotactl_fd);
/* fs/readdir.c */ /* fs/readdir.c */
......
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