提交 09cb22d2 编写于 作者: A Andreas Gruenbacher 提交者: Dave Chinner

xfs: Plug memory leak in xfs_attrmulti_attr_set

When setting attributes via XFS_IOC_ATTRMULTI_BY_HANDLE, the user-space
buffer is copied into a new kernel-space buffer via memdup_user; that
buffer then isn't freed.
Signed-off-by: NAndreas Gruenbacher <agruenba@redhat.com>
Reviewed-by: NDave Chinner <dchinner@redhat.com>
Signed-off-by: NDave Chinner <david@fromorbit.com>
上级 86a21c79
......@@ -482,6 +482,7 @@ xfs_attrmulti_attr_set(
__uint32_t flags)
{
unsigned char *kbuf;
int error;
if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
return -EPERM;
......@@ -492,7 +493,9 @@ xfs_attrmulti_attr_set(
if (IS_ERR(kbuf))
return PTR_ERR(kbuf);
return xfs_attr_set(XFS_I(inode), name, kbuf, len, flags);
error = xfs_attr_set(XFS_I(inode), name, kbuf, len, flags);
kfree(kbuf);
return error;
}
int
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册