git: efa78078be9d - stable/15 - stand: Try to parse vdisk correctly

From: Warner Losh <imp_at_FreeBSD.org>
Date: Tue, 13 Jan 2026 17:48:04 UTC
The branch stable/15 has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=efa78078be9dceb19655cf6dc4f400b1db940cc5

commit efa78078be9dceb19655cf6dc4f400b1db940cc5
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2025-11-11 00:41:52 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2026-01-13 17:28:56 +0000

    stand: Try to parse vdisk correctly
    
    PR:                     289306
    Sponsored by:           Netflix
    Reviewed by:            dab
    MFC After:              5 days
    Differential Revision:  https://reviews.freebsd.org/D52500
    
    (cherry picked from commit d18ed8e19c3cb264340987bdc191615108d8413a)
---
 stand/common/disk.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/stand/common/disk.c b/stand/common/disk.c
index c1650f0fa1ec..47f882d5a532 100644
--- a/stand/common/disk.c
+++ b/stand/common/disk.c
@@ -417,7 +417,18 @@ disk_parsedev(struct devdesc **idev, const char *devspec, const char **path)
 	char *cp;
 	struct disk_devdesc *dev;
 
-	np = devspec + 4;	/* Skip the leading 'disk' */
+	/*
+	 * disk names look approximately like:
+	 *	v?disk([0-9]+(p[0-9]+|s[a-z])?)?:
+	 * so skip over the initial bit. We don't have access to the devsw
+	 * to check the name.
+	 */
+	if (strncmp(devspec, "disk", 4) == 0)
+		np = devspec + 4;
+	else if (strncmp(devspec, "vdisk", 5) == 0)
+		np = devspec + 5;
+	else
+		return (EINVAL);
 	unit = -1;
 	/*
 	 * If there is path/file info after the device info, then any missing