* [syzbot] memory leak in fbcon_set_font (2)
@ 2022-12-05 4:34 syzbot
2022-12-05 22:10 ` [PATCH] fbdev: fbcon: release buffer when fbcon_do_set_font() failed Tetsuo Handa
0 siblings, 1 reply; 3+ messages in thread
From: syzbot @ 2022-12-05 4:34 UTC (permalink / raw)
To: daniel, deller, dri-devel, geert+renesas, linux-fbdev,
linux-kernel, sam, syzkaller-bugs, tzimmermann
Hello,
syzbot found the following issue on:
HEAD commit: c2bf05db6c78 Merge tag 'i2c-for-6.1-rc8' of git://git.kern..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=171883d5880000
kernel config: https://syzkaller.appspot.com/x/.config?x=979161df0e247659
dashboard link: https://syzkaller.appspot.com/bug?extid=25bdb7b1703639abd498
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14fff84d880000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=135806a7880000
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/63cd45bf1d68/disk-c2bf05db.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/bafbfb42c660/vmlinux-c2bf05db.xz
kernel image: https://storage.googleapis.com/syzbot-assets/9f803a721cfc/bzImage-c2bf05db.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+25bdb7b1703639abd498@syzkaller.appspotmail.com
BUG: memory leak
unreferenced object 0xffff888111648000 (size 18448):
comm "syz-executor148", pid 3653, jiffies 4294970435 (age 13.520s)
hex dump (first 32 bytes):
85 44 7e c7 00 00 00 00 00 48 00 00 00 00 00 00 .D~......H......
92 30 86 d2 8c 38 30 9e e7 a3 05 00 9f 09 33 bb .0...80.......3.
backtrace:
[<ffffffff814ee6d3>] __do_kmalloc_node mm/slab_common.c:943 [inline]
[<ffffffff814ee6d3>] __kmalloc+0xb3/0x120 mm/slab_common.c:968
[<ffffffff8250c359>] kmalloc include/linux/slab.h:558 [inline]
[<ffffffff8250c359>] fbcon_set_font+0x1a9/0x470 drivers/video/fbdev/core/fbcon.c:2508
[<ffffffff8262cd59>] con_font_set drivers/tty/vt/vt.c:4667 [inline]
[<ffffffff8262cd59>] con_font_op+0x3a9/0x600 drivers/tty/vt/vt.c:4713
[<ffffffff82618e3d>] vt_k_ioctl drivers/tty/vt/vt_ioctl.c:474 [inline]
[<ffffffff82618e3d>] vt_ioctl+0x14fd/0x1a80 drivers/tty/vt/vt_ioctl.c:752
[<ffffffff825fdaf5>] tty_ioctl+0x6d5/0xbe0 drivers/tty/tty_io.c:2771
[<ffffffff816200bc>] vfs_ioctl fs/ioctl.c:51 [inline]
[<ffffffff816200bc>] __do_sys_ioctl fs/ioctl.c:870 [inline]
[<ffffffff816200bc>] __se_sys_ioctl fs/ioctl.c:856 [inline]
[<ffffffff816200bc>] __x64_sys_ioctl+0xfc/0x140 fs/ioctl.c:856
[<ffffffff8485c5e5>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff8485c5e5>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
[<ffffffff84a00087>] entry_SYSCALL_64_after_hwframe+0x63/0xcd
BUG: memory leak
unreferenced object 0xffff888110b18000 (size 18448):
comm "syz-executor148", pid 3655, jiffies 4294971001 (age 7.860s)
hex dump (first 32 bytes):
85 44 7e c7 00 00 00 00 00 48 00 00 00 00 00 00 .D~......H......
92 30 86 d2 8c 38 30 9e e7 a3 05 00 9f 09 33 bb .0...80.......3.
backtrace:
[<ffffffff814ee6d3>] __do_kmalloc_node mm/slab_common.c:943 [inline]
[<ffffffff814ee6d3>] __kmalloc+0xb3/0x120 mm/slab_common.c:968
[<ffffffff8250c359>] kmalloc include/linux/slab.h:558 [inline]
[<ffffffff8250c359>] fbcon_set_font+0x1a9/0x470 drivers/video/fbdev/core/fbcon.c:2508
[<ffffffff8262cd59>] con_font_set drivers/tty/vt/vt.c:4667 [inline]
[<ffffffff8262cd59>] con_font_op+0x3a9/0x600 drivers/tty/vt/vt.c:4713
[<ffffffff82618e3d>] vt_k_ioctl drivers/tty/vt/vt_ioctl.c:474 [inline]
[<ffffffff82618e3d>] vt_ioctl+0x14fd/0x1a80 drivers/tty/vt/vt_ioctl.c:752
[<ffffffff825fdaf5>] tty_ioctl+0x6d5/0xbe0 drivers/tty/tty_io.c:2771
[<ffffffff816200bc>] vfs_ioctl fs/ioctl.c:51 [inline]
[<ffffffff816200bc>] __do_sys_ioctl fs/ioctl.c:870 [inline]
[<ffffffff816200bc>] __se_sys_ioctl fs/ioctl.c:856 [inline]
[<ffffffff816200bc>] __x64_sys_ioctl+0xfc/0x140 fs/ioctl.c:856
[<ffffffff8485c5e5>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff8485c5e5>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
[<ffffffff84a00087>] entry_SYSCALL_64_after_hwframe+0x63/0xcd
write to /proc/sys/kernel/hung_task_check_interval_secs failed: No such file or directory
write to /proc/sys/kernel/softlockup_all_cpu_backtrace failed: No such file or directory
write to /proc/sys/kernel/hung_task_check_interval_secs failed: No such file or directory
write to /proc/sys/kernel/softlockup_all_cpu_backtrace failed: No such file or directory
---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.
syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] fbdev: fbcon: release buffer when fbcon_do_set_font() failed
2022-12-05 4:34 [syzbot] memory leak in fbcon_set_font (2) syzbot
@ 2022-12-05 22:10 ` Tetsuo Handa
2022-12-10 16:18 ` Helge Deller
0 siblings, 1 reply; 3+ messages in thread
From: Tetsuo Handa @ 2022-12-05 22:10 UTC (permalink / raw)
To: Daniel Vetter, Helge Deller, Shigeru Yoshida; +Cc: linux-fbdev, dri-devel
syzbot is reporting memory leak at fbcon_do_set_font() [1], for
commit a5a923038d70 ("fbdev: fbcon: Properly revert changes when
vc_resize() failed") missed that the buffer might be newly allocated
by fbcon_set_font().
Link: https://syzkaller.appspot.com/bug?extid=25bdb7b1703639abd498 [1]
Reported-by: syzbot <syzbot+25bdb7b1703639abd498@syzkaller.appspotmail.com>
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Tested-by: syzbot <syzbot+25bdb7b1703639abd498@syzkaller.appspotmail.com>
Fixes: a5a923038d70 ("fbdev: fbcon: Properly revert changes when vc_resize() failed")
---
drivers/video/fbdev/core/fbcon.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 098b62f7b701..8363f3b2b452 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -2450,7 +2450,8 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h, int charcount,
if (userfont) {
p->userfont = old_userfont;
- REFCOUNT(data)--;
+ if (--REFCOUNT(data) == 0)
+ kfree(data - FONT_EXTRA_WORDS * sizeof(int));
}
vc->vc_font.width = old_width;
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] fbdev: fbcon: release buffer when fbcon_do_set_font() failed
2022-12-05 22:10 ` [PATCH] fbdev: fbcon: release buffer when fbcon_do_set_font() failed Tetsuo Handa
@ 2022-12-10 16:18 ` Helge Deller
0 siblings, 0 replies; 3+ messages in thread
From: Helge Deller @ 2022-12-10 16:18 UTC (permalink / raw)
To: Tetsuo Handa, Daniel Vetter, Shigeru Yoshida; +Cc: linux-fbdev, dri-devel
On 12/5/22 23:10, Tetsuo Handa wrote:
> syzbot is reporting memory leak at fbcon_do_set_font() [1], for
> commit a5a923038d70 ("fbdev: fbcon: Properly revert changes when
> vc_resize() failed") missed that the buffer might be newly allocated
> by fbcon_set_font().
>
> Link: https://syzkaller.appspot.com/bug?extid=25bdb7b1703639abd498 [1]
> Reported-by: syzbot <syzbot+25bdb7b1703639abd498@syzkaller.appspotmail.com>
> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> Tested-by: syzbot <syzbot+25bdb7b1703639abd498@syzkaller.appspotmail.com>
> Fixes: a5a923038d70 ("fbdev: fbcon: Properly revert changes when vc_resize() failed")
applied.
Thanks!
Helge
> ---
> drivers/video/fbdev/core/fbcon.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
> index 098b62f7b701..8363f3b2b452 100644
> --- a/drivers/video/fbdev/core/fbcon.c
> +++ b/drivers/video/fbdev/core/fbcon.c
> @@ -2450,7 +2450,8 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h, int charcount,
>
> if (userfont) {
> p->userfont = old_userfont;
> - REFCOUNT(data)--;
> + if (--REFCOUNT(data) == 0)
> + kfree(data - FONT_EXTRA_WORDS * sizeof(int));
> }
>
> vc->vc_font.width = old_width;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-12-10 16:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-05 4:34 [syzbot] memory leak in fbcon_set_font (2) syzbot
2022-12-05 22:10 ` [PATCH] fbdev: fbcon: release buffer when fbcon_do_set_font() failed Tetsuo Handa
2022-12-10 16:18 ` Helge Deller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.