]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: fix export secctx error handling
authorPablo Neira Ayuso <pablo@netfilter.org>
Thu, 6 Jan 2011 19:25:00 +0000 (11:25 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 6 Jan 2011 19:25:00 +0000 (11:25 -0800)
commita1a1e24c8197af8c411d95337fc9e6c51a376fef
tree785e2a715a922c36b15e1929473498e3b3aae724
parent9dea4b6cfdfb841ad00a2a13d6529c9a2a1c89fd
netfilter: fix export secctx error handling

In 74d1e3f0d0527bcd3dfd1d3eb043c61f30770bde, the secctx was exported
via the /proc/net/netfilter/nf_conntrack and ctnetlink interfaces
instead of the secmark.

That patch introduced the use of security_secid_to_secctx() which may
return a non-zero value on error.

In one of my setups, I have NF_CONNTRACK_SECMARK enabled but no
security modules. Thus, security_secid_to_secctx() returns a negative
value that results in the breakage of the /proc and `conntrack -L'
outputs. To fix this, we skip the inclusion of secctx if the
aforementioned function fails.

This patch also fixes the dynamic netlink message size calculation
if security_secid_to_secctx() returns an error, since its logic is
also wrong.

This problem exists in Linux kernel >= 2.6.37.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
net/netfilter/nf_conntrack_netlink.c
net/netfilter/nf_conntrack_standalone.c