forked from gentoo/gentoo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
308-3.10-02-control.patch
57 lines (49 loc) · 1.64 KB
/
308-3.10-02-control.patch
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
54
55
56
57
The API to create proc entries now takes the file ops structure directly, instead of being set after the fact
Using new __getname/__putname API
--- a/vmblock-only/linux/control.c 2015-02-07 03:11:55.000000000 +0300
+++ c/vmblock-only/linux/control.c 2015-02-24 03:58:06.038605919 +0300
@@ -208,9 +208,11 @@
VMBlockSetProcEntryOwner(controlProcMountpoint);
/* Create /proc/fs/vmblock/dev */
- controlProcEntry = create_proc_entry(VMBLOCK_CONTROL_DEVNAME,
- VMBLOCK_CONTROL_MODE,
- controlProcDirEntry);
+ controlProcEntry = proc_create(VMBLOCK_CONTROL_DEVNAME,
+ VMBLOCK_CONTROL_MODE,
+ controlProcDirEntry,
+ &ControlFileOps);
+
if (!controlProcEntry) {
Warning("SetupProcDevice: could not create " VMBLOCK_DEVICE "\n");
remove_proc_entry(VMBLOCK_CONTROL_MOUNTPOINT, controlProcDirEntry);
@@ -218,7 +220,10 @@
return -EINVAL;
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
controlProcEntry->proc_fops = &ControlFileOps;
+#endif
+
return 0;
}
@@ -287,18 +287,24 @@ ExecuteBlockOp(const char __user *buf,
int i;
int retval;
- name = getname(buf);
+ name = __getname();
if (IS_ERR(name)) {
return PTR_ERR(name);
}
+ i = strncpy_from_user(name, buf, PATH_MAX);
+ if (i < 0 || i == PATH_MAX) {
+ __putname(name);
+ return -EINVAL;
+ }
+
for (i = strlen(name) - 1; i >= 0 && name[i] == '/'; i--) {
name[i] = '\0';
}
retval = i < 0 ? -EINVAL : blockOp(name, blocker);
- putname(name);
+ __putname(name);
return retval;
}