From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:54201) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Si8i3-0004mY-TR for qemu-devel@nongnu.org; Fri, 22 Jun 2012 14:35:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Si8i2-00081w-5i for qemu-devel@nongnu.org; Fri, 22 Jun 2012 14:35:55 -0400 Received: from e35.co.us.ibm.com ([32.97.110.153]:44345) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Si8i1-00080o-Ul for qemu-devel@nongnu.org; Fri, 22 Jun 2012 14:35:54 -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 ; Fri, 22 Jun 2012 12:35:50 -0600 Received: from d03relay01.boulder.ibm.com (d03relay01.boulder.ibm.com [9.17.195.226]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id 02698C40003 for ; Fri, 22 Jun 2012 18:35:38 +0000 (WET) Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d03relay01.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q5MIZVte102400 for ; Fri, 22 Jun 2012 12:35:32 -0600 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q5MIZTKq004758 for ; Fri, 22 Jun 2012 12:35:30 -0600 From: Corey Bryant Date: Fri, 22 Jun 2012 14:36:12 -0400 Message-Id: <1340390174-7493-6-git-send-email-coreyb@linux.vnet.ibm.com> In-Reply-To: <1340390174-7493-1-git-send-email-coreyb@linux.vnet.ibm.com> References: <1340390174-7493-1-git-send-email-coreyb@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH v4 5/7] 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. v4 -Moved patch to be earlier in series (lcapitulino@redhat.com) 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 03fcfcc..0d9be0b 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 = open(filename, O_RDONLY | O_NONBLOCK); if (fd < 0) { -- 1.7.10.2