Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5608065imu; Mon, 26 Nov 2018 02:56:54 -0800 (PST) X-Google-Smtp-Source: AJdET5dbhjGKSxiIJrE3r7kybeanF6FrmpZ3RwWrUf4xRZTNjAR1Fa+J7aQY+tIofoYVGZbxStoK X-Received: by 2002:a63:ce08:: with SMTP id y8mr24160324pgf.388.1543229814093; Mon, 26 Nov 2018 02:56:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543229814; cv=none; d=google.com; s=arc-20160816; b=F6MrKHCVPRqd9k5UfrCG5I79lzc039uTNPRABP7+voG5t6GNG7ML8kHPsL8gbBjVeO 9qRtOwJbA1is8kP+tkQYM9enRQjUP9sApYI4+Kd5E8/Xm/xORBvar+NkOARFJTujKheg weNIrArFvssLP7AqIeDWWqXygCVLAnhRvwto50aOH6jP1rrkVeq0PC92NSidXMnGcLMI ZrOFmyNeTCcq549dXr/gapVGvzwzSo189Fr9wiKBPFXim8HEVCAQSp3IiAR55Aep6vXn +F3F3OesjtYu+XcV7j5cACtY7IFcDG5zuBSAAXvVeiRNLHTuIXHsR0OirIyLrCtVGeLL RqpQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OEHKnbNtzenjn4aUajCfktuiMUit2k8TwD7L8QW88uw=; b=K5Vt0EiNNoJslbJ/pwx2P/Ekauk+Q4iZd+WPdEJUPYxVLu7arDtVOEqli4YJSXFFH3 BQ1/SUa1Aq40CjeE81QHW7NWiylZjoWQrkppiE2asaAWLLhTW7350i8OCJlp+biWJjU0 wfSoN88vVPHYI5ZqvwAV9zJojiD83u1pVW8RI/b7bNGcvUzqXUz7OnBv4o7CkDhhyKC/ Q0WVG0Uxgife6qAmY1UrtKUDybDwdmJMzyrWGx1o1hMuDJTxFWI/mLwpGVtBHaHYzt9k 1QYt2nwcFT0ij1Vw4aecD647qF8Ll7Af6vwsdK+R+t4wunPEFLWdJr2073R2v5kkcuhT 8jRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TtAQZS0U; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g32si61643617pgg.400.2018.11.26.02.56.38; Mon, 26 Nov 2018 02:56:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TtAQZS0U; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727829AbeKZVs5 (ORCPT + 99 others); Mon, 26 Nov 2018 16:48:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:57712 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726274AbeKZVs4 (ORCPT ); Mon, 26 Nov 2018 16:48:56 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (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 0DC0F20817; Mon, 26 Nov 2018 10:55:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543229712; bh=5o0llT7teHSuigy/LDLuMADhWSGrs5P3LHP0qGrrEvM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TtAQZS0U2Xzq/bqyG7SJa6nE324V38rnv5RhLBIY8q0nY8I/7ae2OY4mOcW3rpBnK MsMjGICm+W2QfbiwrSlhqkybT5gIA8lCzOJiMlQ0gUG2oAl4CtAEECr6kz8fUPV7rI 93F4AbhEQ8YuLQOavvdkW4dob6lIF1LV5YMSgME4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chengguang Xu , Al Viro , Sasha Levin Subject: [PATCH 4.4 42/70] fs/exofs: fix potential memory leak in mount option parsing Date: Mon, 26 Nov 2018 11:50:57 +0100 Message-Id: <20181126105051.091079555@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181126105046.722096341@linuxfoundation.org> References: <20181126105046.722096341@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 515f1867addaba49c1c6ac73abfaffbc192c1db4 ] There are some cases can cause memory leak when parsing option 'osdname'. Signed-off-by: Chengguang Xu Signed-off-by: Al Viro Signed-off-by: Sasha Levin --- fs/exofs/super.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/exofs/super.c b/fs/exofs/super.c index b795c567b5e1..360ba74e04e6 100644 --- a/fs/exofs/super.c +++ b/fs/exofs/super.c @@ -100,6 +100,7 @@ static int parse_options(char *options, struct exofs_mountopt *opts) token = match_token(p, tokens, args); switch (token) { case Opt_name: + kfree(opts->dev_name); opts->dev_name = match_strdup(&args[0]); if (unlikely(!opts->dev_name)) { EXOFS_ERR("Error allocating dev_name"); @@ -868,8 +869,10 @@ static struct dentry *exofs_mount(struct file_system_type *type, int ret; ret = parse_options(data, &opts); - if (ret) + if (ret) { + kfree(opts.dev_name); return ERR_PTR(ret); + } if (!opts.dev_name) opts.dev_name = dev_name; -- 2.17.1