From nobody Thu Aug 15 19:06:19 2024 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 4WlF2z6GV0z5ShDK; Thu, 15 Aug 2024 19:06:19 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WlF2z4YZXz4qv6; Thu, 15 Aug 2024 19:06:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723748779; 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=0nXeQQG4uCPfAXpo64kEY3FZCFecXPYT8x5AuvmTOCc=; b=bMaOk0GbAD0k9oL9bVb9d4NSJ3KEFZvLuYrz2YAEoKJ9jMJ/OR+8Jj0VmUxcSK5x0csFK4 LXw+b1Gal9zLfqKVPqeZXbbH7MSrALQxho1vOWFsdrOlUtarUc5bbtvDeoQwKI0FC0nbeH Q52Eyt/aV6VDGvHd3939S+iaLS38Y+ySO8JBu9EZpQ5EzNXMdernpxzjpWdBx0obD8tUNZ X6FxX6I9iyNTWXkvdYOM26TSvtfyDM3U4ZjEMgd0Fv4VBGLfy6CxVJMCJFBD1unBz1OZ5y t/QyF3N7JAVOVksGoGdZfqY2f/n4WFjZg4gOcA49cKSWYEYnSi7rK1bBpR2v/w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1723748779; a=rsa-sha256; cv=none; b=w0R5Hk7Gm5w0KHX1GCOIkbQZe9wfXCkdokNrH4rGH1LojTiKIYU3mv6/fZXkFqBmwSs8m6 CACBm+zfhNXjifcIZCzjJVXt6VPeJMlNpS8ghtjcs0mHA5ZRUGkWYrDJI7R3ImpH3K75ZX kA4nno25Z93WTnuXiFc28YQnq9d20WgdTxgOv+EpVysUGh1lXxbVGShQH3wrRrJYw74drm 4knZfu/M9nDQ1NTzaVXvZrIszVVTGmytR3x2Ev5URKFRXaHjuSz1i0lamFe3iKJeZ9Kvth W7LHY0Fyvu3yX3LTxYTDZZbVbFudLoKQ1Lxo/zl6745Mui/fGZMN6KfhaTJ5Dw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723748779; 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=0nXeQQG4uCPfAXpo64kEY3FZCFecXPYT8x5AuvmTOCc=; b=JopFN/XsIyNQXv1XfmzGFdxkgNY8HsRz8R0czUGq9b09JFVYzwMMFafUCpo5Y/U8J4aKKD rZYdC5npoecgG8bM+g13jXNzXkaIh7RLbFUVVZ9EKucM3Uso3IOt6F2wUnKaSWKxUtIaU+ DypKZ0MG48QTjAH8Gtwoue/RRQt+CLYnXfAEJfUKj3JTfQc+RSslfBq4lErKz71gwGfiU1 rudxikQYA0kFigBxy149hiZ8q+Pb0i2Yb1SJSCm3XidZB42GE0M2Hlxc0RJBhzaDAzHP7O F/3Afa46t7sj8f4fYtfL79Gw/COxV0/7+/ZcRdTGx/bjhmjOaKSOQXwRRs6jRQ== 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 4WlF2z49mNzbNF; Thu, 15 Aug 2024 19:06:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 47FJ6JgX092154; Thu, 15 Aug 2024 19:06:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 47FJ6JBq092151; Thu, 15 Aug 2024 19:06:19 GMT (envelope-from git) Date: Thu, 15 Aug 2024 19:06:19 GMT Message-Id: <202408151906.47FJ6JBq092151@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Stefan =?utf-8?Q?E=C3=9Fer?= Subject: git: e8f52a86ee27 - stable/13 - msdosfs: fix cluster limit when mounting FAT-16 file systems 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e8f52a86ee279a1270e31bc5bad436939e44f555 Auto-Submitted: auto-generated The branch stable/13 has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=e8f52a86ee279a1270e31bc5bad436939e44f555 commit e8f52a86ee279a1270e31bc5bad436939e44f555 Author: Stefan Eßer AuthorDate: 2024-08-09 17:26:27 +0000 Commit: Stefan Eßer CommitDate: 2024-08-15 19:05:50 +0000 msdosfs: fix cluster limit when mounting FAT-16 file systems The maximum cluster number was calculated based on the number of data cluters that fit in the givem partition size and the size of the FAT area. This limit did not take into account that the highest 10 cluster numbers are reserved and must not be used for files. PR: 280347 Reported by: pho@FreeBSD.org (cherry picked from commit 45d4e82bf61f91792142a2b9e2af657dab8500fd) --- sys/fs/msdosfs/msdosfs_vfsops.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c index b5392e62b578..4326dc1f0a6d 100644 --- a/sys/fs/msdosfs/msdosfs_vfsops.c +++ b/sys/fs/msdosfs/msdosfs_vfsops.c @@ -724,7 +724,9 @@ mountmsdosfs(struct vnode *odevvp, struct mount *mp) } } - clusters = (pmp->pm_fatsize / pmp->pm_fatmult) * pmp->pm_fatdiv ; + clusters = (pmp->pm_fatsize / pmp->pm_fatmult) * pmp->pm_fatdiv; + if (clusters >= (CLUST_RSRVD & pmp->pm_fatmask)) + clusters = CLUST_RSRVD & pmp->pm_fatmask; if (pmp->pm_maxcluster >= clusters) { #ifdef MSDOSFS_DEBUG printf("Warning: number of clusters (%ld) exceeds FAT "