Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5613876imu; Mon, 26 Nov 2018 03:01:56 -0800 (PST) X-Google-Smtp-Source: AFSGD/UL5KKX6f1ed8+ILljz5F6c2O5gvUzTFJZ5eiaX2p+KkPBozv5/IZm6CaMD2OcdG6fNH5pV X-Received: by 2002:a17:902:66e5:: with SMTP id e92-v6mr26632718plk.92.1543230116205; Mon, 26 Nov 2018 03:01:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543230116; cv=none; d=google.com; s=arc-20160816; b=YfYbnthMLg6BUvzBZYluPYhi+iEAK71X2TkWl/tAwz2D03llqjR0tVA81PxiCE9bjp 6CkpQPTn8cC+9BJ+x6cMNDqkLsQUfHchlV2GXGxPJh4fWNGh9c99y6L8HbV7SW4R4Uqy 1et3KL1yYQuWRCl+Px5P55rPS+uEXXDmCS/Tb9qBAV9WhaqhJ83Y8BNIzi/lbhG9XTQn rGoyxp8m/e/ew1mY5QNSMUE7FcxKPGi6jskgp0VGlq32qtgf8biirT6sPcfVYWj+zA+H uNYG4QJBaOr8URojtJ3arh0IMGcD0OLAjmHz/K198DJ4UUMxe+8IPPRV2dqD3ueZrPDK Yqhw== 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:dkim-signature; bh=Hltj7olSWPUQtMmoZBcp8WsuzBEvo7siuS+Qe5k0pd4=; b=a+QtIMdB8D63V99K3OBM+KG3mXsmKugTkof8F9qX6zdvvcOkSpgWdTWrY8g+Bi856g DRhE6uGvIAJ+I37p5+XNu3cV+9svMJunMykv0zDwS/Rr1W6SgEOsZe/XHN53Et66gjRa T8vpM9IFfe6uH6k6ZyzdLG3pAsU4WwsT6V1VqzGGSm5Efe48SY2UVT0YOT2Zb729KdHh 55IxMs9d9/08yiiK8FZHaWnFTx0Z6dKK1qQ+1bMa2jDP8fDE/AzXpb9ibJuKMIsNFrz3 koGpXOdfdcPKuaiSOJIaXCVHx8Wy1p8spuhlZyT7mRA94sDRoP0ViiArBhxe9Jz2OT0H 8NJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ElAVS+H4; 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 15-v6si12861128pfr.242.2018.11.26.03.01.33; Mon, 26 Nov 2018 03:01:56 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=ElAVS+H4; 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 S1729747AbeKZVxw (ORCPT + 99 others); Mon, 26 Nov 2018 16:53:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:35688 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728553AbeKZVxv (ORCPT ); Mon, 26 Nov 2018 16:53:51 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B074220817; Mon, 26 Nov 2018 11:00:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543230006; bh=fpTD0ysJEdVeiWXbAEL48UcURfs08lQawS/r4j+qfQg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ElAVS+H4g+mcQgo5WtBWLZyQUmDLc6vP9pxv9Czw9TlYpNKlsecJ7qBxZ1EEZLE/t WwzkMecWr8Kic6mQnNoJWmNO05Dyk3mr0y0mnMTuXWg7rv5/nrl1bKkV/CUdEd0man sDr4u0o/H95JMRu4Yt+Lt4u9gqxaMeSHfn8KBdZU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jann Horn , Andrew Morton , Jeff Mahoney , Eric Biggers , Al Viro , Linus Torvalds , Sasha Levin Subject: [PATCH 4.14 06/62] reiserfs: propagate errors from fill_with_dentries() properly Date: Mon, 26 Nov 2018 11:50:47 +0100 Message-Id: <20181126105051.497519036@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181126105050.592727680@linuxfoundation.org> References: <20181126105050.592727680@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. ------------------ [ Upstream commit b10298d56c9623f9b173f19959732d3184b35f4f ] fill_with_dentries() failed to propagate errors up to reiserfs_for_each_xattr() properly. Plumb them through. Note that reiserfs_for_each_xattr() is only used by reiserfs_delete_xattrs() and reiserfs_chown_xattrs(). The result of reiserfs_delete_xattrs() is discarded anyway, the only difference there is whether a warning is printed to dmesg. The result of reiserfs_chown_xattrs() does matter because it can block chowning of the file to which the xattrs belong; but either way, the resulting state can have misaligned ownership, so my patch doesn't improve things greatly. Credit for making me look at this code goes to Al Viro, who pointed out that the ->actor calling convention is suboptimal and should be changed. Link: http://lkml.kernel.org/r/20180802163335.83312-1-jannh@google.com Signed-off-by: Jann Horn Reviewed-by: Andrew Morton Cc: Jeff Mahoney Cc: Eric Biggers Cc: Al Viro Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- fs/reiserfs/xattr.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c index 505f87a8c724..83423192588c 100644 --- a/fs/reiserfs/xattr.c +++ b/fs/reiserfs/xattr.c @@ -185,6 +185,7 @@ struct reiserfs_dentry_buf { struct dir_context ctx; struct dentry *xadir; int count; + int err; struct dentry *dentries[8]; }; @@ -207,6 +208,7 @@ fill_with_dentries(struct dir_context *ctx, const char *name, int namelen, dentry = lookup_one_len(name, dbuf->xadir, namelen); if (IS_ERR(dentry)) { + dbuf->err = PTR_ERR(dentry); return PTR_ERR(dentry); } else if (d_really_is_negative(dentry)) { /* A directory entry exists, but no file? */ @@ -215,6 +217,7 @@ fill_with_dentries(struct dir_context *ctx, const char *name, int namelen, "not found for file %pd.\n", dentry, dbuf->xadir); dput(dentry); + dbuf->err = -EIO; return -EIO; } @@ -262,6 +265,10 @@ static int reiserfs_for_each_xattr(struct inode *inode, err = reiserfs_readdir_inode(d_inode(dir), &buf.ctx); if (err) break; + if (buf.err) { + err = buf.err; + break; + } if (!buf.count) break; for (i = 0; !err && i < buf.count && buf.dentries[i]; i++) { -- 2.17.1