From: Chuck Lever <chuck.lever@oracle.com> To: Dan Carpenter <dan.carpenter@oracle.com> Cc: Trond Myklebust <trond.myklebust@hammerspace.com>, Jeff Layton <jlayton@kernel.org>, Anna Schumaker <anna.schumaker@netapp.com>, Linux NFS Mailing List <linux-nfs@vger.kernel.org>, kernel-janitors@vger.kernel.org Subject: Re: [PATCH] xprtrdma: Make rpcrdma_sendctxs_destroy() more robust Date: Mon, 07 Jan 2019 21:25:19 +0000 [thread overview] Message-ID: <E3C7A7BA-DECD-4EF6-96D8-A43681E56081@oracle.com> (raw) In-Reply-To: <20190107190806.GA6094@kadam> > On Jan 7, 2019, at 2:08 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote: > > There was a double free in the error handling here recently. It was > a bit subtle which function was supposed to call rpcrdma_sendctxs_destroy() > so it was called in both. > > This patch makes it so we can call rpcrdma_sendctxs_destroy() twice > in a row without crashing. Belt-and-braces. I think the other patch "must" be applied, and this one "should" be applied. Reviewed-by: Chuck Lever <chuck.lever@oracle.com> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> > --- > net/sunrpc/xprtrdma/verbs.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c > index 7749a2bf6887..d05f4885548d 100644 > --- a/net/sunrpc/xprtrdma/verbs.c > +++ b/net/sunrpc/xprtrdma/verbs.c > @@ -802,9 +802,12 @@ static void rpcrdma_sendctxs_destroy(struct rpcrdma_buffer *buf) > { > unsigned long i; > > + if (!buf->rb_sc_ctxs) > + return; > for (i = 0; i <= buf->rb_sc_last; i++) > kfree(buf->rb_sc_ctxs[i]); > kfree(buf->rb_sc_ctxs); > + buf->rb_sc_ctxs = NULL; > } > > static struct rpcrdma_sendctx *rpcrdma_sendctx_create(struct rpcrdma_ia *ia) > -- > 2.17.1 > -- Chuck Lever
WARNING: multiple messages have this Message-ID (diff)
From: Chuck Lever <chuck.lever@oracle.com> To: Dan Carpenter <dan.carpenter@oracle.com> Cc: Trond Myklebust <trond.myklebust@hammerspace.com>, Jeff Layton <jlayton@kernel.org>, Anna Schumaker <anna.schumaker@netapp.com>, Linux NFS Mailing List <linux-nfs@vger.kernel.org>, kernel-janitors@vger.kernel.org Subject: Re: [PATCH] xprtrdma: Make rpcrdma_sendctxs_destroy() more robust Date: Mon, 7 Jan 2019 16:25:19 -0500 [thread overview] Message-ID: <E3C7A7BA-DECD-4EF6-96D8-A43681E56081@oracle.com> (raw) In-Reply-To: <20190107190806.GA6094@kadam> > On Jan 7, 2019, at 2:08 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote: > > There was a double free in the error handling here recently. It was > a bit subtle which function was supposed to call rpcrdma_sendctxs_destroy() > so it was called in both. > > This patch makes it so we can call rpcrdma_sendctxs_destroy() twice > in a row without crashing. Belt-and-braces. I think the other patch "must" be applied, and this one "should" be applied. Reviewed-by: Chuck Lever <chuck.lever@oracle.com> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> > --- > net/sunrpc/xprtrdma/verbs.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c > index 7749a2bf6887..d05f4885548d 100644 > --- a/net/sunrpc/xprtrdma/verbs.c > +++ b/net/sunrpc/xprtrdma/verbs.c > @@ -802,9 +802,12 @@ static void rpcrdma_sendctxs_destroy(struct rpcrdma_buffer *buf) > { > unsigned long i; > > + if (!buf->rb_sc_ctxs) > + return; > for (i = 0; i <= buf->rb_sc_last; i++) > kfree(buf->rb_sc_ctxs[i]); > kfree(buf->rb_sc_ctxs); > + buf->rb_sc_ctxs = NULL; > } > > static struct rpcrdma_sendctx *rpcrdma_sendctx_create(struct rpcrdma_ia *ia) > -- > 2.17.1 > -- Chuck Lever
next prev parent reply other threads:[~2019-01-07 21:25 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-01-05 13:06 [PATCH 2/2] xprtrdma: Double free in rpcrdma_sendctxs_create() Dan Carpenter 2019-01-05 13:06 ` Dan Carpenter 2019-01-05 16:24 ` Chuck Lever 2019-01-05 16:24 ` Chuck Lever 2019-01-07 17:22 ` Bruce Fields 2019-01-07 17:22 ` Bruce Fields 2019-01-07 22:21 ` Schumaker, Anna 2019-01-07 22:21 ` Schumaker, Anna 2019-01-07 18:41 ` Dan Carpenter 2019-01-07 18:41 ` Dan Carpenter 2019-01-07 19:08 ` [PATCH] xprtrdma: Make rpcrdma_sendctxs_destroy() more robust Dan Carpenter 2019-01-07 19:08 ` Dan Carpenter 2019-01-07 21:25 ` Chuck Lever [this message] 2019-01-07 21:25 ` Chuck Lever
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=E3C7A7BA-DECD-4EF6-96D8-A43681E56081@oracle.com \ --to=chuck.lever@oracle.com \ --cc=anna.schumaker@netapp.com \ --cc=dan.carpenter@oracle.com \ --cc=jlayton@kernel.org \ --cc=kernel-janitors@vger.kernel.org \ --cc=linux-nfs@vger.kernel.org \ --cc=trond.myklebust@hammerspace.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.