Check the allocation size before toggling kfence_allocation_gate.
This way allocations that can't be served by KFENCE will not result in
waiting for another CONFIG_KFENCE_SAMPLE_INTERVAL without allocating
anything.
Suggested-by: Marco Elver <elver(a)google.com>
Cc: Andrew Morton <akpm(a)linux-foundation.org>
Cc: Dmitry Vyukov <dvyukov(a)google.com>
Cc: Marco Elver <elver(a)google.com>
Cc: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Cc: stable(a)vger.kernel.org # 5.12+
Signed-off-by: Alexander Potapenko <glider(a)google.com>
---
mm/kfence/core.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/mm/kfence/core.c b/mm/kfence/core.c
index 4d21ac44d5d35..33bb20d91bf6a 100644
--- a/mm/kfence/core.c
+++ b/mm/kfence/core.c
@@ -733,6 +733,13 @@ void kfence_shutdown_cache(struct kmem_cache *s)
void *__kfence_alloc(struct kmem_cache *s, size_t size, gfp_t flags)
{
+ /*
+ * Perform size check before switching kfence_allocation_gate, so that
+ * we don't disable KFENCE without making an allocation.
+ */
+ if (size > PAGE_SIZE)
+ return NULL;
+
/*
* allocation_gate only needs to become non-zero, so it doesn't make
* sense to continue writing to it and pay the associated contention
@@ -757,9 +764,6 @@ void *__kfence_alloc(struct kmem_cache *s, size_t size, gfp_t flags)
if (!READ_ONCE(kfence_enabled))
return NULL;
- if (size > PAGE_SIZE)
- return NULL;
-
return kfence_guarded_alloc(s, size, flags);
}
--
2.32.0.93.g670b81a890-goog
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
I'm announcing the release of the 4.4.274 kernel.
All users of the 4.4 kernel series must upgrade.
The updated 4.4.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-4.4.y
and can be browsed at the normal kernel.org git web browser:
https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary
Thanks,
Sasha
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCgAdFiEE4n5dijQDou9mhzu83qZv95d3LNwFAmDcdJAACgkQ3qZv95d3
LNy2nw/8DjXdbC/e2QMD0vKWBKmEeJv4IdTEqZ0UFy6TtXYEu5xP6nPjQwFj1QBe
QEjA2/E/OfbVvw03VmkJCYhIJHNjod7+qc2fjwiYqwjuanzaEL1r1bwjvuAWEWir
4Dv7Ld24qGvPIku/9/O6scdEYhCxJD0nmP1PoYi65+qysdKz0Uz9/H8NGMg/4EOL
N0SO402K38PXMpSqNVQO1j/geBhGMEdKYPCCHbYtuTI2HTp+cz24dHuJ3qCnNZvu
6TLienmeqrfSHWZcy5Ylfe4pvac79ZOu2k8R/bOaldoDJEKsGIvhcXkW148u9J2R
344QhW7kf+qyjWbuYUTRT4MCJMU7gmSxOUpKj9uk1k0flC6kQlOmJgxK2tWcI76R
NhokvUXNDMBhD15FkomU2djDTeZlE213UNPerf3rdIvobCzqWKyQRhmf7UuIKA73
gukTSnVr5qW9PpAWsIoIeNVK/MTgqLX/KMTOOVjudPwo9ub+KeGgffWBK5JUBagX
a0THRt0C+bRoSQw5AWc/Wjbk5yd2ZIfmrLWRTjfAxWkEzOmd5k+1xC4BhrDMw/+f
ltsplL3LVFQ4vnUOiRsJfiLxVSPxdHP0xqhdSi/v2BKVyvwooqygv+2E+yCx6ChM
EkmJ7I3Nx+90WUxN4aKS2B4G8yX+r2p3XXzPomXkkqhkoOm5odc=
=dnqU
-----END PGP SIGNATURE-----
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
I'm announcing the release of the 4.9.274 kernel.
All users of the 4.9 kernel series must upgrade.
The updated 4.9.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-4.9.y
and can be browsed at the normal kernel.org git web browser:
https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary
Thanks,
Sasha
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCgAdFiEE4n5dijQDou9mhzu83qZv95d3LNwFAmDcdIgACgkQ3qZv95d3
LNwY3A/+PUro+6tW4eV+l/s2KhV16XpQeyj4d3r4rA3CxNNS7vRfe36EE2c57Y7y
ij+qHzrSphoA8WVfWbTVwRwxX0WLaOsNRD2UKHzg9Ngnd3EVnEks/g0Cu3FIKaEK
v4GSwNZCUB+TjS/i/VGPdbDMGYNA+S13A4qLf1cX9ZZcbZzX8cQuLO8UBIzeCFzX
M/IajOd+Z8vocrXcThGlXnsVcDGGg7wTd7D5jq2m14xsTYzt8XiS1Bk5a1kBVvrH
XjMhB2k7XaPd8cydK2lg7MQSPqEJzUEssyJKl1odkFcP5h+MrcN7FbBREbZhD3L4
ivvEx0zJnityqdS3av7UQC/OFpL8giSb560hHI3/K+Pe6Ww/DnwqEgNM6SuxmSyX
8ee7DDvUmEOsFIPJPG7zfesowGy1OVFZGPFQtRlb4wUncWJdWrbO1bSez3Kh/2Oa
VaGtmzgRWDaYOvHroVQqAFOXKG01geVgatRojLUCoo0SDKDcF5gCLhUkHVlhSuLG
oZJpboUuAfQcvU9fMFTSn6AuNa1MX9u820/jC3sG8cFh4rH9CKQMBtMDs8D5bxd+
Gp5uPd+KSHY3S2xfSzmXSX5XlOHXDep/4JRwZOZpH/pcv7bzC5qfh9veRjZoIo+a
qcjW8xJ/VqL/+Y/RMYXJAV4lQTsAkQkJK62Stj/Lz0Z5sPxfNkw=
=pF1+
-----END PGP SIGNATURE-----
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
I'm announcing the release of the 5.12.14 kernel.
All users of the 5.12 kernel series must upgrade.
The updated 5.12.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-5.12.y
and can be browsed at the normal kernel.org git web browser:
https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary
Thanks,
Sasha
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCgAdFiEE4n5dijQDou9mhzu83qZv95d3LNwFAmDcc0QACgkQ3qZv95d3
LNwH5w//TFlFjU8wQBo9akQQjQguKKAiuIa6Mw21rWbl7kJbQpANN34+CiSF8IKS
zlDmuAcAGASQttQ5Ud0TgF7wkrSFdDEwGKXeqrAmHTL2ux+1dTImBSeFAlIuEPYH
dcZdhrHcrPnQGcOwrh9oE0DBJRRVyztPgqAZXXKtvraPJQnCmr5UryI31C7t2ZjQ
vvtwMXNuYAzmqe9tsWYdEY4zk1cqMLWKjK1a4ePhvknnq+NSolzmv9WYJER1gjxN
j5BXKms2RUZjbWql456rP0k2gRxsL2A2ZEnUzxDMgbwQASSEcQzLjpZIjrZWrteM
kunUw8Qyq6FHLnmavE/l4g1tY6wPDljw6Y80Yijlr9yYgCEOvaBuKNMpeUoiwNhb
WyeebAFDycuguwjpE1Fds+Qb8LgVKyzrXWgHMU75H9+VFRPIShXWgyll77DsJL8s
9Fgt8IVUCC0IyPKERsgkJ7xfWa6K5Icrhlf5jpymIZjGMfhv9G/C86CdAkBwRB9f
oD6lHy/CPffzzUPuI1eSiGEv3RXHlJwrs0GWrkDJfoObli2lTXR6olNblhJwGh2y
bZ26x4NU88oHUBuizMkmCiL9NK/usMfWQZdlDJ7rfPrLiHjQ+Xdf7+ORCCa35ahE
DRGxrF7EpIxMjgq4LEKTlKbvT6AqsAjdw+mhjpoQoE1W6WcebkM=
=Q/ui
-----END PGP SIGNATURE-----
From: Kan Liang <kan.liang(a)linux.intel.com>
The uncore unit with the type ID 0 and the unit ID 0 is missed.
The table3 of the uncore unit maybe 0. The
uncore_discovery_invalid_unit() mistakenly treated it as an invalid
value.
Remove the !unit.table3 check.
Fixes: edae1f06c2cd ("perf/x86/intel/uncore: Parse uncore discovery tables")
Reviewed-by: Andi Kleen <ak(a)linux.intel.com>
Signed-off-by: Kan Liang <kan.liang(a)linux.intel.com>
Cc: stable(a)vger.kernel.org
---
The patch was posted as a part of the "perf: Add Sapphire Rapids server
uncore support" patch set. But it doesn't depend on the other patches in
the patch set. The bugfix can be accepted and merged separately.
https://lore.kernel.org/lkml/cb0d2d43-102a-994c-f777-e11d61c77bf5@linux.int…
arch/x86/events/intel/uncore_discovery.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/events/intel/uncore_discovery.h b/arch/x86/events/intel/uncore_discovery.h
index 1d65293..abfb1e8 100644
--- a/arch/x86/events/intel/uncore_discovery.h
+++ b/arch/x86/events/intel/uncore_discovery.h
@@ -30,7 +30,7 @@
#define uncore_discovery_invalid_unit(unit) \
- (!unit.table1 || !unit.ctl || !unit.table3 || \
+ (!unit.table1 || !unit.ctl || \
unit.table1 == -1ULL || unit.ctl == -1ULL || \
unit.table3 == -1ULL)
--
2.7.4
From: Kan Liang <kan.liang(a)linux.intel.com>
The uncore unit with the type ID 0 and the unit ID 0 is missed.
The table3 of the uncore unit maybe 0. The
uncore_discovery_invalid_unit() mistakenly treated it as an invalid
value.
Remove the !unit.table3 check.
Fixes: edae1f06c2cd ("perf/x86/intel/uncore: Parse uncore discovery tables")
Reviewed-by: Andi Kleen <ak(a)linux.intel.com>
Signed-off-by: Kan Liang <kan.liang(a)linux.intel.com>
Cc: stable(a)vger.kernel.org
---
arch/x86/events/intel/uncore_discovery.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/events/intel/uncore_discovery.h b/arch/x86/events/intel/uncore_discovery.h
index 7280c8a..6d735611 100644
--- a/arch/x86/events/intel/uncore_discovery.h
+++ b/arch/x86/events/intel/uncore_discovery.h
@@ -30,7 +30,7 @@
#define uncore_discovery_invalid_unit(unit) \
- (!unit.table1 || !unit.ctl || !unit.table3 || \
+ (!unit.table1 || !unit.ctl || \
unit.table1 == -1ULL || unit.ctl == -1ULL || \
unit.table3 == -1ULL)
--
2.7.4
Hi,
I realized that this cve(
https://www.openwall.com/lists/oss-security/2021/03/23/2 ) is not in
the 4.19 tree but the commits introduced the vulnerability before
4.19. Is there any reason that the fix was not cherry-picked to 4.19?
Best,
Anil
The Tegra serial driver always prints an error message when enabling the
FIFO for devices that have support for checking the FIFO enable status.
Fix this by only display the error message, when an error occurs.
Fixes: 222dcdff3405 ("serial: tegra: check for FIFO mode enabled status")
Cc: <stable(a)vger.kernel.org>
Signed-off-by: Jon Hunter <jonathanh(a)nvidia.com>
---
drivers/tty/serial/serial-tegra.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/serial-tegra.c b/drivers/tty/serial/serial-tegra.c
index 222032792d6c..cd481f7ba8eb 100644
--- a/drivers/tty/serial/serial-tegra.c
+++ b/drivers/tty/serial/serial-tegra.c
@@ -1045,9 +1045,10 @@ static int tegra_uart_hw_init(struct tegra_uart_port *tup)
if (tup->cdata->fifo_mode_enable_status) {
ret = tegra_uart_wait_fifo_mode_enabled(tup);
- dev_err(tup->uport.dev, "FIFO mode not enabled\n");
- if (ret < 0)
+ if (ret < 0) {
+ dev_err(tup->uport.dev, "FIFO mode not enabled\n");
return ret;
+ }
} else {
/*
* For all tegra devices (up to t210), there is a hardware
--
2.25.1