From 6dc9b262fcd480c75a1c9b206ed00fe7b3c05824 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 24 Apr 2025 13:58:54 +0000 Subject: [PATCH] Revert "RDMA/core: Don't expose hw_counters outside of init net namespace" This reverts commit df45ae2a4f1cdfda00c032839e12092e1f32c05e which is commit a1ecb30f90856b0be4168ad51b8875148e285c1f upstream. It breaks the Android kernel abi and can be brought back in the future in an abi-safe way if it is really needed. Bug: 161946584 Change-Id: Ibdc0ab01798b9814e1b5e39e2cc1718e9856a4fd Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/core/device.c | 9 --------- drivers/infiniband/core/sysfs.c | 1 - include/rdma/ib_verbs.h | 1 - 3 files changed, 11 deletions(-) diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index 46102f179955..9ac442505747 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -544,8 +544,6 @@ static struct class ib_class = { static void rdma_init_coredev(struct ib_core_device *coredev, struct ib_device *dev, struct net *net) { - bool is_full_dev = &dev->coredev == coredev; - /* This BUILD_BUG_ON is intended to catch layout change * of union of ib_core_device and device. * dev must be the first element as ib_core and providers @@ -557,13 +555,6 @@ static void rdma_init_coredev(struct ib_core_device *coredev, coredev->dev.class = &ib_class; coredev->dev.groups = dev->groups; - - /* - * Don't expose hw counters outside of the init namespace. - */ - if (!is_full_dev && dev->hw_stats_attr_index) - coredev->dev.groups[dev->hw_stats_attr_index] = NULL; - device_initialize(&coredev->dev); coredev->owner = dev; INIT_LIST_HEAD(&coredev->port_list); diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c index 210092b9bf17..9f97bef02149 100644 --- a/drivers/infiniband/core/sysfs.c +++ b/drivers/infiniband/core/sysfs.c @@ -988,7 +988,6 @@ int ib_setup_device_attrs(struct ib_device *ibdev) for (i = 0; i != ARRAY_SIZE(ibdev->groups); i++) if (!ibdev->groups[i]) { ibdev->groups[i] = &data->group; - ibdev->hw_stats_attr_index = i; return 0; } WARN(true, "struct ib_device->groups is too small"); diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index c2b5de75daf2..67551133b522 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -2737,7 +2737,6 @@ struct ib_device { * It is a NULL terminated array. */ const struct attribute_group *groups[4]; - u8 hw_stats_attr_index; u64 uverbs_cmd_mask;