The commit is pushed to "branch-rh9-5.14.vz9.1.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git after ark-5.14 ------> commit 4c09d662b7a49971d24b030bf9305496902de408 Author: Andrey Zhadchenko <andrey.zhadche...@virtuozzo.com> Date: Thu Sep 30 16:03:51 2021 +0300
include/linux/sockptr: introduce vmemdup_sockptr helper 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 ea193414298b..3538721a348c 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); _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel