Received: from eggs.gnu.org ([2001:4830:134:3::10]:57115) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVxQY-0006cK-Ve for qemu-devel@nongnu.org; Wed, 17 Feb 2016 03:25:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aVxQX-0005Z0-Cb for qemu-devel@nongnu.org; Wed, 17 Feb 2016 03:25:38 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50675) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVxQX-0005Ys-0t for qemu-devel@nongnu.org; Wed, 17 Feb 2016 03:25:37 -0500 Date: Wed, 17 Feb 2016 13:55:30 +0530 (IST) From: P J P In-Reply-To: <1455633230.7504.107.camel@redhat.com> Message-ID: References: <1454669651-29411-1-git-send-email-ppandit@redhat.com> <1455633230.7504.107.camel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Subject: Re: [Qemu-devel] [PATCH] usb: check RNDIS buffer offsets & length List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: Qinghao Tang , Qemu Developers +-- On Tue, 16 Feb 2016, Gerd Hoffmann wrote --+ | > @@ -172,11 +172,18 @@ static void do_token_in(USBDevice *s, USBPacket *p) | > assert(p->ep->nr == 0); | > + if (s->setup_len > sizeof(s->data_buf)) { | > + fprintf(stderr, | > + "usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n", | > + s->setup_len, sizeof(s->data_buf)); | > + p->status = USB_RET_STALL; | > + return; | > + } | | Why this is needed? All control transfers go through do_token_setup | first, so with the check moved in do_token_setup we should never ever | trigger it here ... usb_handle_packet -> usb_process_one -> do_token_in Is it possible for a guest to call do_token_in, without calling do_token_setup first? Most drivers seem to have their own 'usb_packet_setup' routine. (to confirm) Thank you. -- Prasad J Pandit / Red Hat Product Security Team 47AF CE69 3A90 54AA 9045 1053 DD13 3D32 FE5B 041F