libceph: NULL deref on crush_decode() error path
[ Upstream commit293dffaad8
] If there is not enough space then ceph_decode_32_safe() does a goto bad. We need to return an error code in that situation. The current code returns ERR_PTR(0) which is NULL. The callers are not expecting that and it results in a NULL dereference. Fixes:f24e9980eb
("ceph: OSD client") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Ilya Dryomov <idryomov@gmail.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
9fc2a46ade
commit
0bd1a03e00
@ -295,6 +295,7 @@ static struct crush_map *crush_decode(void *pbyval, void *end)
|
|||||||
u32 yes;
|
u32 yes;
|
||||||
struct crush_rule *r;
|
struct crush_rule *r;
|
||||||
|
|
||||||
|
err = -EINVAL;
|
||||||
ceph_decode_32_safe(p, end, yes, bad);
|
ceph_decode_32_safe(p, end, yes, bad);
|
||||||
if (!yes) {
|
if (!yes) {
|
||||||
dout("crush_decode NO rule %d off %x %p to %p\n",
|
dout("crush_decode NO rule %d off %x %p to %p\n",
|
||||||
|
Reference in New Issue
Block a user