public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
To: hariprasad-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [bug report] RDMA/iw_cxgb4: Handle return value of c4iw_ofld_send() in abort_arp_failure()
Date: Thu, 13 Apr 2017 13:33:03 +0300	[thread overview]
Message-ID: <20170413103303.kamrcz4qrd576ock@mwanda> (raw)
In-Reply-To: <20170223155809.GA16463@mwanda>

Any update on this?  It really looks buggy to me.

regards,
dan carpenter

On Thu, Feb 23, 2017 at 06:58:09PM +0300, Dan Carpenter wrote:
> Hello Hariprasad S,
> 
> The patch 761e19a504af: "RDMA/iw_cxgb4: Handle return value of
> c4iw_ofld_send() in abort_arp_failure()" from May 6, 2016, leads to
> the following static checker warning:
> 
> 	drivers/infiniband/hw/cxgb4/cm.c:575 abort_arp_failure()
> 	warn: passing freed memory 'skb'
> 
> drivers/infiniband/hw/cxgb4/cm.c
>    559  /*
>    560   * Handle an ARP failure for a CPL_ABORT_REQ.  Change it into a no RST variant
>    561   * and send it along.
>    562   */
>    563  static void abort_arp_failure(void *handle, struct sk_buff *skb)
>    564  {
>    565          int ret;
>    566          struct c4iw_ep *ep = handle;
>    567          struct c4iw_rdev *rdev = &ep->com.dev->rdev;
>    568          struct cpl_abort_req *req = cplhdr(skb);
>    569  
>    570          PDBG("%s rdev %p\n", __func__, rdev);
>    571          req->cmd = CPL_ABORT_NO_RST;
>    572          ret = c4iw_ofld_send(rdev, skb);
>    573          if (ret) {
> 
> If c4iw_ofld_send() fails then it frees skb.
> 
>    574                  __state_set(&ep->com, DEAD);
>    575                  queue_arp_failure_cpl(ep, skb, FAKE_CPL_PUT_EP_SAFE);
>                                                   ^^^
> Used after free here.  These are ref counted data so it might actually
> be that I have misread it and miscounted the references so perhaps it's
> OK, but it looks might suspect at a glance.
> 
>    576          }
>    577  }
> 
> regards,
> dan carpenter
--
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

  reply	other threads:[~2017-04-13 10:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-23 15:58 [bug report] RDMA/iw_cxgb4: Handle return value of c4iw_ofld_send() in abort_arp_failure() Dan Carpenter
2017-04-13 10:33 ` Dan Carpenter [this message]
2017-04-13 16:46   ` Steve Wise

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=20170413103303.kamrcz4qrd576ock@mwanda \
    --to=dan.carpenter-qhclzuegtsvqt0dzr+alfa@public.gmane.org \
    --cc=hariprasad-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox