Received: from eggs.gnu.org ([2001:4830:134:3::10]:53722) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDESd-0007Aq-Hv for qemu-devel@nongnu.org; Wed, 15 Jun 2016 13:18:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bDESZ-0004y3-6T for qemu-devel@nongnu.org; Wed, 15 Jun 2016 13:18:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54485) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDESZ-0004xn-0R for qemu-devel@nongnu.org; Wed, 15 Jun 2016 13:18:35 -0400 Date: Wed, 15 Jun 2016 22:48:26 +0530 (IST) From: P J P In-Reply-To: <97a65801-e94d-9ea8-80f4-4caa4a8cf4a4@redhat.com> Message-ID: References: <1466007376-27333-1-git-send-email-ppandit@redhat.com> <97a65801-e94d-9ea8-80f4-4caa4a8cf4a4@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Subject: Re: [Qemu-devel] [PATCH v3] scsi: esp: check length before dma read List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Qemu Developers , Li Qiang , Laszlo Ersek Hello Paolo, +-- On Wed, 15 Jun 2016, Paolo Bonzini wrote --+ | Actually, the commit message is wrong. The length parameter cannot | exceed the buffer size anymore. It wouldn't exceed after this patch, right? Is it possible 'esp_do_dma' is called via 'esp_transfer_data' with 's->do_cmd' set? 'len' isn't checked there. | Can you do a v4 with the corrected | commit message and an assert that avoids overflows like in Laszlo's | proposal? I think this: | | assert (s->cmdlen <= sizeof(s->cmdbuf) && | len <= sizeof(s->cmdbuf) - s->cmdlen); Okay. Thank you. -- Prasad J Pandit / Red Hat Product Security Team 47AF CE69 3A90 54AA 9045 1053 DD13 3D32 FE5B 041F