Re: [PATCH] RDMA/core: don't expose hw_counters outside of init net namespace

Roman Gushchin
2025-02-27T16:48:30Z

On Thu, Feb 27, 2025 at 05:22:59AM +0000, Parav Pandit wrote:
>
> > From: Roman Gushchin <roman.gushchin@linux.dev>
> > Sent: Thursday, February 27, 2025 12:32 AM
> >
> > Commit 5fd8529350f0 ("RDMA/core: fix a NULL-pointer dereference in
> > hw_stat_device_show()") accidentally almost exposed hw counters to non-init
> > net namespaces. It didn't expose them fully, as an attempt to read any of
> > those counters leads to a crash like this one:
> >
> It is not the commit 5fd8529350f0.
> You just want to say cited commit accidentally..

Right, it's a typo, it had to be 467f432a521a ("RDMA/core: Split port
and device counter sysfs attributes").

> > WARN(true, "struct ib_device->groups is too small"); diff --git
> > a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index
> > b59bf30de430..a5761038935d 100644
> > --- a/include/rdma/ib_verbs.h
> > +++ b/include/rdma/ib_verbs.h
> > @@ -2767,6 +2767,7 @@ struct ib_device {
> > * It is a NULL terminated array.
> > */
> > const struct attribute_group *groups[4];
> > + u8 hw_stats_attr_index;
> >
> > u64 uverbs_cmd_mask;
> >
> > --
> > 2.48.1.711.g2feabab25a-goog
>
> With above suggested small commit log correction,
> Reviewed-by: Parav Pandit <parav@nvidia.com>

Thank you!