Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp1680841rdb; Sat, 3 Feb 2024 18:18:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IE3Ik2qac1U12KZSMOepevHFlznsJy5FdI1LG4i18LJkxiPGoAlQl1pVbaUG5rQrIbc1CVS X-Received: by 2002:a5d:64ce:0:b0:33b:180c:bded with SMTP id f14-20020a5d64ce000000b0033b180cbdedmr6425004wri.14.1707013128050; Sat, 03 Feb 2024 18:18:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707013128; cv=pass; d=google.com; s=arc-20160816; b=mXeuvVZpv1tmgteWzSbp6TrhOjlCbvecRJFM6HxP5x1+XkeZc7l4eigw9RNRYR8P4x 3ddyt8Nbyq79goPkHchvq5nv+TY8kiENufwCZilA54iE/cLTrPoiCupnQP5txMyOZBhy TpnZEK0SPfIyhaTLv3Runwk2byG0ui8xdB12aMYyyYHawO5piDuaAPCYcco9FyhMFKex qoWnhhc8BfM+/T3rxP9D2lawcbL2j0K4ljjafBvmFo1UKbf36oTFzLvDBBM+CEVd8/Mz mZQ9CHediSS2+WtpB4JM9OubCi5REFhyAZWcBF9Huh2ZgpBFuk1g5o8Xd5DoAd99l4Rj bgLQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=cuFhGgNbk5LHRay7zOGcHPlnB60egP7ycJDnEl7eO64=; fh=nhN3QDohveHDSxASQULSzlDb5U+5t34+xjW/xCa7gd0=; b=OOGW2sqscqVecRpNZWRSEBxGou+nd9jjrixsW/p2FFuMpWIZTPc5AsySiLZkNqyaY+ SwZKJ6an20ksvt9dNULXGY1k3nap71FAWBxtclGahtgH6GX0YDNYeHNrns56i8NcMTqV vrB+vF5T/goiAcOtCT+ulTe8QlNcEJyJYaZwAFPsHEIwUxElBfP0kBlPH/9Hg49zxq8u XygAbmGNB2VrSgneOclWrLHNI0U3NjmIQ/wzsT1oyqYMovG8qRpO7LLlrPxwzRrUPj0W nEmOFD1V5sRObLI4tjM1TA4zNibsSRptsiptMMRQQr9UndBVNqKMTT7zskCAWvzrGQbu 5ZxQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b="F/db2XFg"; arc=pass (i=1 dkim=pass dkdomain=linux.org.uk dmarc=pass fromdomain=zeniv.linux.org.uk); spf=pass (google.com: domain of linux-nfs+bounces-1744-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-nfs+bounces-1744-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk X-Forwarded-Encrypted: i=1; AJvYcCVDTGjhrwQ2+GDl9VHxidxrPBt8y81PIOc3sfrLy/ecArGhQe+afAFxuLKZbmCtXG4Pfl3Rg9rW2iTjC5N4Rk2uo4zf+zZN6ZVto1BQFQ== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id z1-20020a05640240c100b0056026abbbfasi961197edb.12.2024.02.03.18.18.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 18:18:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs+bounces-1744-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b="F/db2XFg"; arc=pass (i=1 dkim=pass dkdomain=linux.org.uk dmarc=pass fromdomain=zeniv.linux.org.uk); spf=pass (google.com: domain of linux-nfs+bounces-1744-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-nfs+bounces-1744-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C52D61F24770 for ; Sun, 4 Feb 2024 02:18:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 64566BA29; Sun, 4 Feb 2024 02:17:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="F/db2XFg" X-Original-To: linux-nfs@vger.kernel.org Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 85D5D79C1; Sun, 4 Feb 2024 02:17:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707013065; cv=none; b=Vwy8ZQeN1QY14/mF2ln1O8QkCnThr/dIpuSg/bbTTXf9aFnUhxIJ2Wccvl/HoqS73dkJOgtfHG3s2fOQLGfQjRy+eXsgworGdl1ZpfkT0ab0cbQR2XXmfpAb0L83Ta8AqtoPAWDTzOO52o+4zKBBXB3UL0w62SZP8geZzPsK4TY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707013065; c=relaxed/simple; bh=y54nHQkPOl359AVYAtuuO+KK5TXGw8vABwwc1x2IPbk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=bQ7u+0tChuGfKcMt0a1YLRZXkQd2YGRj+MVNiV6iJXLiKWdi8nzMbnKSU9lXqS68M6qYbuvl0BQGQ5vCggkvUs2YjvjDZd8+YWIFWlHk+SkA6QiZyWnU29qNmr287ySGizaG2nt6LrbxAwWvVZmRzFitxB1kMquZTs4gqjz3Qwk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=F/db2XFg; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=cuFhGgNbk5LHRay7zOGcHPlnB60egP7ycJDnEl7eO64=; b=F/db2XFgUPBdiv/ecH+HGw4r7+ jHgTBCznaicUuHEoLs0TjVoyi0YO4LRxQjgMlEcDleaiOCi/JbMKLglgJ8fC96Hh3AVrcOUKLPVoW x3pBPoK+WdflalrUN5AgC7OkMjQqEZmNkZfe21v0PH06RNlJ0LJFtNEtPYp1VnbMplhdRvZlVQEiW D0gkE9Tsc7Whe7xRXjuEDKgjhsZubJCyjOhHUpllu0uF8IV7J/5cSEFa1ia2K5HyjOlDBg4E5KWv7 dVP0/l1+1X1J/XHhT5P2a2p1t4CjzcyMsIrf3fUGxjRhTw8LlhGtnA/t45qG2L6BhyN4KKLvd35Kw gbmINdHA==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1rWS4j-004rDo-3C; Sun, 04 Feb 2024 02:17:42 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Linus Torvalds , Christian Brauner , linux-ext4@vger.kernel.org, linux-nfs@vger.kernel.org, Miklos Szeredi , linux-cifs@vger.kernel.org Subject: [PATCH 13/13] ext4_get_link(): fix breakage in RCU mode Date: Sun, 4 Feb 2024 02:17:39 +0000 Message-Id: <20240204021739.1157830-13-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240204021739.1157830-1-viro@zeniv.linux.org.uk> References: <20240204021436.GH2087318@ZenIV> <20240204021739.1157830-1-viro@zeniv.linux.org.uk> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Al Viro 1) errors from ext4_getblk() should not be propagated to caller unless we are really sure that we would've gotten the same error in non-RCU pathwalk. 2) we leak buffer_heads if ext4_getblk() is successful, but bh is not uptodate. Signed-off-by: Al Viro --- fs/ext4/symlink.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fs/ext4/symlink.c b/fs/ext4/symlink.c index 75bf1f88843c..645240cc0229 100644 --- a/fs/ext4/symlink.c +++ b/fs/ext4/symlink.c @@ -92,10 +92,12 @@ static const char *ext4_get_link(struct dentry *dentry, struct inode *inode, if (!dentry) { bh = ext4_getblk(NULL, inode, 0, EXT4_GET_BLOCKS_CACHED_NOWAIT); - if (IS_ERR(bh)) - return ERR_CAST(bh); - if (!bh || !ext4_buffer_uptodate(bh)) + if (IS_ERR(bh) || !bh) return ERR_PTR(-ECHILD); + if (!ext4_buffer_uptodate(bh)) { + brelse(bh); + return ERR_PTR(-ECHILD); + } } else { bh = ext4_bread(NULL, inode, 0, 0); if (IS_ERR(bh)) -- 2.39.2