Dan Carpenter 44addae95e xfs: prevent a WARN_ONCE() in xfs_ioc_attr_list()
[ Upstream commit 6ed6356b07714e0198be3bc3ecccc8b40a212de4 ]

The "bufsize" comes from the root user.  If "bufsize" is negative then,
because of type promotion, neither of the validation checks at the start
of the function are able to catch it:

	if (bufsize < sizeof(struct xfs_attrlist) ||
	    bufsize > XFS_XATTR_LIST_MAX)
		return -EINVAL;

This means "bufsize" will trigger (WARN_ON_ONCE(size > INT_MAX)) in
kvmalloc_node().  Fix this by changing the type from int to size_t.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com>
Acked-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-29 17:25:09 +02:00
..
2021-09-02 09:21:27 -07:00
2021-09-02 08:26:03 -07:00
2021-09-02 08:26:03 -07:00
2021-08-24 19:13:04 -07:00
2021-09-02 08:26:03 -07:00
2021-04-12 15:04:29 +02:00
2021-08-24 19:13:04 -07:00
2021-01-24 14:43:46 +01:00
2021-01-24 14:43:46 +01:00
2021-06-21 10:05:46 -07:00
2021-01-24 14:43:46 +01:00
2021-08-19 10:07:14 -07:00