mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-14 12:37:32 +00:00
s390/pai: fix attr_event_free upper limit for pai device drivers
[ Upstream commit225d09d6e5
] 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:39d62336f5
("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>
This commit is contained in:
parent
6f339ae67a
commit
8c29c81cbc
2 changed files with 2 additions and 2 deletions
|
@ -715,7 +715,7 @@ static int __init attr_event_init(void)
|
|||
for (i = 0; i < ARRAY_SIZE(paicrypt_ctrnames); i++) {
|
||||
ret = attr_event_init_one(attrs, i);
|
||||
if (ret) {
|
||||
attr_event_free(attrs, i - 1);
|
||||
attr_event_free(attrs, i);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -604,7 +604,7 @@ static int __init attr_event_init(void)
|
|||
for (i = 0; i < ARRAY_SIZE(paiext_ctrnames); i++) {
|
||||
ret = attr_event_init_one(attrs, i);
|
||||
if (ret) {
|
||||
attr_event_free(attrs, i - 1);
|
||||
attr_event_free(attrs, i);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue