Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp2214140ybg; Fri, 5 Jun 2020 08:20:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJysht+n+I09k+BtiyLhw7kMXBHdsh6T/wo1rz6HKl7uvqKFTxHJe8mWNaovC81q2qhezXa7 X-Received: by 2002:a17:906:d215:: with SMTP id w21mr8943573ejz.383.1591370439720; Fri, 05 Jun 2020 08:20:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591370439; cv=none; d=google.com; s=arc-20160816; b=0pKgxG91QYwgbQASrkv+MxDWwGeUj4iH54Kj+Bh7OfvJbS5C+ydP9JY7BYptRUR17j dYKG/AHiSh1IeIn3xjd3Vi9s50q5fFnb4BBp6bzOKjlZvw3Vr1j6FMzpWySoUA1JZ7aT tziTMESTB3JghMJiDctfyHYPntZtiLu0DE1Wr5ZOXMLYkTFvkPdKzbllIhvOmWbqFVdV sNU1jnxskRAPKqNNH+l9ptSticKGALh7E0Xc9YuAVudirfAYJBCxY/XfJ/EzXbZruZgN Ehc625CHTdgApxZnXULTMVTejKhUWU78EFxap0G5Zz/a/9jyZtoG4nOw1cfPVh9B4X/g iM5g== 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=uH01EG9TgRl5QQ1CdTC9L+6nZKIA8ffxfpqb0ORVUqI=; b=ybRbiHX7JO540SM0TsBKeAklMam2JYuOo1dATzE4HA7/5JYpMI6uCB5hIaTrcjyX0f h/myJScC4A5UInA3QhVOY08cG3XJoMdny/yO/qpDWM33Ir8AR6wEXLOtgRBfn181NVuj TT+t9k/JuxQgF4pRM3tT5l/QT/lTshsdFeq9BVPL4RnOACPuQwlYoaJln6TlDLpYpSxh OZAbTxXE68eJBAfTRCcNek0wJ4Zn+GLd/owF/Cr2QvJ5upyGwAUzitKxI3sazApiO0Pc YXNUeO1tfPhdDGyCr9HRSyWevAFd/A5GN68Mwk0w1V7uR25fpobRmpiZBOMMDwNWkucf Q0Ag== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m17si3650311eji.138.2020.06.05.08.20.14; Fri, 05 Jun 2020 08:20:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726675AbgFEPUI (ORCPT + 99 others); Fri, 5 Jun 2020 11:20:08 -0400 Received: from mx2.suse.de ([195.135.220.15]:55716 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726601AbgFEPUI (ORCPT ); Fri, 5 Jun 2020 11:20:08 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 7F7C4AE68; Fri, 5 Jun 2020 15:20:10 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id A20B31E1281; Fri, 5 Jun 2020 17:20:05 +0200 (CEST) Date: Fri, 5 Jun 2020 17:20:05 +0200 From: Jan Kara To: Chengguang Xu Cc: jack@suse.com, linux-ext4@vger.kernel.org Subject: Re: [PATCH] ext2: fix improper assignment for e_value_offs Message-ID: <20200605152005.GE13248@quack2.suse.cz> References: <20200603084429.25344-1-cgxu519@mykernel.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200603084429.25344-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 03-06-20 16:44:29, Chengguang Xu wrote: > In the process of changing value for existing EA, > there is an improper assignment of e_value_offs(setting to 0), > because it will be reset to incorrect value in the following > loop(shifting EA values before target). Delayed assignment > can avoid this issue. > > Signed-off-by: Chengguang Xu Thanks. I've added the patch to my tree. Honza > --- > fs/ext2/xattr.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c > index 943cc469f42f..c802ea682e7f 100644 > --- a/fs/ext2/xattr.c > +++ b/fs/ext2/xattr.c > @@ -588,7 +588,6 @@ ext2_xattr_set(struct inode *inode, int name_index, const char *name, > /* Remove the old value. */ > memmove(first_val + size, first_val, val - first_val); > memset(first_val, 0, size); > - here->e_value_offs = 0; > min_offs += size; > > /* Adjust all value offsets. */ > @@ -600,6 +599,8 @@ ext2_xattr_set(struct inode *inode, int name_index, const char *name, > cpu_to_le16(o + size); > last = EXT2_XATTR_NEXT(last); > } > + > + here->e_value_offs = 0; > } > if (value == NULL) { > /* Remove the old name. */ > -- > 2.20.1 > > -- Jan Kara SUSE Labs, CR