]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[ncm] Respect maximum transfer size of the bus
authorMichael Brown <mcb30@ipxe.org>
Mon, 16 Mar 2015 05:39:41 +0000 (05:39 +0000)
committerMichael Brown <mcb30@ipxe.org>
Mon, 16 Mar 2015 15:40:54 +0000 (15:40 +0000)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/drivers/net/ncm.c

index 8620985b3de00bf09f376737fc56d2383a55eafb..10728d2a1dd3f4957bd219cebe4e394adba45133 100644 (file)
@@ -157,6 +157,7 @@ static struct usb_endpoint_driver_operations ncm_intr_operations = {
  * @ret rc             Return status code
  */
 static int ncm_in_prefill ( struct ncm_device *ncm ) {
+       struct usb_bus *bus = ncm->bus;
        size_t mtu;
        unsigned int count;
        int rc;
@@ -178,6 +179,8 @@ static int ncm_in_prefill ( struct ncm_device *ncm ) {
                /* Attempt allocation at this MTU */
                if ( mtu > NCM_MAX_NTB_INPUT_SIZE )
                        continue;
+               if ( mtu > bus->mtu )
+                       continue;
                count = ( NCM_IN_MIN_SIZE / mtu );
                if ( count < NCM_IN_MIN_COUNT )
                        count = NCM_IN_MIN_COUNT;