[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [V9 PATCH 13/13] virtio-9p: Chroot environment for othe
From: |
M. Mohan Kumar |
Subject: |
[Qemu-devel] Re: [V9 PATCH 13/13] virtio-9p: Chroot environment for other functions |
Date: |
Tue, 29 Mar 2011 11:25:05 +0530 |
User-agent: |
KMail/1.13.6 (Linux/2.6.35.11-83.fc14.i686.PAE; KDE/4.5.5; i686; ; ) |
Thanks Stefan. I will send next version with incorporating your suggestions.
> dpath is leaked in the success case. I suggest writing the function like
> this: static int get_dirfd(FsContext *fs_ctx, const char *path)
> {
> int fd;
> char *dpath;
> char *last_component;
>
> /* path can not contain ".." */
> last_component = strrchr(path, '/');
> if (last_component && !strcmp(last_component, "/..")) {
> error_report("9p path request contains \"..\": %s\n", path);
> errno = EFAULT;
> return -1;
> }
> dpath = qemu_strdup(path);
> fd = passthrough_request(fs_ctx, NULL, dirname(dpath), 0, NULL,
> T_OPEN); qemu_free(dpath);
> if (fd < 0) {
> errno = -fd;
> fd = -1;
> }
> return fd;
> }
Ok, I will rewrite the function as you mentioned.
>
> > -static int local_utimensat(FsContext *s, const char *path,
> > - const struct timespec *buf)
> > +static int local_utimensat(FsContext *fs_ctx, const char *path,
> > + const struct timespec *buf)
> >
> > {
> >
> > - return qemu_utimensat(AT_FDCWD, rpath(s, path), buf,
> > AT_SYMLINK_NOFOLLOW); + if (fs_ctx->fs_sm == SM_PASSTHROUGH) {
> > + int fd, retval;
> > + fd = passthrough_request(fs_ctx, NULL, path,
> > + O_RDONLY | O_NONBLOCK | O_NOFOLLOW, NULL,
> > T_OPEN); + if (fd < 0) {
> > + errno = -fd;
> > + return -1;
> > + }
> > + retval = futimens(fd, buf);
> > + close(fd);
> > + return retval;
>
> errno is clobbered here.
I will fix it.
----
M. Mohan Kumar
- [Qemu-devel] [V9 PATCH 00/13] virtio-9p: Use chroot to safely access files in passthrough security model, M. Mohan Kumar, 2011/03/17
- [Qemu-devel] [V9 PATCH 10/13] virtio-9p: Move file post creation changes to none security model, M. Mohan Kumar, 2011/03/17
- [Qemu-devel] [V9 PATCH 08/13] virtio-9p: Add support for removing file or directory, M. Mohan Kumar, 2011/03/17
- [Qemu-devel] [V9 PATCH 11/13] virtio-9p: Add support for chmod, M. Mohan Kumar, 2011/03/17
- [Qemu-devel] [V9 PATCH 03/13] virtio-9p: Provide chroot worker side interfaces, M. Mohan Kumar, 2011/03/17
- [Qemu-devel] [V9 PATCH 13/13] virtio-9p: Chroot environment for other functions, M. Mohan Kumar, 2011/03/17
- [Qemu-devel] [V9 PATCH 12/13] virtio-9p: Add support for chown, M. Mohan Kumar, 2011/03/17
- [Qemu-devel] [V9 PATCH 05/13] virtio-9p: Add support to open a file in chroot environment, M. Mohan Kumar, 2011/03/17
- [Qemu-devel] [V9 PATCH 04/13] virtio-9p: Add qemu side interfaces for chroot environment, M. Mohan Kumar, 2011/03/17
- [Qemu-devel] [V9 PATCH 01/13] Implement qemu_read_full, M. Mohan Kumar, 2011/03/17
- [Qemu-devel] [V9 PATCH 09/13] virtio-9p: Add support to rename, M. Mohan Kumar, 2011/03/17
- [Qemu-devel] [V9 PATCH 06/13] virtio-9p: Create support in chroot environment, M. Mohan Kumar, 2011/03/17
- [Qemu-devel] [V9 PATCH 02/13] virtio-9p: Enable CONFIG_THREAD if CONFIG_VIRTFS is enabled, M. Mohan Kumar, 2011/03/17
- [Qemu-devel] [V9 PATCH 07/13] virtio-9p: Support for creating special files, M. Mohan Kumar, 2011/03/17