From nobody Fri Jun 02 16:57:34 2023 X-Original-To: dev-commits-src-all@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 4QXq1V2kBNz4Z4pY; Fri, 2 Jun 2023 16:57:34 +0000 (UTC) (envelope-from git@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 4QXq1V2HHXz3QDX; Fri, 2 Jun 2023 16:57:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1685725054; 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; bh=cxOe5jrVP2znwznTY5z0XTiEjDjR+SIZ08zjmL1lxAo=; b=hF85PFWEXt0qwVYNYcYVuYe84k/R4o7QDw9pgO0Z8G9IE09cP6p3tH45rvuozYtXm2TrVB nRcZkPjYWKNI2aqlRB85tpWYytJwuRu/ItpvmfI50beM8ORxfYFRQmCNmvgi0NehYkvez4 1fr/89eS42Ur4NxL9mDxO+exgyWrzfYXFF15+E7/D8COT7NMret03D7QtO3YLrD/zji/R4 cykl/9uL1dXq43VuFJst9RxUzY2Sylf7AjgVdcOplV6EwoHyqbFDHods+zTQpXF8qq6ZgL U25+oMntdgHDNWqj2uU3Xku2enveVeIFXB4VbgbDot86YcV4CQ1XtO3eO4RJMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1685725054; 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; bh=cxOe5jrVP2znwznTY5z0XTiEjDjR+SIZ08zjmL1lxAo=; b=X1+OKBabuTEUxIOn7FJu3wsKq4fVT/4BQQEzNS4ud/Llf4Dkt77A0NcPvkHPPo9/R5t+X8 ihTpZ8sMRRzc7OJZ409Chr8hfpubz+IfgoxCTIhBF1sA4LrIQeOPyn2Mf1HtbjkVkuwXP0 6++Uh7DfIOBtN+0x+aSHunJWfi1EthmYhypgbgxvgpepbs7IvAFUGplwTarlRgt3vTrgNe rYbGjMtX76QTcBdqDDDGF4jU4qnUZ5E6+lwic5Mssxme0kPILQe+MM4N0Hmsw20O9HzjuQ 8RORQwSFaTlZC7MrWaexZOJ6jC6blJzfUQy62Wh/+abQwFs8aHpgQrXwAwsVCA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1685725054; a=rsa-sha256; cv=none; b=Ij7xArfBwQ4MibZg20lX+Z49JbCS2fgd3SAZYzcbCDPwLZKoB3i/OLAfBuqnFKtjh1yBYI DVrCcTxK6Et3RxPKmhfgkk9xWUsSUBo7GgYjo7Sc4JnCoL3PUwYg93UbE5NRF7MD3PQ7zE 54ibmJbsowBAq8Ap3Mbkx/AEeW90NB8r39e/HKKIBfw7jefr0P2buSDRZUCY6JhQrpedaV jkCciNUUlSDZTTmzWrfcnA/D8GH8WbyZP9JHNExkjmTlP3+Jg0akOX/0f99PXW2e3BOPv5 /QYm281nZgnEsFYEuqhBVTM0y5luwYvZ2eDv9zj2B16HfL26eRIEdb8EvXeyEw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 4QXq1V1MF7z15xv; Fri, 2 Jun 2023 16:57:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 352GvY5U025465; Fri, 2 Jun 2023 16:57:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 352GvYes025464; Fri, 2 Jun 2023 16:57:34 GMT (envelope-from git) Date: Fri, 2 Jun 2023 16:57:34 GMT Message-Id: <202306021657.352GvYes025464@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 30ff1255fcd6 - main - Fix panic in nfs bootp/diskless after 0785c323f3. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 30ff1255fcd6fc2cdb96924d3185dd7fa6c31c68 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=30ff1255fcd6fc2cdb96924d3185dd7fa6c31c68 commit 30ff1255fcd6fc2cdb96924d3185dd7fa6c31c68 Author: Alexander Motin AuthorDate: 2023-06-02 16:53:08 +0000 Commit: Alexander Motin CommitDate: 2023-06-02 16:57:26 +0000 Fix panic in nfs bootp/diskless after 0785c323f3. If there is no interface, count won't be initialized, while cnt is not even relevant. Check ifp, that really matters, and delete count. --- sys/nfs/nfs_diskless.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/sys/nfs/nfs_diskless.c b/sys/nfs/nfs_diskless.c index 8f21861ab27e..001673f7a442 100644 --- a/sys/nfs/nfs_diskless.c +++ b/sys/nfs/nfs_diskless.c @@ -190,7 +190,6 @@ nfs_setup_diskless(void) int cnt, fhlen, is_nfsv3; uint32_t len; time_t timeout_at; - u_int count; if (nfs_diskless_valid != 0) return; @@ -238,20 +237,16 @@ nfs_setup_diskless(void) retry: CURVNET_SET(TD_TO_VNET(curthread)); NET_EPOCH_ENTER(et); - for (ifp = if_iter_start(&iter); ifp != NULL; ifp = if_iter_next(&iter)) { - count = if_foreach_lladdr(ifp, nfs_setup_diskless_ifa_cb, &ourdl); - - if (count > 0) + cnt = if_foreach_lladdr(ifp, nfs_setup_diskless_ifa_cb, &ourdl); + if (cnt > 0) break; - } if_iter_finish(&iter); NET_EPOCH_EXIT(et); CURVNET_RESTORE(); - if (cnt > 0) { + if (ifp != NULL) goto match_done; - } if (time_uptime < timeout_at) { pause("nfssdl", hz / 5);