* [PATCH] btrfs-progs: subv del: hide a bogus warning on an unprivileged delete
@ 2022-01-24 13:36 Adam Borowski
2022-02-01 17:19 ` David Sterba
0 siblings, 1 reply; 2+ messages in thread
From: Adam Borowski @ 2022-01-24 13:36 UTC (permalink / raw)
To: linux-btrfs; +Cc: Adam Borowski
Checking the default subvolume uses TREE_SEARCH which is a CAP_SYS_ADMIN
only operation, and thus will fail when unprivileged, even if we have
permissions to actually delete the subvolume.
This produces a warning even if all is ok. Let's hide it if we're not
root (root but !CAP is odd enough to warn).
Fixes 87804a3f0663a4d1891395bd97b8e81e6f183e66
Ref: https://bugs.debian.org/998840
Signed-off-by: Adam Borowski <kilobyte@angband.pl>
---
cmds/subvolume.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/cmds/subvolume.c b/cmds/subvolume.c
index 6aac7dd1..e767e20d 100644
--- a/cmds/subvolume.c
+++ b/cmds/subvolume.c
@@ -376,7 +376,8 @@ again:
err = btrfs_util_get_default_subvolume_fd(fd, &default_subvol_id);
if (err) {
- warning("cannot read default subvolume id: %m");
+ if (!geteuid())
+ warning("cannot read default subvolume id: %m");
default_subvol_id = 0;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] btrfs-progs: subv del: hide a bogus warning on an unprivileged delete
2022-01-24 13:36 [PATCH] btrfs-progs: subv del: hide a bogus warning on an unprivileged delete Adam Borowski
@ 2022-02-01 17:19 ` David Sterba
0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2022-02-01 17:19 UTC (permalink / raw)
To: Adam Borowski; +Cc: linux-btrfs
On Mon, Jan 24, 2022 at 02:36:32PM +0100, Adam Borowski wrote:
> Checking the default subvolume uses TREE_SEARCH which is a CAP_SYS_ADMIN
> only operation, and thus will fail when unprivileged, even if we have
> permissions to actually delete the subvolume.
>
> This produces a warning even if all is ok. Let's hide it if we're not
> root (root but !CAP is odd enough to warn).
>
> Fixes 87804a3f0663a4d1891395bd97b8e81e6f183e66
> Ref: https://bugs.debian.org/998840
> Signed-off-by: Adam Borowski <kilobyte@angband.pl>
Thanks, added to devel, that covers the part when the search fails. It
could also fail when the default subvolume is not set so I might add a
separate check for that.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-02-01 17:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-24 13:36 [PATCH] btrfs-progs: subv del: hide a bogus warning on an unprivileged delete Adam Borowski
2022-02-01 17:19 ` David Sterba
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.