os/FuseStore: do not call exists() on an out-of-bounds oid

Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Sage Weil 2016-01-07 12:51:03 -05:00
parent ca4f077edd
commit b2a1c8614f

View File

@ -210,6 +210,26 @@ static int os_getattr(const char *path, struct stat *stbuf)
stbuf->st_gid = 0;
stbuf->st_mode = S_IFREG | 0700;
switch (t) {
case FN_OBJECT_OMAP:
case FN_OBJECT_ATTR:
case FN_OBJECT:
case FN_OBJECT_DATA:
case FN_OBJECT_OMAP_HEADER:
case FN_OBJECT_OMAP_VAL:
{
spg_t pgid;
if (cid.is_pg(&pgid)) {
int bits = fs->store->collection_bits(cid);
if (bits >= 0 && !oid.match(bits, pgid.ps())) {
// sorry, not part of this PG
return -ENOENT;
}
}
}
break;
}
switch (t) {
case FN_OBJECT_OMAP:
case FN_OBJECT_ATTR: