From mboxrd@z Thu Jan 1 00:00:00 1970 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 090DFC433F5 for ; Thu, 19 May 2022 02:11:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232745AbiESCLC (ORCPT ); Wed, 18 May 2022 22:11:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232743AbiESCLB (ORCPT ); Wed, 18 May 2022 22:11:01 -0400 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80D0D186EF; Wed, 18 May 2022 19:10:59 -0700 (PDT) Received: from cwcc.thunk.org (pool-108-7-220-252.bstnma.fios.verizon.net [108.7.220.252]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 24J2Absr020685 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 18 May 2022 22:10:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mit.edu; s=outgoing; t=1652926239; bh=tR13JwUbXXXeiykjLNhK4pqKKdnGUOdKfC+6Atr7Qec=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=KY3MZRCTmd2jkp++r3S74yh8ujOH46dVzROEXMoxhUYCq6YqEsVLiNa9z56gC2bJX 12fgbb9hMeavEFfQmzO9FZEqge1/QMMZ4KLrBJQHwtF0qY6SLff4ZctdYz4q1G8WiI WUPRss6ao9UlJIXxLBVxjKqHTO3rYM8bmP6r4gfuXXhblBUHbZ2m+WscMUjoH03biB 4HHxTjXPUR0xA1wBvEZmZkuxuMsjc7FI4HwBMcMnzW54ONA3RZn/YTLQjIxT6ZWNKG HjvYP7WCH7HrcY5Z7YAEAiify4VsKjVBlw+bIXSahQiubRkTsxq2sXNvxkdQA2iXYk AOyQNsCLz86TQ== Received: by cwcc.thunk.org (Postfix, from userid 15806) id 86D8015C3EC0; Wed, 18 May 2022 22:10:37 -0400 (EDT) Date: Wed, 18 May 2022 22:10:37 -0400 From: "Theodore Ts'o" To: Eric Biggers Cc: linux-fscrypt@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, Jeff Layton , Lukas Czerner , Jaegeuk Kim , stable@vger.kernel.org Subject: Re: [PATCH v3 1/5] ext4: fix memory leak in parse_apply_sb_mount_options() Message-ID: References: <20220513231605.175121-1-ebiggers@kernel.org> <20220513231605.175121-2-ebiggers@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220513231605.175121-2-ebiggers@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org On Fri, May 13, 2022 at 04:16:01PM -0700, Eric Biggers wrote: > From: Eric Biggers > > If processing the on-disk mount options fails after any memory was > allocated in the ext4_fs_context, e.g. s_qf_names, then this memory is > leaked. Fix this by calling ext4_fc_free() instead of kfree() directly. > > Reproducer: > > mkfs.ext4 -F /dev/vdc > tune2fs /dev/vdc -E mount_opts=usrjquota=file > echo clear > /sys/kernel/debug/kmemleak > mount /dev/vdc /vdc > echo scan > /sys/kernel/debug/kmemleak > sleep 5 > echo scan > /sys/kernel/debug/kmemleak > cat /sys/kernel/debug/kmemleak > > Fixes: 7edfd85b1ffd ("ext4: Completely separate options parsing and sb setup") > Cc: stable@vger.kernel.org > Signed-off-by: Eric Biggers Thanks, applied. - Ted From mboxrd@z Thu Jan 1 00:00:00 1970 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 lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 26914C433F5 for ; Thu, 19 May 2022 02:11:00 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.94.2) (envelope-from ) id 1nrVcx-0008Pw-HN; Thu, 19 May 2022 02:10:58 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nrVcv-0008Pn-Fi for linux-f2fs-devel@lists.sourceforge.net; Thu, 19 May 2022 02:10:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=In-Reply-To:Content-Type:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=tR13JwUbXXXeiykjLNhK4pqKKdnGUOdKfC+6Atr7Qec=; b=mhje6KWXU3m2t7XcQZeH3mKT/z rVNwfqyKvlwsYIZM909VHWWN8gvggPxjjEbZwc0/4mHgA+fTkFHFaLG26PvvMnnF57XLhj/Ieg+3P VCIEC13xsFc8xWIOioNJ/aNJp9IdQt7qyXLzjVxs+qTQyNfXGzOwtbobhiu1QH8TSOgM=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To :From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=tR13JwUbXXXeiykjLNhK4pqKKdnGUOdKfC+6Atr7Qec=; b=Yn18dN81DutZBF2CJTSaDKArkb lUUH2rf2WzJmo7/CC859wbc5iGkDcEt87FWyCmsQRGNynajRU7FDABLge6MLciyxFlJFfhTt+w0u8 iAGpUYHFQOyJfK57yGoYvc2NijFUfJeQuCmazajpdDjp2ZZtQ+1g769EjWUgcyS24/Ts=; Received: from outgoing-auth-1.mit.edu ([18.9.28.11] helo=outgoing.mit.edu) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.94.2) id 1nrVcq-0004WM-VB for linux-f2fs-devel@lists.sourceforge.net; Thu, 19 May 2022 02:10:55 +0000 Received: from cwcc.thunk.org (pool-108-7-220-252.bstnma.fios.verizon.net [108.7.220.252]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 24J2Absr020685 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 18 May 2022 22:10:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mit.edu; s=outgoing; t=1652926239; bh=tR13JwUbXXXeiykjLNhK4pqKKdnGUOdKfC+6Atr7Qec=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=KY3MZRCTmd2jkp++r3S74yh8ujOH46dVzROEXMoxhUYCq6YqEsVLiNa9z56gC2bJX 12fgbb9hMeavEFfQmzO9FZEqge1/QMMZ4KLrBJQHwtF0qY6SLff4ZctdYz4q1G8WiI WUPRss6ao9UlJIXxLBVxjKqHTO3rYM8bmP6r4gfuXXhblBUHbZ2m+WscMUjoH03biB 4HHxTjXPUR0xA1wBvEZmZkuxuMsjc7FI4HwBMcMnzW54ONA3RZn/YTLQjIxT6ZWNKG HjvYP7WCH7HrcY5Z7YAEAiify4VsKjVBlw+bIXSahQiubRkTsxq2sXNvxkdQA2iXYk AOyQNsCLz86TQ== Received: by cwcc.thunk.org (Postfix, from userid 15806) id 86D8015C3EC0; Wed, 18 May 2022 22:10:37 -0400 (EDT) Date: Wed, 18 May 2022 22:10:37 -0400 From: "Theodore Ts'o" To: Eric Biggers Message-ID: References: <20220513231605.175121-1-ebiggers@kernel.org> <20220513231605.175121-2-ebiggers@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220513231605.175121-2-ebiggers@kernel.org> X-Headers-End: 1nrVcq-0004WM-VB Subject: Re: [f2fs-dev] [PATCH v3 1/5] ext4: fix memory leak in parse_apply_sb_mount_options() X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jeff Layton , stable@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-fscrypt@vger.kernel.org, Lukas Czerner , Jaegeuk Kim , linux-ext4@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net On Fri, May 13, 2022 at 04:16:01PM -0700, Eric Biggers wrote: > From: Eric Biggers > > If processing the on-disk mount options fails after any memory was > allocated in the ext4_fs_context, e.g. s_qf_names, then this memory is > leaked. Fix this by calling ext4_fc_free() instead of kfree() directly. > > Reproducer: > > mkfs.ext4 -F /dev/vdc > tune2fs /dev/vdc -E mount_opts=usrjquota=file > echo clear > /sys/kernel/debug/kmemleak > mount /dev/vdc /vdc > echo scan > /sys/kernel/debug/kmemleak > sleep 5 > echo scan > /sys/kernel/debug/kmemleak > cat /sys/kernel/debug/kmemleak > > Fixes: 7edfd85b1ffd ("ext4: Completely separate options parsing and sb setup") > Cc: stable@vger.kernel.org > Signed-off-by: Eric Biggers Thanks, applied. - Ted _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel