* [Qemu-devel] [PATCH] Add a check for readlink in mapped mode.
@ 2010-12-22 23:09 Venkateswararao Jujjuri (JV)
2010-12-23 2:28 ` Stefan Hajnoczi
0 siblings, 1 reply; 2+ messages in thread
From: Venkateswararao Jujjuri (JV) @ 2010-12-22 23:09 UTC (permalink / raw)
To: qemu-devel; +Cc: aliguori, Venkateswararao Jujjuri (JV)
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-12-23 2:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-22 23:09 [Qemu-devel] [PATCH] Add a check for readlink in mapped mode Venkateswararao Jujjuri (JV)
2010-12-23 2:28 ` Stefan Hajnoczi
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).