cfm: Fix a memory allocation bug in cfm_get_remove_mpids().
authorGuolin Yang <gyang@nicira.com>
Wed, 4 Sep 2013 16:00:12 +0000 (09:00 -0700)
committerBen Pfaff <blp@nicira.com>
Wed, 4 Sep 2013 19:56:34 +0000 (12:56 -0700)
In cfm, when allocating the rmp array, the size is not calculated correctly
which cause the remote MPID not correctly updated in ovsdb.

This bug was introduced by commit 13b1b2ae70 (cfm: Make the CFM module
thread safe.).

Signed-off-by: Guolin Yang <gyang@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/cfm.c

index 297894e..4a46c05 100644 (file)
--- a/lib/cfm.c
+++ b/lib/cfm.c
@@ -862,7 +862,7 @@ cfm_get_remote_mpids(const struct cfm *cfm, uint64_t **rmps, size_t *n_rmps)
     OVS_EXCLUDED(mutex)
 {
     ovs_mutex_lock(&mutex);
-    *rmps = xmemdup(cfm->rmps_array, cfm->rmps_array_len);
+    *rmps = xmemdup(cfm->rmps_array, cfm->rmps_array_len * sizeof **rmps);
     *n_rmps = cfm->rmps_array_len;
     ovs_mutex_unlock(&mutex);
 }