Hi,
Attached is a patch that corrects what I belive is a minor flaw in
copy_and_csum_toiovec().
Currently there is no distinction between a csum error and an io error. If a
user application provides a bad buffer, this would result in incoming segments
being silently discarded (copy_and_csum_toiovec() returns -EINVAL). What should
happen, to my understanding, is that the error from csum_and_copy_to_user()
should be returned so that the user application is notified.
/Per
Index: net/core/iovec.c
===================================================================
RCS file: /n/cvsroot/os/linux/net/core/iovec.c,v
retrieving revision 1.2
diff -u -r1.2 iovec.c
--- net/core/iovec.c 2001/02/23 13:51:30 1.2
+++ net/core/iovec.c 2001/03/06 14:08:11
@@ -130,7 +130,9 @@
csum = csum_partial(skb->h.raw, hlen, skb->csum);
csum = csum_and_copy_to_user(skb->h.raw+hlen, iov->iov_base,
chunk, csum, &err);
- if (err || ((unsigned short)csum_fold(csum)))
+ if (err)
+ return err;
+ if ((unsigned short)csum_fold(csum))
goto csum_error;
iov->iov_len -= chunk;
iov->iov_base += chunk;
|