* [patch] cgroups: save space for the terminator
@ 2010-07-10 10:54 ` Dan Carpenter
0 siblings, 0 replies; 9+ messages in thread
From: Dan Carpenter @ 2010-07-10 10:54 UTC (permalink / raw)
To: Paul Menage
Cc: Li Zefan, Andrew Morton, KAMEZAWA Hiroyuki, Ben Blum, containers,
linux-kernel, kernel-janitors
The original code didn't leave enough space for a NULL terminator.
These strings are copied with strcpy() into fixed length buffers in
cgroup_root_from_opts().
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 3ac6f5b..a942820 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1102,7 +1102,7 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
if (opts->release_agent)
return -EINVAL;
opts->release_agent - kstrndup(token + 14, PATH_MAX, GFP_KERNEL);
+ kstrndup(token + 14, PATH_MAX - 1, GFP_KERNEL);
if (!opts->release_agent)
return -ENOMEM;
} else if (!strncmp(token, "name=", 5)) {
@@ -1123,7 +1123,7 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
if (opts->name)
return -EINVAL;
opts->name = kstrndup(name,
- MAX_CGROUP_ROOT_NAMELEN,
+ MAX_CGROUP_ROOT_NAMELEN - 1,
GFP_KERNEL);
if (!opts->name)
return -ENOMEM;
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [patch] cgroups: save space for the terminator
@ 2010-07-10 10:54 ` Dan Carpenter
0 siblings, 0 replies; 9+ messages in thread
From: Dan Carpenter @ 2010-07-10 10:54 UTC (permalink / raw)
To: Paul Menage
Cc: Li Zefan, Andrew Morton, KAMEZAWA Hiroyuki, Ben Blum, containers,
linux-kernel, kernel-janitors
The original code didn't leave enough space for a NULL terminator.
These strings are copied with strcpy() into fixed length buffers in
cgroup_root_from_opts().
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 3ac6f5b..a942820 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1102,7 +1102,7 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
if (opts->release_agent)
return -EINVAL;
opts->release_agent =
- kstrndup(token + 14, PATH_MAX, GFP_KERNEL);
+ kstrndup(token + 14, PATH_MAX - 1, GFP_KERNEL);
if (!opts->release_agent)
return -ENOMEM;
} else if (!strncmp(token, "name=", 5)) {
@@ -1123,7 +1123,7 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
if (opts->name)
return -EINVAL;
opts->name = kstrndup(name,
- MAX_CGROUP_ROOT_NAMELEN,
+ MAX_CGROUP_ROOT_NAMELEN - 1,
GFP_KERNEL);
if (!opts->name)
return -ENOMEM;
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [patch] cgroups: save space for the terminator
@ 2010-07-10 10:54 Dan Carpenter
0 siblings, 0 replies; 9+ messages in thread
From: Dan Carpenter @ 2010-07-10 10:54 UTC (permalink / raw)
To: Paul Menage
Cc: Ben Blum, kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Andrew Morton
The original code didn't leave enough space for a NULL terminator.
These strings are copied with strcpy() into fixed length buffers in
cgroup_root_from_opts().
Signed-off-by: Dan Carpenter <error27-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 3ac6f5b..a942820 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1102,7 +1102,7 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
if (opts->release_agent)
return -EINVAL;
opts->release_agent =
- kstrndup(token + 14, PATH_MAX, GFP_KERNEL);
+ kstrndup(token + 14, PATH_MAX - 1, GFP_KERNEL);
if (!opts->release_agent)
return -ENOMEM;
} else if (!strncmp(token, "name=", 5)) {
@@ -1123,7 +1123,7 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
if (opts->name)
return -EINVAL;
opts->name = kstrndup(name,
- MAX_CGROUP_ROOT_NAMELEN,
+ MAX_CGROUP_ROOT_NAMELEN - 1,
GFP_KERNEL);
if (!opts->name)
return -ENOMEM;
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [patch] cgroups: save space for the terminator
2010-07-10 10:54 ` Dan Carpenter
(?)
(?)
@ 2010-07-12 0:10 ` Serge E. Hallyn
-1 siblings, 0 replies; 9+ messages in thread
From: Serge E. Hallyn @ 2010-07-12 0:10 UTC (permalink / raw)
To: Dan Carpenter, Paul Menage, Li Zefan, Andrew Morton
Quoting Dan Carpenter (error27-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org):
> The original code didn't leave enough space for a NULL terminator.
> These strings are copied with strcpy() into fixed length buffers in
> cgroup_root_from_opts().
>
> Signed-off-by: Dan Carpenter <error27-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Hmm, yes - the fact that kstrndup() allocs len+1 probably threw off
the author of these original lines. Thanks for spotting this!
Acked-by: Serge E. Hallyn <serge-A9i7LUbDfNHQT0dZR+AlfA@public.gmane.org>
> diff --git a/kernel/cgroup.c b/kernel/cgroup.c
> index 3ac6f5b..a942820 100644
> --- a/kernel/cgroup.c
> +++ b/kernel/cgroup.c
> @@ -1102,7 +1102,7 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
> if (opts->release_agent)
> return -EINVAL;
> opts->release_agent =
> - kstrndup(token + 14, PATH_MAX, GFP_KERNEL);
> + kstrndup(token + 14, PATH_MAX - 1, GFP_KERNEL);
> if (!opts->release_agent)
> return -ENOMEM;
> } else if (!strncmp(token, "name=", 5)) {
> @@ -1123,7 +1123,7 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
> if (opts->name)
> return -EINVAL;
> opts->name = kstrndup(name,
> - MAX_CGROUP_ROOT_NAMELEN,
> + MAX_CGROUP_ROOT_NAMELEN - 1,
> GFP_KERNEL);
> if (!opts->name)
> return -ENOMEM;
> _______________________________________________
> Containers mailing list
> Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
> https://lists.linux-foundation.org/mailman/listinfo/containers
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [patch] cgroups: save space for the terminator
2010-07-10 10:54 ` Dan Carpenter
@ 2010-07-12 0:10 ` Serge E. Hallyn
-1 siblings, 0 replies; 9+ messages in thread
From: Serge E. Hallyn @ 2010-07-12 0:10 UTC (permalink / raw)
To: Dan Carpenter, Paul Menage, Li Zefan, Andrew Morton,
KAMEZAWA Hiroyuki, Ben Blum, containers, linux-kernel,
kernel-janitors
Quoting Dan Carpenter (error27@gmail.com):
> The original code didn't leave enough space for a NULL terminator.
> These strings are copied with strcpy() into fixed length buffers in
> cgroup_root_from_opts().
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
Hmm, yes - the fact that kstrndup() allocs len+1 probably threw off
the author of these original lines. Thanks for spotting this!
Acked-by: Serge E. Hallyn <serge@hallyn.com>
> diff --git a/kernel/cgroup.c b/kernel/cgroup.c
> index 3ac6f5b..a942820 100644
> --- a/kernel/cgroup.c
> +++ b/kernel/cgroup.c
> @@ -1102,7 +1102,7 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
> if (opts->release_agent)
> return -EINVAL;
> opts->release_agent > - kstrndup(token + 14, PATH_MAX, GFP_KERNEL);
> + kstrndup(token + 14, PATH_MAX - 1, GFP_KERNEL);
> if (!opts->release_agent)
> return -ENOMEM;
> } else if (!strncmp(token, "name=", 5)) {
> @@ -1123,7 +1123,7 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
> if (opts->name)
> return -EINVAL;
> opts->name = kstrndup(name,
> - MAX_CGROUP_ROOT_NAMELEN,
> + MAX_CGROUP_ROOT_NAMELEN - 1,
> GFP_KERNEL);
> if (!opts->name)
> return -ENOMEM;
> _______________________________________________
> Containers mailing list
> Containers@lists.linux-foundation.org
> https://lists.linux-foundation.org/mailman/listinfo/containers
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [patch] cgroups: save space for the terminator
@ 2010-07-12 0:10 ` Serge E. Hallyn
0 siblings, 0 replies; 9+ messages in thread
From: Serge E. Hallyn @ 2010-07-12 0:10 UTC (permalink / raw)
To: Dan Carpenter, Paul Menage, Li Zefan, Andrew Morton,
KAMEZAWA Hiroyuki, Ben Blum, containers, linux-kernel,
kernel-janitors
Quoting Dan Carpenter (error27@gmail.com):
> The original code didn't leave enough space for a NULL terminator.
> These strings are copied with strcpy() into fixed length buffers in
> cgroup_root_from_opts().
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
Hmm, yes - the fact that kstrndup() allocs len+1 probably threw off
the author of these original lines. Thanks for spotting this!
Acked-by: Serge E. Hallyn <serge@hallyn.com>
> diff --git a/kernel/cgroup.c b/kernel/cgroup.c
> index 3ac6f5b..a942820 100644
> --- a/kernel/cgroup.c
> +++ b/kernel/cgroup.c
> @@ -1102,7 +1102,7 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
> if (opts->release_agent)
> return -EINVAL;
> opts->release_agent =
> - kstrndup(token + 14, PATH_MAX, GFP_KERNEL);
> + kstrndup(token + 14, PATH_MAX - 1, GFP_KERNEL);
> if (!opts->release_agent)
> return -ENOMEM;
> } else if (!strncmp(token, "name=", 5)) {
> @@ -1123,7 +1123,7 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
> if (opts->name)
> return -EINVAL;
> opts->name = kstrndup(name,
> - MAX_CGROUP_ROOT_NAMELEN,
> + MAX_CGROUP_ROOT_NAMELEN - 1,
> GFP_KERNEL);
> if (!opts->name)
> return -ENOMEM;
> _______________________________________________
> Containers mailing list
> Containers@lists.linux-foundation.org
> https://lists.linux-foundation.org/mailman/listinfo/containers
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [patch] cgroups: save space for the terminator
2010-07-10 10:54 ` Dan Carpenter
` (2 preceding siblings ...)
(?)
@ 2010-07-12 0:23 ` KAMEZAWA Hiroyuki
-1 siblings, 0 replies; 9+ messages in thread
From: KAMEZAWA Hiroyuki @ 2010-07-12 0:23 UTC (permalink / raw)
To: Dan Carpenter
Cc: Ben Blum, kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
Andrew-FOgKQjlUJ6BQetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Paul Menage, Morton
On Sat, 10 Jul 2010 12:54:29 +0200
Dan Carpenter <error27-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> The original code didn't leave enough space for a NULL terminator.
> These strings are copied with strcpy() into fixed length buffers in
> cgroup_root_from_opts().
>
> Signed-off-by: Dan Carpenter <error27-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>
Nice!,
Reviewd-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [patch] cgroups: save space for the terminator
2010-07-10 10:54 ` Dan Carpenter
@ 2010-07-12 0:23 ` KAMEZAWA Hiroyuki
-1 siblings, 0 replies; 9+ messages in thread
From: KAMEZAWA Hiroyuki @ 2010-07-12 0:23 UTC (permalink / raw)
To: Dan Carpenter
Cc: Paul Menage, Li Zefan, Andrew Morton, Ben Blum, containers,
linux-kernel, kernel-janitors
On Sat, 10 Jul 2010 12:54:29 +0200
Dan Carpenter <error27@gmail.com> wrote:
> The original code didn't leave enough space for a NULL terminator.
> These strings are copied with strcpy() into fixed length buffers in
> cgroup_root_from_opts().
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
>
Nice!,
Reviewd-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [patch] cgroups: save space for the terminator
@ 2010-07-12 0:23 ` KAMEZAWA Hiroyuki
0 siblings, 0 replies; 9+ messages in thread
From: KAMEZAWA Hiroyuki @ 2010-07-12 0:23 UTC (permalink / raw)
To: Dan Carpenter
Cc: Paul Menage, Li Zefan, Andrew Morton, Ben Blum, containers,
linux-kernel, kernel-janitors
On Sat, 10 Jul 2010 12:54:29 +0200
Dan Carpenter <error27@gmail.com> wrote:
> The original code didn't leave enough space for a NULL terminator.
> These strings are copied with strcpy() into fixed length buffers in
> cgroup_root_from_opts().
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
>
Nice!,
Reviewd-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2010-07-12 0:28 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-10 10:54 [patch] cgroups: save space for the terminator Dan Carpenter
2010-07-10 10:54 ` Dan Carpenter
2010-07-12 0:10 ` Serge E. Hallyn
2010-07-12 0:10 ` Serge E. Hallyn
2010-07-12 0:10 ` Serge E. Hallyn
2010-07-12 0:23 ` KAMEZAWA Hiroyuki
2010-07-12 0:23 ` KAMEZAWA Hiroyuki
2010-07-12 0:23 ` KAMEZAWA Hiroyuki
-- strict thread matches above, loose matches on Subject: below --
2010-07-10 10:54 Dan Carpenter
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.