Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1349595imm; Thu, 23 Aug 2018 01:19:12 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwJfa73eLIJmwHvsvhQ+ogogk6DUidSTtfclE4TotFTf+RGGnFNz5IF9z/hWpScSIwhuqHK X-Received: by 2002:a17:902:22:: with SMTP id 31-v6mr57228945pla.190.1535012352082; Thu, 23 Aug 2018 01:19:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535012352; cv=none; d=google.com; s=arc-20160816; b=zSmz6rPTlPByjUcbHlfcQNPI1hXMuYCcvMXdRLa3j2sZrYme1HYPPPPUEkCDlcnmE5 sFI4tWRzamJmXHoAgte2dgQwb8Ls2TdZ5ArhZPUngF8MKBM1rvCfcySX3/Vd0k/dHPnd gWut4A0XpG/Q7neWAquM80MxZFB29X9BPGyvIqG84cczib1QYZP1MULkbegp+17gcFkv 3aF4IrlRB8YJfvo9I149oMt6rM9n87skVrceJDrzpqTcSyNN4ukprJqyEZVPwYkJU5V/ bWhS+V9X7kyles6dLfKiteTOtcZjdzZP2MAT+A6RkjehgLp/t8v7xi5QNo/p4Oru/Jfn PN1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:to:from :arc-authentication-results; bh=B1j8hjsWACniK6OzyJneFEj+hFfNN0W9ixnvIeABEZ8=; b=ZK2qcXz4vsDBRhvK3dCggo4wjJuq2mI0NlI9C0hJnVd6bhVWcL1ySCG7GxF6WU9AR4 YETjrg6zywkLbGotJYLSokQk7Kbh5MpYmmxfH2QCOt6iQSjSh2U6mTfsYho8Sg9zJWyj ksA4WlUFF3/C8Irzt1PrEHsNHRnIn6mwEBqDQhjHbivLpARwX+WYLpOg5iKKd7tzsYgc djsO9cByEuG2bAeVRX1Yr3leC2+iivJgn06Ox2JWn/X1fItn07R0tsheYJPcvgzo8+NQ B0hKWWuPbDMQmsbnwjwcfzYE7r/0GH/c3o4/yNe+ynwXQCpuZfdEVd3EzUQHmjbIIxLZ V+eg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q19-v6si3435251pls.490.2018.08.23.01.18.56; Thu, 23 Aug 2018 01:19:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728981AbeHWLpG (ORCPT + 99 others); Thu, 23 Aug 2018 07:45:06 -0400 Received: from cmccmta2.chinamobile.com ([221.176.66.80]:37520 "EHLO cmccmta2.chinamobile.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728510AbeHWLgN (ORCPT ); Thu, 23 Aug 2018 07:36:13 -0400 Received: from spf.mail.chinamobile.com (unknown[172.16.121.19]) by rmmx-syy-dmz-app05-12005 (RichMail) with SMTP id 2ee55b7e6b4be11-bc67c; Thu, 23 Aug 2018 16:07:40 +0800 (CST) X-RM-TRANSID: 2ee55b7e6b4be11-bc67c X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from bclinux72.localdomain (unknown[223.105.0.243]) by rmsmtp-syy-appsvr10-12010 (RichMail) with SMTP id 2eea5b7e6b4b00c-19bcb; Thu, 23 Aug 2018 16:07:40 +0800 (CST) X-RM-TRANSID: 2eea5b7e6b4b00c-19bcb From: Ding Xiang To: mdr@sgi.com, jejb@linux.vnet.ibm.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] scsi: qla1280: Fix memory leak when open DUMP_IT_BACK Date: Thu, 23 Aug 2018 05:19:03 -0400 Message-Id: <1535015943-4907-1-git-send-email-dingxiang@cmss.chinamobile.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If open DUMP_IT_BACK and unfortunately fw is error, memory leak will happen. Signed-off-by: Ding Xiang --- drivers/scsi/qla1280.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c index 390775d..abdcf70 100644 --- a/drivers/scsi/qla1280.c +++ b/drivers/scsi/qla1280.c @@ -1756,8 +1756,12 @@ static void qla1280_mailbox_timeout(struct timer_list *t) #endif fw = qla1280_request_firmware(ha); - if (IS_ERR(fw)) + if (IS_ERR(fw)) { +#if DUMP_IT_BACK + pci_free_consistent(ha->pdev, 8000, tbuf, p_tbuf); +#endif return PTR_ERR(fw); + } fw_data = (const __le16 *)&fw->data[0]; ha->fwstart = __le16_to_cpu(fw_data[2]); -- 1.8.3.1