udf: NULL dereference at udf_symlink() on error
PATCH 1/1 udf: NULL dereference at udf_symlink() on error
There is no check for udf_tgetblk(), which could return NULL, in udf_symlink(). So there is a possibility of returning NULL under heavy memory pressure and possibility of NULL dereference.
Signed-off-by Changwoo Min <[email protected]>
--- fs/udf/namei.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/udf/namei.c +4 -0
@@ -902,6 +902,10 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry, iinfo->i_location.partitionReferenceNum, 0); epos.bh =udf_tgetblk (sb, block); +if (!epos.bh) { + err = -ENOMEM ; + goto out_no_entry; + }lock_buffer (epos.bh);memset (epos.bh->b_data,0x00 , bsize);set_buffer_uptodate (epos.bh);
Signature · 1 line
1.9.1
Quoted 14 lines · Changwoo Min
There is no check for
udf_tgetblk(), which could return NULL, inudf_symlink(). So there is a possibility of returning NULL under heavy memory pressure and possibility of NULL dereference.Signed-off-by Changwoo Min <[email protected]>--- fs/udf/namei.c | 4 ++++ 1 file changed, 4 insertions(+)fs/udf/namei.c +0
-0
fs/udf/namei.c static int udf_symlink(struct inode *dir, struct dentry *dentry, · line 906
Quoted 5 lines
fs/udf/namei.c +2
-0@@ -902,6 +902,10 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry, iinfo->i_location.partitionReferenceNum, 0); epos.bh =udf_tgetblk (sb, block); +if (!epos.bh) { + err = -ENOMEM ;
This should be -EIO as per our discussion at the previous patch.
Otherwise I agree.
Honza
Quoted 8 lines
fs/udf/namei.c +2
-0+ goto out_no_entry; + }lock_buffer (epos.bh);memset (epos.bh->b_data,0x00 , bsize);set_buffer_uptodate (epos.bh);Signature · 1 line
1.9.1
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR