diff options
author | Martin Brandenburg <martin@omnibond.com> | 2016-03-16 14:01:43 -0400 |
---|---|---|
committer | Mike Marshall <hubcap@omnibond.com> | 2016-03-17 14:33:47 -0400 |
commit | 02a5cc537dfa222583b6b6c17451a67816fce9f5 (patch) | |
tree | 56e4fc6a8a908348bcf35c767915fd9e886ca1c8 | |
parent | 5e06664f29c92c8e6b007cdec1f3abf197bc1961 (diff) |
orangefs: sanitize listxattr and return EIO on impossible values
Signed-off-by: Martin Brandenburg <martin@omnibond.com>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
-rw-r--r-- | fs/orangefs/xattr.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/orangefs/xattr.c b/fs/orangefs/xattr.c index 75a7dde8cc5f..ef5da7538cd5 100644 --- a/fs/orangefs/xattr.c +++ b/fs/orangefs/xattr.c | |||
@@ -394,6 +394,7 @@ try_again: | |||
394 | gossip_err("%s: impossible value for returned_count:%d:\n", | 394 | gossip_err("%s: impossible value for returned_count:%d:\n", |
395 | __func__, | 395 | __func__, |
396 | returned_count); | 396 | returned_count); |
397 | ret = -EIO; | ||
397 | goto done; | 398 | goto done; |
398 | } | 399 | } |
399 | 400 | ||
@@ -401,6 +402,15 @@ try_again: | |||
401 | * Check to see how much can be fit in the buffer. Fit only whole keys. | 402 | * Check to see how much can be fit in the buffer. Fit only whole keys. |
402 | */ | 403 | */ |
403 | for (i = 0; i < returned_count; i++) { | 404 | for (i = 0; i < returned_count; i++) { |
405 | if (new_op->downcall.resp.listxattr.lengths[i] < 0 || | ||
406 | new_op->downcall.resp.listxattr.lengths[i] > | ||
407 | ORANGEFS_MAX_XATTR_NAMELEN) { | ||
408 | gossip_err("%s: impossible value for lengths[%d]\n", | ||
409 | __func__, | ||
410 | new_op->downcall.resp.listxattr.lengths[i]); | ||
411 | ret = -EIO; | ||
412 | goto done; | ||
413 | } | ||
404 | if (total + new_op->downcall.resp.listxattr.lengths[i] > size) | 414 | if (total + new_op->downcall.resp.listxattr.lengths[i] > size) |
405 | goto done; | 415 | goto done; |
406 | 416 | ||