Re: [PATCH] timer_list: Correct the show function for timer_listby using iter->now

From: Nathan Zimmer
Date: Tue Jul 23 2013 - 18:50:52 EST


On 07/23/2013 02:18 AM, Holger Hans Peter Freyther wrote:
On Mon, Jul 22, 2013 at 04:18:31PM -0500, Nathan Zimmer wrote:
This patch corrects the issue with /proc/timer_list reported by Holger.
When reading from the proc file with a sufficently small buffer, 2k so not
really that small, there was one could get hung trying to read the file a
chunk at a time.
I think it makes sense to always use iter->now but it does not solve
the issue with dropbear/my test case. Or is this meant to be applied
on top of the previous patch?


holger

Ah sorry I networked booted the wrong kernel and got excited.


However after hitting my head against this for the better part of the day I found
the root cause of my issue.

In seq_read about halfway down when we flush the buffer to userland.
m->index is advanced without calling m->op->next().
My iterator doesn't take notice of that and thus fails to advance.

/* if not empty - flush it first */
if (m->count) {
n = min(m->count, size);
err = copy_to_user(buf, m->buf + m->from, n);
if (err)
goto Efault;
m->count -= n;
m->from += n;
size -= n;
buf += n;
copied += n;
if (!m->count)
m->index++;
....


I'll need to think about how to correct it.

For the moment probably the right thing would be to revert b3956a896ea5

--
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/