Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1780224imm; Thu, 27 Sep 2018 02:20:51 -0700 (PDT) X-Google-Smtp-Source: ACcGV61TCq2Y143IvMSBrmFPZQGMfnuMA6N5xBLItC6Dsi0kV8crGe0Cd0FuJv6F7/jRZp7miV+K X-Received: by 2002:a63:4907:: with SMTP id w7-v6mr9268943pga.123.1538040051754; Thu, 27 Sep 2018 02:20:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538040051; cv=none; d=google.com; s=arc-20160816; b=TPBOsexy42iy71OtCbfqu0yLN7/uXdbMNeVcTdcXhoTN9V3SBmtVx8+IvwBgtsk+QX KrlacIr/Q4R9Ouin6jXaZzLtHqfCyCW1CYcMHFpPbCSuHtg98BifkztnGfBep/Zp0KF6 gRP4qBfHii6B3E2B0vKygVcOJpJ6+vX6v/KsXZeQZTns3Y2Pob1Z1kpJTJ3jNkiMFCtb btT+kGBj1v5FQARwMQaWYDmH0WE36i6aa5E1caHrdb3ivJEbfOYBbpmrxjjTPDvFq/kl N49vQzAHGFN/+X30O9bQy+ZsrZfQ7xhSuhw9qC3QLPNOecX2L84y6Dmc1jwwI5NPZb86 2QPw== 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=ssrRD0SIWh3tUtCs+qkAuXSHdq4YXef0LcQWE24ZJv4=; b=bPStpSM6M5fA3/5G4HfXGrr5LdGolg/EBSDl7ldySJ/MthwbDKQd6iTxBDFtEc8zoR uBTRraLTLtOAWsWz0svxBG6BZJl6udWogJ22dEUZWI/jarx5usZdLAUccaejHzAbJNYP DSW6WKg54qxKiDN5rhsMEIQolD1JMD5/2yc7yqgdOno5qapfThDAS4qIz8dmt7XXxAVu 1jwtkbQ+fFJ9yHi89FiZMdKaBjB3UVF2GETUvbDiJUG7Ot4junfYtEg4VvNRvv9HhxvW zUb9CuI3/5J58qkVeUxB3FPpI0Vm/y1RzrzMjeHgi8brjuNiOZhKfGgfz5bPANi/gg7z d0WQ== 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 c5-v6si1359879pgw.343.2018.09.27.02.20.36; Thu, 27 Sep 2018 02:20: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 S1728815AbeI0PhP (ORCPT + 99 others); Thu, 27 Sep 2018 11:37:15 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:56266 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727439AbeI0PhP (ORCPT ); Thu, 27 Sep 2018 11:37:15 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 8717C110D; Thu, 27 Sep 2018 09:19:55 +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.14 39/64] Revert "ubifs: xattr: Dont operate on deleted inodes" Date: Thu, 27 Sep 2018 11:03:56 +0200 Message-Id: <20180927090255.591958407@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180927090249.801943776@linuxfoundation.org> References: <20180927090249.801943776@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.14-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)); @@ -189,7 +183,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); @@ -241,12 +234,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); @@ -268,7 +255,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: @@ -497,12 +483,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)); @@ -522,7 +502,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); @@ -562,9 +541,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;