From patchwork Wed Dec 16 23:12:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 7866731 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 826FABEEED for ; Wed, 16 Dec 2015 23:12:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B2F4B203EB for ; Wed, 16 Dec 2015 23:12:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C0981203B8 for ; Wed, 16 Dec 2015 23:12:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934279AbbLPXMk (ORCPT ); Wed, 16 Dec 2015 18:12:40 -0500 Received: from mail-pa0-f41.google.com ([209.85.220.41]:33354 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754948AbbLPXMW (ORCPT ); Wed, 16 Dec 2015 18:12:22 -0500 Received: by mail-pa0-f41.google.com with SMTP id ur14so30973979pab.0 for ; Wed, 16 Dec 2015 15:12:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=avagotech.com; s=google; h=date:from:to:subject:message-id:user-agent:mime-version :content-type:content-transfer-encoding; bh=knfNc08SS8OiiI6cJyvbB6HlNnPjRphkIqGbMXYLK7Q=; b=Vqa/UfV6MfuzQiZa7IeCtIaYRuqQr3a65kPEaUT7bH+AwSCQyT6B0fQPPURrF3PD7x DsWE6tBTsRQqu7Pxct6iaGAcxvRmefEqEfkTKrY+aPzJkS5wrWumCS4aGiaR0UAOfZfy qwevxuLwqd4S3rRO+2rY04wIDFNyheE0ewm1Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:user-agent :mime-version:content-type:content-transfer-encoding; bh=knfNc08SS8OiiI6cJyvbB6HlNnPjRphkIqGbMXYLK7Q=; b=Dz0xkB4D34azkKTg2YEXOiCTu0G3xTcukryL/0iSzOwdUpnhvTOureBz8ZWXM58SxG MMU3hsIu6U9DGxB5e/qc7QFCZJU8PDWEGq2+ScX1+0iCbf6954L65+VeZCT+p7Nvwahm fnjvDf3+93OTFdLRaN4jKCHgit10f74e4X2snnwtl2dsjVgv84moYzRfkIsPZ3KJ+MS2 hKWnAQbggHov/0cz8sIuL7om3XC5rRrN6DBbdqBkY8ztcKnFaiu7C8YKV9t6G3vnOT8v wlhDE/c3io46O/cBTqNQFtBSqDhEq3H4Du+43yIUXdWYxhlgAIw/OkVp5h5Y44dJWhUt CVcQ== X-Gm-Message-State: ALoCoQm/EWFO1Af7CdCEn9L7+LU+O2+L7tpq+RtkoSsXovZlw9jiRlhMWAPP6W9H7xug/MyEK1ruqX08Dj7vFBLHYKAaqCcviQ== X-Received: by 10.67.14.3 with SMTP id fc3mr68131084pad.134.1450307541943; Wed, 16 Dec 2015 15:12:21 -0800 (PST) Received: from myfc17 (cm-wififw.emulex.com. [138.239.220.50]) by smtp.gmail.com with ESMTPSA id 72sm1904025pfa.92.2015.12.16.15.12.20 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 16 Dec 2015 15:12:20 -0800 (PST) Date: Wed, 16 Dec 2015 18:12:03 -0500 From: james.smart@avagotech.com (James Smart) To: linux-scsi@vger.kernel.org Subject: [PATCH 12/17] lpfc: Fix mbox reuse in PLOGI completion Message-ID: <5671efc3.0ctNdaGDOZR2f0ML%james.smart@avagotech.com> User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.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=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham 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 Fix mbox reuse in PLOGI completion. Moved allocations so that buffer properly init'd. Signed-off-by: Dick Kennedy Signed-off-by: James Smart Reviewed-by: Hannes Reinecke --- drivers/scsi/lpfc/lpfc_nportdisc.c | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c index 9e571dd..193733e 100644 --- a/drivers/scsi/lpfc/lpfc_nportdisc.c +++ b/drivers/scsi/lpfc/lpfc_nportdisc.c @@ -1045,16 +1045,6 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport, if (irsp->ulpStatus) goto out; - mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); - if (!mbox) { - lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, - "0133 PLOGI: no memory for reg_login " - "Data: x%x x%x x%x x%x\n", - ndlp->nlp_DID, ndlp->nlp_state, - ndlp->nlp_flag, ndlp->nlp_rpi); - goto out; - } - pcmd = (struct lpfc_dmabuf *) cmdiocb->context2; prsp = list_get_first(&pcmd->list, struct lpfc_dmabuf, list); @@ -1118,6 +1108,17 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport, if (phba->sli_rev == LPFC_SLI_REV4) { lpfc_issue_reg_vfi(vport); } else { + mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); + if (!mbox) { + lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, + "0133 PLOGI: no memory " + "for config_link " + "Data: x%x x%x x%x x%x\n", + ndlp->nlp_DID, ndlp->nlp_state, + ndlp->nlp_flag, ndlp->nlp_rpi); + goto out; + } + lpfc_config_link(phba, mbox); mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl; @@ -1132,6 +1133,16 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport, lpfc_unreg_rpi(vport, ndlp); + mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); + if (!mbox) { + lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, + "0018 PLOGI: no memory for reg_login " + "Data: x%x x%x x%x x%x\n", + ndlp->nlp_DID, ndlp->nlp_state, + ndlp->nlp_flag, ndlp->nlp_rpi); + goto out; + } + if (lpfc_reg_rpi(phba, vport->vpi, irsp->un.elsreq64.remoteID, (uint8_t *) sp, mbox, ndlp->nlp_rpi) == 0) { switch (ndlp->nlp_DID) {