Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp2706793ybg; Thu, 24 Oct 2019 13:55:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqzvuMaHKgHCCyOBI48QChxr71XV4PEVgpUnod6+NDTkI0wHtucZ/MRYRjqm8M14rBOaPkLQ X-Received: by 2002:a17:906:360e:: with SMTP id q14mr96406ejb.313.1571950542591; Thu, 24 Oct 2019 13:55:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571950542; cv=none; d=google.com; s=arc-20160816; b=rzfXDN+EtDuHEIx9ClkrqGwI3d5woWsw+mFRBoQkOtV1TM2L1tT0C4/o5G7o3ICPAd 0DrwkIgAdyNsKj6/7yqpnTY4bPtJk/enuvR4zNcZVIMNGc9rwO85cOHfRyZdwfrVYdmk Kr7Dn5AWsfMbN2y928zoatQ241CAEBxNkQxM8KXkWRM3I8fqajjcqDRXk23ZrqFdh1KJ /NofZJa6M+PgCNf+yAD8BN0Jt5HUpa/YRDvvHG3u2KfPT1JDtl/i6CTsTs2YXX2aQaSz 4Q9xIoNHLqGV2DmOpzskU6CbnYVoyIrFjkw84Yry1HNVRd7rsLyb6I8xLR+nDH+yo0Vv hOuA== 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=ym+o0d9QrVw46o5cuzzXF7KNzAVG4jiHToQ22Ql6w0k=; b=gPXzlAZR/Emgk0hTBfmydpfxu0BP6SsckOKqKK6JYWs38JlDtoQcAM3/ofHJI2/NB6 VFG0RLNhphGpqnXrEOoFwKXs12fvSaxCdtxzzDKYGH59xgN5R1CP+4LoL7f1N3KyacsB hzeix5McMFZY04fCLD94YEKXYWalfIHzJL1n+68naIS5QlR9aJ1KrrukjjXouWuFnvP9 L2zS1OlOabt6QeR58RWo5HHpeDNIKD/GgWhlnc9vp9axTHf9lIHLR96AyF0K9wfwPOEv J9ryjDlQ1lWwJ+fZfItpom0bKjJC151Ux2dTmiGmyUWlxLAI47ZjjpIHH3dmjA7QHswp NbuA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-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 c1si7187728ejb.116.2019.10.24.13.55.17; Thu, 24 Oct 2019 13:55:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-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-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392957AbfJXHY6 (ORCPT + 99 others); Thu, 24 Oct 2019 03:24:58 -0400 Received: from mx2.suse.de ([195.135.220.15]:52772 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2390783AbfJXHY6 (ORCPT ); Thu, 24 Oct 2019 03:24:58 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id EF08BAEB8; Thu, 24 Oct 2019 07:24:56 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 8506E1E4A99; Thu, 24 Oct 2019 09:24:56 +0200 (CEST) Date: Thu, 24 Oct 2019 09:24:56 +0200 From: Jan Kara To: Chengguang Xu Cc: jack@suse.com, linux-ext4@vger.kernel.org Subject: Re: [PATCH] ext2: return error when fail to allocating memory in ioctl Message-ID: <20191024072456.GH31271@quack2.suse.cz> References: <20191023135643.28837-1-cgxu519@mykernel.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191023135643.28837-1-cgxu519@mykernel.net> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Wed 23-10-19 21:56:43, Chengguang Xu wrote: > Currently, we do not check memory allocation > result for ei->i_block_alloc_info in ioctl, > this patch checks it and returns error in > failure case. > > Signed-off-by: Chengguang Xu Makes sense. Applied. Thanks! Honza > --- > fs/ext2/ioctl.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/fs/ext2/ioctl.c b/fs/ext2/ioctl.c > index 1b853fb0b163..32a8d10b579d 100644 > --- a/fs/ext2/ioctl.c > +++ b/fs/ext2/ioctl.c > @@ -145,10 +145,13 @@ long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) > if (ei->i_block_alloc_info){ > struct ext2_reserve_window_node *rsv = &ei->i_block_alloc_info->rsv_window_node; > rsv->rsv_goal_size = rsv_window_size; > + } else { > + ret = -ENOMEM; > } > + > mutex_unlock(&ei->truncate_mutex); > mnt_drop_write_file(filp); > - return 0; > + return ret; > } > default: > return -ENOTTY; > -- > 2.21.0 > > > -- Jan Kara SUSE Labs, CR