Loading net/ipv4/netfilter/ip_tables.c +92 −89 Original line number Diff line number Diff line Loading @@ -600,8 +600,8 @@ check_entry(struct ipt_entry *e, const char *name) } static inline int check_match(struct ipt_entry_match *m, const char *name, const struct ipt_ip *ip, unsigned int hookmask, unsigned int *i) const struct ipt_ip *ip, unsigned int hookmask, unsigned int *i) { struct xt_match *match; int ret; Loading Loading @@ -663,8 +663,8 @@ static inline int check_target(struct ipt_entry *e, const char *name) name, e->comefrom, e->ip.proto, e->ip.invflags & IPT_INV_PROTO); if (!ret && t->u.kernel.target->checkentry && !t->u.kernel.target->checkentry(name, e, target, t->data, e->comefrom)) { && !t->u.kernel.target->checkentry(name, e, target, t->data, e->comefrom)) { duprintf("ip_tables: check failed for `%s'.\n", t->u.kernel.target->name); ret = -EINVAL; Loading Loading @@ -1020,7 +1020,7 @@ struct compat_delta { short delta; }; static struct compat_delta *compat_offsets = NULL; static struct compat_delta *compat_offsets; static int compat_add_offset(unsigned int offset, short delta) { Loading Loading @@ -1109,11 +1109,11 @@ static int compat_calc_entry(struct ipt_entry *e, return ret; for (i = 0; i < NF_INET_NUMHOOKS; i++) { if (info->hook_entry[i] && (e < (struct ipt_entry *) (base + info->hook_entry[i]))) if (info->hook_entry[i] && (e < (struct ipt_entry *)(base + info->hook_entry[i]))) newinfo->hook_entry[i] -= off; if (info->underflow[i] && (e < (struct ipt_entry *) (base + info->underflow[i]))) if (info->underflow[i] && (e < (struct ipt_entry *)(base + info->underflow[i]))) newinfo->underflow[i] -= off; } return 0; Loading @@ -1132,7 +1132,8 @@ static int compat_table_info(const struct xt_table_info *info, newinfo->initial_entries = 0; loc_cpu_entry = info->entries[raw_smp_processor_id()]; return IPT_ENTRY_ITERATE(loc_cpu_entry, info->size, compat_calc_entry, info, loc_cpu_entry, newinfo); compat_calc_entry, info, loc_cpu_entry, newinfo); } #endif Loading Loading @@ -1289,7 +1290,8 @@ __do_replace(const char *name, unsigned int valid_hooks, get_counters(oldinfo, counters); /* Decrease module usage counts and free resource */ loc_cpu_old_entry = oldinfo->entries[raw_smp_processor_id()]; IPT_ENTRY_ITERATE(loc_cpu_old_entry, oldinfo->size, cleanup_entry,NULL); IPT_ENTRY_ITERATE(loc_cpu_old_entry, oldinfo->size, cleanup_entry, NULL); xt_free_table_info(oldinfo); if (copy_to_user(counters_ptr, counters, sizeof(struct xt_counters) * num_counters) != 0) Loading Loading @@ -1346,9 +1348,8 @@ do_replace(void __user *user, unsigned int len) duprintf("ip_tables: Translated table\n"); ret = __do_replace(tmp.name, tmp.valid_hooks, newinfo, tmp.num_counters, tmp.counters); ret = __do_replace(tmp.name, tmp.valid_hooks, newinfo, tmp.num_counters, tmp.counters); if (ret) goto free_newinfo_untrans; return 0; Loading Loading @@ -1653,15 +1654,18 @@ check_compat_entry_size_and_hooks(struct ipt_entry *e, return ret; } static inline int compat_copy_match_from_user(struct ipt_entry_match *m, void **dstptr, compat_uint_t *size, const char *name, const struct ipt_ip *ip, unsigned int hookmask) static inline int compat_copy_match_from_user(struct ipt_entry_match *m, void **dstptr, compat_uint_t *size, const char *name, const struct ipt_ip *ip, unsigned int hookmask) { xt_compat_match_from_user(m, dstptr, size); return 0; } static int compat_copy_entry_from_user(struct ipt_entry *e, void **dstptr, static int compat_copy_entry_from_user(struct ipt_entry *e, void **dstptr, unsigned int *size, const char *name, struct xt_table_info *newinfo, unsigned char *base) { Loading Loading @@ -1874,15 +1878,15 @@ compat_do_replace(void __user *user, unsigned int len) ret = translate_compat_table(tmp.name, tmp.valid_hooks, &newinfo, &loc_cpu_entry, tmp.size, tmp.num_entries, tmp.hook_entry, tmp.underflow); tmp.num_entries, tmp.hook_entry, tmp.underflow); if (ret != 0) goto free_newinfo; duprintf("compat_do_replace: Translated table\n"); ret = __do_replace(tmp.name, tmp.valid_hooks, newinfo, tmp.num_counters, compat_ptr(tmp.counters)); ret = __do_replace(tmp.name, tmp.valid_hooks, newinfo, tmp.num_counters, compat_ptr(tmp.counters)); if (ret) goto free_newinfo_untrans; return 0; Loading Loading @@ -1920,15 +1924,15 @@ compat_do_ipt_set_ctl(struct sock *sk, int cmd, void __user *user, return ret; } struct compat_ipt_get_entries { struct compat_ipt_get_entries { char name[IPT_TABLE_MAXNAMELEN]; compat_uint_t size; struct compat_ipt_entry entrytable[0]; }; static int compat_copy_entries_to_user(unsigned int total_size, struct xt_table *table, void __user *userptr) static int compat_copy_entries_to_user(unsigned int total_size, struct xt_table *table, void __user *userptr) { struct xt_counters *counters; struct xt_table_info *private = table->private; Loading Loading @@ -1964,7 +1968,6 @@ compat_get_entries(struct compat_ipt_get_entries __user *uptr, int *len) struct compat_ipt_get_entries get; struct xt_table *t; if (*len < sizeof(get)) { duprintf("compat_get_entries: %u < %u\n", *len, (unsigned int)sizeof(get)); Loading Loading
net/ipv4/netfilter/ip_tables.c +92 −89 Original line number Diff line number Diff line Loading @@ -600,8 +600,8 @@ check_entry(struct ipt_entry *e, const char *name) } static inline int check_match(struct ipt_entry_match *m, const char *name, const struct ipt_ip *ip, unsigned int hookmask, unsigned int *i) const struct ipt_ip *ip, unsigned int hookmask, unsigned int *i) { struct xt_match *match; int ret; Loading Loading @@ -663,8 +663,8 @@ static inline int check_target(struct ipt_entry *e, const char *name) name, e->comefrom, e->ip.proto, e->ip.invflags & IPT_INV_PROTO); if (!ret && t->u.kernel.target->checkentry && !t->u.kernel.target->checkentry(name, e, target, t->data, e->comefrom)) { && !t->u.kernel.target->checkentry(name, e, target, t->data, e->comefrom)) { duprintf("ip_tables: check failed for `%s'.\n", t->u.kernel.target->name); ret = -EINVAL; Loading Loading @@ -1020,7 +1020,7 @@ struct compat_delta { short delta; }; static struct compat_delta *compat_offsets = NULL; static struct compat_delta *compat_offsets; static int compat_add_offset(unsigned int offset, short delta) { Loading Loading @@ -1109,11 +1109,11 @@ static int compat_calc_entry(struct ipt_entry *e, return ret; for (i = 0; i < NF_INET_NUMHOOKS; i++) { if (info->hook_entry[i] && (e < (struct ipt_entry *) (base + info->hook_entry[i]))) if (info->hook_entry[i] && (e < (struct ipt_entry *)(base + info->hook_entry[i]))) newinfo->hook_entry[i] -= off; if (info->underflow[i] && (e < (struct ipt_entry *) (base + info->underflow[i]))) if (info->underflow[i] && (e < (struct ipt_entry *)(base + info->underflow[i]))) newinfo->underflow[i] -= off; } return 0; Loading @@ -1132,7 +1132,8 @@ static int compat_table_info(const struct xt_table_info *info, newinfo->initial_entries = 0; loc_cpu_entry = info->entries[raw_smp_processor_id()]; return IPT_ENTRY_ITERATE(loc_cpu_entry, info->size, compat_calc_entry, info, loc_cpu_entry, newinfo); compat_calc_entry, info, loc_cpu_entry, newinfo); } #endif Loading Loading @@ -1289,7 +1290,8 @@ __do_replace(const char *name, unsigned int valid_hooks, get_counters(oldinfo, counters); /* Decrease module usage counts and free resource */ loc_cpu_old_entry = oldinfo->entries[raw_smp_processor_id()]; IPT_ENTRY_ITERATE(loc_cpu_old_entry, oldinfo->size, cleanup_entry,NULL); IPT_ENTRY_ITERATE(loc_cpu_old_entry, oldinfo->size, cleanup_entry, NULL); xt_free_table_info(oldinfo); if (copy_to_user(counters_ptr, counters, sizeof(struct xt_counters) * num_counters) != 0) Loading Loading @@ -1346,9 +1348,8 @@ do_replace(void __user *user, unsigned int len) duprintf("ip_tables: Translated table\n"); ret = __do_replace(tmp.name, tmp.valid_hooks, newinfo, tmp.num_counters, tmp.counters); ret = __do_replace(tmp.name, tmp.valid_hooks, newinfo, tmp.num_counters, tmp.counters); if (ret) goto free_newinfo_untrans; return 0; Loading Loading @@ -1653,15 +1654,18 @@ check_compat_entry_size_and_hooks(struct ipt_entry *e, return ret; } static inline int compat_copy_match_from_user(struct ipt_entry_match *m, void **dstptr, compat_uint_t *size, const char *name, const struct ipt_ip *ip, unsigned int hookmask) static inline int compat_copy_match_from_user(struct ipt_entry_match *m, void **dstptr, compat_uint_t *size, const char *name, const struct ipt_ip *ip, unsigned int hookmask) { xt_compat_match_from_user(m, dstptr, size); return 0; } static int compat_copy_entry_from_user(struct ipt_entry *e, void **dstptr, static int compat_copy_entry_from_user(struct ipt_entry *e, void **dstptr, unsigned int *size, const char *name, struct xt_table_info *newinfo, unsigned char *base) { Loading Loading @@ -1874,15 +1878,15 @@ compat_do_replace(void __user *user, unsigned int len) ret = translate_compat_table(tmp.name, tmp.valid_hooks, &newinfo, &loc_cpu_entry, tmp.size, tmp.num_entries, tmp.hook_entry, tmp.underflow); tmp.num_entries, tmp.hook_entry, tmp.underflow); if (ret != 0) goto free_newinfo; duprintf("compat_do_replace: Translated table\n"); ret = __do_replace(tmp.name, tmp.valid_hooks, newinfo, tmp.num_counters, compat_ptr(tmp.counters)); ret = __do_replace(tmp.name, tmp.valid_hooks, newinfo, tmp.num_counters, compat_ptr(tmp.counters)); if (ret) goto free_newinfo_untrans; return 0; Loading Loading @@ -1920,15 +1924,15 @@ compat_do_ipt_set_ctl(struct sock *sk, int cmd, void __user *user, return ret; } struct compat_ipt_get_entries { struct compat_ipt_get_entries { char name[IPT_TABLE_MAXNAMELEN]; compat_uint_t size; struct compat_ipt_entry entrytable[0]; }; static int compat_copy_entries_to_user(unsigned int total_size, struct xt_table *table, void __user *userptr) static int compat_copy_entries_to_user(unsigned int total_size, struct xt_table *table, void __user *userptr) { struct xt_counters *counters; struct xt_table_info *private = table->private; Loading Loading @@ -1964,7 +1968,6 @@ compat_get_entries(struct compat_ipt_get_entries __user *uptr, int *len) struct compat_ipt_get_entries get; struct xt_table *t; if (*len < sizeof(get)) { duprintf("compat_get_entries: %u < %u\n", *len, (unsigned int)sizeof(get)); Loading