From nobody Tue Dec 2 02:49:44 2025 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B4DD2377E8A for ; Tue, 18 Nov 2025 16:09:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763482155; cv=none; b=G/XJ4Odpg69TyTN/tUkEuXGTwH75tCSfj1yLk64iTDECDAqURO2kb0QTYPzQhtZXSw5j7UrYWQBFMMFLlVrIs/JIwKqflrwf7ytOnmXhKNGLzruoIp9petxp4itnpwKWTYjl/mi+vW6XO0L2eSN31HLTUb3cbphQPpS5cGIrTbM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763482155; c=relaxed/simple; bh=9oUVPZXb839YHlhJsKwAl4wHIictHBrmkJfSVFYDhYA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DAP+RswnjKJvuPgdIBPAsb5iNKYv+02q7T4kAaBI9CIk0au1QRZ/mxAtAWkUpp9OrMo0V3IfYxPrQptvTd/Gc0wgcWtnmtDPM0OqX/cqeJcfJDH0XHdqg3BCZATO+VrB//gDcwBknNFUr3uMm3sBqHkLwKflVG70clhhlfVH98Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 23E041FF8C; Tue, 18 Nov 2025 16:08:54 +0000 (UTC) Authentication-Results: smtp-out2.suse.de; none Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 0EE3A3EA61; Tue, 18 Nov 2025 16:08:54 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id MPAYAxaaHGlnYQAAD6G6ig (envelope-from ); Tue, 18 Nov 2025 16:08:54 +0000 From: Daniel Vacek To: Chris Mason , Josef Bacik , David Sterba Cc: Daniel Vacek , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 4/6] btrfs: don't rewrite ret from inode_permission Date: Tue, 18 Nov 2025 17:08:41 +0100 Message-ID: <20251118160845.3006733-5-neelx@suse.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251118160845.3006733-1-neelx@suse.com> References: <20251118160845.3006733-1-neelx@suse.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spam-Level: X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[] X-Rspamd-Queue-Id: 23E041FF8C X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Action: no action X-Spam-Flag: NO X-Spam-Score: -4.00 Content-Type: text/plain; charset="utf-8" From: Josef Bacik In our user safe ino resolve ioctl we'll just turn any ret into -EACCES from inode_permission. This is redundant, and could potentially be wrong if we had an ENOMEM in the security layer or some such other error, so simply return the actual return value. Signed-off-by: Josef Bacik Reviewed-by: Johannes Thumshirn --- fs/btrfs/ioctl.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 1920caf8d308..c2d992f5ce7d 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -1910,10 +1910,8 @@ static int btrfs_search_path_in_tree_user(struct mnt= _idmap *idmap, ret =3D inode_permission(idmap, &temp_inode->vfs_inode, MAY_READ | MAY_EXEC); iput(&temp_inode->vfs_inode); - if (ret) { - ret =3D -EACCES; + if (ret) goto out_put; - } =20 if (key.offset =3D=3D upper_limit) break; --=20 2.51.0