Patch "ASoC: mediatek: common: Fix refcount leak in parse_dai_link_info" has been added to the 6.3-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

    ASoC: mediatek: common: Fix refcount leak in parse_dai_link_info

to the 6.3-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:
     asoc-mediatek-common-fix-refcount-leak-in-parse_dai_.patch
and it can be found in the queue-6.3 subdirectory.

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



commit 54286c23610b8f96295416e3a527adeea34dc6a9
Author: Aashish Sharma <shraash@xxxxxxxxxx>
Date:   Tue Apr 11 06:04:31 2023 +0530

    ASoC: mediatek: common: Fix refcount leak in parse_dai_link_info
    
    [ Upstream commit beed115c2ce78f990222a29abed042582df4e87c ]
    
    Add missing of_node_put()s before the returns to balance
    of_node_get()s and of_node_put()s, which may get unbalanced
    in case the for loop 'for_each_available_child_of_node' returns
    early.
    
    Fixes: 4302187d955f ("ASoC: mediatek: common: add soundcard driver common code")
    Reported-by: kernel test robot <lkp@xxxxxxxxx>
    Reported-by: Julia Lawall <julia.lawall@xxxxxxxx>
    Link: https://lore.kernel.org/r/202304090504.2K8L6soj-lkp@xxxxxxxxx/
    Signed-off-by: Aashish Sharma <shraash@xxxxxxxxxx>
    Reviewed-by: Guenter Roeck <groeck@xxxxxxxxxxxx>
    Reviewed-by: Trevor Wu <trevor.wu@xxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230411003431.4048700-1-shraash@xxxxxxxxxx
    Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/sound/soc/mediatek/common/mtk-soundcard-driver.c b/sound/soc/mediatek/common/mtk-soundcard-driver.c
index 7c55c2cb1f214..738093451ccbf 100644
--- a/sound/soc/mediatek/common/mtk-soundcard-driver.c
+++ b/sound/soc/mediatek/common/mtk-soundcard-driver.c
@@ -47,20 +47,26 @@ int parse_dai_link_info(struct snd_soc_card *card)
 	/* Loop over all the dai link sub nodes */
 	for_each_available_child_of_node(dev->of_node, sub_node) {
 		if (of_property_read_string(sub_node, "link-name",
-					    &dai_link_name))
+					    &dai_link_name)) {
+			of_node_put(sub_node);
 			return -EINVAL;
+		}
 
 		for_each_card_prelinks(card, i, dai_link) {
 			if (!strcmp(dai_link_name, dai_link->name))
 				break;
 		}
 
-		if (i >= card->num_links)
+		if (i >= card->num_links) {
+			of_node_put(sub_node);
 			return -EINVAL;
+		}
 
 		ret = set_card_codec_info(card, sub_node, dai_link);
-		if (ret < 0)
+		if (ret < 0) {
+			of_node_put(sub_node);
 			return ret;
+		}
 	}
 
 	return 0;



[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