lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Fri, 2 Nov 2007 10:57:10 -0600
From:	Latchesar Ionkov <lucho@...kov.net>
To:	v9fs-developer@...ts.sourceforge.net
Cc:	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 2/10] 9p: fcall deserialization changes

Modify p9_deserialize_fcall to read from p9_fcall's internal buffer instead
of specifying an external one. Add functions that copy raw data to and from
a fcall.

Signed-off-by: Latchesar Ionkov <lucho@...kov.net>

---
 include/net/9p/9p.h |    4 +++-
 net/9p/conv.c       |   34 ++++++++++++++++++++++++++++------
 2 files changed, 31 insertions(+), 7 deletions(-)

diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h
index 86fee63..8de6eef 100644
--- a/include/net/9p/9p.h
+++ b/include/net/9p/9p.h
@@ -381,9 +381,11 @@ extern struct kset p9_subsys;
 
 int p9_deserialize_stat(void *buf, u32 buflen, struct p9_stat *stat,
 	int dotu);
-int p9_deserialize_fcall(void *buf, u32 buflen, struct p9_fcall *fc, int dotu);
+int p9_deserialize_fcall(struct p9_fcall *fc, int dotu);
 void p9_set_tag(struct p9_fcall *fc, u16 tag);
 struct p9_fcall *p9_fcall_alloc(u32 size);
+int p9_fcall_get(char *dst, int dstlen, struct p9_fcall *fc);
+int p9_fcall_put(struct p9_fcall *fc, char *src, int srclen);
 struct p9_fcall *p9_create_tversion(u32 msize, char *version);
 struct p9_fcall *p9_create_tattach(u32 fid, u32 afid, char *uname,
 	char *aname, u32 n_uname, int dotu);
diff --git a/net/9p/conv.c b/net/9p/conv.c
index 3627753..74d57c7 100644
--- a/net/9p/conv.c
+++ b/net/9p/conv.c
@@ -322,18 +322,20 @@ EXPORT_SYMBOL(p9_deserialize_stat);
  *
  */
 
-int
-p9_deserialize_fcall(void *buf, u32 buflen, struct p9_fcall *rcall,
-		       int dotu)
+int p9_deserialize_fcall(struct p9_fcall *rcall, int dotu)
 {
-
+	u32 size;
 	struct cbuf buffer;
 	struct cbuf *bufp = &buffer;
 	int i = 0;
 
-	buf_init(bufp, buf, buflen);
+	buf_init(bufp, rcall->sdata, rcall->size);
 
-	rcall->size = buf_get_int32(bufp);
+	size = buf_get_int32(bufp);
+	if (size > rcall->size)
+		return -EPROTO;
+
+	rcall->size = size;
 	rcall->id = buf_get_int8(bufp);
 	rcall->tag = buf_get_int16(bufp);
 
@@ -941,3 +943,23 @@ error:
 	return fc;
 }
 EXPORT_SYMBOL(p9_create_twstat);
+
+int p9_fcall_get(char *dst, int dstlen, struct p9_fcall *fc)
+{
+	if (dstlen > fc->size)
+		dstlen = fc->size;
+
+	memmove(dst, fc->sdata, dstlen);
+	return dstlen;
+}
+EXPORT_SYMBOL(p9_fcall_get);
+
+int p9_fcall_put(struct p9_fcall *fc, char *src, int srclen)
+{
+	if (srclen > fc->size)
+		return -ENOMEM;
+
+	memmove(fc->sdata, src, srclen);
+	return srclen;
+}
+EXPORT_SYMBOL(p9_fcall_put);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ