]> git.baikalelectronics.ru Git - kernel.git/commit
netlabel: cope with NULL catmap
authorPaolo Abeni <pabeni@redhat.com>
Tue, 12 May 2020 12:43:14 +0000 (14:43 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 13 May 2020 01:12:40 +0000 (18:12 -0700)
commitdfb9e47d94497c76b075e1aed127c7e33f46a8dc
tree74a6833236e82b1de6ec523ef9ae7e3bde1250fa
parent021059ac8ea0cda6b2176380c021621b8d2a6eea
netlabel: cope with NULL catmap

The cipso and calipso code can set the MLS_CAT attribute on
successful parsing, even if the corresponding catmap has
not been allocated, as per current configuration and external
input.

Later, selinux code tries to access the catmap if the MLS_CAT flag
is present via netlbl_catmap_getlong(). That may cause null ptr
dereference while processing incoming network traffic.

Address the issue setting the MLS_CAT flag only if the catmap is
really allocated. Additionally let netlbl_catmap_getlong() cope
with NULL catmap.

Reported-by: Matthew Sheets <matthew.sheets@gd-ms.com>
Fixes: 3923d400b577 ("netlabel: fix the horribly broken catmap functions")
Fixes: 717cf28a6712 ("calipso: Set the calipso socket label to match the secattr.")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Acked-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/cipso_ipv4.c
net/ipv6/calipso.c
net/netlabel/netlabel_kapi.c