All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Steve Wise" <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
To: 'Ganesh Goudar'
	<ganeshgr-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>,
	dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	hariprasad-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org,
	nirranjan-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org
Subject: RE: [PATCH] iw_cxgb4: Guard against null cm_id in dump_ep/qp
Date: Tue, 17 Jan 2017 09:54:08 -0600	[thread overview]
Message-ID: <06fe01d270d9$f0275790$d07606b0$@opengridcomputing.com> (raw)
In-Reply-To: <1483369573-9604-1-git-send-email-ganeshgr-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>


> Endpoints that are aborting can have already dereferenced the
> cm_id and set ep->com.cm_id to NULL.  So guard against that in
> dump_ep() and dump_qp().
> 
> Also create a common function for setting up ip address pointers
> since the same logic is needed in several places.
> 
> Based on the original work of Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
> 
> Signed-off-by: Ganesh Goudar <ganeshgr-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>
> ---
>  drivers/infiniband/hw/cxgb4/device.c | 133 ++++++++++++++++++++++-------
> ------
>  1 file changed, 84 insertions(+), 49 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/cxgb4/device.c
> b/drivers/infiniband/hw/cxgb4/device.c
> index 516b0ae..1c61b49 100644
> --- a/drivers/infiniband/hw/cxgb4/device.c
> +++ b/drivers/infiniband/hw/cxgb4/device.c
> @@ -214,6 +214,52 @@ static const struct file_operations
> wr_log_debugfs_fops = {
>  	.write   = wr_log_clear,
>  };
> 
> +static struct sockaddr_in zero_sin = {
> +	.sin_family = AF_INET,
> +};
> +
> +static struct sockaddr_in6 zero_sin6 = {
> +	.sin6_family = AF_INET6,
> +};
> +
> +static void set_ep_sin_addrs(struct c4iw_ep *ep,
> +			     struct sockaddr_in **lsin,
> +			     struct sockaddr_in **rsin,
> +			     struct sockaddr_in **m_lsin,
> +			     struct sockaddr_in **m_rsin)
> +{
> +	struct iw_cm_id *id = ep->com.cm_id;
> +
> +	*lsin = (struct sockaddr_in *)&ep->com.local_addr;
> +	*rsin = (struct sockaddr_in *)&ep->com.remote_addr;
> +	if (id) {
> +		*m_lsin = (struct sockaddr_in *)&id->local_addr;
> +		*m_rsin = (struct sockaddr_in *)&id->remote_addr;

The above two should be using id->m_local_addr and id->m_remote_addr.

> +	} else {
> +		*m_lsin = &zero_sin;
> +		*m_rsin = &zero_sin;
> +	}
> +}
> +
> +static void set_ep_sin6_addrs(struct c4iw_ep *ep,
> +			      struct sockaddr_in6 **lsin6,
> +			      struct sockaddr_in6 **rsin6,
> +			      struct sockaddr_in6 **m_lsin6,
> +			      struct sockaddr_in6 **m_rsin6)
> +{
> +	struct iw_cm_id *id = ep->com.cm_id;
> +
> +	*lsin6 = (struct sockaddr_in6 *)&ep->com.local_addr;
> +	*rsin6 = (struct sockaddr_in6 *)&ep->com.remote_addr;
> +	if (id) {
> +		*m_lsin6 = (struct sockaddr_in6 *)&id->local_addr;
> +		*m_rsin6 = (struct sockaddr_in6 *)&id->remote_addr;

Same thing here.


Other than that, this looks good.  Please repost a V2 and add my Reviewed-by
tag.

Steve.


--
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

  parent reply	other threads:[~2017-01-17 15:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-02 15:06 [PATCH] iw_cxgb4: Guard against null cm_id in dump_ep/qp Ganesh Goudar
     [not found] ` <1483369573-9604-1-git-send-email-ganeshgr-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>
2017-01-17 15:54   ` Steve Wise [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-01-20  7:02 Ganesh Goudar
     [not found] ` <1484895721-10839-1-git-send-email-ganeshgr-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>
2017-01-24 19:45   ` Doug Ledford

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='06fe01d270d9$f0275790$d07606b0$@opengridcomputing.com' \
    --to=swise-7bpotxp6k4+p2yhjcf5u+vpxobypeauw@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=ganeshgr-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org \
    --cc=hariprasad-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=nirranjan-ut6Up61K2wZBDgjK7y7TUQ@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.