[PATCH] 9p bug fix: return non-zero error value in p9_put_data

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Abhishek Kulkarni
Date: Tuesday, August 26, 2008 - 10:30 am

p9_put_data is called by p9_create_twrite which expects it to return a
non-zero value on error. This was the reason why every p9_client_write
was failing. This patch also adds a check for buffer overflow in
p9_put_data.

Signed-off-by: Abhishek Kulkarni <kulkarni@lanl.gov>
---
 net/9p/conv.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/net/9p/conv.c b/net/9p/conv.c
index 4454720..7f6db15 100644
--- a/net/9p/conv.c
+++ b/net/9p/conv.c
@@ -451,8 +451,11 @@ p9_put_data(struct cbuf *bufp, const char *data,
int count,
 		   unsigned char **pdata)
 {
 	*pdata = buf_alloc(bufp, count);
+	if (buf_check_overflow(bufp))
+		return -EIO;
+
 	memmove(*pdata, data, count);
-	return count;
+	return 0;
 }
 
 static int


Thanks,
 -- Abhishek

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] 9p bug fix: return non-zero error value in p9_put_data, Abhishek Kulkarni, (Tue Aug 26, 10:30 am)
Re: [V9fs-developer] [PATCH] 9p bug fix: return non-zero e ..., Latchesar Ionkov, (Tue Aug 26, 11:53 am)
Re: [PATCH] 9p bug fix: return non-zero error value in p9_ ..., Eric Van Hensbergen, (Thu Aug 28, 11:10 am)
Re: [PATCH] 9p bug fix: return non-zero error value in p9_ ..., Abhishek Kulkarni, (Thu Aug 28, 11:35 am)
Re: [PATCH] 9p bug fix: return non-zero error value in p9_ ..., Abhishek Kulkarni, (Tue Sep 2, 12:04 pm)
Re: [PATCH] 9p bug fix: return non-zero error value in p9_ ..., Eric Van Hensbergen, (Tue Sep 23, 1:33 pm)