summaryrefslogtreecommitdiffstats
path: root/sys/dev/softraid.c
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2009-09-03 13:26:38 +0000
committerjsing <jsing@openbsd.org>2009-09-03 13:26:38 +0000
commit3f2a4a44c430f14b9da207fd3426474492d291ed (patch)
tree9ae10a913fd7257352552582a72e833efe9830a9 /sys/dev/softraid.c
parentDon't call VOP_CLOSE() with a null pointer, if the VOP_OPEN() call failed. (diff)
downloadwireguard-openbsd-3f2a4a44c430f14b9da207fd3426474492d291ed.tar.xz
wireguard-openbsd-3f2a4a44c430f14b9da207fd3426474492d291ed.zip
Check the return value of copyin().
ok marco@
Diffstat (limited to 'sys/dev/softraid.c')
-rw-r--r--sys/dev/softraid.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c
index 5162f0c81a3..29563b33277 100644
--- a/sys/dev/softraid.c
+++ b/sys/dev/softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid.c,v 1.172 2009/09/03 13:20:29 jsing Exp $ */
+/* $OpenBSD: softraid.c,v 1.173 2009/09/03 13:26:38 jsing Exp $ */
/*
* Copyright (c) 2007, 2008, 2009 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org>
@@ -2693,9 +2693,10 @@ sr_ioctl_createraid(struct sr_softc *sc, struct bioc_createraid *bc, int user)
goto unwind;
dt = malloc(bc->bc_dev_list_len, M_DEVBUF, M_WAITOK | M_ZERO);
- if (user)
- copyin(bc->bc_dev_list, dt, bc->bc_dev_list_len);
- else
+ if (user) {
+ if (copyin(bc->bc_dev_list, dt, bc->bc_dev_list_len) != 0)
+ goto unwind;
+ } else
bcopy(bc->bc_dev_list, dt, bc->bc_dev_list_len);
sd = malloc(sizeof(struct sr_discipline), M_DEVBUF, M_WAITOK | M_ZERO);