summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2000-06-13 05:15:20 +0000
committerJason Wright <jason@cvs.openbsd.org>2000-06-13 05:15:20 +0000
commitdd8e6169744a0ffcb6f0f49abffbdec0b139ce12 (patch)
tree154f0c4e7caa50319561570a9283d41bb2b1cfb6
parentd64777741686106171c3d0c66cc9b2150a2b09e1 (diff)
put an upperbound on queue length
-rw-r--r--sys/dev/pci/ubsec.c10
-rw-r--r--sys/dev/pci/ubsecvar.h7
2 files changed, 15 insertions, 2 deletions
diff --git a/sys/dev/pci/ubsec.c b/sys/dev/pci/ubsec.c
index 830fcb0a858..feaa133fca8 100644
--- a/sys/dev/pci/ubsec.c
+++ b/sys/dev/pci/ubsec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ubsec.c,v 1.8 2000/06/13 00:38:25 deraadt Exp $ */
+/* $OpenBSD: ubsec.c,v 1.9 2000/06/13 05:15:19 jason Exp $ */
/*
* Copyright (c) 2000 Jason L. Wright (jason@thought.net)
@@ -336,6 +336,14 @@ ubsec_process(crp)
sc = ubsec_cd.cd_devs[card];
+ s = splnet();
+ if (sc->sc_nqueue == UBS_MAX_NQUEUE) {
+ splx(s);
+ err = ENOMEM;
+ goto errout;
+ }
+ splx(s);
+
q = (struct ubsec_q *)malloc(sizeof(struct ubsec_q),
M_DEVBUF, M_NOWAIT);
if (q == NULL) {
diff --git a/sys/dev/pci/ubsecvar.h b/sys/dev/pci/ubsecvar.h
index 262815ed34e..031b8170642 100644
--- a/sys/dev/pci/ubsecvar.h
+++ b/sys/dev/pci/ubsecvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ubsecvar.h,v 1.3 2000/06/12 19:50:35 deraadt Exp $ */
+/* $OpenBSD: ubsecvar.h,v 1.4 2000/06/13 05:15:19 jason Exp $ */
/*
* Copyright (c) 2000 Theo de Raadt
@@ -60,3 +60,8 @@ struct ubsec_q {
int q_dst_packl[MAX_SCATTER];
int q_dst_npa, q_dst_l;
};
+
+/* Maximum queue length */
+#ifndef UBS_MAX_NQUEUE
+#define UBS_MAX_NQUEUE 24
+#endif