diff options
| author | Trond Myklebust <trond.myklebust@primarydata.com> | 2015-02-11 17:27:55 -0500 |
|---|---|---|
| committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2015-02-11 19:02:51 -0500 |
| commit | d8ba1f971497c19cf80da1ea5391a46a5f9fbd41 (patch) | |
| tree | 42028cf8afc20ecb15740a60300b4b5274cc4b8a | |
| parent | c627d31ba0696cbd829437af2be2f2dee3546b1e (diff) | |
NFSv4.1: Fix a kfree() of uninitialised pointers in decode_cb_sequence_args
If the call to decode_rc_list() fails due to a memory allocation error,
then we need to truncate the array size to ensure that we only call
kfree() on those pointer that were allocated.
Reported-by: David Ramos <daramos@stanford.edu>
Fixes: 4aece6a19cf7f ("nfs41: cb_sequence xdr implementation")
Cc: stable@vger.kernel.org
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
| -rw-r--r-- | fs/nfs/callback_xdr.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c index f4ccfe6521ec..02f8d09e119f 100644 --- a/fs/nfs/callback_xdr.c +++ b/fs/nfs/callback_xdr.c | |||
| @@ -464,8 +464,10 @@ static __be32 decode_cb_sequence_args(struct svc_rqst *rqstp, | |||
| 464 | 464 | ||
| 465 | for (i = 0; i < args->csa_nrclists; i++) { | 465 | for (i = 0; i < args->csa_nrclists; i++) { |
| 466 | status = decode_rc_list(xdr, &args->csa_rclists[i]); | 466 | status = decode_rc_list(xdr, &args->csa_rclists[i]); |
| 467 | if (status) | 467 | if (status) { |
| 468 | args->csa_nrclists = i; | ||
| 468 | goto out_free; | 469 | goto out_free; |
| 470 | } | ||
| 469 | } | 471 | } |
| 470 | } | 472 | } |
| 471 | status = 0; | 473 | status = 0; |
