Skip to contentSkip to conversation

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

DISCUSSION Alexey Dobriyan 1 participant 1 message Jun 6, 2005 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Added linux-kernel, sorry.

Quoted 12 lines · On Monday 06 June 2005 10:24, [email protected] wrote:

v9fs: transport modules

fs/9p/mux.c new file +7 -0
 
+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);

fs/9p/mux.c

Quoted 10 lines
fs/9p/mux.c new file +10 -0
+		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?

Quoted 5 lines

+/**
+ * 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.

fs/9p/mux.c

Quoted 12 lines
fs/9p/mux.c new file +11 -0
+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.

fs/9p/mux.c

Quoted 8 lines
fs/9p/mux.c new file +7 -0
+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".

fs/9p/mux.c

Quoted 7 lines
fs/9p/mux.c new file +6 -0
+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().

fs/9p/trans_sock.c

Quoted 13 lines
fs/9p/trans_sock.c new file +10 -0
 
+/**
+ * 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.

fs/9p/trans_sock.c

Quoted 11 lines
fs/9p/trans_sock.c new file +11 -0
+/**
+ * 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.