Skip to contentSkip to conversation

block: Prevent /dev/fd/X filename from being detected as floppy

PATCH In review root 4 participants 5 messages Jun 13, 2012 – Jun 14, 2012 Block layer

lore
Share & tools
lore

root

author
#0 lore raw

PATCH 1/1 block: Prevent /dev/fd/X filename from being detected as floppy

From: Corey Bryant <[email protected]>

---
 block/raw-posix.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
block/raw-posix.c +3 -1
index d8eff2f..68886cd 100644
@@ -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) {
Signature · 1 line
1.7.10.2
Reviewed-by on v1 1/1
#1 lore raw

Il 13/06/2012 16:30, root ha scritto:

Quoted 16 lines

From: Corey Bryant <[email protected]>

---
 block/raw-posix.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
block/raw-posix.c +0 -0
index d8eff2f..68886cd 100644
@@ -946,9 +946,11 @@ static int floppy_probe_device(const char *filename)
     int prio = 0;
     struct floppy_struct fdparam;

block/raw-posix.c static int floppy_probe_device(const char *filename) · line 956

Quoted 10 lines
block/raw-posix.c +3 -1
     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) {
#2 lore raw
Quoted 24 lines · Paolo Bonzini

Il 13/06/2012 16:30, root ha scritto:

Quoted 23 lines

From: Corey Bryant <[email protected]>

---
  block/raw-posix.c |    4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
block/raw-posix.c +3 -1
index d8eff2f..68886cd 100644
@@ -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;
+    }
 
Quoted 6 lines

block/raw-posix.c static int floppy_probe_device(const char *filename) · line 956

Quoted 3 lines
block/raw-posix.c +0 -0
      fd = qemu_open(filename, O_RDONLY | O_NONBLOCK);
      if (fd < 0) {

Thanks!

Signature · 2 lines
Regards,
Corey
#3 lore raw

Am 14.06.2012 15:39, schrieb Corey Bryant:

Quoted 27 lines · Paolo Bonzini
Quoted 24 lines

Il 13/06/2012 16:30, root ha scritto:

Quoted 23 lines

From: Corey Bryant <[email protected]>

---
  block/raw-posix.c |    4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
block/raw-posix.c +3 -1
index d8eff2f..68886cd 100644
@@ -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;
+    }
 
Quoted 8 lines
Quoted 6 lines

block/raw-posix.c static int floppy_probe_device(const char *filename) · line 956

Quoted 3 lines
block/raw-posix.c +0 -0
      fd = qemu_open(filename, O_RDONLY | O_NONBLOCK);
      if (fd < 0) {

Thanks!

I tried to apply this earlier today, but it depends on the other patch series, so I couldn't. Can you just include it as patch 5 when you send the next version?

Oh, and you'll probably want to fix your mailing setup to put into From:
something different than [email protected]...

Kevin

#4 lore raw
Quoted 35 lines · Kevin Wolf

Am 14.06.2012 15:39, schrieb Corey Bryant:

Quoted 34 lines · Paolo Bonzini
Quoted 30 lines

Il 13/06/2012 16:30, root ha scritto:

Quoted 16 lines

From: Corey Bryant <[email protected]>

---
   block/raw-posix.c |    4 +++-
   1 file changed, 3 insertions(+), 1 deletion(-)
block/raw-posix.c +0 -0
index d8eff2f..68886cd 100644
@@ -946,9 +946,11 @@ static int floppy_probe_device(const char *filename)
       int prio = 0;
       struct floppy_struct fdparam;

block/raw-posix.c static int floppy_probe_device(const char *filename) · line 956

Quoted 10 lines
block/raw-posix.c +3 -1
       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) {
Quoted 5 lines
Quoted 1 line

Thanks!

I tried to apply this earlier today, but it depends on the other patch series, so I couldn't. Can you just include it as patch 5 when you send the next version?

Ok sure I'll do that.

Quoted 3 lines

Oh, and you'll probably want to fix your mailing setup to put into From:
something different than [email protected]...

Ugh.. I'm sorry about that.

Quoted 3 lines

Kevin

Signature · 2 lines
Regards,
Corey