public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* re: lpfc: Add support for RDP ELS command.
@ 2015-06-10 15:43 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2015-06-10 15:43 UTC (permalink / raw)
  To: james.smart; +Cc: linux-scsi

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-06-10 15:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-10 15:43 lpfc: Add support for RDP ELS command Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox