]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
netfilter: x_tables: fix cgroup matching on non-full sks
authorDaniel Borkmann <daniel@iogearbox.net>
Fri, 27 Mar 2015 18:37:41 +0000 (19:37 +0100)
committerSasha Levin <sasha.levin@oracle.com>
Sun, 28 Jun 2015 17:39:21 +0000 (13:39 -0400)
commit405ef57147cc24325ed64f32139eb20e4294f9c5
treec50aca6726d5fe04d501006a67fe2b01874d7243
parent2ed8cb3d22b59eda73c203412d02add4d0901255
netfilter: x_tables: fix cgroup matching on non-full sks

[ Upstream commit afb7718016fcb0370ac29a83b2839c78b76c2960 ]

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 <a.perevalov@samsung.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
net/netfilter/xt_cgroup.c