Re: [PATCH]dm_get_map: fix segfault when can't found target

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2022-05-27 at 14:35 -0500, Benjamin Marzinski wrote:
> On Fri, May 27, 2022 at 10:27:37AM +0800, Wu Guanghao wrote:
> > We got a segfault when we test multipath + iscsi.
> > 
> > (gdb) bt
> > #0  __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-
> > avx2.S:74
> > #1  0x00007f694306cd23 in __GI___strdup (s=0x0) at strdup.c:41
> > #2  0x00007f69433a147c in dm_get_map (name=0x55d4bc090320
> > "3600140537cde137ea8c43d8a971462c7",
> >     size=size@entry=0x55d4bc0270d8,
> > outparams=outparams@entry=0x7f6941add640) at devmapper.c:688
> > #3  0x00007f69433cbbdf in update_multipath_table
> > (mpp=mpp@entry=0x55d4bc026f30,
> >     pathvec=pathvec@entry=0x55d4bc063990, flags=flags@entry=0) at
> > structs_vec.c:426
> > #4  0x00007f69433cbfe5 in update_multipath_strings
> > (mpp=0x55d4bc026f30, pathvec=0x55d4bc063990)
> >     at structs_vec.c:526
> > #5  0x000055d4bb52e03e in check_path (vecs=0x55d4bbfad760,
> > pp=0x7f692402d270, ticks=<optimized out>)
> >     at main.c:2280
> > #6  0x000055d4bb52f3e2 in checkerloop (ap=0x55d4bbfad760) at
> > main.c:2542
> > #7  0x00007f694305b3ba in start_thread (arg=<optimized out>) at
> > pthread_create.c:443
> > #8  0x00007f69430ddb40 in clone3 () at
> > ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
> > (gdb) f 2
> > #2  0x00007f69433a147c in dm_get_map (name=0x55d4bc090320
> > "3600140537cde137ea8c43d8a971462c7",
> >     size=size@entry=0x55d4bc0270d8,
> > outparams=outparams@entry=0x7f6941add640) at devmapper.c:688
> > 688                     *outparams = strdup(params);
> > (gdb) l
> > 683                     *size = length;
> > 684     
> > 685             if (!outparams)
> > 686                     r = DMP_OK;
> > 687             else {
> > 688                     *outparams = strdup(params);
> > 689                     r = *outparams ? DMP_OK : DMP_ERR;
> > 690             }
> > 691     
> > 692     out:
> > (gdb) p params
> > $1 = 0x0
> > 
> > If can't found target, we should goto out
> > 
> > Signed-off-by: Wu Guanghao <wuguanghao3@xxxxxxxxxx>
> 
> Reviewed-by: Benjamin Marzinski <bmarzins@xxxxxxxxxx>

Reviewed-by: Martin Wilck <mwilck@xxxxxxxx>

Thanks! Note: We have two other callers of dm_get_next_target that
should add a similar check.

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/dm-devel





[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux