Author: markj Date: Sat Jan 12 17:00:54 2019 New Revision: 342970 URL: https://svnweb.freebsd.org/changeset/base/342970
Log: MFC r342787: Add a bounds check to the tws(4) passthrough ioctl handler. admbug: 825 Modified: stable/12/sys/dev/tws/tws_user.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/dev/tws/tws_user.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/dev/tws/tws_user.c ============================================================================== --- stable/12/sys/dev/tws/tws_user.c Sat Jan 12 16:58:32 2019 (r342969) +++ stable/12/sys/dev/tws/tws_user.c Sat Jan 12 17:00:54 2019 (r342970) @@ -92,9 +92,13 @@ tws_passthru(struct tws_softc *sc, void *buf) struct tws_request *req; struct tws_ioctl_no_data_buf *ubuf = (struct tws_ioctl_no_data_buf *)buf; int error; + u_int32_t buffer_length; u_int16_t lun4; - + buffer_length = roundup2(ubuf->driver_pkt.buffer_length, 512); + if ( buffer_length > TWS_MAX_IO_SIZE ) { + return(EINVAL); + } if ( tws_get_state(sc) != TWS_ONLINE) { return(EBUSY); } @@ -118,7 +122,7 @@ tws_passthru(struct tws_softc *sc, void *buf) } } while(1); - req->length = (ubuf->driver_pkt.buffer_length + 511) & ~511; + req->length = buffer_length; TWS_TRACE_DEBUG(sc, "datal,rid", req->length, req->request_id); if ( req->length ) { req->data = sc->ioctl_data_mem; _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"