[Devel] [PATCH RH7 3/4] ploop: possible NULL pointer dereference in ploop_thaw

Kirill Tkhai ktkhai at virtuozzo.com
Mon Jun 1 11:23:10 MSK 2020


On 31.05.2020 16:23, Vasily Averin wrote:
> found by smatch:
> drivers/block/ploop/dev.c:5334 ploop_thaw() error:
>  we previously assumed 'bdev' could be null (see line 5318)
> 
> Signed-off-by: Vasily Averin <vvs at virtuozzo.com>

Reviewed-by: Kirill Tkhai <ktkhai at virtuozzo.com>

> ---
>  drivers/block/ploop/dev.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
> index da124fa..ca94bf5 100644
> --- a/drivers/block/ploop/dev.c
> +++ b/drivers/block/ploop/dev.c
> @@ -5327,6 +5327,9 @@ static int ploop_thaw(struct ploop_device *plo)
>  	if (plo->freeze_state == PLOOP_F_THAWING)
>  		return -EBUSY;
>  
> +	if (!bdev)
> +		return -EINVAL;
> +
>  	plo->frozen_bdev = NULL;
>  	plo->freeze_state = PLOOP_F_THAWING;
>  
> 



More information about the Devel mailing list