Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c4fcfbf8 authored by Liang He's avatar Liang He Committed by Greg Kroah-Hartman
Browse files

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: 43fdf274 ("[SPARC64]: Abstract out mdesc accesses for better MD update handling.")
Signed-off-by: default avatarLiang He <windhl@126.com>
Link: https://lore.kernel.org/r/20230315062032.1741692-1-windhl@126.com


[axboe: style cleanup]
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 04c39420
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -983,6 +983,8 @@ static int vdc_port_probe(struct vio_dev *vdev, const struct vio_device_id *id)
	print_version();

	hp = mdesc_grab();
	if (!hp)
		return -ENODEV;

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