mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf
Pablo Neira Ayuso says:
====================
Netfilter fixes for net
The following patchset contains Netfilter fixes for your net tree,
they are:
1) Fix OOM that syskaller triggers with ipt_replace.size = -1 and
IPT_SO_SET_REPLACE socket option, from Dmitry Vyukov.
2) Check for too long extension name in xt_request_find_{match|target}
that result in out-of-bound reads, from Eric Dumazet.
3) Fix memory exhaustion bug in ipset hash:*net* types when adding ranges
that look like x.x.x.x-255.255.255.255, from Jozsef Kadlecsik.
4) Fix pointer leaks to userspace in x_tables, from Dmitry Vyukov.
5) Insufficient sanity checks in clusterip_tg_check(), also from Dmitry.
====================
Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
commit
b9a40729e7
17 changed files with 114 additions and 99 deletions
|
|
@ -1255,11 +1255,8 @@ int ip_setsockopt(struct sock *sk, int level,
|
|||
if (err == -ENOPROTOOPT && optname != IP_HDRINCL &&
|
||||
optname != IP_IPSEC_POLICY &&
|
||||
optname != IP_XFRM_POLICY &&
|
||||
!ip_mroute_opt(optname)) {
|
||||
lock_sock(sk);
|
||||
!ip_mroute_opt(optname))
|
||||
err = nf_setsockopt(sk, PF_INET, optname, optval, optlen);
|
||||
release_sock(sk);
|
||||
}
|
||||
#endif
|
||||
return err;
|
||||
}
|
||||
|
|
@ -1284,12 +1281,9 @@ int compat_ip_setsockopt(struct sock *sk, int level, int optname,
|
|||
if (err == -ENOPROTOOPT && optname != IP_HDRINCL &&
|
||||
optname != IP_IPSEC_POLICY &&
|
||||
optname != IP_XFRM_POLICY &&
|
||||
!ip_mroute_opt(optname)) {
|
||||
lock_sock(sk);
|
||||
err = compat_nf_setsockopt(sk, PF_INET, optname,
|
||||
optval, optlen);
|
||||
release_sock(sk);
|
||||
}
|
||||
!ip_mroute_opt(optname))
|
||||
err = compat_nf_setsockopt(sk, PF_INET, optname, optval,
|
||||
optlen);
|
||||
#endif
|
||||
return err;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -431,7 +431,7 @@ static int clusterip_tg_check(const struct xt_tgchk_param *par)
|
|||
struct ipt_clusterip_tgt_info *cipinfo = par->targinfo;
|
||||
const struct ipt_entry *e = par->entryinfo;
|
||||
struct clusterip_config *config;
|
||||
int ret;
|
||||
int ret, i;
|
||||
|
||||
if (par->nft_compat) {
|
||||
pr_err("cannot use CLUSTERIP target from nftables compat\n");
|
||||
|
|
@ -450,8 +450,18 @@ static int clusterip_tg_check(const struct xt_tgchk_param *par)
|
|||
pr_info("Please specify destination IP\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* FIXME: further sanity checks */
|
||||
if (cipinfo->num_local_nodes > ARRAY_SIZE(cipinfo->local_nodes)) {
|
||||
pr_info("bad num_local_nodes %u\n", cipinfo->num_local_nodes);
|
||||
return -EINVAL;
|
||||
}
|
||||
for (i = 0; i < cipinfo->num_local_nodes; i++) {
|
||||
if (cipinfo->local_nodes[i] - 1 >=
|
||||
sizeof(config->local_nodes) * 8) {
|
||||
pr_info("bad local_nodes[%d] %u\n",
|
||||
i, cipinfo->local_nodes[i]);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
config = clusterip_config_find_get(par->net, e->ip.dst.s_addr, 1);
|
||||
if (!config) {
|
||||
|
|
|
|||
|
|
@ -213,15 +213,19 @@ getorigdst(struct sock *sk, int optval, void __user *user, int *len)
|
|||
struct nf_conntrack_tuple tuple;
|
||||
|
||||
memset(&tuple, 0, sizeof(tuple));
|
||||
|
||||
lock_sock(sk);
|
||||
tuple.src.u3.ip = inet->inet_rcv_saddr;
|
||||
tuple.src.u.tcp.port = inet->inet_sport;
|
||||
tuple.dst.u3.ip = inet->inet_daddr;
|
||||
tuple.dst.u.tcp.port = inet->inet_dport;
|
||||
tuple.src.l3num = PF_INET;
|
||||
tuple.dst.protonum = sk->sk_protocol;
|
||||
release_sock(sk);
|
||||
|
||||
/* We only do TCP and SCTP at the moment: is there a better way? */
|
||||
if (sk->sk_protocol != IPPROTO_TCP && sk->sk_protocol != IPPROTO_SCTP) {
|
||||
if (tuple.dst.protonum != IPPROTO_TCP &&
|
||||
tuple.dst.protonum != IPPROTO_SCTP) {
|
||||
pr_debug("SO_ORIGINAL_DST: Not a TCP/SCTP socket\n");
|
||||
return -ENOPROTOOPT;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue