Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2838696rwb; Mon, 15 Aug 2022 12:20:37 -0700 (PDT) X-Google-Smtp-Source: AA6agR66v6URXP/t6h5PlLmeA/GThTfHQF+m5X8xns8DulJ9Ng2Ey9Thumkl6u46co3y+Wukq4Oe X-Received: by 2002:a17:907:28ca:b0:730:aabe:2e28 with SMTP id en10-20020a17090728ca00b00730aabe2e28mr11378200ejc.72.1660591237681; Mon, 15 Aug 2022 12:20:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660591237; cv=none; d=google.com; s=arc-20160816; b=YPPYzJWFTqhMxjtldavjrRRpja+tMD8O2XRS+jztnJPU9k96SHKgrlxTYiDZ2KqnYH rNmKqCTb68tQJqembmQ67toMowLidApYZtX34WSmwEIT9eOw+HL9gMssc07ZWcdmyBVo nKM2AbaZ7eEDb9XJBFUpu53u5m07VFhDY6TpzWv3v/kDwls6mLazC9leTMSlQdHO6APd SAYnfunbjvlgxdMzlvcQyCsXCc5TG8QLpFkAjIS8cOWll+89a4T1Vz4sKRus2l5hBTws inoGs228046RmpaJss+bDdRQudUZ/z6QKLurTmabwG1UHQY9HWdlF2V4pu0xC5wRxZKP Vopg== 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=TpkG1+GNsVsZN+fVMvgpmXc2ad0MDIVo4POlrdmJU1I=; b=kmSwv99FhGMcKWVNdyAHQdX6iVgw64uNqt1f7lh7W6QhtvUgIreKexepspQL6kK3kO 7KkS36MEl9X8c7L65Swr0Ge4blOFPhSk2XCA3KSizVppl5/Bmuk621O3UGaqEHiWdAMi Uhr+BZk7AcM6Wag/Nhtto8OCD1Xdsmog13d9t14aQsdr50nHQRFYvdhbGOzJOZipyfwy v6zG3ICbgSFtAP+RdpwtjT1kxhjJYyJnmxGUedB3omNU0Tq283JUl/WqzdO2yww7LjFJ Znb+5WJNGjEMRGVT4RdXunGejPS408iRHdAO6XPdya5CYC9IahvQjMhSa3CmR9L3NxXK tuvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="0ylK/uzf"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d6-20020a50cd46000000b0043aa374346bsi7682457edj.626.2022.08.15.12.20.09; Mon, 15 Aug 2022 12:20:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="0ylK/uzf"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343941AbiHOTSm (ORCPT + 99 others); Mon, 15 Aug 2022 15:18:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344296AbiHOTQS (ORCPT ); Mon, 15 Aug 2022 15:16:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 852323C152; Mon, 15 Aug 2022 11:38:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7A4BC61124; Mon, 15 Aug 2022 18:37:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6978DC433C1; Mon, 15 Aug 2022 18:37:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588678; bh=T9beneGmNTE1bc1SIe7uSeF7u3ye+KG+gZabQacfRmI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0ylK/uzf/lQZFfxXTPsl9zS8HZYcGpvglRm/Ep9OnQSmj6NbpemxIQIMhUPvBIwO5 YV9mZcQ+9Cw54wryWV0DuDKqEJJQK8JzX8oBR3FIRLg59KgBUfvygmqPfYdA52EqVq 7FoLEaSpRfikREZRuUtGL4gxhY94A2eg4k2ZoyxI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Ulf Hansson , Sasha Levin Subject: [PATCH 5.15 480/779] memstick/ms_block: Fix a memory leak Date: Mon, 15 Aug 2022 20:02:04 +0200 Message-Id: <20220815180357.777685721@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe JAILLET [ Upstream commit 54eb7a55be6779c4d0c25eaf5056498a28595049 ] 'erased_blocks_bitmap' is never freed. As it is allocated at the same time as 'used_blocks_bitmap', it is likely that it should be freed also at the same time. Add the corresponding bitmap_free() in msb_data_clear(). Fixes: 0ab30494bc4f ("memstick: add support for legacy memorysticks") Signed-off-by: Christophe JAILLET Link: https://lore.kernel.org/r/b3b78926569445962ea5c3b6e9102418a9effb88.1656155715.git.christophe.jaillet@wanadoo.fr Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- drivers/memstick/core/ms_block.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/memstick/core/ms_block.c b/drivers/memstick/core/ms_block.c index 7275217e485e..f854822f84d6 100644 --- a/drivers/memstick/core/ms_block.c +++ b/drivers/memstick/core/ms_block.c @@ -1963,6 +1963,7 @@ static void msb_data_clear(struct msb_data *msb) { kfree(msb->boot_page); bitmap_free(msb->used_blocks_bitmap); + bitmap_free(msb->erased_blocks_bitmap); kfree(msb->lba_to_pba_table); kfree(msb->cache); msb->card = NULL; -- 2.35.1