From: Markus Elfring <Markus.Elfring@web.de>
To: Qiushi Wu <wu000273@umn.edu>, linux-rdma@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
Doug Ledford <dledford@redhat.com>,
Jason Gunthorpe <jgg@ziepe.ca>, Kangjie Lu <kjlu@umn.edu>,
Leon Romanovsky <leon@kernel.org>
Subject: Re: [PATCH] RDMA/core: Complete exception handling in add_port()
Date: Mon, 25 May 2020 14:54:47 +0200 [thread overview]
Message-ID: <4bf45476-ad99-042b-d0ea-3c97bb429a98@web.de> (raw)
> In function add_port(), pointer p is not released in error paths.
1. I would prefer to describe that an ib_port data structure was not released
in some error cases.
How relevant can its size be here?
> Fix this issue by adding a kfree(p) into the end of error path.
2. I suggest to improve also this change description.
3. I find an other subject more appropriate.
…
> +++ b/drivers/infiniband/core/sysfs.c
> @@ -1202,6 +1202,7 @@ static int add_port(struct ib_core_device *coredev, int port_num)
>
> err_put:
> kobject_put(&p->kobj);
> + kfree(p);
> return ret;
> }
4. I recommend to add also the label “free_port” before the missed function call.
Another source code place should be accordingly adjusted then.
ret = kobject_init_and_add(&p->kobj, &port_type,
coredev->ports_kobj,
"%d", port_num);
- if (ret) {
- kfree(p);
- return ret;
- }
+ if (ret)
+ goto free_port;
5. Will a similar adjustment be needed for the data structure member “gid_attr_group”
according to the desired complete exception handling?
Regards,
Markus
reply other threads:[~2020-05-25 12:55 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4bf45476-ad99-042b-d0ea-3c97bb429a98@web.de \
--to=markus.elfring@web.de \
--cc=dledford@redhat.com \
--cc=jgg@ziepe.ca \
--cc=kernel-janitors@vger.kernel.org \
--cc=kjlu@umn.edu \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=wu000273@umn.edu \
/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
all inboxes | Powered by JetHome®