From: <gregkh@linuxfoundation.org>
To: leon@kernel.org, dledford@redhat.com, gregkh@linuxfoundation.org
Cc: <stable@vger.kernel.org>, <stable-commits@vger.kernel.org>
Subject: Patch "IB/core: Release allocated memory in cache setup failure" has been added to the 4.9-stable tree
Date: Fri, 20 Jan 2017 15:29:53 +0100 [thread overview]
Message-ID: <14849225931170@kroah.com> (raw)
This is a note to let you know that I've just added the patch titled
IB/core: Release allocated memory in cache setup failure
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
ib-core-release-allocated-memory-in-cache-setup-failure.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.
>From aa6aae38f7fb2c030f326a6dd10b58fff1851dfa Mon Sep 17 00:00:00 2001
From: Leon Romanovsky <leon@kernel.org>
Date: Thu, 3 Nov 2016 16:44:11 +0200
Subject: IB/core: Release allocated memory in cache setup failure
From: Leon Romanovsky <leon@kernel.org>
commit aa6aae38f7fb2c030f326a6dd10b58fff1851dfa upstream.
The failure in ib_cache_setup_one function during
ib_register_device will leave leaked allocated memory.
Fixes: 03db3a2d81e6 ("IB/core: Add RoCE GID table management")
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/infiniband/core/cache.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
--- a/drivers/infiniband/core/cache.c
+++ b/drivers/infiniband/core/cache.c
@@ -770,12 +770,8 @@ static int _gid_table_setup_one(struct i
int err = 0;
table = kcalloc(ib_dev->phys_port_cnt, sizeof(*table), GFP_KERNEL);
-
- if (!table) {
- pr_warn("failed to allocate ib gid cache for %s\n",
- ib_dev->name);
+ if (!table)
return -ENOMEM;
- }
for (port = 0; port < ib_dev->phys_port_cnt; port++) {
u8 rdma_port = port + rdma_start_port(ib_dev);
@@ -1170,14 +1166,13 @@ int ib_cache_setup_one(struct ib_device
GFP_KERNEL);
if (!device->cache.pkey_cache ||
!device->cache.lmc_cache) {
- pr_warn("Couldn't allocate cache for %s\n", device->name);
- return -ENOMEM;
+ err = -ENOMEM;
+ goto free;
}
err = gid_table_setup_one(device);
if (err)
- /* Allocated memory will be cleaned in the release function */
- return err;
+ goto free;
for (p = 0; p <= rdma_end_port(device) - rdma_start_port(device); ++p)
ib_cache_update(device, p + rdma_start_port(device));
@@ -1192,6 +1187,9 @@ int ib_cache_setup_one(struct ib_device
err:
gid_table_cleanup_one(device);
+free:
+ kfree(device->cache.pkey_cache);
+ kfree(device->cache.lmc_cache);
return err;
}
Patches currently in stable-queue which might be from leon@kernel.org are
queue-4.9/ib-mlx4-check-if-grh-is-available-before-using-it.patch
queue-4.9/ib-mlx4-set-traffic-class-in-ah.patch
queue-4.9/ib-mlx5-assign-srq-type-earlier.patch
queue-4.9/ib-mlx4-fix-port-query-for-56gb-ethernet-links.patch
queue-4.9/ib-mlx5-avoid-system-crash-when-enabling-many-vfs.patch
queue-4.9/ib-mlx4-handle-well-known-gid-in-mad_demux-processing.patch
queue-4.9/ib-ipoib-remove-can-t-use-gfp_noio-warning.patch
queue-4.9/ib-mlx5-wait-for-all-async-command-completions-to-complete.patch
queue-4.9/ib-mlx5-fix-reported-max-sge-calculation.patch
queue-4.9/ib-mlx4-when-no-dmfs-for-ipoib-don-t-allow-net_if-qps.patch
queue-4.9/ib-mlx4-fix-out-of-range-array-index-in-destroy-qp-flow.patch
queue-4.9/ib-core-release-allocated-memory-in-cache-setup-failure.patch
queue-4.9/ib-rxe-increase-max-number-of-completions-to-32k.patch
reply other threads:[~2017-01-20 14:29 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=14849225931170@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=dledford@redhat.com \
--cc=leon@kernel.org \
--cc=stable-commits@vger.kernel.org \
--cc=stable@vger.kernel.org \
/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 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.