[1360] in linux-net channel archive

home help back first fref pref prev next nref lref last post

Net problems with send() in 1.3.40

daemon@ATHENA.MIT.EDU (Corey Minyard)
Sun Nov 12 08:18:06 1995

Date: Sat, 11 Nov 95 23:48 CST
From: Corey Minyard <minyard@wf-rch.cirr.com>
To: linux-net@vger.rutgers.edu, linux-kernel@vger.rutgers.edu
Reply-to: minyard@metronet.com


I just tried out 1.3.40.  It looks pretty good for the most part and
cleans up all the module problems I had been having.  However, the tcp
fixes for sendmsg() changes seem to have exposed another bug in the
send() call (see the end of the email for the fix).

Things are looking really good.  I am still having problems with the
sound driver with a SB16 (recording in 8-bit mode adds funny data to
the buffer at 1K intervals, 16-bit recording gets timeouts.  Playback
in both modes works fine).  My PAS16 works great, though, even as a
module.

Dare I ask it?  Are we almost ready for 1.4?  I seem to be at the
stability level of the 1.2 kernels (which stayed up for 130 days
before I upgraded to 1.3 and ELF at work.  That was a painful reboot).
I would like to see 2.0 reserved for a full working SMP kernel (code
name NT Killer), but these decisions are not mine to make.

Anyway, the probable bug in net/socket.c ...

asmlinkage int sys_send(int fd, void * buff, int len, unsigned flags)
{
	struct socket *sock;
	struct file *file;
	int err;
	struct msghdr msg;
	struct iovec iov;

	if (fd < 0 || fd >= NR_OPEN || ((file = current->files->fd[fd]) == NULL))
		return(-EBADF);
	if (!(sock = sockfd_lookup(fd, NULL))) 
		return(-ENOTSOCK);

	if(len<0)
		return -EINVAL;
	err=verify_area(VERIFY_READ, buff, len);
	if(err)
		return err;
		
	msg.msg_name=NULL;
	msg.msg_iov=&iov;
	msg.msg_iovlen=1;
	msg.msg_accrights=NULL;
	iov.iov_base=buff;
	iov.iov_len=1;
		    ^
		    |
->		    I think this should be len, not 1

	return(sock->ops->sendmsg(sock, &msg, len, (file->f_flags & O_NONBLOCK), flags));
}

As you might image, send only sent one byte, not the length of the
buffer.  I think this fix is right, but I don't know if it will break
something else.  It seems to work fine for me.

-- 
Corey Minyard               Internet:  minyard@metronet.com
  Work: minyard@bnr.ca          UUCP:  minyard@wf-rch.cirr.com

home help back first fref pref prev next nref lref last post