Commit 8c25dc72 authored by Darrick J. Wong's avatar Darrick J. Wong

xfs: validate attr remote value buffer owners

Check the owner field of xattr remote value blocks.
Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent f4887fbc
...@@ -280,12 +280,12 @@ xfs_attr_rmtval_copyout( ...@@ -280,12 +280,12 @@ xfs_attr_rmtval_copyout(
struct xfs_mount *mp, struct xfs_mount *mp,
struct xfs_buf *bp, struct xfs_buf *bp,
struct xfs_inode *dp, struct xfs_inode *dp,
xfs_ino_t owner,
int *offset, int *offset,
int *valuelen, int *valuelen,
uint8_t **dst) uint8_t **dst)
{ {
char *src = bp->b_addr; char *src = bp->b_addr;
xfs_ino_t ino = dp->i_ino;
xfs_daddr_t bno = xfs_buf_daddr(bp); xfs_daddr_t bno = xfs_buf_daddr(bp);
int len = BBTOB(bp->b_length); int len = BBTOB(bp->b_length);
int blksize = mp->m_attr_geo->blksize; int blksize = mp->m_attr_geo->blksize;
...@@ -299,11 +299,11 @@ xfs_attr_rmtval_copyout( ...@@ -299,11 +299,11 @@ xfs_attr_rmtval_copyout(
byte_cnt = min(*valuelen, byte_cnt); byte_cnt = min(*valuelen, byte_cnt);
if (xfs_has_crc(mp)) { if (xfs_has_crc(mp)) {
if (xfs_attr3_rmt_hdr_ok(src, ino, *offset, if (xfs_attr3_rmt_hdr_ok(src, owner, *offset,
byte_cnt, bno)) { byte_cnt, bno)) {
xfs_alert(mp, xfs_alert(mp,
"remote attribute header mismatch bno/off/len/owner (0x%llx/0x%x/Ox%x/0x%llx)", "remote attribute header mismatch bno/off/len/owner (0x%llx/0x%x/Ox%x/0x%llx)",
bno, *offset, byte_cnt, ino); bno, *offset, byte_cnt, owner);
xfs_dirattr_mark_sick(dp, XFS_ATTR_FORK); xfs_dirattr_mark_sick(dp, XFS_ATTR_FORK);
return -EFSCORRUPTED; return -EFSCORRUPTED;
} }
...@@ -427,8 +427,7 @@ xfs_attr_rmtval_get( ...@@ -427,8 +427,7 @@ xfs_attr_rmtval_get(
return error; return error;
error = xfs_attr_rmtval_copyout(mp, bp, args->dp, error = xfs_attr_rmtval_copyout(mp, bp, args->dp,
&offset, &valuelen, args->owner, &offset, &valuelen, &dst);
&dst);
xfs_buf_relse(bp); xfs_buf_relse(bp);
if (error) if (error)
return error; return error;
......
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