mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ted Phelps <phelps@dstc.edu.au>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] counting bug in svc_tcp_recvfrom causes panic for TCP NFS
Date: Wed, 15 Jan 2003 22:54:32 +0000	[thread overview]
Message-ID: <200301152254.WAA19810@tereshkova.dstc.edu.au> (raw)


When svc_tcp_recvfrom() builds up its iovec to receive a packet, it
invokes page_address() with an argument which refers to
rqstp->rq_argused++.  For some memory layouts (eg not HIMEM and
not WANT_PAGE_VIRTUAL), page_address() is a macro which evalutes its
argument three times.  This results in a kernel panic when an TCP NFS
client sends a packet longer than about 1/3 of the maximum size.

The patch below causes the increment to be performed outside of the
call to page_address(), which avoids the kernel panic.  Perhaps a
better solution would be to change page_address() to be consistently
be a function for all memory layouts.

Thanks,
-Ted

--- ./linux-2.5.58-ORIG/net/sunrpc/svcsock.c	2003-01-13 22:30:06.000000000 +0000
+++ ./linux-2.5.58/net/sunrpc/svcsock.c	2003-01-15 22:42:03.000000000 +0000
@@ -924,8 +924,9 @@
 	vlen = PAGE_SIZE;
 	pnum = 1;
 	while (vlen < len) {
-		vec[pnum].iov_base = page_address(rqstp->rq_argpages[rqstp->rq_argused++]);
+		vec[pnum].iov_base = page_address(rqstp->rq_argpages[rqstp->rq_argused]);
 		vec[pnum].iov_len = PAGE_SIZE;
+		rqstp->rq_argused++;
 		pnum++;
 		vlen += PAGE_SIZE;
 	}

             reply	other threads:[~2003-01-15 22:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-15 22:54 Ted Phelps [this message]
2003-01-15 23:28 ` Andrew Morton
2003-01-16  0:51   ` Ted Phelps
2003-01-16  0:57     ` Andrew Morton

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=200301152254.WAA19810@tereshkova.dstc.edu.au \
    --to=phelps@dstc.edu.au \
    --cc=linux-kernel@vger.kernel.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®