Commit c34bc10d authored by Christoph Hellwig's avatar Christoph Hellwig Committed by David S. Miller

netfilter: remove the compat argument to xt_copy_counters_from_user

Lift the in_compat_syscall() from the callers instead.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 77d4df41
...@@ -302,7 +302,7 @@ int xt_data_to_user(void __user *dst, const void *src, ...@@ -302,7 +302,7 @@ int xt_data_to_user(void __user *dst, const void *src,
int usersize, int size, int aligned_size); int usersize, int size, int aligned_size);
void *xt_copy_counters_from_user(const void __user *user, unsigned int len, void *xt_copy_counters_from_user(const void __user *user, unsigned int len,
struct xt_counters_info *info, bool compat); struct xt_counters_info *info);
struct xt_counters *xt_counters_alloc(unsigned int counters); struct xt_counters *xt_counters_alloc(unsigned int counters);
struct xt_table *xt_register_table(struct net *net, struct xt_table *xt_register_table(struct net *net,
......
...@@ -1008,8 +1008,7 @@ static int do_add_counters(struct net *net, const void __user *user, ...@@ -1008,8 +1008,7 @@ static int do_add_counters(struct net *net, const void __user *user,
struct arpt_entry *iter; struct arpt_entry *iter;
unsigned int addend; unsigned int addend;
paddc = xt_copy_counters_from_user(user, len, &tmp, paddc = xt_copy_counters_from_user(user, len, &tmp);
in_compat_syscall());
if (IS_ERR(paddc)) if (IS_ERR(paddc))
return PTR_ERR(paddc); return PTR_ERR(paddc);
......
...@@ -1163,8 +1163,7 @@ do_add_counters(struct net *net, const void __user *user, ...@@ -1163,8 +1163,7 @@ do_add_counters(struct net *net, const void __user *user,
struct ipt_entry *iter; struct ipt_entry *iter;
unsigned int addend; unsigned int addend;
paddc = xt_copy_counters_from_user(user, len, &tmp, paddc = xt_copy_counters_from_user(user, len, &tmp);
in_compat_syscall());
if (IS_ERR(paddc)) if (IS_ERR(paddc))
return PTR_ERR(paddc); return PTR_ERR(paddc);
......
...@@ -1179,8 +1179,7 @@ do_add_counters(struct net *net, const void __user *user, unsigned int len) ...@@ -1179,8 +1179,7 @@ do_add_counters(struct net *net, const void __user *user, unsigned int len)
struct ip6t_entry *iter; struct ip6t_entry *iter;
unsigned int addend; unsigned int addend;
paddc = xt_copy_counters_from_user(user, len, &tmp, paddc = xt_copy_counters_from_user(user, len, &tmp);
in_compat_syscall());
if (IS_ERR(paddc)) if (IS_ERR(paddc))
return PTR_ERR(paddc); return PTR_ERR(paddc);
t = xt_find_table_lock(net, AF_INET6, tmp.name); t = xt_find_table_lock(net, AF_INET6, tmp.name);
......
...@@ -1033,15 +1033,14 @@ EXPORT_SYMBOL_GPL(xt_check_target); ...@@ -1033,15 +1033,14 @@ EXPORT_SYMBOL_GPL(xt_check_target);
* @user: src pointer to userspace memory * @user: src pointer to userspace memory
* @len: alleged size of userspace memory * @len: alleged size of userspace memory
* @info: where to store the xt_counters_info metadata * @info: where to store the xt_counters_info metadata
* @compat: true if we setsockopt call is done by 32bit task on 64bit kernel
* *
* Copies counter meta data from @user and stores it in @info. * Copies counter meta data from @user and stores it in @info.
* *
* vmallocs memory to hold the counters, then copies the counter data * vmallocs memory to hold the counters, then copies the counter data
* from @user to the new memory and returns a pointer to it. * from @user to the new memory and returns a pointer to it.
* *
* If @compat is true, @info gets converted automatically to the 64bit * If called from a compat syscall, @info gets converted automatically to the
* representation. * 64bit representation.
* *
* The metadata associated with the counters is stored in @info. * The metadata associated with the counters is stored in @info.
* *
...@@ -1049,13 +1048,13 @@ EXPORT_SYMBOL_GPL(xt_check_target); ...@@ -1049,13 +1048,13 @@ EXPORT_SYMBOL_GPL(xt_check_target);
* If IS_ERR is false, caller has to vfree the pointer. * If IS_ERR is false, caller has to vfree the pointer.
*/ */
void *xt_copy_counters_from_user(const void __user *user, unsigned int len, void *xt_copy_counters_from_user(const void __user *user, unsigned int len,
struct xt_counters_info *info, bool compat) struct xt_counters_info *info)
{ {
void *mem; void *mem;
u64 size; u64 size;
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
if (compat) { if (in_compat_syscall()) {
/* structures only differ in size due to alignment */ /* structures only differ in size due to alignment */
struct compat_xt_counters_info compat_tmp; struct compat_xt_counters_info compat_tmp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment