diff options
author | Dinghao Liu <[email protected]> | 2023-09-21 15:14:12 +0800 |
---|---|---|
committer | Vasily Gorbik <[email protected]> | 2023-10-16 13:03:05 +0200 |
commit | 63e8b94ad1840f02462633abdb363397f56bc642 (patch) | |
tree | 7408e21b5dfbf994772896e4d3802d95497999c0 | |
parent | 5c95bf274665cc9f5126e4a48a9da51114f7afd2 (diff) |
s390/cio: fix a memleak in css_alloc_subchannel
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 <[email protected]>
Message-Id: <[email protected]>
Link: https://lore.kernel.org/linux-s390/[email protected]/
Reviewed-by: Halil Pasic <[email protected]>
Reviewed-by: Peter Oberparleiter <[email protected]>
Signed-off-by: Vasily Gorbik <[email protected]>
-rw-r--r-- | drivers/s390/cio/css.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c index 3ef636935a54..3ff46fc694f8 100644 --- 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); |