Re: [PATCH] RDMA/core: fix a NULL-pointer dereference in hw_stat_device_show()
From: Jason Gunthorpe
Date: Fri Feb 21 2025 - 12:44:10 EST
On Fri, Feb 21, 2025 at 04:34:25AM +0000, Parav Pandit wrote:
> I just tried reproducing now on 6.12+ kernel manually.
> It appears impossible to reach flow to me as intended in the commit
> I listed.
It looks to me like this:
static void rdma_init_coredev(struct ib_core_device *coredev,
struct ib_device *dev, struct net *net)
{
coredev->dev.groups = dev->groups;
^^^^^^^^^^^^^^^^^^^^^
Copies the sysfs groups from the normal ib_dev which includes the hw_*
stuff to the per-NS device?
Everything in that groups list must use rdma_device_to_ibdev()
int ib_setup_device_attrs(struct ib_device *ibdev)
{
[..]
attr->attr.show = hw_stat_device_show;
attr->show = show_hw_stats;
data->group.attrs[pos] = &attr->attr.attr;
[..]
ibdev->groups[i] = &data->group;
Which means the sysfs reported here is in that list?
Maybe this was misses when the sysfs was shut off?
Jason