From: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
To: linux-btrfs <linux-btrfs@vger.kernel.org>,
Qu Wenruo <quwenruo.btrfs@gmx.com>
Subject: [PATCH] btrfs-progs: mkfs rootdir: use lgetxattr() not to follow a symbolic link
Date: Mon, 2 Apr 2018 10:59:31 +0900 [thread overview]
Message-ID: <f53cc5d0-24ff-81b7-68db-0c615edf4936@jp.fujitsu.com> (raw)
mkfs-test 016 "rootdir-bad-symbolic-link" fails when selinux is enabled.
This is because add_xattr_item() uses getxattr() and tries to follow a
bad symbolic link for selinux item, which causes ENOENT error.
The line above already uses llistxattr() for getting list of xattr in
order not to follow a symbolic link, so just use lgetxattr() too.
Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com>
---
mkfs/rootdir.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mkfs/rootdir.c b/mkfs/rootdir.c
index 33c3ff1e..ff00bb0f 100644
--- a/mkfs/rootdir.c
+++ b/mkfs/rootdir.c
@@ -249,7 +249,7 @@ static int add_xattr_item(struct btrfs_trans_handle *trans,
cur_name_len = strlen(cur_name);
next_location += cur_name_len + 1;
- ret = getxattr(file_name, cur_name, cur_value, XATTR_SIZE_MAX);
+ ret = lgetxattr(file_name, cur_name, cur_value, XATTR_SIZE_MAX);
if (ret < 0) {
if (errno == ENOTSUP)
return 0;
--
2.14.3
next reply other threads:[~2018-04-02 2:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-02 1:59 Misono Tomohiro [this message]
2018-04-02 2:09 ` [PATCH] btrfs-progs: mkfs rootdir: use lgetxattr() not to follow a symbolic link Qu Wenruo
2018-04-06 12:59 ` David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f53cc5d0-24ff-81b7-68db-0c615edf4936@jp.fujitsu.com \
--to=misono.tomohiro@jp.fujitsu.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=quwenruo.btrfs@gmx.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.