aboutsummaryrefslogtreecommitdiffstats
path: root/main/open-vm-tools-grsec/0004-Use-new-link-helpers.patch
blob: a60fa6faedc0605ea895d608c7c3c24e8ab73c84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
From 20437d731289126ee5363a6f73e4171d39f2e3d9 Mon Sep 17 00:00:00 2001
From: "Scott M. Kroll" <skroll@gmail.com>
Date: Mon, 14 Jul 2014 11:32:35 -0400
Subject: [PATCH 4/5] Use new link helpers

* vfs_follow_link was removed in 3.12.
* vfs_readlink was removed in 3.15.
---
 open-vm-tools/modules/linux/vmhgfs/link.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/open-vm-tools/modules/linux/vmhgfs/link.c b/open-vm-tools/modules/linux/vmhgfs/link.c
index 9fb95a5..06ea953 100644
--- a/modules/linux/vmhgfs/link.c
+++ b/modules/linux/vmhgfs/link.c
@@ -110,9 +110,15 @@ HgfsFollowlink(struct dentry *dentry, // IN: Dentry containing link
                  "on something that wasn't a symlink\n"));
          error = -EINVAL;
       } else {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0)
+         LOG(6, (KERN_DEBUG "VMware hgfs: HgfsFollowlink: calling "
+                 "nd_set_link\n"));
+         nd_set_link(nd, fileName);
+#else
          LOG(6, (KERN_DEBUG "VMware hgfs: HgfsFollowlink: calling "
                  "vfs_follow_link\n"));
          error = vfs_follow_link(nd, fileName);
+#endif
       }
       kfree(fileName);
    }
@@ -172,9 +178,18 @@ HgfsReadlink(struct dentry *dentry,  // IN:  Dentry containing link
                  "on something that wasn't a symlink\n"));
          error = -EINVAL;
       } else {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)
+         LOG(6, (KERN_DEBUG "VMware hgfs: HgfsReadlink: calling "
+                 "readlink_copy\n"));
+         LOG(6, (KERN_DEBUG "VMware hgfs: %s: calling "
+                 "readlink_copy\n",
+                 __func__));
+         error = readlink_copy(buffer, buflen, fileName);
+#else
          LOG(6, (KERN_DEBUG "VMware hgfs: HgfsReadlink: calling "
                  "vfs_readlink\n"));
          error = vfs_readlink(dentry, buffer, buflen, fileName);
+#endif
       }
       kfree(fileName);
    }
-- 
2.0.1