From: Jeremy Sowden Date: Mon, 31 Aug 2020 12:59:47 +0000 (+0200) Subject: xt_ACCOUNT: update prototype of nf_sockopt_ops::set callback X-Git-Tag: v3.11~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=48e30a0990f94d9e50a25e3e4bfed6c6e68aeb1f;p=thirdparty%2Fxtables-addons.git xt_ACCOUNT: update prototype of nf_sockopt_ops::set callback In 5.9, the `void __user` parameter has been replaced by a `sockptr`. Update `ipt_acc_set_ctl` appropriately. Signed-off-by: Jeremy Sowden --- diff --git a/extensions/ACCOUNT/xt_ACCOUNT.c b/extensions/ACCOUNT/xt_ACCOUNT.c index 019f5bd..18e0b8a 100644 --- a/extensions/ACCOUNT/xt_ACCOUNT.c +++ b/extensions/ACCOUNT/xt_ACCOUNT.c @@ -28,6 +28,9 @@ #include #include #include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0) +#include +#endif #include #include #include @@ -879,7 +882,12 @@ static int ipt_acc_handle_get_data(struct ipt_acc_net *ian, } static int ipt_acc_set_ctl(struct sock *sk, int cmd, - void *user, unsigned int len) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0) + void *user, +#else + sockptr_t arg, +#endif + unsigned int len) { struct net *net = sock_net(sk); struct ipt_acc_net *ian = net_generic(net, ipt_acc_net_id); @@ -898,7 +906,12 @@ static int ipt_acc_set_ctl(struct sock *sk, int cmd, break; } - if (copy_from_user(&handle, user, len)) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0) + if (copy_from_user(&handle, user, len)) +#else + if (copy_from_sockptr(&handle, arg, len)) +#endif + { printk("ACCOUNT: ipt_acc_set_ctl: copy_from_user failed for " "IPT_SO_SET_HANDLE_FREE\n"); break;