mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 02:21:52 +09:00
udf: Avoid directory type conversion failure due to ENOMEM
commitdf97f64dfaupstream. When converting directory from in-ICB to normal format, the last iteration through the directory fixing up directory enteries can fail due to ENOMEM. We do not expect this iteration to fail since the directory is already verified to be correct and it is difficult to undo the conversion at this point. So just use GFP_NOFAIL to make sure the small allocation cannot fail. Reported-by: syzbot+111eaa994ff74f8d440f@syzkaller.appspotmail.com Fixes:0aba4860b0("udf: Allocate name buffer in directory iterator on heap") Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
7089811e20
commit
d285ba6f22
@@ -248,9 +248,12 @@ int udf_fiiter_init(struct udf_fileident_iter *iter, struct inode *dir,
|
||||
iter->elen = 0;
|
||||
iter->epos.bh = NULL;
|
||||
iter->name = NULL;
|
||||
iter->namebuf = kmalloc(UDF_NAME_LEN_CS0, GFP_KERNEL);
|
||||
if (!iter->namebuf)
|
||||
return -ENOMEM;
|
||||
/*
|
||||
* When directory is verified, we don't expect directory iteration to
|
||||
* fail and it can be difficult to undo without corrupting filesystem.
|
||||
* So just do not allow memory allocation failures here.
|
||||
*/
|
||||
iter->namebuf = kmalloc(UDF_NAME_LEN_CS0, GFP_KERNEL | __GFP_NOFAIL);
|
||||
|
||||
if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) {
|
||||
err = udf_copy_fi(iter);
|
||||
|
||||
Reference in New Issue
Block a user