Patch "ALSA: asihpi: fix iounmap in error handler" has been added to the 4.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

    ALSA: asihpi: fix iounmap in error handler

to the 4.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:
     alsa-asihpi-fix-iounmap-in-error-handler.patch
and it can be found in the queue-4.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 ffab78558cc11fa4252f4ac55d4f21fe695bbed3
Author: Tom Rix <trix@xxxxxxxxxx>
Date:   Sun Sep 13 09:52:30 2020 -0700

    ALSA: asihpi: fix iounmap in error handler
    
    [ Upstream commit 472eb39103e885f302fd8fd6eff104fcf5503f1b ]
    
    clang static analysis flags this problem
    hpioctl.c:513:7: warning: Branch condition evaluates to
      a garbage value
                    if (pci.ap_mem_base[idx]) {
                        ^~~~~~~~~~~~~~~~~~~~
    
    If there is a failure in the middle of the memory space loop,
    only some of the memory spaces need to be cleaned up.
    
    At the error handler, idx holds the number of successful
    memory spaces mapped.  So rework the handler loop to use the
    old idx.
    
    There is a second problem, the memory space loop conditionally
    iomaps()/sets the mem_base so it is necessay to initize pci.
    
    Fixes: 719f82d3987a ("ALSA: Add support of AudioScience ASI boards")
    Signed-off-by: Tom Rix <trix@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20200913165230.17166-1-trix@xxxxxxxxxx
    Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/sound/pci/asihpi/hpioctl.c b/sound/pci/asihpi/hpioctl.c
index 7a32abbe0cef8..4bdcb7443b1f5 100644
--- a/sound/pci/asihpi/hpioctl.c
+++ b/sound/pci/asihpi/hpioctl.c
@@ -346,7 +346,7 @@ int asihpi_adapter_probe(struct pci_dev *pci_dev,
 	struct hpi_message hm;
 	struct hpi_response hr;
 	struct hpi_adapter adapter;
-	struct hpi_pci pci;
+	struct hpi_pci pci = { 0 };
 
 	memset(&adapter, 0, sizeof(adapter));
 
@@ -502,7 +502,7 @@ int asihpi_adapter_probe(struct pci_dev *pci_dev,
 	return 0;
 
 err:
-	for (idx = 0; idx < HPI_MAX_ADAPTER_MEM_SPACES; idx++) {
+	while (--idx >= 0) {
 		if (pci.ap_mem_base[idx]) {
 			iounmap(pci.ap_mem_base[idx]);
 			pci.ap_mem_base[idx] = NULL;



[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