From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Tore Anderson <tore@linpro.no>
Cc: "David S. Miller" <davem@redhat.com>, linux-kernel@vger.kernel.org
Subject: Re: [BUG] scheduling while atomic when lseek()ing in /proc/net/tcp
Date: Sat, 29 Nov 2003 02:12:38 +0900 [thread overview]
Message-ID: <87n0ag2z95.fsf@devron.myhome.or.jp> (raw)
In-Reply-To: <1069974335.14367.17.camel@echo.linpro.no>
Tore Anderson <tore@linpro.no> writes:
> #include <sys/types.h>
> #include <sys/stat.h>
> #include <fcntl.h>
> #include <unistd.h>
> #include <stdio.h>
>
> int main(void) {
> char buf[8192];
> int fd, chars;
> fd = open("/proc/net/tcp", O_RDONLY);
> chars = read(fd, buf, sizeof(buf));
> lseek(fd, -chars+1, SEEK_CUR);
> close(fd);
> return 0;
> }
This seems to need initialization of st->state in tcp_seq_start().
tcp_seq_stop() is run with previous st->state, so it call the unneeded
unlock etc.
net/ipv4/tcp_ipv4.c | 1 +
1 files changed, 1 insertion(+)
diff -puN net/ipv4/tcp_ipv4.c~tcp_seq-oops-fix net/ipv4/tcp_ipv4.c
--- linux-2.6.0-test11/net/ipv4/tcp_ipv4.c~tcp_seq-oops-fix 2003-11-29 00:52:15.000000000 +0900
+++ linux-2.6.0-test11-hirofumi/net/ipv4/tcp_ipv4.c 2003-11-29 00:52:28.000000000 +0900
@@ -2356,6 +2356,7 @@ static void *tcp_get_idx(struct seq_file
static void *tcp_seq_start(struct seq_file *seq, loff_t *pos)
{
struct tcp_iter_state* st = seq->private;
+ st->state = TCP_SEQ_STATE_LISTENING;
st->num = 0;
return *pos ? tcp_get_idx(seq, *pos - 1) : SEQ_START_TOKEN;
}
_
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
next prev parent reply other threads:[~2003-11-28 17:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-27 23:05 [BUG] scheduling while atomic when lseek()ing in /proc/net/tcp Tore Anderson
2003-11-28 6:19 ` Raj
2003-11-28 17:12 ` OGAWA Hirofumi [this message]
2003-11-30 4:42 ` David S. Miller
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=87n0ag2z95.fsf@devron.myhome.or.jp \
--to=hirofumi@mail.parknet.co.jp \
--cc=davem@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tore@linpro.no \
/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 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.