* [PATCH 1/1] libmultipath: fix segfault when vector is null
@ 2013-01-08 19:36 michaelc
2013-01-08 23:45 ` Christophe Varoqui
0 siblings, 1 reply; 2+ messages in thread
From: michaelc @ 2013-01-08 19:36 UTC (permalink / raw)
To: dm-devel, christophe.varoqui
From: Mike Christie <michaelc@cs.wisc.edu>
While performing tests that caused paths to get added
and deleted, we hit a segfault. We traced it to the
vector struct being NULL. This patch fixes the problem
by checking for a NULL vector before accessing it.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
---
libmultipath/vector.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libmultipath/vector.c b/libmultipath/vector.c
index 652f118..0564224 100644
--- a/libmultipath/vector.c
+++ b/libmultipath/vector.c
@@ -94,6 +94,9 @@ find_slot(vector v, void * addr)
{
int i;
+ if (!v)
+ return -1;
+
for (i = 0; i < (v->allocated / VECTOR_DEFAULT_SIZE); i++)
if (v->slot[i] == addr)
return i;
--
1.7.11.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] libmultipath: fix segfault when vector is null
2013-01-08 19:36 [PATCH 1/1] libmultipath: fix segfault when vector is null michaelc
@ 2013-01-08 23:45 ` Christophe Varoqui
0 siblings, 0 replies; 2+ messages in thread
From: Christophe Varoqui @ 2013-01-08 23:45 UTC (permalink / raw)
To: michaelc; +Cc: dm-devel
On mar., 2013-01-08 at 13:36 -0600, michaelc@cs.wisc.edu wrote:
> From: Mike Christie <michaelc@cs.wisc.edu>
>
> While performing tests that caused paths to get added
> and deleted, we hit a segfault. We traced it to the
> vector struct being NULL. This patch fixes the problem
> by checking for a NULL vector before accessing it.
>
Applied.
Thanks,
Christophe Varoqui
www.opensvc.com
> Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
> ---
> libmultipath/vector.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/libmultipath/vector.c b/libmultipath/vector.c
> index 652f118..0564224 100644
> --- a/libmultipath/vector.c
> +++ b/libmultipath/vector.c
> @@ -94,6 +94,9 @@ find_slot(vector v, void * addr)
> {
> int i;
>
> + if (!v)
> + return -1;
> +
> for (i = 0; i < (v->allocated / VECTOR_DEFAULT_SIZE); i++)
> if (v->slot[i] == addr)
> return i;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-01-08 23:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-08 19:36 [PATCH 1/1] libmultipath: fix segfault when vector is null michaelc
2013-01-08 23:45 ` Christophe Varoqui
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox