diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index a86ba8b7857546cec36ad7c2c71868c348216e45..8c1678f10440ced2d83265537e7d78acace74393 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -5090,7 +5090,7 @@ static int decode_watchers(void **p, void *end, if (ret) return ret; - *num_watchers = ceph_decode_32(p); + ceph_decode_32_safe(p, end, *num_watchers, bad); *watchers = kcalloc(*num_watchers, sizeof(**watchers), GFP_NOIO); if (!*watchers) return -ENOMEM; @@ -5104,6 +5104,9 @@ static int decode_watchers(void **p, void *end, } return 0; + +bad: + return -EINVAL; } /*