[dm-devel] [PATCH V6 11/14] mpathpersist: check whether malloc paramp->trnptid_list fails in handle_args func

Martin Wilck mwilck at suse.com
Mon Sep 21 08:56:45 UTC 2020


On Sat, 2020-09-19 at 18:28 +0800, lixiaokeng wrote:
> In handle_args func, we donot check whether malloc paramp and
> each paramp->trnptid_list[j] fails before using them, it may
> cause access NULL pointer.
> 
> Here, we add alloc_prout_param_descriptor to allocate and init
> paramp, and we add free_prout_param_descriptor to free paramp
> and each paramp->trnptid_list[j].
> 
> We change num_transport to num_transportids to combine them.
> 
> Signed-off-by: Zhiqiang Liu <liuzhiqiang26 at huawei.com>
> Signed-off-by: lixiaokeng <lixiaokeng at huawei.com>
> ---
>  mpathpersist/main.c | 64 ++++++++++++++++++++++++++++++++++---------
> --
>  1 file changed, 49 insertions(+), 15 deletions(-)
> 

OK. So your v5 patch wasn't wrong either, as you did set
num_transportids twice. I admit I missed that. But it's better now
anyway. 

Actually, I would have preferred if you solved the issue the other way
around, by moving the assignment to num_transportids to after the
memset() in alloc_prout_param_descriptor(). But it's not worth forcing
you into yet another iteration, so:

Reviewed-by: Martin Wilck <mwilck at suse.com>

This means the whole series (except 8/14 which had been taken back) is
acked now, and I'll push it to the upstream-queue branch.

Martin





More information about the dm-devel mailing list