[dm-devel] [PATCH 7/7] multipathd: Fix a use-after-free
Hannes Reinecke
hare at suse.de
Thu Jul 28 13:45:19 UTC 2016
On 07/27/2016 11:14 PM, Bart Van Assche wrote:
> Avoid that Valgrind reports the following:
>
> Invalid read of size 4
> at 0x40C7AE: child (main.c:2382)
> by 0x40D2DC: main (main.c:2608)
> Address 0x7ed255c is 76 bytes inside a block of size 416 free'd
> at 0x4C2E38B: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
> by 0x5DD37ED: free_config (config.c:539)
> by 0x40B76C: rcu_free_config (main.c:1987)
> by 0x4E3C1FF: call_rcu_thread (urcu-call-rcu-impl.h:332)
> by 0x5047473: start_thread (pthread_create.c:333)
> by 0x671C3EC: clone (clone.S:109)
> Block was alloc'd at
> at 0x4C2D12F: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
> by 0x5DC7D9B: zalloc (memory.c:41)
> by 0x5DD34D7: alloc_config (config.c:472)
> by 0x5DD3A87: load_config (config.c:582)
> by 0x40BF98: child (main.c:2246)
> by 0x40D2DC: main (main.c:2608)
>
> Signed-off-by: Bart Van Assche <bart.vanassche at sandisk.com>
> ---
> multipathd/main.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/multipathd/main.c b/multipathd/main.c
> index f4c8245..6a4135c 100644
> --- a/multipathd/main.c
> +++ b/multipathd/main.c
> @@ -2376,9 +2376,11 @@ child (void * param)
> }
>
> lock(vecs->lock);
> + conf = get_multipath_config();
> if (conf->queue_without_daemon == QUE_NO_DAEMON_OFF)
> vector_foreach_slot(vecs->mpvec, mpp, i)
> dm_queue_if_no_path(mpp->alias, 0);
> + put_multipath_config(conf);
> remove_maps_and_stop_waiters(vecs);
> unlock(vecs->lock);
>
>
This one is already included in my patch 'multipathd: Correctly
invalidate configuration during shutdown', which also contains some
additional fixes for RCU config access.
I would prefer taking that instead of this patch.
Cheers,
Hannes
--
Dr. Hannes Reinecke Teamlead Storage & Networking
hare at suse.de +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
More information about the dm-devel
mailing list