From: Darrick J. Wong Date: Tue, 21 Jun 2016 01:53:28 +0000 (+1000) Subject: xfs: check for a valid error_tag in errortag_add X-Git-Tag: v4.8-rc1~146^2~5^2~4 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=128f24d5d9def3c47b6b659b2454f0426a347144;p=karo-tx-linux.git xfs: check for a valid error_tag in errortag_add Currently we don't check the error_tag when someone's trying to set up error injection testing. If userspace passes in a value we don't know about, send back an error. This will help xfstests to _notrun a test that uses error injection to test things like log replay. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Signed-off-by: Dave Chinner --- diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c index 88693a98fac5..355619ae5e3e 100644 --- a/fs/xfs/xfs_error.c +++ b/fs/xfs/xfs_error.c @@ -61,6 +61,9 @@ xfs_errortag_add(int error_tag, xfs_mount_t *mp) int len; int64_t fsid; + if (error_tag >= XFS_ERRTAG_MAX) + return -EINVAL; + memcpy(&fsid, mp->m_fixedfsid, sizeof(xfs_fsid_t)); for (i = 0; i < XFS_NUM_INJECT_ERROR; i++) {