public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: james.smart@avagotech.com
Cc: linux-scsi@vger.kernel.org
Subject: re: lpfc: Add support for RDP ELS command.
Date: Wed, 10 Jun 2015 18:43:26 +0300	[thread overview]
Message-ID: <20150610154326.GG10549@mwanda> (raw)

Hello James Smart,

The patch 86478875eb4d: "lpfc: Add support for RDP ELS command." from
May 21, 2015, leads to the following static checker warning:

	drivers/scsi/lpfc/lpfc_mbox.c:2307 lpfc_mbx_cmpl_rdp_page_a2()
	error: dereferencing freed memory 'mp'

drivers/scsi/lpfc/lpfc_mbox.c
  2279  void
  2280  lpfc_mbx_cmpl_rdp_page_a2(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox)
  2281  {
  2282          struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *) mbox->context1;
  2283          struct lpfc_rdp_context *rdp_context =
  2284                          (struct lpfc_rdp_context *)(mbox->context2);
  2285  
  2286          if (bf_get(lpfc_mqe_status, &mbox->u.mqe))
  2287                  goto error;
  2288  
  2289          lpfc_sli_bemem_bcopy(mp->virt, &rdp_context->page_a2,
  2290                                  DMP_SFF_PAGE_A2_SIZE);
  2291  
  2292          /* We don't need dma buffer for link stat. */
  2293          lpfc_mbuf_free(phba, mp->virt, mp->phys);
  2294          kfree(mp);
                ^^^^^^^^
  2295  
  2296          memset(mbox, 0, sizeof(*mbox));
  2297          lpfc_read_lnk_stat(phba, mbox);
  2298          mbox->vport = rdp_context->ndlp->vport;
  2299          mbox->mbox_cmpl = lpfc_mbx_cmpl_rdp_link_stat;
  2300          mbox->context2 = (struct lpfc_rdp_context *) rdp_context;
  2301          if (lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT) == MBX_NOT_FINISHED)
  2302                  goto error;
                        ^^^^^^^^^^
  2303  
  2304          return;
  2305  
  2306  error:
  2307          lpfc_mbuf_free(phba, mp->virt, mp->phys);
                                     ^^^^^^^^
  2308          kfree(mp);
                ^^^^^^^^^
  2309          lpfc_sli4_mbox_cmd_free(phba, mbox);
  2310          rdp_context->cmpl(phba, rdp_context, FAILURE);
  2311  }



regards,
dan carpenter

                 reply	other threads:[~2015-06-10 15:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20150610154326.GG10549@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=james.smart@avagotech.com \
    --cc=linux-scsi@vger.kernel.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