* [PATCH] mm, vmpressure: free the same pointer we allocated
@ 2017-06-13 19:18 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2017-06-13 19:18 UTC (permalink / raw)
To: Andrew Morton, David Rientjes
Cc: Minchan Kim, Vinayak Menon, Michal Hocko, linux-mm, kernel-janitors
We keep incrementing "spec" as we parse the args so we end up calling
kfree() on a modified of spec. It probably works or this would have
been caught in testing, but it looks weird.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/mm/vmpressure.c b/mm/vmpressure.c
index 0781b1363e0a..1225ec5d9596 100644
--- a/mm/vmpressure.c
+++ b/mm/vmpressure.c
@@ -386,11 +386,11 @@ int vmpressure_register_event(struct mem_cgroup *memcg,
struct vmpressure_event *ev;
enum vmpressure_modes mode = VMPRESSURE_NO_PASSTHROUGH;
enum vmpressure_levels level = -1;
- char *spec = NULL;
+ char *spec, *spec_orig;
char *token;
int ret = 0;
- spec = kzalloc(MAX_VMPRESSURE_ARGS_LEN + 1, GFP_KERNEL);
+ spec_orig = spec = kzalloc(MAX_VMPRESSURE_ARGS_LEN + 1, GFP_KERNEL);
if (!spec) {
ret = -ENOMEM;
goto out;
@@ -429,7 +429,7 @@ int vmpressure_register_event(struct mem_cgroup *memcg,
list_add(&ev->node, &vmpr->events);
mutex_unlock(&vmpr->events_lock);
out:
- kfree(spec);
+ kfree(spec_orig);
return ret;
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] mm, vmpressure: free the same pointer we allocated
@ 2017-06-13 19:18 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2017-06-13 19:18 UTC (permalink / raw)
To: Andrew Morton, David Rientjes
Cc: Minchan Kim, Vinayak Menon, Michal Hocko, linux-mm, kernel-janitors
We keep incrementing "spec" as we parse the args so we end up calling
kfree() on a modified of spec. It probably works or this would have
been caught in testing, but it looks weird.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/mm/vmpressure.c b/mm/vmpressure.c
index 0781b1363e0a..1225ec5d9596 100644
--- a/mm/vmpressure.c
+++ b/mm/vmpressure.c
@@ -386,11 +386,11 @@ int vmpressure_register_event(struct mem_cgroup *memcg,
struct vmpressure_event *ev;
enum vmpressure_modes mode = VMPRESSURE_NO_PASSTHROUGH;
enum vmpressure_levels level = -1;
- char *spec = NULL;
+ char *spec, *spec_orig;
char *token;
int ret = 0;
- spec = kzalloc(MAX_VMPRESSURE_ARGS_LEN + 1, GFP_KERNEL);
+ spec_orig = spec = kzalloc(MAX_VMPRESSURE_ARGS_LEN + 1, GFP_KERNEL);
if (!spec) {
ret = -ENOMEM;
goto out;
@@ -429,7 +429,7 @@ int vmpressure_register_event(struct mem_cgroup *memcg,
list_add(&ev->node, &vmpr->events);
mutex_unlock(&vmpr->events_lock);
out:
- kfree(spec);
+ kfree(spec_orig);
return ret;
}
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mm, vmpressure: free the same pointer we allocated
2017-06-13 19:18 ` Dan Carpenter
@ 2017-06-15 1:49 ` David Rientjes
-1 siblings, 0 replies; 4+ messages in thread
From: David Rientjes @ 2017-06-15 1:49 UTC (permalink / raw)
To: Dan Carpenter
Cc: Andrew Morton, Minchan Kim, Vinayak Menon, Michal Hocko,
linux-mm, kernel-janitors
On Tue, 13 Jun 2017, Dan Carpenter wrote:
> We keep incrementing "spec" as we parse the args so we end up calling
> kfree() on a modified of spec. It probably works or this would have
> been caught in testing, but it looks weird.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: David Rientjes <rientjes@google.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm, vmpressure: free the same pointer we allocated
@ 2017-06-15 1:49 ` David Rientjes
0 siblings, 0 replies; 4+ messages in thread
From: David Rientjes @ 2017-06-15 1:49 UTC (permalink / raw)
To: Dan Carpenter
Cc: Andrew Morton, Minchan Kim, Vinayak Menon, Michal Hocko,
linux-mm, kernel-janitors
On Tue, 13 Jun 2017, Dan Carpenter wrote:
> We keep incrementing "spec" as we parse the args so we end up calling
> kfree() on a modified of spec. It probably works or this would have
> been caught in testing, but it looks weird.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: David Rientjes <rientjes@google.com>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-06-15 1:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-13 19:18 [PATCH] mm, vmpressure: free the same pointer we allocated Dan Carpenter
2017-06-13 19:18 ` Dan Carpenter
2017-06-15 1:49 ` David Rientjes
2017-06-15 1:49 ` David Rientjes
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.