Skip to contentSkip to conversation

nes: Add missing rcu_read_unlock() call

RFC PATCH In review Bart Van Assche 2 participants 2 messages Jan 10, 2012 – Jan 27, 2012 InfiniBand

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 nes: Add missing rcu_read_unlock() call

Hi,

Sparse complains about nes_addr_resolve_neigh(). Does the patch below make sense ?

---
 drivers/infiniband/hw/nes/nes_cm.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/infiniband/hw/nes/nes_cm.c +1 -0
index 425065b..1b2ccc7 100644
@@ -1360,6 +1360,7 @@ static int nes_addr_resolve_neigh(struct nes_vnic *nesvnic, u32 dst_ip, int arpi
 				if (!memcmp(nesadapter->arp_table[arpindex].mac_addr,
 					    neigh->ha, ETH_ALEN)) {
 					/* Mac address same as in nes_arp_table */
+					rcu_read_unlock();
 					ip_rt_put(rt);
 					return rc;
 				}
Signature · 7 lines
1.7.7


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw

Good catch. I think it's closer to kernel idiom to jump to one unwind path, though:

RDMA/nes: Add missing rcu_read_unlock() in nes_addr_resolve_neigh()

Make sure all exit paths from this function unlock everything.

---
 drivers/infiniband/hw/nes/nes_cm.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/infiniband/hw/nes/nes_cm.c
index 183f7ab..271279c 100644

drivers/infiniband/hw/nes/nes_cm.c +0 -0
@@ -1363,8 +1363,7 @@ static int nes_addr_resolve_neigh(struct

nes_vnic *nesvnic, u32 dst_ip, int arpi
if
(!memcmp(nesadapter->arp_table[arpindex].mac_addr,

                                            neigh->ha, ETH_ALEN)) {
                                        /* Mac address same as in
nes_arp_table */
-                                       ip_rt_put(rt);
-                                       return rc;
+                                       goto out;
                                }

                                nes_manage_arp_cache(nesvnic->netdev,
@@ -1380,6 +1379,8 @@ static int nes_addr_resolve_neigh(struct
nes_vnic *nesvnic, u32 dst_ip, int arpi
                        neigh_event_send(neigh, NULL);
                }
        }
+
+out:
        rcu_read_unlock();
        ip_rt_put(rt);
        return rc;

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html