Smack: prevent underflow in smk_set_cipso()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 23 Jul 2020 15:23:05 +0000 (18:23 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Aug 2020 08:53:02 +0000 (10:53 +0200)
commit23e854676593fa65adf1f103aec84e7a03a396e1
tree46e20168c7aa212cf13b52b907c5bd60c4d1bd11
parentfd9ff27063dd473219a7be89b5d8576c8b70b13d
Smack: prevent underflow in smk_set_cipso()

[ Upstream commit 42a2df3e829f3c5562090391b33714b2e2e5ad4a ]

We have an upper bound on "maplevel" but forgot to check for negative
values.

Fixes: e114e473771c ("Smack: Simplified Mandatory Access Control Kernel")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
security/smack/smackfs.c