From nobody Sat Jan 08 04:29:32 2022 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 D2F4C1931D4D; Sat, 8 Jan 2022 04:29:33 +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 4JW6Ym5SBQz3DqW; Sat, 8 Jan 2022 04:29:32 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 2D9EB18593; Sat, 8 Jan 2022 04:29:32 +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 2084TWbT022242; Sat, 8 Jan 2022 04:29:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2084TWj5022241; Sat, 8 Jan 2022 04:29:32 GMT (envelope-from git) Date: Sat, 8 Jan 2022 04:29:32 GMT Message-Id: <202201080429.2084TWj5022241@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 1319c433f4e5 - main - msdosfs: handle a case when non-dot lookup returned dvp 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1319c433f4e5d67f8ea6fd2369c604069f733c94 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1641616173; 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=5zMiwo57KTiSTOgDlCprVhtSUcWv7weDetU2NQpgb+A=; b=OL+uyKL/Wg24u4LnQck5J2TMUGmd6c7JC3QfAbsMRzq8UuA1iw3vfUWVVdfy0suU1RBrnS GQjhzkRvGz/juiDobMLN95rSnFSB888IWCu08QFvpIX/UH872LBTph5rAUNEqIVW3iaznI 9ulrqalpWf32Xm50i4yX05FWax2stlZp47biy16muJ26//5amTwPNmPyykB0qhbgK2lXsC 51axsKyUNsDjSOBDYx2pGSPY6A3zNr7dgAarOfG8CbfkUBjRPUiT4eNWeWYmxaL/JrRW7T 6vABn6nUnXx7+vIvoXSWcMOFs9tuy+MHY/YkFCJNh4ZEL6PLPt8XYYtS+O6Mrg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1641616173; a=rsa-sha256; cv=none; b=Rvae1Vu0u5RsVlWj9uHy2T+7ltIZzbJiHyTXck734lCT4rK8+xczET6U3gr6iYsAjGfFJr iP+0LhdXKHQZ0nUdclfo0gEz6zrh2simaZU4t3tSCK8IcYNLkESShDrRDPdj3Q34LBoJ1Z RuTuHu3INf/OFrDBZatc0ZgQ1Kfc3mns28+GNU6e07q9ndmEOf+P3rYdK0voCPiQZysWfU umPD5SR4xa/+FD1JXhPt4DdpPZqyHVgqxWGdx2LCMEIit3EmO69BJqFYXyNjStoSc+t0Hj Ml8xAQNXg7NzgqsRZWvekb7V3sRoqu6W5t8Pynep9v+BW7I1tMTyl0JB9hvuNA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1319c433f4e5d67f8ea6fd2369c604069f733c94 commit 1319c433f4e5d67f8ea6fd2369c604069f733c94 Author: Konstantin Belousov AuthorDate: 2021-12-28 13:41:30 +0000 Commit: Konstantin Belousov CommitDate: 2022-01-08 03:41:44 +0000 msdosfs: handle a case when non-dot lookup returned dvp This means that filesystem is corrupted, there is a loop. In collaboration with: pho Reviewed by: markj, mckusick Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D33721 --- sys/fs/msdosfs/msdosfs_lookup.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/fs/msdosfs/msdosfs_lookup.c b/sys/fs/msdosfs/msdosfs_lookup.c index d9b52539e602..38bded459692 100644 --- a/sys/fs/msdosfs/msdosfs_lookup.c +++ b/sys/fs/msdosfs/msdosfs_lookup.c @@ -573,6 +573,10 @@ foundroot: goto restart; } } else if (dp->de_StartCluster == scn && isadir) { + if (cnp->cn_namelen != 1 || cnp->cn_nameptr[0] != '.') { + /* fs is corrupted, non-dot lookup returned dvp */ + return (EBADF); + } VREF(vdp); /* we want ourself, ie "." */ *vpp = vdp; } else {