diff options
| author | Meng Wang <mwang@codeaurora.org> | 2016-07-27 16:05:53 +0800 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2016-08-10 23:22:30 -0700 |
| commit | 45ffbb1fba8a1498c206d78fcca420f0d60f2eff (patch) | |
| tree | f5a6089b4733e8c6b2cfdd73741cc5dcafb14245 | |
| parent | 115b1e7c4e7d1d58de4e96f0d64056dde6ebebb1 (diff) | |
swr-wcd-ctrl: set pointer to null after kfree
In soundwire control drivers, some pointers are not
set as NULL after the memory is freed, which will
leave many dangling pointers. Set them to NULL
explicitly to avoid potential risk.
CRs-Fixed: 997062
Change-Id: I18bd73397173187f87af28c78564835eed6d6a10
Signed-off-by: Meng Wang <mwang@codeaurora.org>
| -rw-r--r-- | drivers/soundwire/swr-wcd-ctrl.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/soundwire/swr-wcd-ctrl.c b/drivers/soundwire/swr-wcd-ctrl.c index 2cb60c11e212..6ffe2e3576e6 100644 --- a/drivers/soundwire/swr-wcd-ctrl.c +++ b/drivers/soundwire/swr-wcd-ctrl.c @@ -325,6 +325,7 @@ static int swrm_set_ch_map(struct swr_mstr_ctrl *swrm, void *data) GFP_KERNEL); if (!swrm->mstr_port->port) { kfree(swrm->mstr_port); + swrm->mstr_port = NULL; return -ENOMEM; } memcpy(swrm->mstr_port->port, pinfo->port, pinfo->num_port); @@ -1474,7 +1475,9 @@ static int swrm_remove(struct platform_device *pdev) swrm, SWR_IRQ_FREE); if (swrm->mstr_port) { kfree(swrm->mstr_port->port); + swrm->mstr_port->port = NULL; kfree(swrm->mstr_port); + swrm->mstr_port = NULL; } pm_runtime_disable(&pdev->dev); pm_runtime_set_suspended(&pdev->dev); |
