Skip to contentSkip to conversation

Patch "netfilter: x_tables: fix cgroup matching on non-full sks" has been added to the 4.0-stable tree

PATCH [email protected] 1 participant 1 message May 2, 2015

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

netfilter: x_tables: fix cgroup matching on non-full sks

to the 4.0-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-x_tables-fix-cgroup-matching-on-non-full-sks.patch
and it can be found in the queue-4.0 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 afb7718016fcb0370ac29a83b2839c78b76c2960 Mon Sep 17 00:00:00 2001

From: Daniel Borkmann <[email protected]>
Date: Fri, 27 Mar 2015 19:37:41 +0100
Subject: netfilter: x_tables: fix cgroup matching on non-full sks

From: Daniel Borkmann <[email protected]>

commit afb7718016fcb0370ac29a83b2839c78b76c2960 upstream.

While originally only being intended for outgoing traffic, commit a00e76349f35 ("netfilter: x_tables: allow to use cgroup match for LOCAL_IN nf hooks") enabled xt_cgroups for the NF_INET_LOCAL_IN hook as well, in order to allow for nfacct accounting.

Besides being currently limited to early demuxes only, commit a00e76349f35 forgot to add a check if we deal with full sockets, i.e. in this case not with time wait sockets. TCP time wait sockets do not have the same memory layout as full sockets, a lower memory footprint and consequently also don't have a sk_classid member; probing for sk_classid member there could potentially lead to a crash.

Fixes a00e76349f35 ("netfilter: x_tables: allow to use cgroup match for LOCAL_IN nf hooks")
Cc Alexey Perevalov <[email protected]>
---
 net/netfilter/xt_cgroup.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/xt_cgroup.c +1 -1
@@ -39,7 +39,7 @@ cgroup_mt(const struct sk_buff *skb, str
 {
 	const struct xt_cgroup_info *info = par->matchinfo;
 
-	if (skb->sk == NULL)
+	if (skb->sk == NULL || !sk_fullsock(skb->sk))
 		return false;
 
 	return (info->id == skb->sk->sk_classid) ^ info->invert;

Patches currently in stable-queue which might be from [email protected] are

queue-4.0/netfilter-x_tables-fix-cgroup-matching-on-non-full-sks.patch queue-4.0/ebpf-verifier-check-that-call-reg-with-arg_anything-is-initialized.patch queue-4.0/lib-memzero_explicit-use-barrier-instead-of-optimizer_hide_var.patch