From: "Venkateswararao Jujjuri (JV)" <jvrao@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: aliguori@us.ibm.com,
"Venkateswararao Jujjuri (JV)" <jvrao@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH] Add a check for readlink in mapped mode.
Date: Wed, 22 Dec 2010 15:09:43 -0800 [thread overview]
Message-ID: <1293059383-9443-1-git-send-email-jvrao@linux.vnet.ibm.com> (raw)
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
---
hw/9pfs/virtio-9p-local.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/hw/9pfs/virtio-9p-local.c b/hw/9pfs/virtio-9p-local.c
index a8e7525..9a106d4 100644
--- a/hw/9pfs/virtio-9p-local.c
+++ b/hw/9pfs/virtio-9p-local.c
@@ -112,6 +112,13 @@ static ssize_t local_readlink(FsContext *fs_ctx, const char *path,
ssize_t tsize = -1;
if (fs_ctx->fs_sm == SM_MAPPED) {
int fd;
+ mode_t tmp_mode;
+ /* Make sure that it is a symlink */
+ if (getxattr(rpath(fs_ctx, path), "user.virtfs.mode", &tmp_mode,
+ sizeof(mode_t)) <= 0 || !(tmp_mode & S_IFLNK)) {
+ errno = EINVAL;
+ return -1;
+ }
fd = open(rpath(fs_ctx, path), O_RDONLY);
if (fd == -1) {
return -1;
--
1.6.5.2
next reply other threads:[~2010-12-22 22:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-22 23:09 Venkateswararao Jujjuri (JV) [this message]
2010-12-23 2:28 ` [Qemu-devel] [PATCH] Add a check for readlink in mapped mode Stefan Hajnoczi
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=1293059383-9443-1-git-send-email-jvrao@linux.vnet.ibm.com \
--to=jvrao@linux.vnet.ibm.com \
--cc=aliguori@us.ibm.com \
--cc=qemu-devel@nongnu.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).