tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: cgdstrategy: divide fault in supervisor mode



On Tue, Sep 13, 2016 at 09:27:11PM +0100, Alexander Nasonov wrote:
> 
> I can reproduce division by zero but not when rebooting. If I take
> an unconfigured cgd device, i.e. cgd2 and run
> 
> 	mount /dev/cgd2d /tmp
> 
> the kernel will panic instead of returning ENXIO.

Ah, maybe then:

--- cgd.c       5 Aug 2016 08:24:46 -0000       1.110
+++ cgd.c       13 Sep 2016 21:43:27 -0000
@@ -305,13 +305,17 @@
 static void
 cgdstrategy(struct buf *bp)
 {
-       struct  cgd_softc *cs = getcgd_softc(bp->b_dev);
-       struct  dk_softc *dksc = &cs->sc_dksc;
-       struct  disk_geom *dg = &dksc->sc_dkdev.dk_geom;
+       struct  cgd_softc *cs;
+       struct  dk_softc *dksc;
+       struct  disk_geom *dg;
 
        DPRINTF_FOLLOW(("cgdstrategy(%p): b_bcount = %ld\n", bp,
            (long)bp->b_bcount));
 
+       GETCGD_SOFTC(cs, bp->b_dev);
+       dksc = &cs->sc_dksc;
+       dg = &dksc->sc_dkdev.dk_geom;
+
        /*
         * Reject unaligned writes.  We can encrypt and decrypt only
         * complete disk sectors, and we let the ciphers require their



Greetings,
-- 
                                Michael van Elst
Internet: mlelstv%serpens.de@localhost
                                "A potential Snark may lurk in every tree."


Home | Main Index | Thread Index | Old Index