mirror of
https://github.com/torvalds/linux
synced 2024-09-06 09:51:23 +00:00
Minor bug fixes and cleanups
-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEIodevzQLVs53l6BhNqiEXrVAjGQFAmSa7GIACgkQNqiEXrVA jGRM/g//RJRHfzztTICn7a7ST964UGeSOhjip76HcOzyTykj0OtBhys8g+9GQeju 1tHnb1KywRwHYTZr8duv+pNTFo1NCsHMgyxGTitjWz7erVknu4wLXlfDFg8XWrxN ZfSyKKP8xSoqS/ftln8UpnbNcKsQX5pttLoWff/T5x1/Go8sIkIRfdLHRSCN5F2R K4MXtd5o/o4Qv71bel2F+fFpKsr3pM6lDLqkY7DIqmi3noghJodYHm9JJ5UZRqKs v0fnpQfNLRHUKaQElxQVBp3/Kvv80GnEBwapmTFl5Q7NolnAwWgawbssG1+wTo8J N3m71W7/xjkUPT9uIRp+CU82JwKU0BIJHm2H/9evlyJ/ceYl+f/Gntt4uEvSOLb0 somLpPUwTTR2/SsaYYHrZAGQBFBI56u65JR8DTeIKrQyw6VkA0tM4BncLuIOSjyw GOjQcPFFBrtqBc8D2jJ4vMhBnjXEqi8olBZUjLWhdEbVzS5w5l0cU3ZMsBMfdfsT TD5HZES+36Hk96sx5HXQSYSE4hkSlWevT/rUvIMhJhL0X++JmmTWcm+OfvmN//Oq PH1N7YLH43fPCIkvJX0kQVpIrzVDDVuWkgoFoboZXv8zV2S3qAitB6Y6HZtPQR/U PHP+SE13rTeumjCvwXfHkIMYxbfF8ji7E8HUd4Sfi05UwA3aWW8= =s+19 -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
b9d02c224d
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue