A couple bug fixes

-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEIodevzQLVs53l6BhNqiEXrVAjGQFAmJDGQUACgkQNqiEXrVA
 jGSENg/5AT5rY7GwLKUrzGcCrikLVt91iftSKfcEtCuZHQiQn/kdpxGwUWW3GJ6y
 GvYKyyUumd6r1WKZArhGwZ/4R/pu0sNSWB6C/cxWqr5r3vJ74cVtsyc49HZvy2w5
 bBoftcDgJPIDPj2POYFbXR14F9D9MjJbcS6Zie5blWhjwNtxTCfc6AwgV5G5cYbo
 X4r/RawUGuJsOLqGjro48v5fVW1za6g8h03y3iWzOcGPn7lsgUaIWzC+ZxK167C7
 qrc4poWpyVcxtCzA+Fwda1VrPYfQWagZcSp0r0bMe2tNw7rvTJKtWZPiIeDlhIhW
 12kbKA/UeJDTMCI4ZA16gUBW0BUvbKRpDYCGtC8OIj64XUblmSOuXHFj71AG7qPI
 X+Lj/1ZxQ1h31bHw5ay859hr36G5EH2yutH5v7wil9yiuBScj2D/D6HC5z7GVb4O
 B5PLRJCRW+Hc86vWUg0hutfwqWmNfcvtxs6nqY111EPV7HShBKsSVhyOrHL/mQOo
 byiFUcYMhbDcrI2dkl8HvELPGMRwn6juw1qL/GlgmCFG7VfR7GW3ilWS8KmjCaTb
 iUoXeNriab3mUkAH9N1+jC6HbRJQnwj8/Exx66CLecqsLeeAIQryPzvAWE8qEJMY
 cTzAUZqp67baoCZ/dmY7AuExkURFc++bu+ulgvye63QIyRwwCBw=
 =ppBo
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2022-03-29 18:17:30 -07:00
commit 1ec48f9551
2 changed files with 9 additions and 1 deletions

View File

@ -146,12 +146,13 @@ void jfs_evict_inode(struct inode *inode)
dquot_initialize(inode);
if (JFS_IP(inode)->fileset == FILESYSTEM_I) {
struct inode *ipimap = JFS_SBI(inode->i_sb)->ipimap;
truncate_inode_pages_final(&inode->i_data);
if (test_cflag(COMMIT_Freewmap, inode))
jfs_free_zero_link(inode);
if (JFS_SBI(inode->i_sb)->ipimap)
if (ipimap && JFS_IP(ipimap)->i_imap)
diFree(inode);
/*

View File

@ -148,6 +148,7 @@ static const s8 budtab[256] = {
* 0 - success
* -ENOMEM - insufficient memory
* -EIO - i/o error
* -EINVAL - wrong bmap data
*/
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_l2nbperpage = le32_to_cpu(dbmp_le->dn_l2nbperpage);
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_maxag = le32_to_cpu(dbmp_le->dn_maxag);
bmp->db_agpref = le32_to_cpu(dbmp_le->dn_agpref);