Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3861096pxb; Tue, 17 Nov 2020 05:37:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJy43e0O+VfBz4c1PaFAjwKhlKr4ihNpGbJkMfxYXm6/Z1jx/I9vn5rgazwMWdMS9nrbBNks X-Received: by 2002:a17:906:12cf:: with SMTP id l15mr20407134ejb.540.1605620258103; Tue, 17 Nov 2020 05:37:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605620258; cv=none; d=google.com; s=arc-20160816; b=cOmjGYZqhKX1ePdUFRIlJvj73L4mNRdXxKT0Ayhn5+rrkfH0/vUkBSwXmqvH1mmCh0 BjvxQwZuv1qNTyY/9UK027Gp2f7OOLv1OM/u5LnjGBUTGp5cAKR3deJPpd7fltJzkSj3 BCqW3WVvAD0LBYf2J6sY/EkxooKu5iJREmfEjMuceFQJBGO2H/XS6QxXyT3B6HIhUeRS ZKQValxAcnm2wi1v8I8VUzxA5I1KRHqFx5Ms1QHNCrXZX5xYQAnQV0m+iUBWDsONGUIB jZvVi5vRXIBoXvhMc1egr8udt7J6+55U3j88fe9egx21XpCCmPN9Bt4eYi0MS/WP890j VLZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8GAip41axlhcuDtpItwvYF7TnRUgp2jdI1/1vtRTx1I=; b=JYSfG0UsHWQ3nQW4H6L1Kz9WCf5PyP3SszUon6j8pD9uhWoiTBW5vovgUd44O9Wpv4 WBHjNDiA1U2igjUgG/MMyRZSRca0JR1gFTRY3NClpZCoCbCBiPVJSJ55mdEgnh0vzFha JQKR5Zlse+mvPN9Hn0OLnejmeVveambPqabPFy3TykIIvTPRSRtiLN4Lg/pfctXID7J0 aBzu1sXGk89Mvul9PG9ApD+TgJyMAHmYS6Kz4+eD3GhmtRKfB/Tez/UsGwzQp1KKlU24 OeQBdhnsfpDN41NZGdNzAnYWP+IuDKY4Omb4hSQ9NniTe3FEmPciHAVtoykFCMGgVrie S+rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AgYqVRq1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k5si595445eji.617.2020.11.17.05.37.15; Tue, 17 Nov 2020 05:37:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AgYqVRq1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732521AbgKQNfv (ORCPT + 99 others); Tue, 17 Nov 2020 08:35:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:46614 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732012AbgKQNfu (ORCPT ); Tue, 17 Nov 2020 08:35:50 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2C2A8207BC; Tue, 17 Nov 2020 13:35:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605620148; bh=KjlZzjSxSYVKd8YaHzTmcETwGpcoLRp3HLiGKbHylBM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AgYqVRq1gqI14GkfQGmlt9JoVuE20FraLMN1WT1PXi4Ga0zGpF4NbvgWqUAaWpyQo WfFqvRm00GM1UmDCbDq/ioTLcu4vAUpvULQpJ6Z2RjpzvHcJe4IgAIplCGBXPCkKNo RtAwHQ2WM9PfhqldozWNDHgJTkTKadYvvxVQr2Z0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Don Brace , Keita Suzuki , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.9 092/255] scsi: hpsa: Fix memory leak in hpsa_init_one() Date: Tue, 17 Nov 2020 14:03:52 +0100 Message-Id: <20201117122143.438268628@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122138.925150709@linuxfoundation.org> References: <20201117122138.925150709@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Keita Suzuki [ Upstream commit af61bc1e33d2c0ec22612b46050f5b58ac56a962 ] When hpsa_scsi_add_host() fails, h->lastlogicals is leaked since it is missing a free() in the error handler. Fix this by adding free() when hpsa_scsi_add_host() fails. Link: https://lore.kernel.org/r/20201027073125.14229-1-keitasuzuki.park@sslab.ics.keio.ac.jp Tested-by: Don Brace Acked-by: Don Brace Signed-off-by: Keita Suzuki Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/hpsa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 48d5da59262b4..aed59ec20ad9e 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c @@ -8854,7 +8854,7 @@ reinit_after_soft_reset: /* hook into SCSI subsystem */ rc = hpsa_scsi_add_host(h); if (rc) - goto clean7; /* perf, sg, cmd, irq, shost, pci, lu, aer/h */ + goto clean8; /* lastlogicals, perf, sg, cmd, irq, shost, pci, lu, aer/h */ /* Monitor the controller for firmware lockups */ h->heartbeat_sample_interval = HEARTBEAT_SAMPLE_INTERVAL; @@ -8869,6 +8869,8 @@ reinit_after_soft_reset: HPSA_EVENT_MONITOR_INTERVAL); return 0; +clean8: /* lastlogicals, perf, sg, cmd, irq, shost, pci, lu, aer/h */ + kfree(h->lastlogicals); clean7: /* perf, sg, cmd, irq, shost, pci, lu, aer/h */ hpsa_free_performant_mode(h); h->access.set_intr_mask(h, HPSA_INTR_OFF); -- 2.27.0