From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:60008) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfCOL-0004pI-3A for qemu-devel@nongnu.org; Thu, 14 Jun 2012 11:55:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SfCOC-0003xf-Gt for qemu-devel@nongnu.org; Thu, 14 Jun 2012 11:55:24 -0400 Received: from e35.co.us.ibm.com ([32.97.110.153]:57724) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfCOC-0003wg-Ai for qemu-devel@nongnu.org; Thu, 14 Jun 2012 11:55:16 -0400 Received: from /spool/local by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 14 Jun 2012 09:55:10 -0600 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id 811BC1FF0020 for ; Thu, 14 Jun 2012 15:54:20 +0000 (WET) Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q5EFsBNR112770 for ; Thu, 14 Jun 2012 09:54:11 -0600 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q5EFsA1g004444 for ; Thu, 14 Jun 2012 09:54:10 -0600 From: Corey Bryant Date: Thu, 14 Jun 2012 11:55:05 -0400 Message-Id: <1339689305-27031-6-git-send-email-coreyb@linux.vnet.ibm.com> In-Reply-To: <1339689305-27031-1-git-send-email-coreyb@linux.vnet.ibm.com> References: <1339689305-27031-1-git-send-email-coreyb@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH v3 5/5] block: Prevent /dev/fd/X filename from being detected as floppy List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, aliguori@us.ibm.com, stefanha@linux.vnet.ibm.com, libvir-list@redhat.com, lcapitulino@redhat.com, pbonzini@redhat.com, eblake@redhat.com Reported-by: Kevin Wolf Reviewed-by: Paolo Bonzini Signed-off-by: Corey Bryant --- v3: -This patch is new in v3. It was previously submitted on its own, and is now being included in this series. block/raw-posix.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/block/raw-posix.c b/block/raw-posix.c index d8eff2f..68886cd 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -946,9 +946,11 @@ static int floppy_probe_device(const char *filename) int prio = 0; struct floppy_struct fdparam; struct stat st; + const char *p; - if (strstart(filename, "/dev/fd", NULL)) + if (strstart(filename, "/dev/fd", &p) && p[0] != '/') { prio = 50; + } fd = qemu_open(filename, O_RDONLY | O_NONBLOCK); if (fd < 0) { -- 1.7.10.2