* [PATCH 0/1] interconnect fix for 5.6
@ 2020-02-26 11:04 Georgi Djakov
2020-02-26 11:04 ` [PATCH 1/1] interconnect: Handle memory allocation errors Georgi Djakov
0 siblings, 1 reply; 2+ messages in thread
From: Georgi Djakov @ 2020-02-26 11:04 UTC (permalink / raw)
To: gregkh; +Cc: linux-pm, linux-kernel, georgi.djakov
Hi Greg,
This is a fix for the current release. Please apply it to char-misc-linus
when you get a chance.
Thanks,
Georgi
Georgi Djakov (1):
interconnect: Handle memory allocation errors
drivers/interconnect/core.c | 9 +++++++++
1 file changed, 9 insertions(+)
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 1/1] interconnect: Handle memory allocation errors
2020-02-26 11:04 [PATCH 0/1] interconnect fix for 5.6 Georgi Djakov
@ 2020-02-26 11:04 ` Georgi Djakov
0 siblings, 0 replies; 2+ messages in thread
From: Georgi Djakov @ 2020-02-26 11:04 UTC (permalink / raw)
To: gregkh; +Cc: linux-pm, linux-kernel, georgi.djakov
When we allocate memory, kasprintf() can fail and we must check its
return value.
Fixes: 05309830e1f8 ("interconnect: Add a name to struct icc_path")
Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
---
drivers/interconnect/core.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c
index f277e467156f..2c6515e3ecf1 100644
--- a/drivers/interconnect/core.c
+++ b/drivers/interconnect/core.c
@@ -445,6 +445,11 @@ struct icc_path *of_icc_get(struct device *dev, const char *name)
path->name = kasprintf(GFP_KERNEL, "%s-%s",
src_node->name, dst_node->name);
+ if (!path->name) {
+ kfree(path);
+ return ERR_PTR(-ENOMEM);
+ }
+
return path;
}
EXPORT_SYMBOL_GPL(of_icc_get);
@@ -579,6 +584,10 @@ struct icc_path *icc_get(struct device *dev, const int src_id, const int dst_id)
}
path->name = kasprintf(GFP_KERNEL, "%s-%s", src->name, dst->name);
+ if (!path->name) {
+ kfree(path);
+ path = ERR_PTR(-ENOMEM);
+ }
out:
mutex_unlock(&icc_lock);
return path;
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-02-26 11:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-26 11:04 [PATCH 0/1] interconnect fix for 5.6 Georgi Djakov
2020-02-26 11:04 ` [PATCH 1/1] interconnect: Handle memory allocation errors Georgi Djakov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).