From nobody Thu Oct 6 10:49:25 2022 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Mjp920VDhz4fYJC for ; Thu, 6 Oct 2022 10:49:26 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Mjp914qLsz43dD for ; Thu, 6 Oct 2022 10:49:25 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Mjp913nx7zDnG for ; Thu, 6 Oct 2022 10:49:25 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 296AnP80007608 for ; Thu, 6 Oct 2022 10:49:25 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 296AnPZ5007607 for bugs@FreeBSD.org; Thu, 6 Oct 2022 10:49:25 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 266862] devctl getpath cause panic invoking with root0 Date: Thu, 06 Oct 2022 10:49:25 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: takawata@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665053365; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=x+h1dSDVfjMFQA4qkB7MBtM6FDh7wbXMFqYQIOg/lVg=; b=P1a0oDUTzBNuWWEzVY42R381Wiksx4m+drsTxuuUQqSvRmZRV3teIElf+TQTRFYLF8FVCU esMpIl7jHaSUtbPCdcQy84IZlfH/dbPVbhLovE7PNG20sHMsnn0h4fjBehr2+LaxMgkQj2 Y14q0QTVjH4MVnUOfjs7B3A2rJCcbD/lVqOvnmjkXzqIsTvG2/aLCPCrcwd4K3TOwXoL8f jtgSTJ02021jdJoDZhzSQs9ONr3ZMQ2fHFQj/Ot/qDS1brDWkpQqnfSIGe/eBxrJfX/odJ WKI/ntBKB/mfvJOqJPW02NoXMIQMvpsi+ur+rigZN4LeakZxGxrQaGAFWd2UbQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1665053365; a=rsa-sha256; cv=none; b=M5/OvXY6vjtpSzQe04ym4xn/OmCYfH2h9SqmwxZd8ERF2h9XtntVs+ubNn2kzeS3ifMpe8 TmNCvCbs3/PmoOYvi/nYWjaSV4xZddzWf5PZ2m5jQRWINuBbX2XqdNCGUQySrei/B/4uGT jcpJGObTJcgKRHz13aH7hekW2D1cRpXA2Uzp06qf81h6MGH98Z06MFE7dDkKhroK/oY17w rSWVUTBjSEVImg3qplzyF/ODEzDZC8Xxep8mbL6wfmbnZjHvSsJ6H/eDHfuxv1ikTuuRVb Z5EdkOEGSmu8mLuaeZBPRxp+CIhjlhRvxEGkbdF3p3TuqA20/KOc9KDueomp6g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D266862 --- Comment #1 from Takanori Watanabe --- The code was not be compiled. Correct code is as follows.=20 With this patch,=20 % devctl devpath FreeBSD root0 does not cause panic and show error message, as I expected. devctl: Failed to get path via FreeBSD to root0: Cannot allocate memory diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 487e573451ed..041e77259313 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -5310,13 +5310,9 @@ device_get_path(device_t dev, const char *locator) ssize_t len; char *rv =3D NULL; int error; - device_t parent =3D device_get_parent(dev); - - if(parent =3D=3D NULL) - return rv; sb =3D sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND | SBUF_INCLUDENUL); - error =3D BUS_GET_DEVICE_PATH(parent, dev, locator, sb); + error =3D BUS_GET_DEVICE_PATH(device_get_parent(dev), dev, locator,= sb); sbuf_finish(sb); /* Note: errors checked with sbuf_len() bel= ow */ if (error !=3D 0) goto out; --=20 You are receiving this mail because: You are the assignee for the bug.=