Subject: CVE-2021-47336: smackfs: restrict bytes count in smk_set_cipso()

From: Greg Kroah-Hartman <[email-masked]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

smackfs: restrict bytes count in smk_set_cipso()

Oops, I failed to update subject line.

From 07571157c91b98ce1a4aa70967531e64b78e8346 Mon Sep 17 00:00:00 2001
Date: Mon, 12 Apr 2021 22:25:06 +0900
Subject: [PATCH] smackfs: restrict bytes count in smk_set_cipso()

Commit 7ef4c19d245f3dc2 ("smackfs: restrict bytes count in smackfs write
functions") missed that count > SMK_CIPSOMAX check applies to only
format == SMK_FIXED24_FMT case.

The Linux kernel CVE team has assigned CVE-2021-47336 to this issue.

Affected and fixed versions
===========================

	Fixed in 4.9.276 with commit 5f9880403e6b
	Fixed in 4.14.240 with commit 5c2dca9a7a7f
	Fixed in 4.19.198 with commit cbd87ba6a138
	Fixed in 5.4.133 with commit 135122f174c3
	Fixed in 5.10.51 with commit 3780348c1a0e
	Fixed in 5.12.18 with commit 8f5c773a2871
	Fixed in 5.13.3 with commit 258fd821f693
	Fixed in 5.14 with commit 49ec114a6e62

Please see https://www.kernel.org for a full list of currently supported
kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to
older supported kernel versions.  The official CVE entry at
	https://cve.org/CVERecord/?id=CVE-2021-47336
will be updated if fixes are backported, please check that for the most
up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
	security/smack/smackfs.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest
stable kernel version for this, and many other bugfixes.  Individual
changes are never tested alone, but rather are part of a larger kernel
release.  Cherry-picking individual commits is not recommended or
supported by the Linux kernel community at all.  If however, updating to
the latest release is impossible, the individual changes to resolve this
issue can be found at these commits:
	https://git.kernel.org/stable/c/5f9880403e6b71d56924748ba331daf836243fca
	https://git.kernel.org/stable/c/5c2dca9a7a7ff6a2df34158903515e2e4fd3d2b2
	https://git.kernel.org/stable/c/cbd87ba6a13891acf6180783f8234a8b7a3e3d4d
	https://git.kernel.org/stable/c/135122f174c357b7a3e58f40fa5792156c5e93e6
	https://git.kernel.org/stable/c/3780348c1a0e14ffefcaf1fc521f815bcaac94b0
	https://git.kernel.org/stable/c/8f5c773a2871cf446e3f36b2834fb25bbb28512b
	https://git.kernel.org/stable/c/258fd821f69378453c071b9dd767b298810fc766
	https://git.kernel.org/stable/c/49ec114a6e62d8d320037ce71c1aaf9650b3cafd