projects
/
platform
/
kernel
/
linux-starfive.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7241c26
)
s390/cio: fix a memleak in css_alloc_subchannel
author
Dinghao Liu
<dinghao.liu@zju.edu.cn>
Thu, 21 Sep 2023 07:14:12 +0000
(15:14 +0800)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Wed, 25 Oct 2023 10:03:15 +0000
(12:03 +0200)
commit
63e8b94ad1840f02462633abdb363397f56bc642
upstream.
When dma_set_coherent_mask() fails, sch->lock has not been
freed, which is allocated in css_sch_create_locks(), leading
to a memleak.
Fixes: 4520a91a976e ("s390/cio: use dma helpers for setting masks")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Message-Id: <
20230921071412
.13806-1-dinghao.liu@zju.edu.cn>
Link:
https://lore.kernel.org/linux-s390/bd38baa8-7b9d-4d89-9422-7e943d626d6e@linux.ibm.com/
Reviewed-by: Halil Pasic <pasic@linux.ibm.com>
Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/s390/cio/css.c
patch
|
blob
|
history
diff --git
a/drivers/s390/cio/css.c
b/drivers/s390/cio/css.c
index c7db953985002f622e37d588feb924d13e167ebe..98a14c1f3d67259be7794f83fe3d5945e2438dc5 100644
(file)
--- a/
drivers/s390/cio/css.c
+++ b/
drivers/s390/cio/css.c
@@
-233,17
+233,19
@@
struct subchannel *css_alloc_subchannel(struct subchannel_id schid,
*/
ret = dma_set_coherent_mask(&sch->dev, DMA_BIT_MASK(31));
if (ret)
- goto err;
+ goto err
_lock
;
/*
* But we don't have such restrictions imposed on the stuff that
* is handled by the streaming API.
*/
ret = dma_set_mask(&sch->dev, DMA_BIT_MASK(64));
if (ret)
- goto err;
+ goto err
_lock
;
return sch;
+err_lock:
+ kfree(sch->lock);
err:
kfree(sch);
return ERR_PTR(ret);