From nobody Sat Jan 15 00:51:38 2022 X-Original-To: dev-commits-src-branches@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 6C810195140A; Sat, 15 Jan 2022 00:51:40 +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 4JbKP72XSPz4kPY; Sat, 15 Jan 2022 00:51:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642207899; 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=lgj2jUwHzXCR5Xj7imNVM+xo+V25AaAjRJFoQeXwpk8=; b=T7O0cdMCvUxBQB/2x31hzbi26aK+ESxmF8Ry8bBNR6TtnWVF5yG3olhyCUZ/llxgI7wgb9 f0td+61sm5cCmz64OlwMyI4jXTgIYEBZ2K8num+JUKdRFDWicE15cz3reJzf1CRwbVIZ6g Xf3jEot0IIIZMUqrq+FE3aBIKKZx8syRhRMVyREC3Ud3AbMNwZzZ3ajZx0gaA0kvbZlF9g mSlDJyrbE3gtdbLDxhLA5665maSHBh9eQAV5e2QrzzMsayst+HGe4LrtXn5UAqAA7cC9P3 Iee2+OjDFsooOaElEl4fwss+9Nm6/d1/MdSpMcghEXpIXbSmjouFUu+0ptcStw== 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 DA1271DCB2; Sat, 15 Jan 2022 00:51:38 +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 20F0pccp031152; Sat, 15 Jan 2022 00:51:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20F0pcwV031151; Sat, 15 Jan 2022 00:51:38 GMT (envelope-from git) Date: Sat, 15 Jan 2022 00:51:38 GMT Message-Id: <202201150051.20F0pcwV031151@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 1bcbcd68f590 - stable/13 - msdosfs: handle a case when non-dot lookup returned dvp List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 1bcbcd68f59099f8813f9767e0781a150b1b7918 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642207899; 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=lgj2jUwHzXCR5Xj7imNVM+xo+V25AaAjRJFoQeXwpk8=; b=Q2Ytu0zDMdc8MZDwa/mpTxSl1mm8wsv3LZj882O6muDslX70Ms3ti79EaPejiv4EMQTDiK aZLrXid4A3IGzvQmjvdueqnEwRwGbAbQ3oH5fq/HR2M0HDYH4lF1n4HA0U2e3cuut5DPXH 1bT5VH4xl+hn+Vlbbvc45kvrw7zv94uJWQRjgn4g6OT5Ss1PhFxU3oTF/MZjJ1b7Pzz34Q LOnYHWT21vtumJkKiWdQDcaVbF/6XlqI+wLO0cGI6hbzSeY/qTR114W6SFjsDhqYPcP6pv zm/H6FqO1ZT8/LgGvnlWSm2vhOzZdeOFSeaOYtRPpQL9YJT0i1VxypEZ4CPrHw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1642207899; a=rsa-sha256; cv=none; b=C52dF8mQgmfub+ptX5gw3mh/VA2SIKFyWfY8hegzaX0zCBm3In6c19IwMSz0UcUrumSzmh fgw9eOUhf6IxS0MQMa0LZXoQG+pyHNKMnh5BCDqPf8d0iX0Ivs9Jg6q6Gd8/63PS1tAOsK UctyQJx9VaZ1dn11uISgbEcb0Ykqn14L8bHOOg7k3VvJwOMeLrAYep7AjhVDBY89bs7icv Ffb6EjgSjcuwHQ9v9THAjb8HFrUnbf4FZxMrlooRwKLFRjFjrRosw2YtV8qCNzUvUZGyJV DYuErUtmpelzy4dVqfR241pifoZAyX0MygPmkg/1MvOwHDyrVtbXLW7nsJfMpA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1bcbcd68f59099f8813f9767e0781a150b1b7918 commit 1bcbcd68f59099f8813f9767e0781a150b1b7918 Author: Konstantin Belousov AuthorDate: 2021-12-28 13:41:30 +0000 Commit: Konstantin Belousov CommitDate: 2022-01-14 18:11:02 +0000 msdosfs: handle a case when non-dot lookup returned dvp (cherry picked from commit 1319c433f4e5d67f8ea6fd2369c604069f733c94) --- 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 9940800a72c2..2478cab84a0a 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 {