Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp1545865ybj; Fri, 20 Sep 2019 12:13:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqx1NcWTvyG+5qHdQaLM37HVNwRl1yyNfsN40pmA8wi0wFnkG/P5CT4gbVzn/yWLi1mzTneR X-Received: by 2002:a05:6402:1ade:: with SMTP id ba30mr17766219edb.304.1569006822293; Fri, 20 Sep 2019 12:13:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569006822; cv=none; d=google.com; s=arc-20160816; b=f79wV3f6HYf8Dm1PQt4SxnlxO8mGR2LCzPGK5dnWeAKOMA0qTRJlvSpryaaTsDFBhU mriL42oY8EhH1RAz0ULPHqei8itMP1fPo5svJ9i+ogCsRWBUfrTg/PhP6+8Ki2UJKag4 2v0lD6psUGWZixMXMxAoiCeXSg2xLC95WPCUzvM7EktFNX4qGwrVBTfWUNBXML0MK6lt 12RuOGYyzYXgQ9ufR72NlpteI+Ogk7A+2KFbZchzv4S5PuSkFlbn60f9wnDIbRn0Eg9z ZKDFHXOyptcw1v64JD4+9/7WLZh6d/eUOKVsw+rs5Y0+izMG+zCKyxa6+Hihnlx3v6W2 GIDA== 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; bh=IA1TFSW/Htv0tNJWTXTQf/Hlnkv4oCB/ge5ST347E5c=; b=V5aQ4ockV44uk1CaTY6Rw/rkMsu1Xdm16HqIftkNSMSk/k+nFykpyrjSjtdhyZ7avO yMGY1HpmCwnHgwb7ZGNN5ISr31yFggVK3fSG+rHWkI9WQojFlDTRmPP9++U0CDCg6wLj SMah65c563I8zqomQF5qvKiIMfsB1CJXwnpaSn4dFqBl0BUx2BMw44lINdJEBnwP6rEc wGhEjeoSb9W0I73vXf3HIghIpkjktacGJb0Ug6mAkq9loJWqqLFkjLtDD08bzE+RzfbM 0wHc7aPPGklYpFSOVblUSRRJdbbgjlNt70CiPI4JXNAc8xJV5smvTqCHEGdTCGWXMuOY bO2w== 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 x25si2011167edr.128.2019.09.20.12.13.18; Fri, 20 Sep 2019 12:13:42 -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 S2438188AbfITLpo (ORCPT + 99 others); Fri, 20 Sep 2019 07:45:44 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:34146 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406069AbfITLpo (ORCPT ); Fri, 20 Sep 2019 07:45:44 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.2 #3 (Red Hat Linux)) id 1iBHK4-00043M-D1; Fri, 20 Sep 2019 11:43:36 +0000 Date: Fri, 20 Sep 2019 12:43:36 +0100 From: Al Viro To: Xiaoming Ni Cc: dwmw2@infradead.org, dilinger@queued.net, richard@nod.at, houtao1@huawei.com, bbrezillon@kernel.org, daniel.santos@pobox.com, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] jffs2:freely allocate memory when parameters are invalid Message-ID: <20190920114336.GM1131@ZenIV.linux.org.uk> References: <1568962478-126260-1-git-send-email-nixiaoming@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1568962478-126260-1-git-send-email-nixiaoming@huawei.com> User-Agent: Mutt/1.12.0 (2019-05-25) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 20, 2019 at 02:54:38PM +0800, Xiaoming Ni wrote: > Use kzalloc() to allocate memory in jffs2_fill_super(). > Freeing memory when jffs2_parse_options() fails will cause > use-after-free and double-free in jffs2_kill_sb() ... so we are not freeing it there. What's the problem?