* [opensm] [PATCH 1/2] Fix segfault corner case
@ 2011-11-10 18:01 Albert Chu
[not found] ` <1320948093.22519.337.camel-akkeaxHeDKRliZ7u+bvwcg@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Albert Chu @ 2011-11-10 18:01 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
On rescan, data segment memory could be attempted to be freed by
config file parsing code.
Signed-off-by: Albert L. Chu <chu11-i2BcT+NCU+M@public.gmane.org>
---
opensm/osm_subnet.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/opensm/osm_subnet.c b/opensm/osm_subnet.c
index 554a950..c8a8add 100644
--- a/opensm/osm_subnet.c
+++ b/opensm/osm_subnet.c
@@ -1159,7 +1159,7 @@ int osm_subn_verify_config(IN osm_subn_opt_t * p_opts)
log_report(" Invalid Cached Option Value:console = %s"
", Using Default:%s\n",
p_opts->console, OSM_DEFAULT_CONSOLE);
- p_opts->console = OSM_DEFAULT_CONSOLE;
+ p_opts->console = strdup(OSM_DEFAULT_CONSOLE);
}
if (p_opts->qos) {
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [opensm] [PATCH 1/2] Fix segfault corner case
[not found] ` <1320948093.22519.337.camel-akkeaxHeDKRliZ7u+bvwcg@public.gmane.org>
@ 2011-11-11 12:19 ` Alex Netes
[not found] ` <20111111121957.GA2968-iQai9MGU/dze+A/uUDamNg@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Alex Netes @ 2011-11-11 12:19 UTC (permalink / raw)
To: Albert Chu; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA
Hi Al,
On 10:01 Thu 10 Nov , Albert Chu wrote:
> On rescan, data segment memory could be attempted to be freed by
> config file parsing code.
>
> Signed-off-by: Albert L. Chu <chu11-i2BcT+NCU+M@public.gmane.org>
> ---
> opensm/osm_subnet.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/opensm/osm_subnet.c b/opensm/osm_subnet.c
> index 554a950..c8a8add 100644
> --- a/opensm/osm_subnet.c
> +++ b/opensm/osm_subnet.c
> @@ -1159,7 +1159,7 @@ int osm_subn_verify_config(IN osm_subn_opt_t * p_opts)
> log_report(" Invalid Cached Option Value:console = %s"
> ", Using Default:%s\n",
> p_opts->console, OSM_DEFAULT_CONSOLE);
> - p_opts->console = OSM_DEFAULT_CONSOLE;
> + p_opts->console = strdup(OSM_DEFAULT_CONSOLE);
If console is set to a wrong value, you get some memory leak here, because
strdup() allocates new buffer and the old one is never free.
> }
>
> if (p_opts->qos) {
> --
> 1.7.1
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
-- Alex
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [opensm] [PATCH 1/2] Fix segfault corner case
[not found] ` <20111111121957.GA2968-iQai9MGU/dze+A/uUDamNg@public.gmane.org>
@ 2011-11-11 17:58 ` Albert Chu
[not found] ` <1321034297.22519.376.camel-akkeaxHeDKRliZ7u+bvwcg@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Albert Chu @ 2011-11-11 17:58 UTC (permalink / raw)
To: Alex Netes; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
On Fri, 2011-11-11 at 04:19 -0800, Alex Netes wrote:
> Hi Al,
>
> On 10:01 Thu 10 Nov , Albert Chu wrote:
> > On rescan, data segment memory could be attempted to be freed by
> > config file parsing code.
> >
> > Signed-off-by: Albert L. Chu <chu11-i2BcT+NCU+M@public.gmane.org>
> > ---
> > opensm/osm_subnet.c | 2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/opensm/osm_subnet.c b/opensm/osm_subnet.c
> > index 554a950..c8a8add 100644
> > --- a/opensm/osm_subnet.c
> > +++ b/opensm/osm_subnet.c
> > @@ -1159,7 +1159,7 @@ int osm_subn_verify_config(IN osm_subn_opt_t * p_opts)
> > log_report(" Invalid Cached Option Value:console = %s"
> > ", Using Default:%s\n",
> > p_opts->console, OSM_DEFAULT_CONSOLE);
> > - p_opts->console = OSM_DEFAULT_CONSOLE;
> > + p_opts->console = strdup(OSM_DEFAULT_CONSOLE);
>
> If console is set to a wrong value, you get some memory leak here, because
> strdup() allocates new buffer and the old one is never free.
Doh! You're right. I guess that mem-leak has been there for quite some
time. I'll add that fix and repost.
Al
> > }
> >
> > if (p_opts->qos) {
> > --
> > 1.7.1
> >
> >
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> > the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Albert Chu
chu11-i2BcT+NCU+M@public.gmane.org
Computer Scientist
High Performance Systems Division
Lawrence Livermore National Laboratory
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [opensm] [PATCH 1/2] Fix memleak and segfault
[not found] ` <1321034297.22519.376.camel-akkeaxHeDKRliZ7u+bvwcg@public.gmane.org>
@ 2011-11-11 18:04 ` Albert Chu
[not found] ` <1321034692.22519.382.camel-akkeaxHeDKRliZ7u+bvwcg@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Albert Chu @ 2011-11-11 18:04 UTC (permalink / raw)
To: Alex Netes; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
If invalid input specified by user, memory would not be freed.
On rescan with new value, data segment memory could be attempted
to be freed.
Signed-off-by: Albert L. Chu <chu11-i2BcT+NCU+M@public.gmane.org>
---
opensm/osm_subnet.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/opensm/osm_subnet.c b/opensm/osm_subnet.c
index 554a950..9845edd 100644
--- a/opensm/osm_subnet.c
+++ b/opensm/osm_subnet.c
@@ -1159,7 +1159,8 @@ int osm_subn_verify_config(IN osm_subn_opt_t * p_opts)
log_report(" Invalid Cached Option Value:console = %s"
", Using Default:%s\n",
p_opts->console, OSM_DEFAULT_CONSOLE);
- p_opts->console = OSM_DEFAULT_CONSOLE;
+ free(p_opts->console);
+ p_opts->console = strdup(OSM_DEFAULT_CONSOLE);
}
if (p_opts->qos) {
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [opensm] [PATCH 1/2] Fix memleak and segfault
[not found] ` <1321034692.22519.382.camel-akkeaxHeDKRliZ7u+bvwcg@public.gmane.org>
@ 2012-01-10 16:26 ` Alex Netes
0 siblings, 0 replies; 5+ messages in thread
From: Alex Netes @ 2012-01-10 16:26 UTC (permalink / raw)
To: Albert Chu; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Hi Al,
On 10:04 Fri 11 Nov , Albert Chu wrote:
> If invalid input specified by user, memory would not be freed.
>
> On rescan with new value, data segment memory could be attempted
> to be freed.
>
> Signed-off-by: Albert L. Chu <chu11-i2BcT+NCU+M@public.gmane.org>
> ---
Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-01-10 16:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-10 18:01 [opensm] [PATCH 1/2] Fix segfault corner case Albert Chu
[not found] ` <1320948093.22519.337.camel-akkeaxHeDKRliZ7u+bvwcg@public.gmane.org>
2011-11-11 12:19 ` Alex Netes
[not found] ` <20111111121957.GA2968-iQai9MGU/dze+A/uUDamNg@public.gmane.org>
2011-11-11 17:58 ` Albert Chu
[not found] ` <1321034297.22519.376.camel-akkeaxHeDKRliZ7u+bvwcg@public.gmane.org>
2011-11-11 18:04 ` [opensm] [PATCH 1/2] Fix memleak and segfault Albert Chu
[not found] ` <1321034692.22519.382.camel-akkeaxHeDKRliZ7u+bvwcg@public.gmane.org>
2012-01-10 16:26 ` Alex Netes
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox