Patch "netfilter: fix IS_ERR_VALUE usage" has been added to the 4.4-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
netfilter: fix IS_ERR_VALUE usage
to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
netfilter-fix-is_err_value-usage.patch
and it can be found in the queue-4.4 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
92b4423e3a0bc5d43ecde4bcad871f8b5ba04efdMon Sep 17 00:00:00 2001
From: Pablo Neira Ayuso <[email protected]>
Date: Fri, 29 Apr 2016 10:39:34 +0200
Subject: netfilter: fix IS_ERR_VALUE usage
From: Pablo Neira Ayuso <[email protected]>
commit 92b4423e3a0bc5d43ecde4bcad871f8b5ba04efd upstream.
This is a forward-port of the original patch from Andrzej Hajda, he said:
"IS_ERR_VALUE should be used only with unsigned long type. Otherwise it can work incorrectly. To achieve this function xt_percpu_counter_alloc is modified to return unsigned long, and its result is assigned to temporary variable to perform error checking, before assigning to .pcnt field.
The patch follows conclusion from discussion on LKML [1][2].
[1]: http://permalink.gmane.org/gmane.linux.kernel/2120927
[2]: http://permalink.gmane.org/gmane.linux.kernel/2150581"
Original patch from Andrzej is here:
http://patchwork.ozlabs.org/patch/582970/
This patch has clashed with input validation fixes for x_tables.
--- include/linux/netfilter/x_tables.h | 6 +++--- net/ipv4/netfilter/arp_tables.c | 6 ++++-- net/ipv4/netfilter/ip_tables.c | 6 ++++-- net/ipv6/netfilter/ip6_tables.c | 6 ++++-- 4 files changed, 15 insertions(+), 9 deletions(-)
include/linux/netfilter/x_tables.h +3 -3
@@ -381,16 +381,16 @@ static inline unsigned long ifname_compa* allows us to return 0 for single core systems without forcing * callers to deal with SMP vs. NONSMP issues. */ -static inline u64 xt_percpu_counter_alloc (void ) +static inline unsigned long xt_percpu_counter_alloc (void ) {if (nr_cpu_ids >1 ) {void __percpu *res =__alloc_percpu (sizeof (struct xt_counters ),sizeof (struct xt_counters ));if (res ==NULL ) -return (u64) -ENOMEM ; +return -ENOMEM ; -return (u64 ) (__force unsigned long ) res; +return (__force unsigned long ) res; }return 0 ;
net/ipv4/netfilter/arp_tables.c +4 -2
@@ -511,11 +511,13 @@ find_check_entry(struct arpt_entry *e, c {struct xt_entry_target *t;struct xt_target *target; +unsigned long pcnt;int ret; - e->counters.pcnt =xt_percpu_counter_alloc (); -if (IS_ERR_VALUE (e->counters.pcnt)) + pcnt =xt_percpu_counter_alloc (); +if (IS_ERR_VALUE (pcnt))return -ENOMEM ; + e->counters.pcnt = pcnt; t =arpt_get_target (e); target = xt_request_find_target(NFPROTO_ARP, t->u.user.name,
net/ipv4/netfilter/ip_tables.c +4 -2
@@ -653,10 +653,12 @@ find_check_entry(struct ipt_entry *e, stunsigned int j;struct xt_mtchk_param mtpar;struct xt_entry_match *ematch; +unsigned long pcnt; - e->counters.pcnt =xt_percpu_counter_alloc (); -if (IS_ERR_VALUE (e->counters.pcnt)) + pcnt =xt_percpu_counter_alloc (); +if (IS_ERR_VALUE (pcnt))return -ENOMEM ; + e->counters.pcnt = pcnt; j =0 ; mtpar.net = net;
net/ipv6/netfilter/ip6_tables.c +4 -2
@@ -666,10 +666,12 @@ find_check_entry(struct ip6t_entry *e, sunsigned int j;struct xt_mtchk_param mtpar;struct xt_entry_match *ematch; +unsigned long pcnt; - e->counters.pcnt =xt_percpu_counter_alloc (); -if (IS_ERR_VALUE (e->counters.pcnt)) + pcnt =xt_percpu_counter_alloc (); +if (IS_ERR_VALUE (pcnt))return -ENOMEM ; + e->counters.pcnt = pcnt; j =0 ; mtpar.net = net;
Patches currently in stable-queue which might be from [email protected] are
queue-4.4/netfilter-x_tables-speed-up-jump-target-validation.patch queue-4.4/netfilter-nf_dup_ipv6-set-again-flowi_flag_known_nh-at-flowi6_flags.patch queue-4.4/netfilter-fix-is_err_value-usage.patch queue-4.4/netfilter-nf_ct_expect-remove-the-redundant-slash-when-policy-name-is-empty.patch queue-4.4/netfilter-xt_osf-add-missing-permission-checks.patch queue-4.4/netfilter-arp_tables-fix-invoking-32bit-iptable-p-input-accept-failed-in-64bit-kernel.patch queue-4.4/netfilter-nf_conntrack_sip-extend-request-line-validation.patch queue-4.4/netfilter-restart-search-if-moved-to-other-chain.patch queue-4.4/netfilter-use-fwmark_reflect-in-nf_send_reset.patch queue-4.4/netfilter-nfnetlink_queue-reject-verdict-request-from-different-portid.patch queue-4.4/netfilter-nfnetlink_cthelper-add-missing-permission-checks.patch