netfilter: fix IS_ERR_VALUE usage
authorPablo Neira Ayuso <pablo@netfilter.org>
Fri, 29 Apr 2016 08:39:34 +0000 (10:39 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 29 Apr 2016 09:02:33 +0000 (11:02 +0200)
commit92b4423e3a0bc5d43ecde4bcad871f8b5ba04efd
treefc6db0429c46bab284871df7ef97df9730e7c9b3
parent6cd54fc60cc9d307c09bd2675f410c1086050e7d
netfilter: fix IS_ERR_VALUE usage

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.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/linux/netfilter/x_tables.h
net/ipv4/netfilter/arp_tables.c
net/ipv4/netfilter/ip_tables.c
net/ipv6/netfilter/ip6_tables.c