From patchwork Tue Aug 2 07:18:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guixin Liu X-Patchwork-Id: 12934281 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B5F4C00140 for ; Tue, 2 Aug 2022 07:19:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235893AbiHBHTC (ORCPT ); Tue, 2 Aug 2022 03:19:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235835AbiHBHS6 (ORCPT ); Tue, 2 Aug 2022 03:18:58 -0400 Received: from out30-56.freemail.mail.aliyun.com (out30-56.freemail.mail.aliyun.com [115.124.30.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD7C546D88 for ; Tue, 2 Aug 2022 00:18:56 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R201e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046059;MF=kanie@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0VLAavpD_1659424729; Received: from localhost(mailfrom:kanie@linux.alibaba.com fp:SMTPD_---0VLAavpD_1659424729) by smtp.aliyun-inc.com; Tue, 02 Aug 2022 15:18:54 +0800 From: Guixin Liu To: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, shivasharan.srikanteshwara@broadcom.com, jejb@linux.ibm.com, martin.petersen@oracle.com Cc: megaraidlinux.pdl@broadcom.com, linux-scsi@vger.kernel.org Subject: [PATCH] scsi: megaraid_sas: fix double kfree Date: Tue, 2 Aug 2022 15:18:49 +0800 Message-Id: <1659424729-46502-1-git-send-email-kanie@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org When alloc log_to_span fail, call kfree(instance->ctrl_context) first, then jump to megasas_free_ctrl_mem() in megasas_init_fw(), call kfree(instance->ctrl_context) second. Signed-off-by: Guixin Liu Acked-by: Sumit Saxena --- drivers/scsi/megaraid/megaraid_sas_fusion.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index 5b5885d..3e9b2b0 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -5311,7 +5311,6 @@ void megasas_fusion_ocr_wq(struct work_struct *work) if (!fusion->log_to_span) { dev_err(&instance->pdev->dev, "Failed from %s %d\n", __func__, __LINE__); - kfree(instance->ctrl_context); return -ENOMEM; } }