mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
RDMA/core: Free unpublished port statistics after initial-read failure
An initial port counter read can fail after allocating its statistics
buffer and wrapper. Free these both allocations.
Fixes: 467f432a52 ("RDMA/core: Split port and device counter sysfs attributes")
Link: https://patch.msgid.link/20261015-ib-core-fixes-v1-2-60f6da3ddec3@nvidia.com
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
This commit is contained in:
parent
d01ee4c841
commit
d74bdcfa89
|
|
@ -996,8 +996,8 @@ static int setup_hw_port_stats(struct ib_port *port,
|
|||
data->stats->num_counters);
|
||||
if (ret != data->stats->num_counters) {
|
||||
if (WARN_ON(ret >= 0))
|
||||
return -EINVAL;
|
||||
return ret;
|
||||
ret = -EINVAL;
|
||||
goto err_free_data;
|
||||
}
|
||||
|
||||
data->stats->timestamp = jiffies;
|
||||
|
|
@ -1031,6 +1031,11 @@ static int setup_hw_port_stats(struct ib_port *port,
|
|||
|
||||
port->hw_stats_data = data;
|
||||
return 0;
|
||||
|
||||
err_free_data:
|
||||
rdma_free_hw_stats_struct(data->stats);
|
||||
kfree(data);
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct rdma_hw_stats *ib_get_hw_stats_port(struct ib_device *ibdev,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user