Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1773412imm; Thu, 27 Sep 2018 02:13:09 -0700 (PDT) X-Google-Smtp-Source: ACcGV62oewpZuQ+p9PTk6Gvewu366gjlHWA60lY9u4jXgWx0KNiE9pATcpKV1ZTT7zm/LiUGwJ/o X-Received: by 2002:a63:f553:: with SMTP id e19-v6mr9379288pgk.417.1538039589252; Thu, 27 Sep 2018 02:13:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538039589; cv=none; d=google.com; s=arc-20160816; b=kWiSMGp8HiB+WrTI4gSwZAkaLmeBqrx1nOsiH/2BUFEz6Cu+K4wmlq9PHpPdOii8jg zJ9OmnuxDwWFXHE04rd04Zq6dULVYuNqY/g1/WoiwYRSO6Xd5AZyI+iTUBWEeafpJPfw xNTV7Wi0JA0YzosMk62qXJp1Uu7PTigk3suCSWpgL682uelKQVEmaw591zsDZTkOBYVu SU55hhHlZGL/QB5R4RhcZgo5PFN3VDt5PGNqi1pGN3jPDejlRXPAESvX0D575jl5CFl0 glnhvXlEOy2YD4v9bL19a8HS/Gp46KLI/xTmuvQATUqQRCq55gfGyHXu1IW197TjVsrB FOGw== 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; bh=gHjWY89AB1Pn6aqdj0mza5NGcDtFUUrVAs68D+MqCQY=; b=eBbxHmnaGBWx099S6lop52v+JylSaXo7DIwKgX+V4X4P+QSePTV48vsYOnfIGTG78u Q1G3bGeC8zZEOK7Q5r6YIeaDRaOi0glMjkn15r4SNmCM2xx3dx1iOmDJwxoeXquU4xKq RqlhL93e9N/iZDQKzIp021bBIiPx5aeqUmLCcJ9FajH8dOm2s1hQgzNqgb5GFcKGjzSV OS9LdDG6gz0dpG4p2SdAzREC4bRhcbD6HeLdnhtGkM6fwsAoUxeyowv+mXPi4ctwzMug Lts9VbSW/9HC/rYXHcJojbDSAShwjY7PEBroec5XTUAyrNjTLi/I1mzNELr/4nsp11Qq Mo0g== 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 p3-v6si1503868pld.329.2018.09.27.02.12.54; Thu, 27 Sep 2018 02:13:09 -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 S1727661AbeI0P3J (ORCPT + 99 others); Thu, 27 Sep 2018 11:29:09 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:55306 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727032AbeI0P3J (ORCPT ); Thu, 27 Sep 2018 11:29:09 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 7119410A4; Thu, 27 Sep 2018 09:11:52 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Koen Vandeputte , Joel Stanley , Richard Weinberger Subject: [PATCH 4.18 58/88] Revert "ubifs: xattr: Dont operate on deleted inodes" Date: Thu, 27 Sep 2018 11:03:39 +0200 Message-Id: <20180927090307.812271713@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180927090300.631426620@linuxfoundation.org> References: <20180927090300.631426620@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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Richard Weinberger commit f061c1cc404a618858a77aea233fde0aeaad2f2d upstream. This reverts commit 11a6fc3dc743e22fb50f2196ec55bee5140d3c52. UBIFS wants to assert that xattr operations are only issued on files with positive link count. The said patch made this operations return -ENOENT for unlinked files such that the asserts will no longer trigger. This was wrong since xattr operations are perfectly fine on unlinked files. Instead the assertions need to be fixed/removed. Cc: Fixes: 11a6fc3dc743 ("ubifs: xattr: Don't operate on deleted inodes") Reported-by: Koen Vandeputte Tested-by: Joel Stanley Signed-off-by: Richard Weinberger Signed-off-by: Greg Kroah-Hartman --- fs/ubifs/xattr.c | 24 ------------------------ 1 file changed, 24 deletions(-) --- a/fs/ubifs/xattr.c +++ b/fs/ubifs/xattr.c @@ -152,12 +152,6 @@ static int create_xattr(struct ubifs_inf ui->data_len = size; mutex_lock(&host_ui->ui_mutex); - - if (!host->i_nlink) { - err = -ENOENT; - goto out_noent; - } - host->i_ctime = current_time(host); host_ui->xattr_cnt += 1; host_ui->xattr_size += CALC_DENT_SIZE(fname_len(nm)); @@ -190,7 +184,6 @@ out_cancel: host_ui->xattr_size -= CALC_XATTR_BYTES(size); host_ui->xattr_names -= fname_len(nm); host_ui->flags &= ~UBIFS_CRYPT_FL; -out_noent: mutex_unlock(&host_ui->ui_mutex); out_free: make_bad_inode(inode); @@ -242,12 +235,6 @@ static int change_xattr(struct ubifs_inf mutex_unlock(&ui->ui_mutex); mutex_lock(&host_ui->ui_mutex); - - if (!host->i_nlink) { - err = -ENOENT; - goto out_noent; - } - host->i_ctime = current_time(host); host_ui->xattr_size -= CALC_XATTR_BYTES(old_size); host_ui->xattr_size += CALC_XATTR_BYTES(size); @@ -269,7 +256,6 @@ static int change_xattr(struct ubifs_inf out_cancel: host_ui->xattr_size -= CALC_XATTR_BYTES(size); host_ui->xattr_size += CALC_XATTR_BYTES(old_size); -out_noent: mutex_unlock(&host_ui->ui_mutex); make_bad_inode(inode); out_free: @@ -496,12 +482,6 @@ static int remove_xattr(struct ubifs_inf return err; mutex_lock(&host_ui->ui_mutex); - - if (!host->i_nlink) { - err = -ENOENT; - goto out_noent; - } - host->i_ctime = current_time(host); host_ui->xattr_cnt -= 1; host_ui->xattr_size -= CALC_DENT_SIZE(fname_len(nm)); @@ -521,7 +501,6 @@ out_cancel: host_ui->xattr_size += CALC_DENT_SIZE(fname_len(nm)); host_ui->xattr_size += CALC_XATTR_BYTES(ui->data_len); host_ui->xattr_names += fname_len(nm); -out_noent: mutex_unlock(&host_ui->ui_mutex); ubifs_release_budget(c, &req); make_bad_inode(inode); @@ -561,9 +540,6 @@ static int ubifs_xattr_remove(struct ino ubifs_assert(inode_is_locked(host)); - if (!host->i_nlink) - return -ENOENT; - if (fname_len(&nm) > UBIFS_MAX_NLEN) return -ENAMETOOLONG;