Patch "media: cx25821: Fix a bug when reallocating some dma memory" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    media: cx25821: Fix a bug when reallocating some dma memory

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     media-cx25821-fix-a-bug-when-reallocating-some-dma-m.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 03920d4c464eb8be6deb66c40f85ebb530237716
Author: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
Date:   Sat Jan 16 22:21:46 2021 +0100

    media: cx25821: Fix a bug when reallocating some dma memory
    
    [ Upstream commit b2de3643c5024fc4fd128ba7767c7fb8b714bea7 ]
    
    This function looks like a realloc.
    
    However, if 'risc->cpu != NULL', the memory will be freed, but never
    reallocated with the bigger 'size'.
    Explicitly set 'risc->cpu' to NULL, so that the reallocation is
    correctly performed a few lines below.
    
    [hverkuil: NULL != risc->cpu -> risc->cpu]
    
    Fixes: 5ede94c70553 ("[media] cx25821: remove bogus btcx_risc dependency)
    Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xxxxxxxxx>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/media/pci/cx25821/cx25821-core.c b/drivers/media/pci/cx25821/cx25821-core.c
index 41be22ce66f3e..44839a6461e88 100644
--- a/drivers/media/pci/cx25821/cx25821-core.c
+++ b/drivers/media/pci/cx25821/cx25821-core.c
@@ -976,8 +976,10 @@ int cx25821_riscmem_alloc(struct pci_dev *pci,
 	__le32 *cpu;
 	dma_addr_t dma = 0;
 
-	if (NULL != risc->cpu && risc->size < size)
+	if (risc->cpu && risc->size < size) {
 		pci_free_consistent(pci, risc->size, risc->cpu, risc->dma);
+		risc->cpu = NULL;
+	}
 	if (NULL == risc->cpu) {
 		cpu = pci_zalloc_consistent(pci, size, &dma);
 		if (NULL == cpu)



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux