From patchwork Tue Nov 3 20:36:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 316922 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 771C4C4742C for ; Tue, 3 Nov 2020 21:29:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1CC5D22226 for ; Tue, 3 Nov 2020 21:29:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604438967; bh=tDP9tNKvXcz9W4/Ob2VP0SNZMWutwGjYqRUALACOOio=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=vEFX9JVrUzzi1VFL5wngOiquV/8Vos+uVQTTX94EvCiL3/qUf7fEmn9UYzXus47pC u/Xut9I9EvV85keEPQYOacMuOFS6qqkdjj4RWZfZFFw8Rsyp/+pYO0alKtZrYrRCvD +71e4CfB3RJZYMfCrvzwf3pA1kF7JrPSqeYNEvt0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732499AbgKCU7R (ORCPT ); Tue, 3 Nov 2020 15:59:17 -0500 Received: from mail.kernel.org ([198.145.29.99]:34312 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732507AbgKCU7Q (ORCPT ); Tue, 3 Nov 2020 15:59:16 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BB5A0223AC; Tue, 3 Nov 2020 20:59:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437156; bh=tDP9tNKvXcz9W4/Ob2VP0SNZMWutwGjYqRUALACOOio=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EeTnclL+AEScoKuxRKJCdXSekaJ4uiJQaW2iVlAfOTKHdN+bTufOIo4001DbBzPwl BHIJb2wOxO/NXWxV2OOobijkVHl83hc416YTlDb7PwpahdA16yFI0s9z3Ctmojb/AK fQniQiyKaplv5FkVw5eq6rheg9Nd/B68J+Jq5KyA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhihao Cheng , Sascha Hauer , Richard Weinberger Subject: [PATCH 5.4 171/214] ubifs: Dont parse authentication mount options in remount process Date: Tue, 3 Nov 2020 21:36:59 +0100 Message-Id: <20201103203306.775312263@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203249.448706377@linuxfoundation.org> References: <20201103203249.448706377@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Zhihao Cheng commit bb674a4d4de1032837fcbf860a63939e66f0b7ad upstream. There is no need to dump authentication options while remounting, because authentication initialization can only be doing once in the first mount process. Dumping authentication mount options in remount process may cause memory leak if UBIFS has already been mounted with old authentication mount options. Signed-off-by: Zhihao Cheng Cc: # 4.20+ Fixes: d8a22773a12c6d7 ("ubifs: Enable authentication support") Reviewed-by: Sascha Hauer Signed-off-by: Richard Weinberger Signed-off-by: Greg Kroah-Hartman --- fs/ubifs/super.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c @@ -1092,14 +1092,20 @@ static int ubifs_parse_options(struct ub break; } case Opt_auth_key: - c->auth_key_name = kstrdup(args[0].from, GFP_KERNEL); - if (!c->auth_key_name) - return -ENOMEM; + if (!is_remount) { + c->auth_key_name = kstrdup(args[0].from, + GFP_KERNEL); + if (!c->auth_key_name) + return -ENOMEM; + } break; case Opt_auth_hash_name: - c->auth_hash_name = kstrdup(args[0].from, GFP_KERNEL); - if (!c->auth_hash_name) - return -ENOMEM; + if (!is_remount) { + c->auth_hash_name = kstrdup(args[0].from, + GFP_KERNEL); + if (!c->auth_hash_name) + return -ENOMEM; + } break; case Opt_ignore: break;