Commit d414505f authored by Richard Weinberger's avatar Richard Weinberger Committed by Willy Tarreau

UBIFS: Fix possible memory leak in ubifs_readdir()

commit aeeb14f7 upstream.

If ubifs_tnc_next_ent() returns something else than -ENOENT
we leak file->private_data.
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
Reviewed-by: default avatarDavid Gstir <david@sigma-star.at>
Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
parent 5fc1b41e
......@@ -467,13 +467,14 @@ static int ubifs_readdir(struct file *file, void *dirent, filldir_t filldir)
}
out:
kfree(file->private_data);
file->private_data = NULL;
if (err != -ENOENT) {
ubifs_err("cannot find next direntry, error %d", err);
return err;
}
kfree(file->private_data);
file->private_data = NULL;
/* 2 is a special value indicating that there are no more direntries */
file->f_pos = 2;
return 0;
......
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