Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3026371rwb; Mon, 15 Aug 2022 16:24:27 -0700 (PDT) X-Google-Smtp-Source: AA6agR5e5R4XZpv+REh9TXhJR5gZH0rxjyzg5TAwji7y1N8LDsMx4UehyfmdPYB06f5Rc/1W+uda X-Received: by 2002:a17:907:a05a:b0:730:98b2:16d7 with SMTP id gz26-20020a170907a05a00b0073098b216d7mr11790117ejc.394.1660605867417; Mon, 15 Aug 2022 16:24:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660605867; cv=none; d=google.com; s=arc-20160816; b=BqCLUoZiKbqnAw9GJvTJp/SmRUciB92JhU1WTelwBp0jNeYfquPZJiMlnEoj5Epnye jvK3SpHbCjE6qBe6XBpe0bmaCLOOX/JNhBpUKi1gLRPUW5/veeifJCuuH0/EbSzph0bt ZRWMO0CVoxHModR8otoJn0ISVYC0mLKX6PU5Ub9cWKyggxUyQzzb8KX4T1Z+hPqmAtJu h6sswYFrPVKBeDDu0/BbBeiEFhmDNYGWpF/zgVmNqdngu/LrKedL5Txbb7qAQwm9BpGP HPRLYZ2L/Sd0CDvxuVGa5yC2Uvt/E2zU8TlVCGbnR02xLvdxsk4kCL/avN+6zvyz+Nbi u+6g== 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=OQ/ClX36CNXI0752D0VSMuG3FUtJJmG4Kp/b8YJUfbQ=; b=ag1ozH/6T79LvK32OlCx7UM0kftpxheMS/CHgJRbWmoadu/Q+2WJWjnivGY7H2s/iO lxtkURWD2dIJuOC7hp+ZaPEzkfSmf+xoUYGgPkoXS5AwCMa8S52wxpWNuf770uVqfYof 2xGlzfzKhk9n60CtUbUrLULPkau9fobSr/8wkV9BZRhbO2eiOupC4P4O60Ga98IwrKfq CLAEKX7P3qxia1fwAyY4HuVuzsUK0QTErS9swipDblapPYKuXm6o8HhiFXlEmBE4QLxG l+/tuHo7x6+j1z6FY42/4WCBtKTSA1YQEyM2II+RC0A5bJPy4r28PLqW4aXR13wfDck1 xpNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xpGEggu1; 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 hd11-20020a170907968b00b00732f74db437si7959304ejc.891.2022.08.15.16.24.01; Mon, 15 Aug 2022 16:24:27 -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=xpGEggu1; 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 S1347882AbiHOWFE (ORCPT + 99 others); Mon, 15 Aug 2022 18:05:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350190AbiHOWBy (ORCPT ); Mon, 15 Aug 2022 18:01:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F13E0113682; Mon, 15 Aug 2022 12:36:11 -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 ams.source.kernel.org (Postfix) with ESMTPS id D2834B81136; Mon, 15 Aug 2022 19:36:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B29CC43470; Mon, 15 Aug 2022 19:36:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592168; bh=WInj4pOrN2LEbYBEShrOBHF7IyqIhqtVGRwA7OG/tBo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xpGEggu1uTwAiA0V37ZK5pSSQaFzkqYLYZ42MduTNPY3D+Tb00NEFsZ632Ddkjcyh Hk0dLVQcYsGt6CCE6dYig3HHyYueVtKcqgXfnFnzkBhMhL7GWEIuo+WUlVZEHMtdXA Flt3H7aheG1zbHurNfYuIQZnmg2x6Zmw52bpWiR0= 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.18 0744/1095] memstick/ms_block: Fix a memory leak Date: Mon, 15 Aug 2022 20:02:23 +0200 Message-Id: <20220815180500.140907842@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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 f8f151163667..f8fdf88fb240 100644 --- a/drivers/memstick/core/ms_block.c +++ b/drivers/memstick/core/ms_block.c @@ -1947,6 +1947,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