Skip to content

Commit f9bcdce

Browse files
windhlAlone0316
authored andcommitted
block: sunvdc: add check for mdesc_grab() returning NULL
[ Upstream commit 6030363199e3a6341afb467ddddbed56640cbf6a ] In vdc_port_probe(), we should check the return value of mdesc_grab() as it may return NULL, which can cause potential NPD bug. Fixes: 43fdf27 ("[SPARC64]: Abstract out mdesc accesses for better MD update handling.") Signed-off-by: Liang He <windhl@126.com> Link: https://lore.kernel.org/r/20230315062032.1741692-1-windhl@126.com [axboe: style cleanup] Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent e22e780 commit f9bcdce

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/block/sunvdc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -874,6 +874,8 @@ static int vdc_port_probe(struct vio_dev *vdev, const struct vio_device_id *id)
874874
print_version();
875875

876876
hp = mdesc_grab();
877+
if (!hp)
878+
return -ENODEV;
877879

878880
err = -ENODEV;
879881
if ((vdev->dev_no << PARTITION_SHIFT) & ~(u64)MINORMASK) {

0 commit comments

Comments
 (0)