Commit 7dd440c9 authored by Ilya Dryomov's avatar Ilya Dryomov Committed by Ilya Dryomov

rbd: do not return -ERANGE on auth failures

Trying to map an image out of a pool for which we don't have an 'x'
permission bit fails with -ERANGE from ceph_extract_encoded_string()
due to an unsigned vs signed bug.  Fix it and get rid of the -EINVAL
sink, thus propagating rbd::get_id cls method errors.  (I've seen
a bunch of unexplained -ERANGE reports, I bet this is it).
Signed-off-by: default avatarIlya Dryomov <ilya.dryomov@inktank.com>
Reviewed-by: default avatarAlex Elder <elder@linaro.org>
parent 91883cd2
...@@ -4924,7 +4924,7 @@ static int rbd_dev_image_id(struct rbd_device *rbd_dev) ...@@ -4924,7 +4924,7 @@ static int rbd_dev_image_id(struct rbd_device *rbd_dev)
ret = image_id ? 0 : -ENOMEM; ret = image_id ? 0 : -ENOMEM;
if (!ret) if (!ret)
rbd_dev->image_format = 1; rbd_dev->image_format = 1;
} else if (ret > sizeof (__le32)) { } else if (ret >= 0) {
void *p = response; void *p = response;
image_id = ceph_extract_encoded_string(&p, p + ret, image_id = ceph_extract_encoded_string(&p, p + ret,
...@@ -4932,8 +4932,6 @@ static int rbd_dev_image_id(struct rbd_device *rbd_dev) ...@@ -4932,8 +4932,6 @@ static int rbd_dev_image_id(struct rbd_device *rbd_dev)
ret = PTR_ERR_OR_ZERO(image_id); ret = PTR_ERR_OR_ZERO(image_id);
if (!ret) if (!ret)
rbd_dev->image_format = 2; rbd_dev->image_format = 2;
} else {
ret = -EINVAL;
} }
if (!ret) { if (!ret) {
......
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