Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp26377ybg; Tue, 9 Jun 2020 15:18:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxoPULO0aK/DQq8WIJ7ntVRRSBlzGpLvw0cUvfzX7mDdeuczr/Wp7HX5lMGvf1sURlSYE6P X-Received: by 2002:aa7:c6d1:: with SMTP id b17mr30430775eds.39.1591741130510; Tue, 09 Jun 2020 15:18:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591741130; cv=none; d=google.com; s=arc-20160816; b=k51daGdEZYAJYMcC8yIeN2dJfGCcRXhrTCxONpAwjfLmY4zvARWXontPTmCXRKYnrs 7klMC/C7NFcGHG8+kT7Tgmzye9jD4smsQ51rlKo8K2tM4MTRVq8UaZmM/NyV+HoQoqBR Awon3Y7L5j5Uqv3g9QcpzuPHvpPIr4QrvWpr2zrq7sJh8MJBAnxwwUIOeNFJKCrL0Ygl 4IvqDQ+EHZKuVOZAdTyOww2rOoYyUls7gJ4+QZJZuCDMJbmR4CPxfZrbc3nmWvZeS52O WIwUcQTC3Zo78pWjipYtvmYzY8PBaWUi6EIDHHbNYdYru1bvr2M0yrf6VB6eHih7zSKd zBfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=qTrEmgv7RHDZYDuYM0LPp7lzo5g/KSIrjUA4oTLoZNQ=; b=MBSDOGVtwpPp25G2HIX0U8ExHJdorEo9Fh10AxNE1h9jYZF/6tCrUy8KUB9vRTsii2 +6lfuc7CmCnltYjARXuSmCr09Xtd+/DNcWuMr4mX8hACrBWKQNSozxISPpRB2jIKb/b1 6nIau8g1s+NXUdVyJqhOU+dljmqlV3ee/u9gvMAgqFWfELaHNebCyI0VqnPtUwFHdGBd PpEa0YhG8vS7bCjZMQSFv6gGdas5VX3MjtU/2EuUietW3dVRjbZtxm7+xFtVB3disgCL QI4NAl1llB3bAVw2BkWH2AojyqvSbIL+IxVZAcQNsg7roZZXRDJCafuDhAey1MeV1wbI +pqA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lz22si11819796ejb.113.2020.06.09.15.18.23; Tue, 09 Jun 2020 15:18:50 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728406AbgFIWPb (ORCPT + 99 others); Tue, 9 Jun 2020 18:15:31 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:45485 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728382AbgFIWPb (ORCPT ); Tue, 9 Jun 2020 18:15:31 -0400 Received: by mail-lf1-f67.google.com with SMTP id d7so235181lfi.12 for ; Tue, 09 Jun 2020 15:15:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qTrEmgv7RHDZYDuYM0LPp7lzo5g/KSIrjUA4oTLoZNQ=; b=VA5dbhNU9cZSbsZx52DDnUol6vyRadTyGMuhWHnZ7lgfaj/Al8fRfVrI/l9oZXZPSv 1iHyDHqy+baFUnw5va4cvI/RB5TlkioFVmUy0C93IZ29/oCxMCphKUVv0R+s+0dclLbb m93R8TpLYTQ4ws+hgTCtT+wSvj95jhuENV3bTreo63fqC9VDrRc7SCFQ/ZcRNRqskdFW HxD5jpa1a2BCZQKrx6/7Vdb2PpZ7GsZPUi1GV4U8m4N5MQWuoSBhef+a7CXVeLZeazKQ /1twZU2rW0dKB1ujK9IsxZNn4SwsJzHJIkV15sKENL/BtxfookWmOZhF1xS35E6N9yZY rYeA== X-Gm-Message-State: AOAM531cNUoPskpFJCwob1Br6RVc/jDs0eOwhF4ujlGuWS/b1bp6y/T3 CA2xdH7k3qvOITTO0mb3P29cI6u1U54= X-Received: by 2002:a19:8ac3:: with SMTP id m186mr19262lfd.131.1591740928724; Tue, 09 Jun 2020 15:15:28 -0700 (PDT) Received: from localhost.localdomain ([213.87.137.116]) by smtp.googlemail.com with ESMTPSA id o19sm4531705ljc.23.2020.06.09.15.15.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2020 15:15:25 -0700 (PDT) From: Denis Efremov To: Chao Yu , Jaegeuk Kim Cc: Denis Efremov , linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH v3] f2fs: use kfree() instead of kvfree() to free superblock data Date: Wed, 10 Jun 2020 01:14:46 +0300 Message-Id: <20200609221446.24537-1-efremov@linux.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200605181533.73113-1-efremov@linux.com> References: <20200605181533.73113-1-efremov@linux.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use kfree() instead of kvfree() to free super in read_raw_super_block() because the memory is allocated with kzalloc() in the function. Use kfree() instead of kvfree() to free sbi, raw_super in f2fs_fill_super() and f2fs_put_super() because the memory is allocated with kzalloc(). Fixes: 5222595d093e ("f2fs: use kvmalloc, if kmalloc is failed") Signed-off-by: Denis Efremov --- Changes in v2: - Single patch instead of two separate patches - kvfree fixed in f2fs_put_super Changes in v3: - raw_super added to the scope, thanks Chao Yu fs/f2fs/super.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 8a9955902d84..7b458268ea09 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1241,7 +1241,7 @@ static void f2fs_put_super(struct super_block *sb) sb->s_fs_info = NULL; if (sbi->s_chksum_driver) crypto_free_shash(sbi->s_chksum_driver); - kvfree(sbi->raw_super); + kfree(sbi->raw_super); destroy_device_list(sbi); f2fs_destroy_xattr_caches(sbi); @@ -1257,7 +1257,7 @@ static void f2fs_put_super(struct super_block *sb) #ifdef CONFIG_UNICODE utf8_unload(sbi->s_encoding); #endif - kvfree(sbi); + kfree(sbi); } int f2fs_sync_fs(struct super_block *sb, int sync) @@ -3130,7 +3130,7 @@ static int read_raw_super_block(struct f2fs_sb_info *sbi, /* No valid superblock */ if (!*raw_super) - kvfree(super); + kfree(super); else err = 0; @@ -3808,11 +3808,11 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) fscrypt_free_dummy_context(&F2FS_OPTION(sbi).dummy_enc_ctx); kvfree(options); free_sb_buf: - kvfree(raw_super); + kfree(raw_super); free_sbi: if (sbi->s_chksum_driver) crypto_free_shash(sbi->s_chksum_driver); - kvfree(sbi); + kfree(sbi); /* give only one another chance */ if (retry_cnt > 0 && skip_recovery) { -- 2.26.2