Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ieee1394 Fix fwohci_write's sanity check against lar...



details:   https://anonhg.NetBSD.org/src/rev/cfea4b7bfdaf
branches:  trunk
changeset: 540285:cfea4b7bfdaf
user:      jmc <jmc%NetBSD.org@localhost>
date:      Mon Dec 09 07:26:02 2002 +0000

description:
Fix fwohci_write's sanity check against large packets. Max rec is only used
when writing directly to the device (ala IEEE1394_TCODE_WRITE_REQ_BLOCK).
Otherwise the largest size is determined strictly by speed

diffstat:

 sys/dev/ieee1394/fwohci.c |  14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diffs (35 lines):

diff -r 7e4597d1b8e0 -r cfea4b7bfdaf sys/dev/ieee1394/fwohci.c
--- a/sys/dev/ieee1394/fwohci.c Mon Dec 09 07:24:57 2002 +0000
+++ b/sys/dev/ieee1394/fwohci.c Mon Dec 09 07:26:02 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fwohci.c,v 1.64 2002/12/06 02:17:30 jmc Exp $  */
+/*     $NetBSD: fwohci.c,v 1.65 2002/12/09 07:26:02 jmc Exp $  */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -49,7 +49,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fwohci.c,v 1.64 2002/12/06 02:17:30 jmc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fwohci.c,v 1.65 2002/12/09 07:26:02 jmc Exp $");
 
 #define FWOHCI_WAIT_DEBUG 1
 
@@ -3711,7 +3711,15 @@
        u_int32_t high, lo;
        int rv;
 
-       if (ab->ab_length > IEEE1394_MAX_REC(sc->sc1394_max_receive)) {
+       if (ab->ab_tcode == IEEE1394_TCODE_WRITE_REQ_BLOCK) {
+               if (ab->ab_length > IEEE1394_MAX_REC(sc->sc1394_max_receive)) {
+                       DPRINTF(("Packet too large: %d\n", ab->ab_length));
+                       return E2BIG;
+               }
+       }
+
+       if (ab->ab_length > 
+           IEEE1394_MAX_ASYNCH_FOR_SPEED(sc->sc1394_link_speed)) {
                DPRINTF(("Packet too large: %d\n", ab->ab_length));
                return E2BIG;
        }



Home | Main Index | Thread Index | Old Index