diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index d594cd501861a8d1fcca60f01656053d2d391113..404d4b851d3f3b093c0fcaac59e4aa8dcc09378b 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -4986,7 +4986,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; @@ -5000,6 +5000,9 @@ static int decode_watchers(void **p, void *end, } return 0; + +bad: + return -EINVAL; } /*