Received: by 10.192.165.156 with SMTP id m28csp350247imm; Mon, 16 Apr 2018 00:50:51 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/m3Yq9OpBcw0PWUrcFwsDUha4TlvC33tatS2HcmwlVzYhlD+kX+f/hq5iLjSmUl9yQGBHe X-Received: by 10.101.97.16 with SMTP id z16mr12197653pgu.23.1523865051406; Mon, 16 Apr 2018 00:50:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523865051; cv=none; d=google.com; s=arc-20160816; b=fR6N5oHCR7FctB9/zWRDFfHE8FtkR6+npQErZy9cr0btjoTvnwHLd6JhUOQgjW4ISP pzodEPeBnrOLWvKgxDGPYwANUjc7UyO90rZeEQ0JbCBd1ZuVjk/HV5ifn3DC9T8nYOft aWSucSQnDUt+fIpbNXHa1xclF5/w4iT73lvK9R0KaxKU7EUTMh4iHU9R4Kx/dgLCoA73 J7rafac9zIKaKFo1RHHf8ZzJ1+Iq5ewliIhNw3nDN7aQHnFolDkNvVIt7TL5hSG+/RB0 PhQFwY5H1RsjycKkQkvguIFVdMaRNBeYql+G3+XtOyb74gbkyuUvZ2XrEGq/ivMKfVds OfFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=pkCrM5AgVESyZ2L2OUzmDLcToPNhl3YWtGDi3lejKe4=; b=BCLOiJKVDCGjIRbGA2xYnjGBtzz07FxhWeApI5oRwl59ZU9At+WRDjWkZMGDDGch+p QDkwjEnSpZ25qvn76yIzC3rp+Skym0ls8RgvV6BUlXF3Y3cRpJaexBhvnb0wGPe03nBy UhvxZi5VqBedy2sOiOj0IR2w6pjcUgwIH5WtRJNHmYcFSiNrcFmKKKOrdmHU5UQtlzWw DvUw5abAuEytOCLCDJwKvRTiMnNvql3CrJAlTwHxq2thwjl2gPyv7BZgpdt2ZRWKHQSK R3vHp52EcxkdJsI++xthWL+MM8X3PfS1AFvJdkkZtGd8Qh/sz5nzQB56gN0kOQd5yEK6 XV3w== ARC-Authentication-Results: i=1; mx.google.com; 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 w27si3583583pge.638.2018.04.16.00.50.37; Mon, 16 Apr 2018 00:50:51 -0700 (PDT) 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; 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 S1753091AbeDPHsP (ORCPT + 99 others); Mon, 16 Apr 2018 03:48:15 -0400 Received: from mx2.suse.de ([195.135.220.15]:45302 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752177AbeDPHsO (ORCPT ); Mon, 16 Apr 2018 03:48:14 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id C0A0DADCC; Mon, 16 Apr 2018 07:48:12 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 8394C1E0A79; Mon, 16 Apr 2018 09:48:11 +0200 (CEST) Date: Mon, 16 Apr 2018 09:48:11 +0200 From: Jan Kara To: Chengguang Xu Cc: jack@suse.cz, dhowells@redhat.com, elfring@users.sourceforge.net, viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org Subject: Re: [PATCH] isofs: fix potential memory leak in mount option parsing Message-ID: <20180416074811.4wqibq6woptzcwfh@quack2.suse.cz> References: <1523708166-32728-1-git-send-email-cgxu519@gmx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1523708166-32728-1-git-send-email-cgxu519@gmx.com> User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat 14-04-18 20:16:06, Chengguang Xu wrote: > When specifying string type mount option (e.g., iocharset) > several times in a mount, current option parsing may > cause memory leak. Hence, call kfree for previous one > in this case. Meanwhile, check memory allocation result > for it. > > Signed-off-by: Chengguang Xu Thanks. I've added the patch to my tree. Honza > --- > fs/isofs/inode.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c > index bc258a4..ec3fba7 100644 > --- a/fs/isofs/inode.c > +++ b/fs/isofs/inode.c > @@ -394,7 +394,10 @@ static int parse_options(char *options, struct iso9660_options *popt) > break; > #ifdef CONFIG_JOLIET > case Opt_iocharset: > + kfree(popt->iocharset); > popt->iocharset = match_strdup(&args[0]); > + if (!popt->iocharset) > + return 0; > break; > #endif > case Opt_map_a: > -- > 1.8.3.1 > -- Jan Kara SUSE Labs, CR