diff options
| author | Dan Carpenter <dan.carpenter@oracle.com> | 2017-05-23 17:25:10 +0300 |
|---|---|---|
| committer | Sasha Levin <alexander.levin@microsoft.com> | 2018-05-22 21:36:25 -0400 |
| commit | 2be3cd9b4a37d022c36be28e30859ed8a741c0bc (patch) | |
| tree | 948f8fa2bdaa40e092dfac57d2b6eeb1daf5c577 | |
| parent | a850df8f9f6cec3a60014830b713d05e341e1dd5 (diff) | |
libceph: NULL deref on crush_decode() error path
[ Upstream commit 293dffaad8d500e1a5336eeb90d544cf40d4fbd8 ]
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: f24e9980eb86 ("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>
| -rw-r--r-- | net/ceph/osdmap.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c index bc95e48d5cfb..378c9ed00d40 100644 --- a/net/ceph/osdmap.c +++ b/net/ceph/osdmap.c @@ -295,6 +295,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", |
