Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3090490rwb; Mon, 15 Aug 2022 17:53:39 -0700 (PDT) X-Google-Smtp-Source: AA6agR4AHiO10hsdK/UG2tobp9wo9HMHX4C8f59zNcqll3kaLW64G4kKAVp33FAzzJScPFbzh7PB X-Received: by 2002:aa7:c3d1:0:b0:43c:c713:fac8 with SMTP id l17-20020aa7c3d1000000b0043cc713fac8mr16753328edr.371.1660611219083; Mon, 15 Aug 2022 17:53:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660611219; cv=none; d=google.com; s=arc-20160816; b=DegR567CZz2JM16IWvoCrcB54/zNijJ3ybaXNPmqtjGIyGRoP6yx/A6WCJDD7IHtnP kAlCjrcGtCu6iMCcnP8mgKlAmkXHgpPPSR+HO+C7TNNvStvoOGxr8nR7dZorC20W8ba/ mSHGrMlZbCaWCdud3+Z9xhBrPXqLk/JqthlYowxIVQKcnRxtMrVY+XEzZs7m0j0va9oy 3wsBJpasfxkfNOGTr4hDtxM5jNhq3op1PlONdgIZNFJ92k3cI7hiEaansODeKlfaN3Iu atbnukLIGcsfBhEDek2oR5dpWy+LJz8k74tS0n/UknYE/Z+MrvOBt9qLFMSE/IQ73KwI OI+Q== 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=TN26UVZTuRaVPbbJcK5iyVa1hcwXDti/UZ0Dh62n+ra2xdNOGq0dnfbRwdlNA2dohA lL2E1pjGGIJLuMq8tNymzKPULLuGsC4J+hvsKprzynWiI24b0kAy4uoUwoZI+DU5uOGJ 6UCiXZeKwW3SrbF4Huuadn5BsbpqJ2w4yC4sREvASmBctrFGyK2hv62VXfNHWXWqukt4 IPb7py0k+G6++i+A6jkKFAtny9J0uv/zI59IUURRg16JtlJMz5fyE5MxJbVRDQHYmxnG y267X6ej5jG/WFcKORITxUzitzHPXrCzff0/8frd8YLJPmRKVjXChrAmbKX94AeTRFgN u6xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GbqY8qUS; 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 b22-20020a1709065e5600b0072f579adddcsi7709918eju.519.2022.08.15.17.53.13; Mon, 15 Aug 2022 17:53:39 -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=GbqY8qUS; 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 S1351757AbiHPA2h (ORCPT + 99 others); Mon, 15 Aug 2022 20:28:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356149AbiHPA0y (ORCPT ); Mon, 15 Aug 2022 20:26:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBC81A99F7; Mon, 15 Aug 2022 13:34:41 -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 73F9EB80EB1; Mon, 15 Aug 2022 20:34:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC941C433D7; Mon, 15 Aug 2022 20:34:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660595647; bh=WInj4pOrN2LEbYBEShrOBHF7IyqIhqtVGRwA7OG/tBo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GbqY8qUSSFV5gH+eJzX+ZYooVr5T1c524SexcjVrYT4C9F98NwWH+6pek718BohVw 4nlWOQ5Vc1WNpQJUdXaNd42SJ+BcLl0jfLFnwTdVvH40RbUXWd0uLTdGSClG6kHql/ QGELPMOY4eHiR1GckdVgQDfmGNY+RVkli8WSXnco= 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.19 0798/1157] memstick/ms_block: Fix a memory leak Date: Mon, 15 Aug 2022 20:02:34 +0200 Message-Id: <20220815180511.405680404@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@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