Patchwork [net/9p] Possible regression in p9_client_stat

login
register
mail settings
Submitter Abhishek Kulkarni
Date July 13, 2009, 1:49 p.m.
Message ID <1247492991-26009-1-git-send-email-adkulkar@umail.iu.edu>
Download mbox | patch
Permalink /patch/29733/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

Abhishek Kulkarni - July 13, 2009, 1:49 p.m.
Fix a possible regression with p9_client_stat where it can try to kfree an ERR_PTR
after an erroneous p9pdu_readf. Also remove an unnecessary data buffer increment
in p9_client_read.

Signed-off-by: Abhishek Kulkarni <adkulkar@umail.iu.edu>
---
:100644 100644 dd43a82... cc25e63... M	net/9p/client.c
 net/9p/client.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
Eric Van Hensbergen - July 14, 2009, 6:29 p.m.
applied v9fs-devel

On Mon, Jul 13, 2009 at 8:49 AM, Abhishek Kulkarni<adkulkar@umail.iu.edu> wrote:
> Fix a possible regression with p9_client_stat where it can try to kfree an ERR_PTR
> after an erroneous p9pdu_readf. Also remove an unnecessary data buffer increment
> in p9_client_read.
>
> Signed-off-by: Abhishek Kulkarni <adkulkar@umail.iu.edu>
> ---
> :100644 100644 dd43a82... cc25e63... M  net/9p/client.c
>  net/9p/client.c |    7 ++-----
>  1 files changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/net/9p/client.c b/net/9p/client.c
> index dd43a82..cc25e63 100644
> --- a/net/9p/client.c
> +++ b/net/9p/client.c
> @@ -1098,7 +1098,6 @@ p9_client_read(struct p9_fid *fid, char *data, char __user *udata, u64 offset,
>
>        if (data) {
>                memmove(data, dataptr, count);
> -               data += count;
>        }
>
>        if (udata) {
> @@ -1192,9 +1191,9 @@ struct p9_wstat *p9_client_stat(struct p9_fid *fid)
>
>        err = p9pdu_readf(req->rc, clnt->dotu, "wS", &ignored, ret);
>        if (err) {
> -               ret = ERR_PTR(err);
>                p9pdu_dump(1, req->rc);
> -               goto free_and_error;
> +               p9_free_req(clnt, req);
> +               goto error;
>        }
>
>        P9_DPRINTK(P9_DEBUG_9P,
> @@ -1211,8 +1210,6 @@ struct p9_wstat *p9_client_stat(struct p9_fid *fid)
>        p9_free_req(clnt, req);
>        return ret;
>
> -free_and_error:
> -       p9_free_req(clnt, req);
>  error:
>        kfree(ret);
>        return ERR_PTR(err);
> --
> 1.6.0.4
>
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/9p/client.c b/net/9p/client.c
index dd43a82..cc25e63 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -1098,7 +1098,6 @@  p9_client_read(struct p9_fid *fid, char *data, char __user *udata, u64 offset,
 
 	if (data) {
 		memmove(data, dataptr, count);
-		data += count;
 	}
 
 	if (udata) {
@@ -1192,9 +1191,9 @@  struct p9_wstat *p9_client_stat(struct p9_fid *fid)
 
 	err = p9pdu_readf(req->rc, clnt->dotu, "wS", &ignored, ret);
 	if (err) {
-		ret = ERR_PTR(err);
 		p9pdu_dump(1, req->rc);
-		goto free_and_error;
+		p9_free_req(clnt, req);
+		goto error;
 	}
 
 	P9_DPRINTK(P9_DEBUG_9P,
@@ -1211,8 +1210,6 @@  struct p9_wstat *p9_client_stat(struct p9_fid *fid)
 	p9_free_req(clnt, req);
 	return ret;
 
-free_and_error:
-	p9_free_req(clnt, req);
 error:
 	kfree(ret);
 	return ERR_PTR(err);