This helper is needed for next patch

https://jira.sw.ru/browse/PSBM-133996
Signed-off-by: Andrey Zhadchenko <andrey.zhadche...@virtuozzo.com>
---
 include/linux/sockptr.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/include/linux/sockptr.h b/include/linux/sockptr.h
index ea19341..3538721 100644
--- a/include/linux/sockptr.h
+++ b/include/linux/sockptr.h
@@ -10,6 +10,7 @@
 
 #include <linux/slab.h>
 #include <linux/uaccess.h>
+#include <linux/mm.h>
 
 typedef struct {
        union {
@@ -77,6 +78,19 @@ static inline void *memdup_sockptr(sockptr_t src, size_t len)
        return p;
 }
 
+static inline void *vmemdup_sockptr(sockptr_t src, size_t len)
+{
+       void *p = kvmalloc(len, GFP_USER);
+
+       if (!p)
+               return ERR_PTR(-ENOMEM);
+       if (copy_from_sockptr(p, src, len)) {
+               kvfree(p);
+               return ERR_PTR(-EFAULT);
+       }
+       return p;
+}
+
 static inline void *memdup_sockptr_nul(sockptr_t src, size_t len)
 {
        char *p = kmalloc_track_caller(len + 1, GFP_KERNEL);
-- 
1.8.3.1

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to