From: Dan Carpenter <error27@gmail.com>
To: Roland Dreier <rdreier@cisco.com>
Cc: Jiri Slaby <jslaby@suse.cz>,
linux-kernel@vger.kernel.org, jirislaby@gmail.com,
Or Gerlitz <ogerlitz@voltaire.com>
Subject: Re: [PATCH 1/1] infiniband: ulp/iser, fix error retval in iser_create_ib_conn_res
Date: Thu, 1 Apr 2010 18:38:40 +0300 [thread overview]
Message-ID: <20100401153839.GA5265@bicker> (raw)
In-Reply-To: <adak4ssi4ky.fsf@roland-alpha.cisco.com>
On Wed, Mar 31, 2010 at 02:06:21PM -0700, Roland Dreier wrote:
> So looking at merging this finally, I think I see one problem with the
> proposed patch. We have:
>
> > @@ -183,7 +180,7 @@ static int iser_create_ib_conn_res(struct iser_conn *ib_conn)
> > ib_conn->fmr_pool = ib_create_fmr_pool(device->pd, ¶ms);
> > if (IS_ERR(ib_conn->fmr_pool)) {
> > ret = PTR_ERR(ib_conn->fmr_pool);
> > - goto fmr_pool_err;
> > + goto out_err;
> > }
>
> and
>
> > @@ -209,12 +206,7 @@ static int iser_create_ib_conn_res(struct iser_conn *ib_conn)
> > ib_conn->fmr_pool, ib_conn->cma_id->qp);
> > return ret;
> >
> > -qp_err:
> > - (void)ib_destroy_fmr_pool(ib_conn->fmr_pool);
> > -fmr_pool_err:
> > - kfree(ib_conn->page_vec);
> > - kfree(ib_conn->login_buf);
> > -alloc_err:
> > +out_err:
> > iser_err("unable to alloc mem or create resource, err %d\n", ret);
> > return ret;
> > }
>
> so if ib_create_fmr_pool() fails, we're left with ib_conn->fmr_pool
> holding an error pointer, right? But we're relying on
> iser_free_ib_conn_res() to clean up after us, and that has:
>
> if (ib_conn->fmr_pool != NULL)
> ib_destroy_fmr_pool(ib_conn->fmr_pool);
>
> so we're going to end up trying to free an error pointer, which will
> probably crash.
>
> I think.
>
> Dan or Or, am I wrong here or do we need another iteration of this
> patch? (the login_buf and page_vec changes do look correct to me, since
> a failed kmalloc() will leave us with a NULL pointer that it is safe to
> kfree() later)
You're right. I missed that.
I will send an updated patch tomorrow.
regards,
dan carpenter
>
> - R.
> --
> Roland Dreier <rolandd@cisco.com> || For corporate legal information go to:
> http://www.cisco.com/web/about/doing_business/legal/cri/index.html
next prev parent reply other threads:[~2010-04-01 15:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-16 14:49 [PATCH 1/1] infiniband: ulp/iser, fix error retval in iser_create_ib_conn_res Jiri Slaby
2010-03-16 23:52 ` Roland Dreier
2010-03-17 15:11 ` Dan Carpenter
2010-03-31 21:06 ` Roland Dreier
2010-04-01 15:38 ` Dan Carpenter [this message]
2010-04-02 11:27 ` [patch v3] " Dan Carpenter
2010-05-05 18:09 ` Roland Dreier
2010-05-06 13:22 ` Or Gerlitz
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=20100401153839.GA5265@bicker \
--to=error27@gmail.com \
--cc=jirislaby@gmail.com \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=ogerlitz@voltaire.com \
--cc=rdreier@cisco.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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox