All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] SQUASHME: pnfs: check for read_buf error in decode_pnfs_layoutrecall_args
@ 2010-06-29 10:55 Benny Halevy
  2010-06-29 12:22 ` William A. (Andy) Adamson
  0 siblings, 1 reply; 5+ messages in thread
From: Benny Halevy @ 2010-06-29 10:55 UTC (permalink / raw)
  To: linux-nfs

read_buf may return NULL. return NFS4ERR_RESOURCE in this case.

Signed-off-by: Benny Halevy <bhalevy@panasas.com>
---
 fs/nfs/callback_xdr.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
index 7e34bb3..2f69f0d 100644
--- a/fs/nfs/callback_xdr.c
+++ b/fs/nfs/callback_xdr.c
@@ -247,6 +247,10 @@ static __be32 decode_pnfs_layoutrecall_args(struct svc_rqst *rqstp,
 			goto out;
 
 		p = read_buf(xdr, 2 * sizeof(uint64_t));
+		if (unlikely(p == NULL)) {
+			status = htonl(NFS4ERR_RESOURCE);
+			goto out;
+		}
 		p = xdr_decode_hyper(p, &args->cbl_seg.offset);
 		p = xdr_decode_hyper(p, &args->cbl_seg.length);
 		status = decode_stateid(xdr, &args->cbl_stateid);
@@ -254,6 +258,10 @@ static __be32 decode_pnfs_layoutrecall_args(struct svc_rqst *rqstp,
 			goto out;
 	} else if (args->cbl_recall_type == RETURN_FSID) {
 		p = read_buf(xdr, 2 * sizeof(uint64_t));
+		if (unlikely(p == NULL)) {
+			status = htonl(NFS4ERR_RESOURCE);
+			goto out;
+		}
 		p = xdr_decode_hyper(p, &args->cbl_fsid.major);
 		p = xdr_decode_hyper(p, &args->cbl_fsid.minor);
 	}
-- 
1.6.6.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-06-29 13:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-29 10:55 [PATCH] SQUASHME: pnfs: check for read_buf error in decode_pnfs_layoutrecall_args Benny Halevy
2010-06-29 12:22 ` William A. (Andy) Adamson
     [not found]   ` <AANLkTiku06tjr1NCt4kJMJOlDne11zhRHKkJMc67-DvR-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-06-29 13:00     ` Benny Halevy
2010-06-29 13:19       ` Andy Adamson
2010-06-29 13:57         ` Benny Halevy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.