]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
s390/pai: fix attr_event_free upper limit for pai device drivers
authorThomas Richter <tmricht@linux.ibm.com>
Thu, 18 Jan 2024 12:03:39 +0000 (13:03 +0100)
committerSasha Levin <sashal@kernel.org>
Tue, 26 Mar 2024 22:19:28 +0000 (18:19 -0400)
commit1cd9c46807486497e4d40174af51e99cf452191b
tree3cf97fd837f589d4e86bb3c3b51176038f7ccf9b
parent85074e3394a854dfc544f8058faf75ce6db14e0a
s390/pai: fix attr_event_free upper limit for pai device drivers

[ Upstream commit 225d09d6e5f3870560665a1829d2db79330b4c58 ]

When the device drivers are initialized, a sysfs directory
is created. This contains many attributes which are allocated with
kzalloc(). Should it fail, the memory for the attributes already
created is freed in attr_event_free(). Its second parameter is number
of attribute elements to delete. This parameter is off by one.
When i. e. the 10th attribute fails to get created, attributes
numbered 0 to 9 should be deleted. Currently only attributes
numbered 0 to 8 are deleted.

Fixes: 39d62336f5c1 ("s390/pai: add support for cryptography counters")
Reported-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Acked-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/s390/kernel/perf_pai_crypto.c
arch/s390/kernel/perf_pai_ext.c