Message ID | 811914f1-3bcc-a0a4-e20a-86e8b5853ac7@acm.org (mailing list archive) |
---|---|
State | Changes Requested |
Headers | show |
On Fri, Dec 16, 2016 at 3:39 PM, Bart Van Assche <bart.vanassche@gmail.com> wrote: > Hello Moni, > > Commit 7b85627b9f02 ("IB/cma: IBoE (RoCE) IP-based GID addressing") introduced code that > dereferences an RCU pointer without using rcu_read_lock(). Can you check whether the patch > below is the correct way to fix this? > > Thanks, > > Bart. Hi Bart Fix looks good. Thanks Reviewed-by: Moni Shoua <monis@mellanox.com> -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 12/18/2016 2:10 AM, Moni Shoua wrote: > On Fri, Dec 16, 2016 at 3:39 PM, Bart Van Assche > <bart.vanassche@gmail.com> wrote: >> Hello Moni, >> >> Commit 7b85627b9f02 ("IB/cma: IBoE (RoCE) IP-based GID addressing") introduced code that >> dereferences an RCU pointer without using rcu_read_lock(). Can you check whether the patch >> below is the correct way to fix this? >> >> Thanks, >> >> Bart. > > Hi Bart > Fix looks good. Thanks > > Reviewed-by: Moni Shoua <monis@mellanox.com> Bart, can you please resend this patch with a proper commit message and a SOB tag?
diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h index 931a47ba4571..1beab5532035 100644 --- a/include/rdma/ib_addr.h +++ b/include/rdma/ib_addr.h @@ -205,10 +205,12 @@ static inline void iboe_addr_get_sgid(struct rdma_dev_addr *dev_addr, dev = dev_get_by_index(&init_net, dev_addr->bound_dev_if); if (dev) { - ip4 = (struct in_device *)dev->ip_ptr; - if (ip4 && ip4->ifa_list && ip4->ifa_list->ifa_address) + ip4 = in_dev_get(dev); + if (ip4 && ip4->ifa_list && ip4->ifa_list->ifa_address) { ipv6_addr_set_v4mapped(ip4->ifa_list->ifa_address, (struct in6_addr *)gid); + in_dev_put(ip4); + } dev_put(dev); } }