Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 293dffaa authored by Dan Carpenter's avatar Dan Carpenter Committed by Ilya Dryomov
Browse files

libceph: NULL deref on crush_decode() error path



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: f24e9980 ("ceph: OSD client")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarIlya Dryomov <idryomov@gmail.com>
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent b51456a6
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -317,6 +317,7 @@ static struct crush_map *crush_decode(void *pbyval, void *end)
		u32 yes;
		struct crush_rule *r;

		err = -EINVAL;
		ceph_decode_32_safe(p, end, yes, bad);
		if (!yes) {
			dout("crush_decode NO rule %d off %x %p to %p\n",