The branch main has been updated by markj:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=47619b604402c9672a0f9bf62666f3bcba1dfb7e

commit 47619b604402c9672a0f9bf62666f3bcba1dfb7e
Author:     Mark Johnston <[email protected]>
AuthorDate: 2021-08-31 19:35:08 +0000
Commit:     Mark Johnston <[email protected]>
CommitDate: 2021-08-31 19:50:04 +0000

    md: Clamp to a multiple of the sector size when resizing
    
    We do this when creating md(4) devices, in kern_mdattach_locked(), but
    not when resizing the provider.  Apply the same policy when resizing, as
    many GEOM classes do not expect to deal with providers for which
    pp->mediasize % pp->sectorsize != 0.
    
    Reported by:    syzkaller
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
---
 sys/dev/md/md.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c
index 1627ee2e5fa6..08fb4b0c6574 100644
--- a/sys/dev/md/md.c
+++ b/sys/dev/md/md.c
@@ -1580,6 +1580,7 @@ mdresize(struct md_s *sc, struct md_req *mdr)
        }
 
        sc->mediasize = mdr->md_mediasize;
+
        g_topology_lock();
        g_resize_provider(sc->pp, sc->mediasize);
        g_topology_unlock();
@@ -1787,6 +1788,7 @@ kern_mdresize_locked(struct md_req *mdr)
                return (ENOENT);
        if (mdr->md_mediasize < sc->sectorsize)
                return (EINVAL);
+       mdr->md_mediasize -= mdr->md_mediasize % sc->sectorsize;
        if (mdr->md_mediasize < sc->mediasize &&
            !(sc->flags & MD_FORCE) &&
            !(mdr->md_options & MD_FORCE))
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "[email protected]"

Reply via email to