Re: v9fs-transport-modules.patch added to -mm tree

From: Alexey Dobriyan
Date: Mon Jun 06 2005 - 05:04:13 EST


Added linux-kernel, sorry.

On Monday 06 June 2005 10:24, akpm@xxxxxxxx wrote:
> v9fs: transport modules

> --- /dev/null
> +++ 25-akpm/fs/9p/mux.c

> +static int xread(struct v9fs_session_info *v9ses, void *ptr, unsigned long sz)
> +{
> + int rd = 0;
> + int ret = 0;
> + int readnum = 0;
> + while (rd < sz) {
> + ret = v9ses->transport->read(v9ses->transport, ptr, sz - rd);
> + readnum++;
> + if (ret <= 0) {
> + dprintk(DEBUG_ERROR, "xread errno %d\n", ret);
> + return ret;
> + }
> + rd += ret;
> + ptr += ret;
> + }
> + return (rd);
> +}

readnum is needed for what?

> +/**
> + * read_message - read a full 9P2000 fcall packet
> + * @v9ses: session info structure
> + * @rcall: fcall structure to read into
> + * @rcalllen: size of fcall structure

This makes me think rcalllen == sizeof(struct v9fs_fcall) which is not true.

> +static int
> +read_message(struct v9fs_session_info *v9ses,
> + struct v9fs_fcall *rcall, int rcalllen)
> +{

> + res = v9fs_deserialize_fcall(v9ses, size, data, v9ses->maxdata,
> + rcall, rcalllen);
> +
> + kfree(data);
> +
> + if (res == 0)
> + return -ENOMEM;

v9fs_deserialize_fcall can return 0 if rcall->id in it is unknown. It's
not -ENOMEM.

> +static int v9fs_send(struct v9fs_session_info *v9ses, struct v9fs_rpcreq *req)
> +{

> + ret =
> + v9fs_serialize_fcall(v9ses, tcall, data,
> + v9ses->maxdata + V9FS_IOHDRSZ);
> + if (ret == 0) {
> + ret = -ENOMEM;

See v9fs_deserialize_fcall wrt "bad msg type".

> +static int v9fs_recvproc(void *data)
> +{

> + while (!kthread_should_stop() && err >= 0) {
> + rcall = kmalloc(v9ses->maxdata + V9FS_IOHDRSZ, GFP_KERNEL);
> + dprintk(DEBUG_MUX, "waiting for message\n");
> + err = read_message(v9ses, rcall, v9ses->maxdata + V9FS_IOHDRSZ);

Unchecked kmalloc().

> --- /dev/null
> +++ 25-akpm/fs/9p/trans_sock.c

> +/**
> + * v9fs_tcp_init - initialize TCP socket
> + * @trans: private socket structure for mount
> + * @dev_name: mount target
> + * @data: mount options
> + *
> + */
> +
> +static int
> +v9fs_tcp_init(struct v9fs_session_info *v9ses, const char *addr, char *data)

Comment and arguments don't match.

> +/**
> + * v9fs_unix_init - initialize UNIX domain socket
> + * @trans: private socket info
> + * @dev_name: mount target
> + * @data: mount options
> + *
> + */
> +
> +static int
> +v9fs_unix_init(struct v9fs_session_info *v9ses, const char *dev_name,
> + char *data)

Comment and arguments don't match.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/