Skip to contentSkip to conversation

pgo: modules Fixup memory leak.

PATCH In review Jarmo Tiitto 2 participants 2 messages May 28, 2021 – May 31, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 5/6 pgo: modules Fixup memory leak.

---
 kernel/pgo/fs_mod.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/pgo/fs_mod.c +3 -1
index 0808d44227f1..2d1ff99e7982 100644
@@ -261,6 +261,8 @@ static int prf_module_open(struct inode *inode, struct file *file)
 
 				if (!pinfo->buffer) {
 					err = -ENOMEM;
+					kfree(pinfo);
+					module_put(mod);
 					goto out;
 				}
 			}
@@ -373,7 +375,7 @@ static int pgo_module_notifier(struct notifier_block *nb, unsigned long event,
 			if (strcmp(data->mod->name, mod->name) == 0) {
 
 				mutex_lock(&prf_mod_lock);
-				/* remofe from profiled modules */
+				/* remove from profiled modules */
 				list_del_rcu(&data->link);
 				/* mark it stale */
 				WRITE_ONCE(data->mod, NULL);
Signature · 1 line
2.31.1
#1 lore raw
Quoted 1 line · Jarmo Tiitto

Similar comment to 6/6, squash this into 3/6.

Quoted 28 lines
---
 kernel/pgo/fs_mod.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/pgo/fs_mod.c +3 -1
index 0808d44227f1..2d1ff99e7982 100644
@@ -261,6 +261,8 @@ static int prf_module_open(struct inode *inode, struct file *file)
 
 				if (!pinfo->buffer) {
 					err = -ENOMEM;
+					kfree(pinfo);
+					module_put(mod);
 					goto out;
 				}
 			}
@@ -373,7 +375,7 @@ static int pgo_module_notifier(struct notifier_block *nb, unsigned long event,
 			if (strcmp(data->mod->name, mod->name) == 0) {
 
 				mutex_lock(&prf_mod_lock);
-				/* remofe from profiled modules */
+				/* remove from profiled modules */
 				list_del_rcu(&data->link);
 				/* mark it stale */
 				WRITE_ONCE(data->mod, NULL);
Signature · 1 line
2.31.1