]> Git Repo - linux.git/commitdiff
Merge tag 'jfs-6.7' of https://github.com/kleikamp/linux-shaggy
authorLinus Torvalds <[email protected]>
Thu, 2 Nov 2023 18:08:28 +0000 (08:08 -1000)
committerLinus Torvalds <[email protected]>
Thu, 2 Nov 2023 18:08:28 +0000 (08:08 -1000)
Pull jfs updates from Dave Kleikamp:
 "Minor stability improvements"

* tag 'jfs-6.7' of https://github.com/kleikamp/linux-shaggy:
  jfs: define xtree root and page independently
  jfs: fix array-index-out-of-bounds in diAlloc
  jfs: fix array-index-out-of-bounds in dbFindLeaf
  fs/jfs: Add validity check for db_maxag and db_agpref
  fs/jfs: Add check for negative db_l2nbperpage

1  2 
fs/jfs/jfs_imap.c

diff --combined fs/jfs/jfs_imap.c
index 8e87264e56ce655555854e4bd9cb97b63eecf9af,394e0af0e5df0c5dec25dcb905380adc94a9d926..a037ee59e39854f662ddfdc03a51d7f0f96a07f6
@@@ -670,7 -670,7 +670,7 @@@ int diWrite(tid_t tid, struct inode *ip
                 * This is the special xtree inside the directory for storing
                 * the directory table
                 */
-               xtpage_t *p, *xp;
+               xtroot_t *p, *xp;
                xad_t *xad;
  
                jfs_ip->xtlid = 0;
                 * copy xtree root from inode to dinode:
                 */
                p = &jfs_ip->i_xtroot;
-               xp = (xtpage_t *) &dp->di_dirtable;
+               xp = (xtroot_t *) &dp->di_dirtable;
                lv = ilinelock->lv;
                for (n = 0; n < ilinelock->index; n++, lv++) {
                        memcpy(&xp->xad[lv->offset], &p->xad[lv->offset],
         *      regular file: 16 byte (XAD slot) granularity
         */
        if (type & tlckXTREE) {
-               xtpage_t *p, *xp;
+               xtroot_t *p, *xp;
                xad_t *xad;
  
                /*
@@@ -1320,7 -1320,7 +1320,7 @@@ diInitInode(struct inode *ip, int iagno
  int diAlloc(struct inode *pip, bool dir, struct inode *ip)
  {
        int rc, ino, iagno, addext, extno, bitno, sword;
-       int nwords, rem, i, agno;
+       int nwords, rem, i, agno, dn_numag;
        u32 mask, inosmap, extsmap;
        struct inode *ipimap;
        struct metapage *mp;
  
        /* get the ag number of this iag */
        agno = BLKTOAG(JFS_IP(pip)->agstart, JFS_SBI(pip->i_sb));
+       dn_numag = JFS_SBI(pip->i_sb)->bmap->db_numag;
+       if (agno < 0 || agno > dn_numag)
+               return -EIO;
  
        if (atomic_read(&JFS_SBI(pip->i_sb)->bmap->db_active[agno])) {
                /*
@@@ -3061,10 -3064,10 +3064,10 @@@ static int copy_from_dinode(struct dino
        }
  
        ip->i_size = le64_to_cpu(dip->di_size);
 -      ip->i_atime.tv_sec = le32_to_cpu(dip->di_atime.tv_sec);
 -      ip->i_atime.tv_nsec = le32_to_cpu(dip->di_atime.tv_nsec);
 -      ip->i_mtime.tv_sec = le32_to_cpu(dip->di_mtime.tv_sec);
 -      ip->i_mtime.tv_nsec = le32_to_cpu(dip->di_mtime.tv_nsec);
 +      inode_set_atime(ip, le32_to_cpu(dip->di_atime.tv_sec),
 +                      le32_to_cpu(dip->di_atime.tv_nsec));
 +      inode_set_mtime(ip, le32_to_cpu(dip->di_mtime.tv_sec),
 +                      le32_to_cpu(dip->di_mtime.tv_nsec));
        inode_set_ctime(ip, le32_to_cpu(dip->di_ctime.tv_sec),
                        le32_to_cpu(dip->di_ctime.tv_nsec));
        ip->i_blocks = LBLK2PBLK(ip->i_sb, le64_to_cpu(dip->di_nblocks));
@@@ -3138,12 -3141,12 +3141,12 @@@ static void copy_to_dinode(struct dinod
        else /* Leave the original permissions alone */
                dip->di_mode = cpu_to_le32(jfs_ip->mode2);
  
 -      dip->di_atime.tv_sec = cpu_to_le32(ip->i_atime.tv_sec);
 -      dip->di_atime.tv_nsec = cpu_to_le32(ip->i_atime.tv_nsec);
 -      dip->di_ctime.tv_sec = cpu_to_le32(inode_get_ctime(ip).tv_sec);
 -      dip->di_ctime.tv_nsec = cpu_to_le32(inode_get_ctime(ip).tv_nsec);
 -      dip->di_mtime.tv_sec = cpu_to_le32(ip->i_mtime.tv_sec);
 -      dip->di_mtime.tv_nsec = cpu_to_le32(ip->i_mtime.tv_nsec);
 +      dip->di_atime.tv_sec = cpu_to_le32(inode_get_atime_sec(ip));
 +      dip->di_atime.tv_nsec = cpu_to_le32(inode_get_atime_nsec(ip));
 +      dip->di_ctime.tv_sec = cpu_to_le32(inode_get_ctime_sec(ip));
 +      dip->di_ctime.tv_nsec = cpu_to_le32(inode_get_ctime_nsec(ip));
 +      dip->di_mtime.tv_sec = cpu_to_le32(inode_get_mtime_sec(ip));
 +      dip->di_mtime.tv_nsec = cpu_to_le32(inode_get_mtime_nsec(ip));
        dip->di_ixpxd = jfs_ip->ixpxd;  /* in-memory pxd's are little-endian */
        dip->di_acl = jfs_ip->acl;      /* as are dxd's */
        dip->di_ea = jfs_ip->ea;
This page took 0.069355 seconds and 4 git commands to generate.