Commit b9d02c22 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'jfs-6.5' of github.com:kleikamp/linux-shaggy

Pull jfs updates from David Kleikamp:
 "Minor bug fixes and cleanups"

* tag 'jfs-6.5' of github.com:kleikamp/linux-shaggy:
  FS: JFS: Check for read-only mounted filesystem in txBegin
  FS: JFS: Fix null-ptr-deref Read in txBegin
  fs: jfs: Fix UBSAN: array-index-out-of-bounds in dbAllocDmapLev
  fs: jfs: (trivial) Fix typo in dbInitTree function
  jfs: jfs_dmap: Validate db_l2nbperpage while mounting
parents be3c2131 95e2b352
......@@ -178,7 +178,13 @@ int dbMount(struct inode *ipbmap)
dbmp_le = (struct dbmap_disk *) mp->data;
bmp->db_mapsize = le64_to_cpu(dbmp_le->dn_mapsize);
bmp->db_nfree = le64_to_cpu(dbmp_le->dn_nfree);
bmp->db_l2nbperpage = le32_to_cpu(dbmp_le->dn_l2nbperpage);
if (bmp->db_l2nbperpage > L2PSIZE - L2MINBLOCKSIZE) {
err = -EINVAL;
goto err_release_metapage;
}
bmp->db_numag = le32_to_cpu(dbmp_le->dn_numag);
if (!bmp->db_numag) {
err = -EINVAL;
......@@ -1953,6 +1959,9 @@ dbAllocDmapLev(struct bmap * bmp,
if (dbFindLeaf((dmtree_t *) & dp->tree, l2nb, &leafidx))
return -ENOSPC;
if (leafidx < 0)
return -EIO;
/* determine the block number within the file system corresponding
* to the leaf at which free space was found.
*/
......@@ -3851,7 +3860,7 @@ static int dbInitTree(struct dmaptree * dtp)
l2max = le32_to_cpu(dtp->l2nleafs) + dtp->budmin;
/*
* configure the leaf levevl into binary buddy system
* configure the leaf level into binary buddy system
*
* Try to combine buddies starting with a buddy size of 1
* (i.e. two leaves). At a buddy size of 1 two buddy leaves
......
......@@ -122,7 +122,9 @@
#define NUM_INODE_PER_IAG INOSPERIAG
#define MINBLOCKSIZE 512
#define L2MINBLOCKSIZE 9
#define MAXBLOCKSIZE 4096
#define L2MAXBLOCKSIZE 12
#define MAXFILESIZE ((s64)1 << 52)
#define JFS_LINK_MAX 0xffffffff
......
......@@ -354,6 +354,11 @@ tid_t txBegin(struct super_block *sb, int flag)
jfs_info("txBegin: flag = 0x%x", flag);
log = JFS_SBI(sb)->log;
if (!log) {
jfs_error(sb, "read-only filesystem\n");
return 0;
}
TXN_LOCK();
INCREMENT(TxStat.txBegin);
......
......@@ -799,6 +799,11 @@ static int jfs_link(struct dentry *old_dentry,
if (rc)
goto out;
if (isReadOnly(ip)) {
jfs_error(ip->i_sb, "read-only filesystem\n");
return -EROFS;
}
tid = txBegin(ip->i_sb, 0);
mutex_lock_nested(&JFS_IP(dir)->commit_mutex, COMMIT_MUTEX_PARENT);
......
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