]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
[RC Fix] Fix bug 548177.
authorVMware, Inc <>
Mon, 26 Apr 2010 18:31:16 +0000 (11:31 -0700)
committerMarcelo Vanzin <mvanzin@vmware.com>
Tue, 27 Apr 2010 03:48:55 +0000 (20:48 -0700)
When user deletes a share on the host, nautilus (ubuntu file manager)
does not like us sending -EIO on a share. We detect this error and map
it to success and create minimal fake attributes.

In future we this client will this mask new error codes that we add to
the server as well, which is sad.

Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/modules/linux/vmhgfs/dir.c
open-vm-tools/modules/linux/vmhgfs/fsutil.c

index c94c9518fbc7f5b141b295d7bcd71f3d47f8b35d..a4cdd916a2a2a66d32587ea65d7fd696eddd80ee 100644 (file)
@@ -1007,7 +1007,11 @@ HgfsReaddir(struct file *file, // IN:  Directory to read from
           * but if the driver ever goes in the host it's probably not
           * a good idea for an attacker to be able to hang the host
           * simply by using a bogus file type in a reply. [bac]
-          */
+         *
+         * Well it happens! Refer bug 548177 for details. In short,
+         * when the user deletes a share, we hit this code path.
+         *
+         */
          d_type = DT_UNKNOWN;
          break;
       }
index c9b01c833e5a291f61a2efa83edb377b10638959..e791df78de31e8b302b8d131b271424751e7de52 100644 (file)
@@ -773,6 +773,24 @@ HgfsPrivateGetattr(struct dentry *dentry,  // IN: Dentry containing name
       case 0:
          result = HgfsUnpackGetattrReply(req, attr, fileName);
          break;
+
+      case -EIO:
+        /*
+         * Fix for bug 548177.
+         * When user deletes a share, we still show that share during directory
+         * enumeration to minimize user's surprise. Now when we get getattr on
+         * that share server returns EIO. Linux file manager doesn't like this,
+         * and it doesn't display any valid shares too. So as a workaround, we
+         * remap EIO to success and create minimal fake attributes.
+         */
+         LOG(1, (KERN_DEBUG "Hgfs:Server returned EIO on unknown file\n"));
+         /* Create fake attributes */
+         attr->mask = HGFS_ATTR_VALID_TYPE | HGFS_ATTR_VALID_SIZE;
+         attr->type = HGFS_FILE_TYPE_DIRECTORY;
+         attr->size = 0;
+         result = 0;
+         break;
+
       case -EBADF:
          /*
           * This can happen if we attempted a getattr by handle and the handle