Re: [patch 04/15] cleanup clocksource selection
- From: Martin Schwidefsky <schwidefsky@xxxxxxxxxx>
- Date: Mon, 17 Aug 2009 09:34:39 +0200
On Fri, 14 Aug 2009 18:42:20 -0700
john stultz <johnstul@xxxxxxxxxx> wrote:
Here when you return count, count may have been decremented in the code
above, which causes the writer to get back fewer bytes then what they
passed in, causing the last char to be repeatedly sent. This is what
causes the immediate switch back to the default clocksource (override
gets set to null), and the hang of the command writing to the sysfs
file.
The fix is simply keeping the initial "size_t ret = count;" and the
final "return ret;"
Index: linux-2.6-tip/kernel/time/clocksource.c
===================================================================
--- linux-2.6-tip.orig/kernel/time/clocksource.c 2009-08-14 17:29:50.000000000 -0400
+++ linux-2.6-tip/kernel/time/clocksource.c 2009-08-14 17:30:36.000000000 -0400
@@ -478,6 +478,8 @@
struct sysdev_attribute *attr,
const char *buf, size_t count)
{
+ size_t ret = count;
+
/* strings from sysfs write are not 0 terminated! */
if (count >= sizeof(override_name))
return -EINVAL;
@@ -495,7 +497,7 @@
spin_unlock_irq(&clocksource_lock);
- return count;
+ return ret;
}
/**
Opps :-(
Thanks for bisecting & fixing.
--
blue skies,
Martin.
"Reality continues to ruin my life." - Calvin.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
- References:
- [patch 00/15] clocksource / timekeeping rework V4 (resend V3 + bug fix)
- From: Martin Schwidefsky
- [patch 04/15] cleanup clocksource selection
- From: Martin Schwidefsky
- Re: [patch 04/15] cleanup clocksource selection
- From: john stultz
- [patch 00/15] clocksource / timekeeping rework V4 (resend V3 + bug fix)
- Prev by Date: Re: [PATCH] Make shr to divide by power of 2 (resend)
- Next by Date: [PATCH] MFD AB3100 OTP readout
- Previous by thread: Re: [patch 04/15] cleanup clocksource selection
- Next by thread: [tip:timers/core] clocksource: Cleanup clocksource selection
- Index(es):
Relevant Pages
|
Loading