diff options
author | Daniele Alessandrelli <daniele.alessandrelli@intel.com> | 2021-01-18 17:59:04 +0100 |
---|---|---|
committer | Bjorn Andersson <bjorn.andersson@linaro.org> | 2021-02-09 23:42:55 +0100 |
commit | 43d3f2c715cefcfb89b10675728e9bf0d8bb98e3 (patch) | |
tree | b399ca74436e6dd77e2400f0448a6383af7d16fa /drivers/remoteproc | |
parent | remoteproc/mediatek: support L1TCM (diff) | |
download | linux-43d3f2c715cefcfb89b10675728e9bf0d8bb98e3.tar.xz linux-43d3f2c715cefcfb89b10675728e9bf0d8bb98e3.zip |
remoteproc: core: Fix rproc->firmware free in rproc_set_firmware()
rproc_alloc_firmware() (called by rproc_alloc()) can allocate
rproc->firmware using kstrdup_const() and therefore should be freed
using kfree_const(); however, rproc_set_firmware() frees it using the
simple kfree(). This causes a kernel oops if a constant string is passed
to rproc_alloc() and rproc_set_firmware() is subsequently called.
Fix the above issue by using kfree_const() to free rproc->firmware in
rproc_set_firmware().
Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Daniele Alessandrelli <daniele.alessandrelli@intel.com>
Link: https://lore.kernel.org/r/20210118165904.719999-1-daniele.alessandrelli@linux.intel.com
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Diffstat (limited to 'drivers/remoteproc')
-rw-r--r-- | drivers/remoteproc/remoteproc_core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 2394eef383e3..ab150765d124 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -1988,7 +1988,7 @@ int rproc_set_firmware(struct rproc *rproc, const char *fw_name) goto out; } - kfree(rproc->firmware); + kfree_const(rproc->firmware); rproc->firmware = p; out: |