mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nick Kossifidis <mickflemm@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	jirislaby@gmail.com, lrodriguez@atheros.com, me@bobcopeland.com,
	linux-wireless@vger.kernel.org, ath5k-devel@venema.h4ckr.net,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] ath5k: prevent infinite loop
Date: Tue, 19 May 2009 03:34:37 +0300	[thread overview]
Message-ID: <40f31dec0905181734t6a3db7f4peb2d57c3aebe075b@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.00.0905182011270.7956@gandalf.stny.rr.com>

2009/5/19 Steven Rostedt <rostedt@goodmis.org>:
>
> After updating my laptop with the latest kernel (had 2.6.26 before that),
> my laptop load went to 100%. The daemon phy0 was at 99.9% of the CPU.
> Luckily I compiled with a preempt kernel otherwise this would have
> been a lock up.
>
> Using ftrace to dig into the problem I found that that the ath5k driver
> was in an infinite loop. The code in ath5k_get_linear_pcdac_min has:
>
>        pwr_i = pwrR[0];
>        do {
>                pwr_i--;
>                tmp = (s8) ath5k_get_interpolated_value(pwr_i,
>                                                pwrR[0], pwrR[1],
>                                                stepR[0], stepR[1]);
>        } while (tmp > 1);
>
>
> But ath5k_get_interpolated returns stepR[0] if pwrR[0] == pwrR[1] or
> stepR[0] == stepR[1]. The pwr_i is ignored and we enter an infinite loop
> because tmp never changes between iterations. Using ftrace, I was able to
> determine that is exactly what happened in the case of my laptop.
>
> This patch tries to keep the same result that would happen when this case
> occurs. That is, the pwr_i becomes a minimal number. I used the minimum
> number that a signed short may be to initialize the min pwrL and pwrR.
> Then if the case that the code would cause an infinite loop, we bypass it.
>
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
>

This is already fixed on wireless-testing ;-)
http://git.kernel.org/?p=linux/kernel/git/linville/wireless-testing.git;a=blob;f=drivers/net/wireless/ath/ath5k/phy.c;h=d0d1c350025aebba1fe4e17a44550536a59951ba;hb=HEAD

-- 
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick

  reply	other threads:[~2009-05-19  0:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-19  0:28 Steven Rostedt
2009-05-19  0:34 ` Nick Kossifidis [this message]
2009-05-19  0:43   ` Steven Rostedt
2009-05-19  6:32     ` Nick Kossifidis
2009-05-19  6:39       ` [ath5k-devel] " Luis R. Rodriguez
2009-05-19 11:45         ` Steven Rostedt
2009-05-19 16:38           ` Luis R. Rodriguez
2009-05-19 11:42       ` Bob Copeland
2009-05-19 11:54         ` Steven Rostedt
2009-05-19 12:34           ` Bob Copeland
2009-05-20  3:37           ` [PATCH] ath5k: avoid and warn on potential " Bob Copeland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=40f31dec0905181734t6a3db7f4peb2d57c3aebe075b@mail.gmail.com \
    --to=mickflemm@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=ath5k-devel@venema.h4ckr.net \
    --cc=jirislaby@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lrodriguez@atheros.com \
    --cc=me@bobcopeland.com \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®