Received: from eggs.gnu.org ([2001:4830:134:3::10]:48833) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bzURq-0003Pq-L1 for qemu-devel@nongnu.org; Wed, 26 Oct 2016 16:05:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bzURp-00074b-Q3 for qemu-devel@nongnu.org; Wed, 26 Oct 2016 16:05:18 -0400 Date: Thu, 27 Oct 2016 01:35:06 +0530 (IST) From: P J P In-Reply-To: Message-ID: References: <1477398120-9000-1-git-send-email-ppandit@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Subject: Re: [Qemu-devel] [Qemu-arm] [PATCH] net: smc91c111: check packet number and data register index List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Qemu Developers , Azure Yang , Jason Wang , qemu-arm +-- On Wed, 26 Oct 2016, Peter Maydell wrote --+ | The queue_tx function checks s->tx_fifo_len (because | it's about to put something into s->tx_fifo[]), but it | does not check anything about the values it puts into | tx_fifo[]. The do_tx function then does | packetnum = s->tx_fifo[i]; | p = &s->data[packetnum][0]; | where packetnum could be out of bounds. Oh, sorry. Fixed in patch v3. | If the passed 'packet' value is greater than 31 or | negative then the function will invoke undefined | behaviour. If it's less than 32 but bigger than the | max number of packets then it will set allocated to | a value it ought not to be able to hold, which makes | the rest of the code harder to reason about. | | It can be set by malicious incoming vmstate data | (and by arranging for release_packet() to be called | with various out-of-bounds values, as described above). Sent patch v3. Thank you. -- Prasad J Pandit / Red Hat Product Security Team 47AF CE69 3A90 54AA 9045 1053 DD13 3D32 FE5B 041F