Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp832267pxb; Tue, 3 Nov 2020 13:50:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJwQOPdbCCBat+97tDeP79GgRZ7fy20AdUPx3pMzhMM1Cq574QTrU5SzAVkQwx8ZRaYeIxg8 X-Received: by 2002:aa7:c358:: with SMTP id j24mr24055277edr.265.1604440237704; Tue, 03 Nov 2020 13:50:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604440237; cv=none; d=google.com; s=arc-20160816; b=WJLghxtMVK8/zmTzJjagdLlo/W+Zi1jMX50FkPZyx319ixRlj36ChekiStm6m3SrXB mhYnYV60PCL4dIunNl9MGCKfui0ct5Y1zB6ElKOwMFZeMXYnvAL1x81xQcVYe269OTb5 JlA69ddY1DfQth6oLR9/PR6fM7wB1ySw40p6choTVwhicBRQe6be2wQ/XJ7CzyxUrqVQ OPzZR9ICUt00PrqbBaiTlSbbg3hUCAc300yJE7KGBOQXZzVdQRVN0uQ0NTGbNAhxIK6M wMM+FGHmflt+lds1T2TJQ8edzNu011oUJXyK8kWt5ThMCtBgyQkM1Y2IGyI04MIsGELQ sT5g== 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=iH8ZKq6V1bTpSp/RY6hpCVRAAO7NFqMF8mZk3NyR0WU=; b=Pt0GLdxS2rFwXBOquRTlyVzKCF44/pCWlS4GomEUvhO78UFYTAC0O1k4+AdEIgqGXp L3/vyun2zAmRu8SvjOmQrHOoIrtrP87MMSbcDU7qS+7XBPbUqmPkxXYtWnwiPZEGyp33 v5kwicvRMLyFh/pnGpoQrLFT/uLuPIjbhPxClsdru6nGNf95A7oTCbgITbw6elloA81s cc4uVhjGjov1gRfS0NJzjo0vutNn5reyxMyGaXkWhieKJzk7syEe+609lh96uNzuQ7X1 WNAyJZvNllHZcP2VyN5t7dsXN/SIjha+QUMMGiLzDl8ZQHZnsuMnygGscs6aaZNnSFiY b6rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KavwDoeW; 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 b26si69642ejd.476.2020.11.03.13.50.14; Tue, 03 Nov 2020 13:50:37 -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=KavwDoeW; 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 S1731887AbgKCUu6 (ORCPT + 99 others); Tue, 3 Nov 2020 15:50:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:45474 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731861AbgKCUu4 (ORCPT ); Tue, 3 Nov 2020 15:50:56 -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 41E4820719; Tue, 3 Nov 2020 20:50:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604436655; bh=CutWjqcMu5F+Q+wyj+XDKFpXKmLMZ2FiTO6jka/hMyM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KavwDoeWEMjKuX6FHxB4JwgNVqZCbtSc48CuesONfzyfQyGmLMiEp1s2Rrw7z9+CN PiqoTAUN7Uq7SwI8WXjsy+Sz02Fq/Q+P3HQS4ZYOybpu44eHdE98oXp8DEsOh7CY6L ORr54metVrMsyRA+/4YaVnJbmlO0QktTuix+xFrg= 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.9 307/391] ubifs: Dont parse authentication mount options in remount process Date: Tue, 3 Nov 2020 21:35:58 +0100 Message-Id: <20201103203407.818350193@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203348.153465465@linuxfoundation.org> References: <20201103203348.153465465@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 @@ -1110,14 +1110,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;