From: Greg Kroah-Hartman Date: Mon, 22 Jan 2024 17:38:11 +0000 (-0800) Subject: 5.15-stable patches X-Git-Tag: v4.19.306~91 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c63eb360fc2a1b59def74fc392d01a947fff465c;p=thirdparty%2Fkernel%2Fstable-queue.git 5.15-stable patches added patches: dma-mapping-fix-build-error-unused-value.patch virtio-crypto-fix-memory-leak-in-virtio_crypto_alg_skcipher_close_session.patch --- diff --git a/queue-5.15/dma-mapping-fix-build-error-unused-value.patch b/queue-5.15/dma-mapping-fix-build-error-unused-value.patch new file mode 100644 index 00000000000..838c171be22 --- /dev/null +++ b/queue-5.15/dma-mapping-fix-build-error-unused-value.patch @@ -0,0 +1,51 @@ +From 50d6281ce9b8412f7ef02d1bc9d23aa62ae0cf98 Mon Sep 17 00:00:00 2001 +From: Ren Zhijie +Date: Thu, 30 Jun 2022 20:35:28 +0800 +Subject: dma-mapping: Fix build error unused-value +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Ren Zhijie + +commit 50d6281ce9b8412f7ef02d1bc9d23aa62ae0cf98 upstream. + +If CONFIG_DMA_DECLARE_COHERENT is not set, +make ARCH=x86_64 CROSS_COMPILE=x86_64-linux-gnu- will be failed, like this: + +drivers/remoteproc/remoteproc_core.c: In function ‘rproc_rvdev_release’: +./include/linux/dma-map-ops.h:182:42: error: statement with no effect [-Werror=unused-value] + #define dma_release_coherent_memory(dev) (0) + ^ +drivers/remoteproc/remoteproc_core.c:464:2: note: in expansion of macro ‘dma_release_coherent_memory’ + dma_release_coherent_memory(dev); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +cc1: all warnings being treated as errors + +The return type of function dma_release_coherent_memory in CONFIG_DMA_DECLARE_COHERENT area is void, so in !CONFIG_DMA_DECLARE_COHERENT area it should neither return any value nor be defined as zero. + +Reported-by: Hulk Robot +Fixes: e61c451476e6 ("dma-mapping: Add dma_release_coherent_memory to DMA API") +Signed-off-by: Ren Zhijie +Reviewed-by: Christoph Hellwig +Link: https://lore.kernel.org/r/20220630123528.251181-1-renzhijie2@huawei.com +Signed-off-by: Mathieu Poirier +Signed-off-by: Greg Kroah-Hartman +--- + include/linux/dma-map-ops.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/include/linux/dma-map-ops.h ++++ b/include/linux/dma-map-ops.h +@@ -179,10 +179,10 @@ static inline int dma_declare_coherent_m + return -ENOSYS; + } + +-#define dma_release_coherent_memory(dev) (0) + #define dma_alloc_from_dev_coherent(dev, size, handle, ret) (0) + #define dma_release_from_dev_coherent(dev, order, vaddr) (0) + #define dma_mmap_from_dev_coherent(dev, vma, vaddr, order, ret) (0) ++static inline void dma_release_coherent_memory(struct device *dev) { } + #endif /* CONFIG_DMA_DECLARE_COHERENT */ + + #ifdef CONFIG_DMA_GLOBAL_POOL diff --git a/queue-5.15/series b/queue-5.15/series index b5000235e13..7dd629ba271 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -243,3 +243,5 @@ keys-dns-fix-size-check-of-v1-server-list-header.patch binder-fix-async-space-check-for-0-sized-buffers.patch binder-fix-unused-alloc-free_async_space.patch input-atkbd-use-ab83-as-id-when-skipping-the-getid-command.patch +dma-mapping-fix-build-error-unused-value.patch +virtio-crypto-fix-memory-leak-in-virtio_crypto_alg_skcipher_close_session.patch diff --git a/queue-5.15/virtio-crypto-fix-memory-leak-in-virtio_crypto_alg_skcipher_close_session.patch b/queue-5.15/virtio-crypto-fix-memory-leak-in-virtio_crypto_alg_skcipher_close_session.patch new file mode 100644 index 00000000000..6a226cd97fd --- /dev/null +++ b/queue-5.15/virtio-crypto-fix-memory-leak-in-virtio_crypto_alg_skcipher_close_session.patch @@ -0,0 +1,37 @@ +From b1d65f717cd6305a396a8738e022c6f7c65cfbe8 Mon Sep 17 00:00:00 2001 +From: Wei Yongjun +Date: Mon, 14 Nov 2022 11:07:40 +0000 +Subject: virtio-crypto: fix memory leak in virtio_crypto_alg_skcipher_close_session() + +From: Wei Yongjun + +commit b1d65f717cd6305a396a8738e022c6f7c65cfbe8 upstream. + +'vc_ctrl_req' is alloced in virtio_crypto_alg_skcipher_close_session(), +and should be freed in the invalid ctrl_status->status error handling +case. Otherwise there is a memory leak. + +Fixes: 0756ad15b1fe ("virtio-crypto: use private buffer for control request") +Signed-off-by: Wei Yongjun +Message-Id: <20221114110740.537276-1-weiyongjun@huaweicloud.com> +Signed-off-by: Michael S. Tsirkin +Reviewed-by: Gonglei +Acked-by: zhenwei pi +Acked-by: Jason Wang +Signed-off-by: Greg Kroah-Hartman +--- + drivers/crypto/virtio/virtio_crypto_algs.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/crypto/virtio/virtio_crypto_algs.c ++++ b/drivers/crypto/virtio/virtio_crypto_algs.c +@@ -255,7 +255,8 @@ static int virtio_crypto_alg_skcipher_cl + vcrypto->ctrl_status.status, + destroy_session->session_id); + +- return -EINVAL; ++ err = -EINVAL; ++ goto out; + } + spin_unlock(&vcrypto->ctrl_lock); +