* [PATCH rdma-next 1/3] RDMA/core: Preserve the selected source GID on failed AH modification
2026-10-15 11:58 [PATCH rdma-next 0/3] Various core fixes spotted by LLMs Leon Romanovsky
@ 2026-10-15 11:59 ` Leon Romanovsky
2026-10-15 11:59 ` [PATCH rdma-next 2/3] RDMA/core: Free unpublished port statistics after initial-read failure Leon Romanovsky
2026-10-15 11:59 ` [PATCH rdma-next 3/3] RDMA/core: Reject LAG selection when source MAC lookup fails Leon Romanovsky
2 siblings, 0 replies; 5+ messages in thread
From: Leon Romanovsky @ 2026-10-15 11:59 UTC (permalink / raw)
To: Jason Gunthorpe, Maor Gottlieb; +Cc: linux-rdma, linux-kernel
From: Leon Romanovsky <leonro@nvidia.com>
When an address-handle modification fails, the core replaces its source-GID
reference. The old address then loses the reference which keeps its source
entry alive.
Fixes: 1a1f460ff151 ("RDMA: Hold the sgid_attr inside the struct ib_ah/qp")
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
drivers/infiniband/core/verbs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index edf62652f9d3..7d52d3036208 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -1011,7 +1011,8 @@ int rdma_modify_ah(struct ib_ah *ah, struct rdma_ah_attr *ah_attr)
ah->device->ops.modify_ah(ah, ah_attr) :
-EOPNOTSUPP;
- ah->sgid_attr = rdma_update_sgid_attr(ah_attr, ah->sgid_attr);
+ if (!ret)
+ ah->sgid_attr = rdma_update_sgid_attr(ah_attr, ah->sgid_attr);
rdma_unfill_sgid_attr(ah_attr, old_sgid_attr);
return ret;
}
--
2.55.0
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH rdma-next 2/3] RDMA/core: Free unpublished port statistics after initial-read failure
2026-10-15 11:58 [PATCH rdma-next 0/3] Various core fixes spotted by LLMs Leon Romanovsky
2026-10-15 11:59 ` [PATCH rdma-next 1/3] RDMA/core: Preserve the selected source GID on failed AH modification Leon Romanovsky
@ 2026-10-15 11:59 ` Leon Romanovsky
2026-10-15 12:54 ` Kalesh Anakkur Purayil
2026-10-15 11:59 ` [PATCH rdma-next 3/3] RDMA/core: Reject LAG selection when source MAC lookup fails Leon Romanovsky
2 siblings, 1 reply; 5+ messages in thread
From: Leon Romanovsky @ 2026-10-15 11:59 UTC (permalink / raw)
To: Jason Gunthorpe, Maor Gottlieb; +Cc: linux-rdma, linux-kernel
From: Leon Romanovsky <leonro@nvidia.com>
An initial port counter read can fail after allocating its statistics
buffer and wrapper. Free these both allocations.
Fixes: 467f432a521a ("RDMA/core: Split port and device counter sysfs attributes")
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
drivers/infiniband/core/sysfs.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
index 69df8b703cbd..4cd861b5d953 100644
--- a/drivers/infiniband/core/sysfs.c
+++ b/drivers/infiniband/core/sysfs.c
@@ -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,
--
2.55.0
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH rdma-next 3/3] RDMA/core: Reject LAG selection when source MAC lookup fails
2026-10-15 11:58 [PATCH rdma-next 0/3] Various core fixes spotted by LLMs Leon Romanovsky
2026-10-15 11:59 ` [PATCH rdma-next 1/3] RDMA/core: Preserve the selected source GID on failed AH modification Leon Romanovsky
2026-10-15 11:59 ` [PATCH rdma-next 2/3] RDMA/core: Free unpublished port statistics after initial-read failure Leon Romanovsky
@ 2026-10-15 11:59 ` Leon Romanovsky
2 siblings, 0 replies; 5+ messages in thread
From: Leon Romanovsky @ 2026-10-15 11:59 UTC (permalink / raw)
To: Jason Gunthorpe, Maor Gottlieb; +Cc: linux-rdma, linux-kernel
From: Leon Romanovsky <leonro@nvidia.com>
GID deletion can clear the source device association after LAG lookup
retains the bonding master. Ignoring the resulting L2 lookup failure
copies uninitialized source MAC bytes into the synthetic hash packet.
Read the source MAC before allocating the packet and propagate lookup
errors to the caller, so failed lookups cannot influence slave selection.
Fixes: bd3920eac133 ("RDMA/core: Add LAG functionality")
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
drivers/infiniband/core/lag.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/infiniband/core/lag.c b/drivers/infiniband/core/lag.c
index 88aac911e8ee..651c868aa04e 100644
--- a/drivers/infiniband/core/lag.c
+++ b/drivers/infiniband/core/lag.c
@@ -19,6 +19,11 @@ static struct sk_buff *rdma_build_skb(struct net_device *netdev,
u8 smac[ETH_ALEN];
bool is_ipv4;
int hdr_len;
+ int ret;
+
+ ret = rdma_read_gid_l2_fields(ah_attr->grh.sgid_attr, NULL, smac);
+ if (ret)
+ return ERR_PTR(ret);
is_ipv4 = ipv6_addr_v4mapped((struct in6_addr *)ah_attr->grh.dgid.raw);
hdr_len = ETH_HLEN + sizeof(struct udphdr) + LL_RESERVED_SPACE(netdev);
@@ -26,7 +31,7 @@ static struct sk_buff *rdma_build_skb(struct net_device *netdev,
skb = alloc_skb(hdr_len, flags);
if (!skb)
- return NULL;
+ return ERR_PTR(-ENOMEM);
skb->dev = netdev;
skb_reserve(skb, hdr_len);
@@ -70,7 +75,6 @@ static struct sk_buff *rdma_build_skb(struct net_device *netdev,
skb_reset_mac_header(skb);
eth = eth_hdr(skb);
skb->protocol = eth->h_proto = htons(is_ipv4 ? ETH_P_IP : ETH_P_IPV6);
- rdma_read_gid_l2_fields(ah_attr->grh.sgid_attr, NULL, smac);
memcpy(eth->h_source, smac, ETH_ALEN);
memcpy(eth->h_dest, ah_attr->roce.dmac, ETH_ALEN);
@@ -86,8 +90,8 @@ static struct net_device *rdma_get_xmit_slave_udp(struct ib_device *device,
struct sk_buff *skb;
skb = rdma_build_skb(master, ah_attr, flags);
- if (!skb)
- return ERR_PTR(-ENOMEM);
+ if (IS_ERR(skb))
+ return ERR_CAST(skb);
rcu_read_lock();
slave = netdev_get_xmit_slave(master, skb,
--
2.55.0
^ permalink raw reply [flat|nested] 5+ messages in thread