Skip to content

Commit b77a69b

Browse files
committed
Merge tag 'fs_for_v5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
Pull UDF, reiserfs, ext2, quota fixes from Jan Kara: - a couple of UDF fixes for issues found by syzbot fuzzing - a couple of reiserfs fixes for issues found by syzbot fuzzing - some minor ext2 cleanups - quota patches to support grace times beyond year 2038 for XFS quota APIs * tag 'fs_for_v5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs: reiserfs: Fix oops during mount udf: Limit sparing table size udf: Remove pointless union in udf_inode_info udf: Avoid accessing uninitialized data on failed inode read quota: clear padding in v2r1_mem2diskdqb() reiserfs: Initialize inode keys properly udf: Fix memory leak when mounting udf: Remove redundant initialization of variable ret reiserfs: only call unlock_new_inode() if I_NEW ext2: Fix some kernel-doc warnings in balloc.c quota: Expand comment describing d_itimer quota: widen timestamps for the fs_disk_quota structure reiserfs: Fix memory leak in reiserfs_parse_options() udf: Use kvzalloc() in udf_sb_alloc_bitmap() ext2: remove duplicate include
2 parents ca5387e + c2bb80b commit b77a69b

File tree

18 files changed

+143
-101
lines changed

18 files changed

+143
-101
lines changed

fs/ext2/balloc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ static void group_adjust_blocks(struct super_block *sb, int group_no,
189189

190190
/**
191191
* __rsv_window_dump() -- Dump the filesystem block allocation reservation map
192-
* @rb_root: root of per-filesystem reservation rb tree
192+
* @root: root of per-filesystem reservation rb tree
193193
* @verbose: verbose mode
194194
* @fn: function which wishes to dump the reservation map
195195
*
@@ -282,7 +282,7 @@ goal_in_my_reservation(struct ext2_reserve_window *rsv, ext2_grpblk_t grp_goal,
282282

283283
/**
284284
* search_reserve_window()
285-
* @rb_root: root of reservation tree
285+
* @root: root of reservation tree
286286
* @goal: target allocation block
287287
*
288288
* Find the reserved window which includes the goal, or the previous one
@@ -859,7 +859,7 @@ static int find_next_reservable_window(
859859
*
860860
* failed: we failed to find a reservation window in this group
861861
*
862-
* @rsv: the reservation
862+
* @my_rsv: the reservation
863863
*
864864
* @grp_goal: The goal (group-relative). It is where the search for a
865865
* free reservable space should start from.

fs/ext2/inode.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#include <linux/iomap.h>
3737
#include <linux/namei.h>
3838
#include <linux/uio.h>
39-
#include <linux/fiemap.h>
4039
#include "ext2.h"
4140
#include "acl.h"
4241
#include "xattr.h"

fs/quota/quota.c

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,14 @@ static inline u64 quota_btobb(u64 bytes)
532532
return (bytes + (1 << XFS_BB_SHIFT) - 1) >> XFS_BB_SHIFT;
533533
}
534534

535+
static inline s64 copy_from_xfs_dqblk_ts(const struct fs_disk_quota *d,
536+
__s32 timer, __s8 timer_hi)
537+
{
538+
if (d->d_fieldmask & FS_DQ_BIGTIME)
539+
return (u32)timer | (s64)timer_hi << 32;
540+
return timer;
541+
}
542+
535543
static void copy_from_xfs_dqblk(struct qc_dqblk *dst, struct fs_disk_quota *src)
536544
{
537545
dst->d_spc_hardlimit = quota_bbtob(src->d_blk_hardlimit);
@@ -540,14 +548,17 @@ static void copy_from_xfs_dqblk(struct qc_dqblk *dst, struct fs_disk_quota *src)
540548
dst->d_ino_softlimit = src->d_ino_softlimit;
541549
dst->d_space = quota_bbtob(src->d_bcount);
542550
dst->d_ino_count = src->d_icount;
543-
dst->d_ino_timer = src->d_itimer;
544-
dst->d_spc_timer = src->d_btimer;
551+
dst->d_ino_timer = copy_from_xfs_dqblk_ts(src, src->d_itimer,
552+
src->d_itimer_hi);
553+
dst->d_spc_timer = copy_from_xfs_dqblk_ts(src, src->d_btimer,
554+
src->d_btimer_hi);
545555
dst->d_ino_warns = src->d_iwarns;
546556
dst->d_spc_warns = src->d_bwarns;
547557
dst->d_rt_spc_hardlimit = quota_bbtob(src->d_rtb_hardlimit);
548558
dst->d_rt_spc_softlimit = quota_bbtob(src->d_rtb_softlimit);
549559
dst->d_rt_space = quota_bbtob(src->d_rtbcount);
550-
dst->d_rt_spc_timer = src->d_rtbtimer;
560+
dst->d_rt_spc_timer = copy_from_xfs_dqblk_ts(src, src->d_rtbtimer,
561+
src->d_rtbtimer_hi);
551562
dst->d_rt_spc_warns = src->d_rtbwarns;
552563
dst->d_fieldmask = 0;
553564
if (src->d_fieldmask & FS_DQ_ISOFT)
@@ -639,10 +650,26 @@ static int quota_setxquota(struct super_block *sb, int type, qid_t id,
639650
return sb->s_qcop->set_dqblk(sb, qid, &qdq);
640651
}
641652

653+
static inline void copy_to_xfs_dqblk_ts(const struct fs_disk_quota *d,
654+
__s32 *timer_lo, __s8 *timer_hi, s64 timer)
655+
{
656+
*timer_lo = timer;
657+
if (d->d_fieldmask & FS_DQ_BIGTIME)
658+
*timer_hi = timer >> 32;
659+
}
660+
661+
static inline bool want_bigtime(s64 timer)
662+
{
663+
return timer > S32_MAX || timer < S32_MIN;
664+
}
665+
642666
static void copy_to_xfs_dqblk(struct fs_disk_quota *dst, struct qc_dqblk *src,
643667
int type, qid_t id)
644668
{
645669
memset(dst, 0, sizeof(*dst));
670+
if (want_bigtime(src->d_ino_timer) || want_bigtime(src->d_spc_timer) ||
671+
want_bigtime(src->d_rt_spc_timer))
672+
dst->d_fieldmask |= FS_DQ_BIGTIME;
646673
dst->d_version = FS_DQUOT_VERSION;
647674
dst->d_id = id;
648675
if (type == USRQUOTA)
@@ -657,14 +684,17 @@ static void copy_to_xfs_dqblk(struct fs_disk_quota *dst, struct qc_dqblk *src,
657684
dst->d_ino_softlimit = src->d_ino_softlimit;
658685
dst->d_bcount = quota_btobb(src->d_space);
659686
dst->d_icount = src->d_ino_count;
660-
dst->d_itimer = src->d_ino_timer;
661-
dst->d_btimer = src->d_spc_timer;
687+
copy_to_xfs_dqblk_ts(dst, &dst->d_itimer, &dst->d_itimer_hi,
688+
src->d_ino_timer);
689+
copy_to_xfs_dqblk_ts(dst, &dst->d_btimer, &dst->d_btimer_hi,
690+
src->d_spc_timer);
662691
dst->d_iwarns = src->d_ino_warns;
663692
dst->d_bwarns = src->d_spc_warns;
664693
dst->d_rtb_hardlimit = quota_btobb(src->d_rt_spc_hardlimit);
665694
dst->d_rtb_softlimit = quota_btobb(src->d_rt_spc_softlimit);
666695
dst->d_rtbcount = quota_btobb(src->d_rt_space);
667-
dst->d_rtbtimer = src->d_rt_spc_timer;
696+
copy_to_xfs_dqblk_ts(dst, &dst->d_rtbtimer, &dst->d_rtbtimer_hi,
697+
src->d_rt_spc_timer);
668698
dst->d_rtbwarns = src->d_rt_spc_warns;
669699
}
670700

fs/quota/quota_v2.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ static void v2r1_mem2diskdqb(void *dp, struct dquot *dquot)
282282
d->dqb_curspace = cpu_to_le64(m->dqb_curspace);
283283
d->dqb_btime = cpu_to_le64(m->dqb_btime);
284284
d->dqb_id = cpu_to_le32(from_kqid(&init_user_ns, dquot->dq_id));
285+
d->dqb_pad = 0;
285286
if (qtree_entry_unused(info, dp))
286287
d->dqb_itime = cpu_to_le64(1);
287288
}

fs/reiserfs/inode.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,11 +1551,7 @@ void reiserfs_read_locked_inode(struct inode *inode,
15511551
* set version 1, version 2 could be used too, because stat data
15521552
* key is the same in both versions
15531553
*/
1554-
key.version = KEY_FORMAT_3_5;
1555-
key.on_disk_key.k_dir_id = dirino;
1556-
key.on_disk_key.k_objectid = inode->i_ino;
1557-
key.on_disk_key.k_offset = 0;
1558-
key.on_disk_key.k_type = 0;
1554+
_make_cpu_key(&key, KEY_FORMAT_3_5, dirino, inode->i_ino, 0, 0, 3);
15591555

15601556
/* look for the object's stat data */
15611557
retval = search_item(inode->i_sb, &key, &path_to_sd);
@@ -2163,7 +2159,8 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
21632159
out_inserted_sd:
21642160
clear_nlink(inode);
21652161
th->t_trans_id = 0; /* so the caller can't use this handle later */
2166-
unlock_new_inode(inode); /* OK to do even if we hadn't locked it */
2162+
if (inode->i_state & I_NEW)
2163+
unlock_new_inode(inode);
21672164
iput(inode);
21682165
return err;
21692166
}

fs/reiserfs/super.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,6 +1258,10 @@ static int reiserfs_parse_options(struct super_block *s,
12581258
"turned on.");
12591259
return 0;
12601260
}
1261+
if (qf_names[qtype] !=
1262+
REISERFS_SB(s)->s_qf_names[qtype])
1263+
kfree(qf_names[qtype]);
1264+
qf_names[qtype] = NULL;
12611265
if (*arg) { /* Some filename specified? */
12621266
if (REISERFS_SB(s)->s_qf_names[qtype]
12631267
&& strcmp(REISERFS_SB(s)->s_qf_names[qtype],
@@ -1287,10 +1291,6 @@ static int reiserfs_parse_options(struct super_block *s,
12871291
else
12881292
*mount_options |= 1 << REISERFS_GRPQUOTA;
12891293
} else {
1290-
if (qf_names[qtype] !=
1291-
REISERFS_SB(s)->s_qf_names[qtype])
1292-
kfree(qf_names[qtype]);
1293-
qf_names[qtype] = NULL;
12941294
if (qtype == USRQUOTA)
12951295
*mount_options &= ~(1 << REISERFS_USRQUOTA);
12961296
else

fs/reiserfs/xattr.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,13 @@ reiserfs_xattr_get(struct inode *inode, const char *name, void *buffer,
674674
if (get_inode_sd_version(inode) == STAT_DATA_V1)
675675
return -EOPNOTSUPP;
676676

677+
/*
678+
* priv_root needn't be initialized during mount so allow initial
679+
* lookups to succeed.
680+
*/
681+
if (!REISERFS_SB(inode->i_sb)->priv_root)
682+
return 0;
683+
677684
dentry = xattr_lookup(inode, name, XATTR_REPLACE);
678685
if (IS_ERR(dentry)) {
679686
err = PTR_ERR(dentry);

fs/udf/directory.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos,
3434
fibh->soffset = fibh->eoffset;
3535

3636
if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) {
37-
fi = udf_get_fileident(iinfo->i_ext.i_data -
37+
fi = udf_get_fileident(iinfo->i_data -
3838
(iinfo->i_efe ?
3939
sizeof(struct extendedFileEntry) :
4040
sizeof(struct fileEntry)),

fs/udf/file.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ static void __udf_adinicb_readpage(struct page *page)
5050
* So just sample it once and use the same value everywhere.
5151
*/
5252
kaddr = kmap_atomic(page);
53-
memcpy(kaddr, iinfo->i_ext.i_data + iinfo->i_lenEAttr, isize);
53+
memcpy(kaddr, iinfo->i_data + iinfo->i_lenEAttr, isize);
5454
memset(kaddr + isize, 0, PAGE_SIZE - isize);
5555
flush_dcache_page(page);
5656
SetPageUptodate(page);
@@ -76,8 +76,7 @@ static int udf_adinicb_writepage(struct page *page,
7676
BUG_ON(!PageLocked(page));
7777

7878
kaddr = kmap_atomic(page);
79-
memcpy(iinfo->i_ext.i_data + iinfo->i_lenEAttr, kaddr,
80-
i_size_read(inode));
79+
memcpy(iinfo->i_data + iinfo->i_lenEAttr, kaddr, i_size_read(inode));
8180
SetPageUptodate(page);
8281
kunmap_atomic(kaddr);
8382
mark_inode_dirty(inode);
@@ -215,7 +214,7 @@ long udf_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
215214
return put_user(UDF_I(inode)->i_lenEAttr, (int __user *)arg);
216215
case UDF_GETEABLOCK:
217216
return copy_to_user((char __user *)arg,
218-
UDF_I(inode)->i_ext.i_data,
217+
UDF_I(inode)->i_data,
219218
UDF_I(inode)->i_lenEAttr) ? -EFAULT : 0;
220219
default:
221220
return -ENOIOCTLCMD;

fs/udf/ialloc.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,16 @@ struct inode *udf_new_inode(struct inode *dir, umode_t mode)
6767
iinfo->i_efe = 1;
6868
if (UDF_VERS_USE_EXTENDED_FE > sbi->s_udfrev)
6969
sbi->s_udfrev = UDF_VERS_USE_EXTENDED_FE;
70-
iinfo->i_ext.i_data = kzalloc(inode->i_sb->s_blocksize -
71-
sizeof(struct extendedFileEntry),
72-
GFP_KERNEL);
70+
iinfo->i_data = kzalloc(inode->i_sb->s_blocksize -
71+
sizeof(struct extendedFileEntry),
72+
GFP_KERNEL);
7373
} else {
7474
iinfo->i_efe = 0;
75-
iinfo->i_ext.i_data = kzalloc(inode->i_sb->s_blocksize -
76-
sizeof(struct fileEntry),
77-
GFP_KERNEL);
75+
iinfo->i_data = kzalloc(inode->i_sb->s_blocksize -
76+
sizeof(struct fileEntry),
77+
GFP_KERNEL);
7878
}
79-
if (!iinfo->i_ext.i_data) {
79+
if (!iinfo->i_data) {
8080
iput(inode);
8181
return ERR_PTR(-ENOMEM);
8282
}

0 commit comments

Comments
 (0)