Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/vinum vinum_super_ioctl(): refuse unknown ioctls, ra...



details:   https://anonhg.NetBSD.org/src/rev/8a06814c79b4
branches:  trunk
changeset: 570012:8a06814c79b4
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Fri Sep 17 19:21:03 2004 +0000

description:
vinum_super_ioctl(): refuse unknown ioctls, rather than pretending
success; this fixes panic caused by null pointer dereference in
spec_open() after DIOCGPART ioctl call and PR bin/26981 by Simon Hitzemann

while here, also remove not reachable return statements, and also
return EINVAL for ioctl to unknown DEVTYPE()s

XXX vinum code is !@#$%^

diffstat:

 sys/dev/vinum/vinumioctl.c |  14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)

diffs (53 lines):

diff -r 3087730d3f5e -r 8a06814c79b4 sys/dev/vinum/vinumioctl.c
--- a/sys/dev/vinum/vinumioctl.c        Fri Sep 17 18:42:41 2004 +0000
+++ b/sys/dev/vinum/vinumioctl.c        Fri Sep 17 19:21:03 2004 +0000
@@ -41,7 +41,7 @@
  * otherwise) arising in any way out of the use of this software, even if
  * advised of the possibility of such damage.
  *
- * $Id: vinumioctl.c,v 1.1.1.1 2003/10/10 03:08:38 grog Exp $
+ * $Id: vinumioctl.c,v 1.2 2004/09/17 19:21:03 jdolecek Exp $
  * $FreeBSD$
  */
 
@@ -107,8 +107,6 @@
                return ENOTTY;                              /* not my kind of ioctl */
            }
 
-           return 0;                                       /* pretend we did it */
-
        case VINUM_PLEX_TYPE:
            objno = Plexno(dev);
 
@@ -132,8 +130,6 @@
                return ENOTTY;                              /* not my kind of ioctl */
            }
 
-           return 0;                                       /* pretend we did it */
-
        case VINUM_VOLUME_TYPE:
            objno = Volno(dev);
 
@@ -181,7 +177,8 @@
            }
            break;
        }
-    return 0;                                              /* XXX */
+
+    return EINVAL;
 }
 
 /* Handle ioctls for the super device */
@@ -423,10 +420,9 @@
        return 0;
 
     default:
-       /* FALLTHROUGH */
-       break;
+       /* unsupported ioctl */
+       return EINVAL;
     }
-    return 0;                                              /* to keep the compiler happy */
 }
 
 /*



Home | Main Index | Thread Index | Old Index