merged.

Bruce

In message: [linux-yocto][v6.1/standard/nxp-sdk-6.1/nxp-soc & 
v6.1/standard/preempt-rt/nxp-sdk-6.1/nxp-soc] video: fbdev: mxc: Release the 
previously allocated modedb before parsing edid
on 10/08/2023 Xiaolei Wang wrote:

> When we don`t set "video=mxcfb0:dev=hdmi" in bootargs,
> but connect  hdmi to imx6q, it will trigger a periodically
> hdmi interrupt in a few  seconds. These repeated interruptions
> will read edid and alloc modedb,  so we need to release the
> modedb before the next allocation.
> 
> Fix following memory leak.
> 
> unreferenced object 0xc6a54000 (size 2048):
> comm "kworker/0:0", pid 2655, jiffies 756371 (age 952.680s)
> hex dump (first 32 bytes):
> 00 00 00 00 3b 00 00 00 90 06 00 00 1a 04 00 00 ....;...........
> b5 1a 00 00 18 01 00 00 68 00 00 00 1e 00 00 00 ........h.......
> backtrace:
> [<00623f2e>] mxc_edid_parse_ext_blk+0x79c/0x820
> [<0ef13c8f>] mxc_edid_read+0x224/0x244
> [<68bdc576>] mxc_hdmi_read_edid+0x6c/0x3d0
> [<a64a63e8>] hotplug_worker+0x64/0x30c
> [<909541fa>] process_one_work+0x1f4/0x308
> [<69f4c3c3>] worker_thread+0x2b0/0x360
> [<7edd79c5>] kthread+0x144/0x150
> [<18f0f29a>] ret_from_fork+0x14/0x24
> [<00000000>] 0x0
> 
> Signed-off-by: Xiaolei Wang <xiaolei.w...@windriver.com>
> Signed-off-by: Bruce Ashfield <bruce.ashfi...@gmail.com>
> ---
>  drivers/video/fbdev/mxc/mxc_edid.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/video/fbdev/mxc/mxc_edid.c 
> b/drivers/video/fbdev/mxc/mxc_edid.c
> index 903172e6ae77..7230fb68260a 100644
> --- a/drivers/video/fbdev/mxc/mxc_edid.c
> +++ b/drivers/video/fbdev/mxc/mxc_edid.c
> @@ -737,6 +737,8 @@ int mxc_edid_read(struct i2c_adapter *adp, unsigned short 
> addr,
>               return extblknum;
>  
>       /* edid first block parsing */
> +     if (fbi->monspecs.modedb)
> +             fb_destroy_modedb(fbi->monspecs.modedb);
>       memset(&fbi->monspecs, 0, sizeof(fbi->monspecs));
>       fb_edid_to_monspecs(edid, &fbi->monspecs);
>  
> -- 
> 2.25.1
> 

In message: [linux-yocto][v6.1/standard/preempt-rt/nxp-sdk-6.1/nxp-soc & 
v6.1/standard/nxp-sdk-6.1/nxp-soc] video: sii902x: Fix panic caused by 
sii902x_read_edid
on 10/08/2023 Xiaolei Wang wrote:

> The data structure edid_fbi needs to be initialized, otherwise
> edid_fbi->monspecs.modedb and fbi->monspecs.modedb_len are not
> initial values, which will cause illegal free to be detected
> by KASAN, and the following panic will appear:
> 
> Unable to handle kernel paging request at virtual address 80f5e000
> pgd = 41eceede
> [80f5e000] *pgd=80e1941e(bad)
> Internal error: Oops: 80d [#1] PREEMPT SMP ARM
> Modules linked in:
> 
> PC is at copy_page+0x1c/0x70
> LR is at 0x7fb78
> pc : [<8062f37c>] lr : [<0007fb78>] psr: 60010113
> sp : 815a5ea8 ip : 0007fb7c fp : 80119288
> r10: 00000040 r9: 815a4000 r8: 815a5fb0
> r7 : 76af0000 r6 : 00000200 r5 : 80f5e000 r4 : 0007fb80
> r3 : 00080000 r2 : 0000001f r1 : 813f8010 r0 : 80f5e000
> Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none
> Control: 10c5387d Table: 83a7406a DAC: 00000051
> Register r0 information: non-slab/vmalloc memory
> Register r1 information: non-slab/vmalloc memory
> Register r2 information: non-paged memory
> Register r3 information: non-paged memory
> Register r4 information: non-paged memory
> Register r5 information: non-slab/vmalloc memory
> Register r6 information: non-paged memory
> Register r7 information: non-paged memory
> Register r8 information: non-slab/vmalloc memory
> Register r9 information: non-slab/vmalloc memory
> Register r10 information: non-paged memory
> Register r11 information: non-slab/vmalloc memory
> Register r12 information: non-paged memory
> Process init (pid: 1, stack limit = 0x6432d6db)
> Stack: (0x815a5ea8 to 0x815a6000)
> 5ea0: 813f8000 801192b8 81d49900 00000d73 00000200 802ab694
> 5ec0: 00000003 801734d8 81d28040 80173e10 81d499c0 00000275 81d499d0 b1f55299
> 5ee0: 76aef000 76aef000 81d49900 01100cca 00000070 76af0000 00000275 83a75da8
> 5f00: 83a75da8 00000000 ab67b938 ab685ee0 00000000 00000000 00000000 b1f55299
> 5f20: 00000001 815a5fb0 76af0124 81d28000 00000817 81d49900 00000275 81d28040
> 5f40: 81380b40 80ccc7e0 815a5f50 815a5f54 00000000 815a5f54 815a5f54 00000800
> 5f60: 00000001 00000817 76af0124 ffffffff 815a5fb0 8120b23c 00080144 7ee89ff0
> 5f80: 00000002 80114db8 76af0124 00000817 815a5fb0 76af0124 76fca960 20010010
> 5fa0: ffffffff 10c5387d 10c5387d 8010167c 76af0124 00000000 00000018 76af0124
> 5fc0: 76fda2b8 7ee8a00c 76af0144 7ee8a0b8 00000003 00080144 7ee89ff0 00000002
> 5fe0: 00000000 7ee89fc8 76fb839b 76fca960 20010010 ffffffff 00000000 00000000
> Code: e3a0201f e8b15018 f5d1f080 f5d1f0c0 (e8a05018)
> ---[ end trace a0459ca32b040418 ]---
> note: init[1] exited with preempt_count 2
> Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
> CPU0: stopping
> 
> Fixed bd21ebe013c9("video: fbdev: mxc: Release the previously allocated 
> modedb before parsing edid")
> Signed-off-by: Xiaolei Wang <xiaolei.w...@windriver.com>
> 
> Signed-off-by: Bruce Ashfield <bruce.ashfi...@gmail.com>
> ---
>  drivers/video/fbdev/mxc/mxsfb_sii902x.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/video/fbdev/mxc/mxsfb_sii902x.c 
> b/drivers/video/fbdev/mxc/mxsfb_sii902x.c
> index c72214de83c7..54a9bc5471ca 100644
> --- a/drivers/video/fbdev/mxc/mxsfb_sii902x.c
> +++ b/drivers/video/fbdev/mxc/mxsfb_sii902x.c
> @@ -397,7 +397,7 @@ static int sii902x_probe(struct i2c_client *client,
>               const struct i2c_device_id *id)
>  {
>       int i, dat, ret;
> -     struct fb_info edid_fbi;
> +     struct fb_info edid_fbi = {};
>       struct fb_info *init_fbi = sii902x.fbi;
>  
>       memset(&sii902x, 0, sizeof(sii902x));
> -- 
> 2.25.1
> 

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#12959): 
https://lists.yoctoproject.org/g/linux-yocto/message/12959
Mute This Topic: https://lists.yoctoproject.org/mt/100657911/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: 
https://lists.yoctoproject.org/g/linux-yocto/leave/6687884/21656/624485779/xyzzy
 [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to