All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mac80211: add check on hw->max_signal value on ieee80211_register_hw
@ 2014-01-19 21:21 andrea merello
  2014-01-20 10:25 ` Johannes Berg
  2014-01-21 19:02 ` Krishna Chaitanya
  0 siblings, 2 replies; 3+ messages in thread
From: andrea merello @ 2014-01-19 21:21 UTC (permalink / raw)
  To: linux-wireless, linville; +Cc: Larry.Finger, andrea merello

When IEEE80211_HW_SIGNAL_UNSPEC is set, mac80211 will perform a
division by max_signal in ieee80211_bss_info_update. If max_signal
is not properly set by the driver (for example it is zero) this
leads to a divide error and crash.
Thanks to Larry Finger, who pointed me to this.
This patch adds in ieee80211_register_hw one more check to detect
this condition and eventually returns -EINVAL, as already done for
other checks already performed there.

Signed-off-by: andrea merello <andrea.merello@gmail.com>
---
 net/mac80211/main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index d767cfb..913307a 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -758,6 +758,9 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
 	     local->hw.offchannel_tx_hw_queue >= local->hw.queues))
 		return -EINVAL;
 
+	if (hw->flags & IEEE80211_HW_SIGNAL_UNSPEC && hw->max_signal <= 0)
+		return -EINVAL;
+
 #ifdef CONFIG_PM
 	if (hw->wiphy->wowlan && (!local->ops->suspend || !local->ops->resume))
 		return -EINVAL;
-- 
1.8.3.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mac80211: add check on hw->max_signal value on ieee80211_register_hw
  2014-01-19 21:21 [PATCH] mac80211: add check on hw->max_signal value on ieee80211_register_hw andrea merello
@ 2014-01-20 10:25 ` Johannes Berg
  2014-01-21 19:02 ` Krishna Chaitanya
  1 sibling, 0 replies; 3+ messages in thread
From: Johannes Berg @ 2014-01-20 10:25 UTC (permalink / raw)
  To: andrea merello; +Cc: linux-wireless, linville, Larry.Finger

On Sun, 2014-01-19 at 22:21 +0100, andrea merello wrote:
> When IEEE80211_HW_SIGNAL_UNSPEC is set, mac80211 will perform a
> division by max_signal in ieee80211_bss_info_update. If max_signal
> is not properly set by the driver (for example it is zero) this
> leads to a divide error and crash.
> Thanks to Larry Finger, who pointed me to this.
> This patch adds in ieee80211_register_hw one more check to detect
> this condition and eventually returns -EINVAL, as already done for
> other checks already performed there.

Applied.

johannes


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mac80211: add check on hw->max_signal value on ieee80211_register_hw
  2014-01-19 21:21 [PATCH] mac80211: add check on hw->max_signal value on ieee80211_register_hw andrea merello
  2014-01-20 10:25 ` Johannes Berg
@ 2014-01-21 19:02 ` Krishna Chaitanya
  1 sibling, 0 replies; 3+ messages in thread
From: Krishna Chaitanya @ 2014-01-21 19:02 UTC (permalink / raw)
  To: andrea merello; +Cc: linux-wireless, John Linville, Larry Finger

On Mon, Jan 20, 2014 at 2:51 AM, andrea merello
<andrea.merello@gmail.com> wrote:
>
> +       if (hw->flags &
> IEEE80211_HW_SIGNAL_UNSPEC && hw->max_signal <= 0)
> +               return -EINVAL;
> +

Should we add a check for > 100 as well, similar to cfg?

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-01-21 19:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-19 21:21 [PATCH] mac80211: add check on hw->max_signal value on ieee80211_register_hw andrea merello
2014-01-20 10:25 ` Johannes Berg
2014-01-21 19:02 ` Krishna Chaitanya

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.