Skip to contentSkip to conversation

block: sunvdc: add check for mdesc_grab()

PATCH Applied Liang He 2 participants 2 messages Mar 15, 2023 Block layer

lore
Share & tools
lore

Liang He

author
#0 lore raw

PATCH 1/1 block: sunvdc: add check for mdesc_grab()

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 43fdf27470b2 ("[SPARC64]: Abstract out mdesc accesses for better MD update handling.")
---
 drivers/block/sunvdc.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/block/sunvdc.c +3 -0
index fb855da971ee..d24a78199cdb 100644
@@ -973,6 +973,9 @@ static int vdc_port_probe(struct vio_dev *vdev, const struct vio_device_id *id)
 
 	hp = mdesc_grab();
 
+	if (!hp)
+		return -ENODEV;
+
 	err = -ENODEV;
 	if ((vdev->dev_no << PARTITION_SHIFT) & ~(u64)MINORMASK) {
 		printk(KERN_ERR PFX "Port id [%llu] too large.\n",
Signature · 1 line
2.25.1
maintainer Applied
#1 lore raw
Quoted 5 lines · Liang He

In vdc_port_probe(), we should check the return value of mdesc_grab() as it may return NULL, which can cause potential NPD bug.

Applied, thanks!

[1/1] block: sunvdc: add check for mdesc_grab()

      commit: 6030363199e3a6341afb467ddddbed56640cbf6a

Best regards,

Signature · 1 line
Jens Axboe