Re: [PATCH] ncpfs bug

Petr Vandrovec Ing. VTEI (VANDROVE@vc.cvut.cz)
Mon, 31 May 1999 16:19:37 MET-1


On Tue, 25 May 1999, Michael Tross <mtross@compu-shack.com> wrote:
> This patch prevents the NCP fs from hanging in a special case and
> generating ill network traffic.
> I found the case where the linker first opened the output file, wrote
> some bytes in the object file header, and then tried to read at a file
> offset behind the file size. The NCP function call succeeds with data
> length 0, this forces the ncpfs to stay in an endless loop of retrying
> to get this data.
Hi,
I have a problem with your patch:
> - --- v2.2.9/fs/ncpfs/file.c Mon Aug 24 22:02:44 1998
> +++ linux/fs/ncpfs/file.c Tue May 25 14:42:22 1999
> @@ -148,6 +148,12 @@
> error = -EIO; /* This is not exact, i know.. */
> goto out;
> }
> + /* NCP return code was success, but no data returned.
> + Possibly caused by an invalid file offset. */
> + if (! read_this_time) {
> + error = -EFAULT;
> + goto out;
> + }
> pos += read_this_time;
> buf += read_this_time;
> already_read += read_this_time;
in both 2.2.9 and 2.3.3 kernel code continues with:
if (read_this_time < to_read) {
break;
}
So code should exit from this loop if read_this_time is not equal to to_read.
So it will not quit only if 'to_read==0'. And 'to_read' can be zero only
'count==already_read'. And if 'already_read >= count', we do not enter
to this loop... So could you send me testcase? In any case, you should
simple 'break' out of the loop, otherwise reading at the end will give
'-EFAULT' (for example 'cat /file/on/ncpfs' will end with this error).
> I don't know if this patch breaks any other code. And I don't know who
> maintaines the ncpfs.
Do you know about linux/MAINTAINERS file? It has one nice entry called
'NCP FILESYSTEM' :-)
> My environment: linux kernel 2.2.9 running on a P166, FDDI network
> adapter; the NetWare Server is 4.11 with IWSP5B installed.
Could you try 2.2.10-pre1 or 2.3.4-pre1 (& newer)? There are some changes
in pagefault mmap handling code, maybe that your problems came from that bug.
Best regards,
Petr Vandrovec
vandrove@vc.cvut.cz

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/