From nobody Sat Jan 15 00:51:35 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 A41181950C81; Sat, 15 Jan 2022 00:51:35 +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 4JbKP34DP4z4k33; Sat, 15 Jan 2022 00:51:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642207895; 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=ZSFbF37HU+B0aVaFET4WJEsDvPaHSNCDiJDVMAjBaF4=; b=VPxpWjPstYdiIQGSEKfi8ZJTH6kPYCTIOaxO21Fb9cOOfC7YKbhc5IOVDux7n5yIv/YGRY +ZUlSUWzPWd6s6zQoDwGSngxAT/WTgEINGrbb6s4Aeh/JTA865koV4Ec6WXLBYe+PIBj/F 3IH5DUas5kxluPzYJPg8r1+xKMGvzR5H39gdhYOQPAEjXF/z86l2cDKTSMFMy8/Tem6vNI PuV/USROQdfWSjALGULOluV7+ACZEwEsYPVUM5xE6kfss2xuvDkIEGkko1CDQZTjmEQeOd vsc10lRxup7STtoyt51fMcVoFh+R0pmkBZT0Y2PFNKtu+aJU0+VgjYqCYiF4Xg== 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 70A601DABC; Sat, 15 Jan 2022 00:51:35 +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 20F0pZl7031073; Sat, 15 Jan 2022 00:51:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20F0pZf3031072; Sat, 15 Jan 2022 00:51:35 GMT (envelope-from git) Date: Sat, 15 Jan 2022 00:51:35 GMT Message-Id: <202201150051.20F0pZf3031072@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: e1ac02ff7adf - stable/13 - geom label msdosfs: sanity check BPB before using it for io request 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: e1ac02ff7adf7a9749ca2a57d6da25e6a295a68f Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642207895; 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=ZSFbF37HU+B0aVaFET4WJEsDvPaHSNCDiJDVMAjBaF4=; b=iqHJYtGND4gARKQPStlH9m40lv69AFmmuahzPC83vJhJF8z9ZuTTyTKU/LlF6P+IeNDQjD 3f37DqCDJagFEG6MQ+7xvgVuoL4fvjlSVFr79GtkdZMHbw8uFWqvMrA/UBSyEJ8bO1OsOu yyUoozEuygbRA2UZt6zMIQLdM+gKR/YlUfCD6q++KErn+M2ZUqjQZYPJwV7uTuig2Z0zvJ wezdGUoMIrz6ZbvafTxxdhy/91v7auaCnGzWc/CbWrcrh0kKccRNlpV2Mncl5CiyF+mD8V WnIUxVAWtrS50NbMdZEBizLqecib/9OUb80Ax93PSLfvqvOlWrQ8aHYMbl7aDg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1642207895; a=rsa-sha256; cv=none; b=Ma9368MVIFqp4ycxCoW3wLA9YjXjzdkDHRgpqaIMJWOxj0lkqITk/j/fi6lu8Xq4RHN5Ay rNOdPa+tvM1uQxyOhjUZOtWR/7drT/sfuSn5BnL0kM2IA+SWu/4CySbXiPEu20GyTzl97K xlIF7KFaO0m0dIIZl02MwFeRb+KjKqaEEjyO3EIAki5oXb/kbpIMHjjtX68FT83CglOVCE R7Tywfne+QQqXsDAkKCC8a68A9cNMnZJF+inGezgRBNV/w10pJgs/S5qdMz1FBlfuaPmp0 tqvyoN3ieS5ssusU+aCbcm1HYDDZDQp0ixCoabztLyoQI9XRrDsk+XgXIexwpQ== 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=e1ac02ff7adf7a9749ca2a57d6da25e6a295a68f commit e1ac02ff7adf7a9749ca2a57d6da25e6a295a68f Author: Konstantin Belousov AuthorDate: 2021-12-30 13:17:59 +0000 Commit: Konstantin Belousov CommitDate: 2022-01-14 18:11:01 +0000 geom label msdosfs: sanity check BPB before using it for io request (cherry picked from commit 9f4073d44628bc70dbe67df5163266cbfbe37167) --- sys/geom/label/g_label_msdosfs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/geom/label/g_label_msdosfs.c b/sys/geom/label/g_label_msdosfs.c index d6ccb8b334ee..67ac879d62c2 100644 --- a/sys/geom/label/g_label_msdosfs.c +++ b/sys/geom/label/g_label_msdosfs.c @@ -152,6 +152,12 @@ g_label_msdosfs_taste(struct g_consumer *cp, char *label, size_t size) G_LABEL_DEBUG(2, "MSDOSFS: FAT_FirstDataSector=0x%x, FAT_BytesPerSector=%d", fat_FirstDataSector, fat_BytesPerSector); + if (fat_BytesPerSector == 0 || + fat_BytesPerSector % pp->sectorsize != 0) { + G_LABEL_DEBUG(1, "MSDOSFS: %s: corrupted BPB", + pp->name); + goto error; + } for (offset = fat_BytesPerSector * fat_FirstDataSector;; offset += fat_BytesPerSector) {