summaryrefslogtreecommitdiff
path: root/sys/dev/ic/ar5xxx.c
diff options
context:
space:
mode:
authorPhilip Guenthe <guenther@cvs.openbsd.org>2009-06-02 12:09:27 +0000
committerPhilip Guenthe <guenther@cvs.openbsd.org>2009-06-02 12:09:27 +0000
commitf02b189f64fff76ecbc81e0d55b4fe65db8d6b2d (patch)
treeac718d48d2a9c0825ee14ca606ae2190afbb5f6d /sys/dev/ic/ar5xxx.c
parent535ef74bd2a86e24c4d3364d46e06886231aed2e (diff)
If a bogus channel is encountered, return an error instead of trying
to use the -1 flag value as an array index. Found by Parfait. ok reyk@ oga@
Diffstat (limited to 'sys/dev/ic/ar5xxx.c')
-rw-r--r--sys/dev/ic/ar5xxx.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/dev/ic/ar5xxx.c b/sys/dev/ic/ar5xxx.c
index edaac74af4c..e1e75da938c 100644
--- a/sys/dev/ic/ar5xxx.c
+++ b/sys/dev/ic/ar5xxx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ar5xxx.c,v 1.52 2008/07/30 07:43:01 reyk Exp $ */
+/* $OpenBSD: ar5xxx.c,v 1.53 2009/06/02 12:09:26 guenther Exp $ */
/*
* Copyright (c) 2004, 2005, 2006, 2007 Reyk Floeter <reyk@openbsd.org>
@@ -1681,6 +1681,10 @@ ar5k_ar5112_rfregs(struct ath_hal *hal, HAL_CHANNEL *channel, u_int mode)
(channel->c_channel >= 5260 ? 1 :
(channel->c_channel > 4000 ? 0 : -1)));
+ /* bogus channel: bad beacon? */
+ if (obdb < 0)
+ return (AH_FALSE);
+
if (!ar5k_rfregs_op(rf, hal->ah_offset[6],
ee->ee_ob[ee_mode][obdb], 3, 279, 0, AH_TRUE))
return (AH_FALSE);