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

Vasily Averin vvs at virtuozzo.com
Sun May 31 16:23:34 MSK 2020


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>
---
 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;
 
-- 
1.8.3.1



More information about the Devel mailing list