From: Jason Gunthorpe <jgg-uk2M96/98Pc@public.gmane.org>
To: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
RDMA mailing list
<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Daniel Jurgens <danielj-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: Re: [PATCH rdma-next 2/3] RDMA/cma: Introduce API to read GIDs for multiple transports
Date: Mon, 15 Jan 2018 15:22:15 -0700 [thread overview]
Message-ID: <20180115222215.GA18795@ziepe.ca> (raw)
In-Reply-To: <20180109111058.29534-3-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
On Tue, Jan 09, 2018 at 01:10:57PM +0200, Leon Romanovsky wrote:
> From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
>
> This patch introduces an API that allows legacy applications to query
> GIDs for a rdma_cm_id which is used during connection establishment.
>
> GIDs are stored and created differently for IB, RoCE and iWARP transports.
> Therefore rdma_read_gids() returns GID for all the transports hiding
> such internal details to caller. It is usable for client side and server
> side connections.
>
> The rdma_read_gids() should not be used by any new ULPs.
This is weird statement. Why can't we change the few callers to do
whatever is correct now?
> +void rdma_read_gids(struct rdma_cm_id *cm_id, union ib_gid *sgid,
> + union ib_gid *dgid)
> +{
> + struct rdma_addr *addr = &cm_id->route.addr;
> +
> + if (!cm_id->device)
> + return;
Nope. I looked at only one caller and saw this return leaks uninited
kernel stack memory to userspace. Probably best to zero the sgid/dgid
in the error case??
> diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h
> index fa809a7b48e7..edb1cdf2a892 100644
> +++ b/include/rdma/ib_addr.h
> @@ -165,6 +165,9 @@ static inline u16 rdma_vlan_dev_vlan_id(const struct net_device *dev)
>
> static inline int rdma_ip2gid(struct sockaddr *addr, union ib_gid *gid)
> {
> + if (!gid)
> + return 0;
> +
> switch (addr->sa_family) {
> case AF_INET:
> ipv6_addr_set_v4mapped(((struct sockaddr_in *)
> @@ -205,6 +208,9 @@ static inline void rdma_gid2ip(struct sockaddr *out, const union ib_gid *gid)
> static inline void rdma_addr_get_sgid(struct rdma_dev_addr *dev_addr,
> union ib_gid *gid)
> {
> + if (!gid)
> + return;
I think it would be clearer to put this test in the rdma_read_gids.
It makes no sense to have a function with one output where the output
is optional. Particularly when it is inlined..
And the prior patch makes a bit more sense after looking here, but the
series seems in the wrong order -> the patch to break
rdma_addr_get_sgid should go after the only rocee code path in ucma is
switched to use rdma_read_gids which hopefully does something similar
to what it did before?
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2018-01-15 22:22 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-09 11:10 [PATCH rdma-next 0/3] Refactor rdma_cm query GID API Leon Romanovsky
[not found] ` <20180109111058.29534-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2018-01-09 11:10 ` [PATCH rdma-next 1/3] RDMA/core: Remove RoCE support from rdma_addr_get_sgid() Leon Romanovsky
[not found] ` <20180109111058.29534-2-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2018-01-15 22:07 ` Jason Gunthorpe
[not found] ` <20180115220741.GA18489-uk2M96/98Pc@public.gmane.org>
2018-01-15 22:34 ` Parav Pandit
[not found] ` <VI1PR0502MB300827C3710085B7D3C3A924D1EB0-o1MPJYiShExKsLr+rGaxW8DSnupUy6xnnBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2018-01-15 22:47 ` Jason Gunthorpe
[not found] ` <20180115224742.GD2206-uk2M96/98Pc@public.gmane.org>
2018-01-15 22:52 ` Parav Pandit
2018-01-09 11:10 ` [PATCH rdma-next 2/3] RDMA/cma: Introduce API to read GIDs for multiple transports Leon Romanovsky
[not found] ` <20180109111058.29534-3-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2018-01-15 22:22 ` Jason Gunthorpe [this message]
[not found] ` <20180115222215.GA18795-uk2M96/98Pc@public.gmane.org>
2018-01-15 22:43 ` Parav Pandit
[not found] ` <VI1PR0502MB30082F945F147FF434835DF3D1EB0-o1MPJYiShExKsLr+rGaxW8DSnupUy6xnnBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2018-01-15 23:04 ` Jason Gunthorpe
2018-01-18 8:10 ` Leon Romanovsky
2018-01-09 11:10 ` [PATCH rdma-next 3/3] RDMA: Use rdma_cm API to query GID Leon Romanovsky
[not found] ` <20180109111058.29534-4-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2018-01-09 16:48 ` Santosh Shilimkar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180115222215.GA18795@ziepe.ca \
--to=jgg-uk2m96/98pc@public.gmane.org \
--cc=danielj-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=parav-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.