Commit 1ec48f95 authored by Linus Torvalds's avatar Linus Torvalds

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

Pull jfs updates from Dave Kleikamp:
 "A couple bug fixes"

* tag 'jfs-5.18' of https://github.com/kleikamp/linux-shaggy:
  jfs: prevent NULL deref in diFree
  jfs: fix divide error in dbNextAG
parents 1c24a186 a5304629
...@@ -146,12 +146,13 @@ void jfs_evict_inode(struct inode *inode) ...@@ -146,12 +146,13 @@ void jfs_evict_inode(struct inode *inode)
dquot_initialize(inode); dquot_initialize(inode);
if (JFS_IP(inode)->fileset == FILESYSTEM_I) { if (JFS_IP(inode)->fileset == FILESYSTEM_I) {
struct inode *ipimap = JFS_SBI(inode->i_sb)->ipimap;
truncate_inode_pages_final(&inode->i_data); truncate_inode_pages_final(&inode->i_data);
if (test_cflag(COMMIT_Freewmap, inode)) if (test_cflag(COMMIT_Freewmap, inode))
jfs_free_zero_link(inode); jfs_free_zero_link(inode);
if (JFS_SBI(inode->i_sb)->ipimap) if (ipimap && JFS_IP(ipimap)->i_imap)
diFree(inode); diFree(inode);
/* /*
......
...@@ -148,6 +148,7 @@ static const s8 budtab[256] = { ...@@ -148,6 +148,7 @@ static const s8 budtab[256] = {
* 0 - success * 0 - success
* -ENOMEM - insufficient memory * -ENOMEM - insufficient memory
* -EIO - i/o error * -EIO - i/o error
* -EINVAL - wrong bmap data
*/ */
int dbMount(struct inode *ipbmap) int dbMount(struct inode *ipbmap)
{ {
...@@ -179,6 +180,12 @@ int dbMount(struct inode *ipbmap) ...@@ -179,6 +180,12 @@ int dbMount(struct inode *ipbmap)
bmp->db_nfree = le64_to_cpu(dbmp_le->dn_nfree); bmp->db_nfree = le64_to_cpu(dbmp_le->dn_nfree);
bmp->db_l2nbperpage = le32_to_cpu(dbmp_le->dn_l2nbperpage); bmp->db_l2nbperpage = le32_to_cpu(dbmp_le->dn_l2nbperpage);
bmp->db_numag = le32_to_cpu(dbmp_le->dn_numag); bmp->db_numag = le32_to_cpu(dbmp_le->dn_numag);
if (!bmp->db_numag) {
release_metapage(mp);
kfree(bmp);
return -EINVAL;
}
bmp->db_maxlevel = le32_to_cpu(dbmp_le->dn_maxlevel); bmp->db_maxlevel = le32_to_cpu(dbmp_le->dn_maxlevel);
bmp->db_maxag = le32_to_cpu(dbmp_le->dn_maxag); bmp->db_maxag = le32_to_cpu(dbmp_le->dn_maxag);
bmp->db_agpref = le32_to_cpu(dbmp_le->dn_agpref); bmp->db_agpref = le32_to_cpu(dbmp_le->dn_agpref);
......
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