From: "Jason J. Herne" <jjherne@linux.ibm.com>
To: linux-s390@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, pasic@linux.ibm.com,
akrowiak@linux.ibm.com, jgg@nvidia.com
Subject: [PATCH] s390/vfio-ap: Fix module unload memory leak of matrix_dev
Date: Fri, 18 Jun 2021 09:35:24 -0400 [thread overview]
Message-ID: <20210618133524.22386-1-jjherne@linux.ibm.com> (raw)
vfio_ap_matrix_dev_release is shadowing the global matrix_dev with driver
data that never gets set. So when release is called we end up not freeing
matrix_dev. The fix is to remove the shadow variable and just free the
global.
Signed-off-by: Jason J. Herne <jjherne@linux.ibm.com>
---
drivers/s390/crypto/vfio_ap_drv.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/s390/crypto/vfio_ap_drv.c b/drivers/s390/crypto/vfio_ap_drv.c
index 7dc72cb718b0..6d3eea838e18 100644
--- a/drivers/s390/crypto/vfio_ap_drv.c
+++ b/drivers/s390/crypto/vfio_ap_drv.c
@@ -82,8 +82,6 @@ static void vfio_ap_queue_dev_remove(struct ap_device *apdev)
static void vfio_ap_matrix_dev_release(struct device *dev)
{
- struct ap_matrix_dev *matrix_dev = dev_get_drvdata(dev);
-
kfree(matrix_dev);
}
--
2.21.1
next reply other threads:[~2021-06-18 14:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-18 13:35 Jason J. Herne [this message]
2021-06-18 14:10 ` [PATCH] s390/vfio-ap: Fix module unload memory leak of matrix_dev Jason Gunthorpe
2021-06-18 14:35 ` Jason J. Herne
2021-06-18 14:59 ` Jason Gunthorpe
2021-06-18 15:31 ` Tony Krowiak
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=20210618133524.22386-1-jjherne@linux.ibm.com \
--to=jjherne@linux.ibm.com \
--cc=akrowiak@linux.ibm.com \
--cc=jgg@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=pasic@linux.ibm.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;
as well as URLs for NNTP newsgroup(s).