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; }