From patchwork Fri Jul 31 16:15:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin King X-Patchwork-Id: 6914531 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id ADCC3C05AC for ; Fri, 31 Jul 2015 16:16:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6C93B2058E for ; Fri, 31 Jul 2015 16:16:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 336A020534 for ; Fri, 31 Jul 2015 16:16:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751250AbbGaQPx (ORCPT ); Fri, 31 Jul 2015 12:15:53 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:32825 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751093AbbGaQPx (ORCPT ); Fri, 31 Jul 2015 12:15:53 -0400 Received: from cpc3-craw7-2-0-cust944.16-3.cable.virginm.net ([92.238.43.177] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1ZLCyL-0002xC-Ua; Fri, 31 Jul 2015 16:15:50 +0000 From: Colin King To: James Smart , Dick Kennedy , "James E.J. Bottomley" , linux-scsi@vger.kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH] lpfc: fix double free on mp Date: Fri, 31 Jul 2015 17:15:24 +0100 Message-Id: <1438359324-8834-1-git-send-email-colin.king@canonical.com> X-Mailer: git-send-email 2.5.0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Colin Ian King The error path when the call to lpfc_sli_issue_mbox returns MBX_NOT_FINISHED results in the code freeing mp and calling lpfc_mbuf_free twice. Fix this by jumping to the correct part of the error clean up path. Signed-off-by: Colin Ian King --- drivers/scsi/lpfc/lpfc_mbox.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c index eb62772..750f34d 100644 --- a/drivers/scsi/lpfc/lpfc_mbox.c +++ b/drivers/scsi/lpfc/lpfc_mbox.c @@ -2299,13 +2299,14 @@ lpfc_mbx_cmpl_rdp_page_a2(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox) mbox->mbox_cmpl = lpfc_mbx_cmpl_rdp_link_stat; mbox->context2 = (struct lpfc_rdp_context *) rdp_context; if (lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT) == MBX_NOT_FINISHED) - goto error; + goto cmd_free; return; error: lpfc_mbuf_free(phba, mp->virt, mp->phys); kfree(mp); +cmd_free: lpfc_sli4_mbox_cmd_free(phba, mbox); rdp_context->cmpl(phba, rdp_context, FAILURE); }