Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp822416pxb; Tue, 3 Nov 2020 13:32:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJwp1IansVksPv+G/fdQhWlRoGNBXzgNIanzqGTGFw0yGBDraYIL/0pe1o/icHwMIpxk1u4/ X-Received: by 2002:a17:906:158e:: with SMTP id k14mr21339765ejd.496.1604439132437; Tue, 03 Nov 2020 13:32:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604439132; cv=none; d=google.com; s=arc-20160816; b=VHWcBOB7+j+57L3x7MZbE2OQWivUHueXqwTkBfFJ4CqTd9+/McZgTupzo10c0O+5Xl jWRIIdHvqanGKEy566Kt6BGW6l6Rc3qizNerdrNHKArkninRnmNkYK7btm4zPc3gNBQ0 fFtYpAONlITtTqVR3emIrb65PV0a2NcSHU3ChY3SFQFmDlgc1xVHobiiOEsVRMGi6KZk H4egDnhoqCBOZDAe4EX8StLFUDUWkj2++PpuBZX+7pb4bdSy1JxDtkrtCkmrSwtIrnZL Z/PvDef+DLErXucubeyC90olDYX8s0YLYkDr25O8AuaCC/LNaVBag5XMXL4FczNW8pmq OmBg== 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=3G8ksdDC1X1jxM5u9tpOu9mSwTYch7dWdVx5jnAjnvU=; b=dx5VfWYm47AdfAuiA1bX2h5ItXE6xbcdxbX34g+yx4V1LC1CNISjQgeyc2db0nF1uD S5JQs/Lua9vXzx00LUA+HSsfT+ztBRncp3WNEH8UFpwilB75+7m/u8s5Ofkh32ZC4+nl Ot4C8Zl7dyBAI1gyaTg+nwiYkhH7G/5cRxPzucfT895fcn0FbJcV3Eo74l57PfQrHpng L68c39siW7uaTIh43U0UIOjQnV5tuzsQkufhagNAKwAPLi11i2twl8wcdrNIOM8w5UgN HG9PUma+fQWmDqmAA3jpXsyb0OTnphAXb8KV40gpLULBQm/3G1qTI+TwlwaG23cEKmVV Y4qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EeTnclL+; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g9si15085120edn.361.2020.11.03.13.31.49; Tue, 03 Nov 2020 13:32:12 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=EeTnclL+; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733072AbgKCU7R (ORCPT + 99 others); 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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;