From: VMware, Inc <> Date: Mon, 26 Apr 2010 18:31:16 +0000 (-0700) Subject: [RC Fix] Fix bug 548177. X-Git-Tag: 2010.04.25-253928~12 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cf353e2cabc5b87a4c0a7efbbaf8b993f3551ba6;p=thirdparty%2Fopen-vm-tools.git [RC Fix] Fix bug 548177. 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 --- diff --git a/open-vm-tools/modules/linux/vmhgfs/dir.c b/open-vm-tools/modules/linux/vmhgfs/dir.c index c94c9518f..a4cdd916a 100644 --- a/open-vm-tools/modules/linux/vmhgfs/dir.c +++ b/open-vm-tools/modules/linux/vmhgfs/dir.c @@ -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; } diff --git a/open-vm-tools/modules/linux/vmhgfs/fsutil.c b/open-vm-tools/modules/linux/vmhgfs/fsutil.c index c9b01c833..e791df78d 100644 --- a/open-vm-tools/modules/linux/vmhgfs/fsutil.c +++ b/open-vm-tools/modules/linux/vmhgfs/fsutil.c @@ -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