Patch "ASoC: codecs: tx-macro: Fix for KASAN: slab-out-of-bounds" has been added to the 6.2-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: codecs: tx-macro: Fix for KASAN: slab-out-of-bounds

to the 6.2-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-codecs-tx-macro-fix-for-kasan-slab-out-of-bound.patch
and it can be found in the queue-6.2 subdirectory.

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



commit c390ddb8655532d0a9f1b85dff46dd42a64042da
Author: Ravulapati Vishnu Vardhan Rao <quic_visr@xxxxxxxxxxx>
Date:   Sat Mar 4 13:37:02 2023 +0530

    ASoC: codecs: tx-macro: Fix for KASAN: slab-out-of-bounds
    
    [ Upstream commit e5e7e398f6bb7918dab0612eb6991f7bae95520d ]
    
    When we run syzkaller we get below Out of Bound.
        "KASAN: slab-out-of-bounds Read in regcache_flat_read"
    
        Below is the backtrace of the issue:
    
        dump_backtrace+0x0/0x4c8
        show_stack+0x34/0x44
        dump_stack_lvl+0xd8/0x118
        print_address_description+0x30/0x2d8
        kasan_report+0x158/0x198
        __asan_report_load4_noabort+0x44/0x50
        regcache_flat_read+0x10c/0x110
        regcache_read+0xf4/0x180
        _regmap_read+0xc4/0x278
        _regmap_update_bits+0x130/0x290
        regmap_update_bits_base+0xc0/0x15c
        snd_soc_component_update_bits+0xa8/0x22c
        snd_soc_component_write_field+0x68/0xd4
        tx_macro_digital_mute+0xec/0x140
    
        Actually There is no need to have decimator with 32 bits.
        By limiting the variable with short type u8 issue is resolved.
    
    Signed-off-by: Ravulapati Vishnu Vardhan Rao <quic_visr@xxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230304080702.609-1-quic_visr@xxxxxxxxxxx
    Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/sound/soc/codecs/lpass-tx-macro.c b/sound/soc/codecs/lpass-tx-macro.c
index 2449a2df66df0..8facdb922f076 100644
--- a/sound/soc/codecs/lpass-tx-macro.c
+++ b/sound/soc/codecs/lpass-tx-macro.c
@@ -242,7 +242,7 @@ enum {
 
 struct tx_mute_work {
 	struct tx_macro *tx;
-	u32 decimator;
+	u8 decimator;
 	struct delayed_work dwork;
 };
 
@@ -635,7 +635,7 @@ static int tx_macro_mclk_enable(struct tx_macro *tx,
 	return 0;
 }
 
-static bool is_amic_enabled(struct snd_soc_component *component, int decimator)
+static bool is_amic_enabled(struct snd_soc_component *component, u8 decimator)
 {
 	u16 adc_mux_reg, adc_reg, adc_n;
 
@@ -849,7 +849,7 @@ static int tx_macro_enable_dec(struct snd_soc_dapm_widget *w,
 			       struct snd_kcontrol *kcontrol, int event)
 {
 	struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
-	unsigned int decimator;
+	u8 decimator;
 	u16 tx_vol_ctl_reg, dec_cfg_reg, hpf_gate_reg, tx_gain_ctl_reg;
 	u8 hpf_cut_off_freq;
 	int hpf_delay = TX_MACRO_DMIC_HPF_DELAY_MS;
@@ -1064,7 +1064,8 @@ static int tx_macro_hw_params(struct snd_pcm_substream *substream,
 			      struct snd_soc_dai *dai)
 {
 	struct snd_soc_component *component = dai->component;
-	u32 decimator, sample_rate;
+	u32 sample_rate;
+	u8 decimator;
 	int tx_fs_rate;
 	struct tx_macro *tx = snd_soc_component_get_drvdata(component);
 
@@ -1128,7 +1129,7 @@ static int tx_macro_digital_mute(struct snd_soc_dai *dai, int mute, int stream)
 {
 	struct snd_soc_component *component = dai->component;
 	struct tx_macro *tx = snd_soc_component_get_drvdata(component);
-	u16 decimator;
+	u8 decimator;
 
 	/* active decimator not set yet */
 	if (tx->active_decimator[dai->id] == -1)



[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