]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
tty/vt: Fix the memory leak in visual_init
authorDongxing Zhang <dongxing.zhang@intel.com>
Wed, 10 Jun 2015 07:21:10 +0000 (15:21 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 23 Jul 2015 22:11:08 +0000 (15:11 -0700)
commit08b33249d89700ba555d4ab5cc88714192b8ee46
tree299fa807766324c88be0f130a6fc45df8cbd397e
parent97a60eac33f663d2150ee1b3c69253d87ba53dff
tty/vt: Fix the memory leak in visual_init

If vc->vc_uni_pagedir_loc is not NULL, its refcount needs to be
decreased before vc_uni_pagedir_loc is re-assigned.

unreferenced object 0xffff88002cdd13b0 (size 512):
  comm "setfont", pid 503, jiffies 4294896503 (age 722.828s)
  hex dump (first 32 bytes):
    40 92 61 2b 00 88 ff ff 00 00 00 00 00 00 00 00  @.a+............
    00 00 00 00 00 00 00 00 a0 ad 61 2b 00 88 ff ff  ..........a+....
  backtrace:
    [<ffffffff817b755e>] kmemleak_alloc+0x4e/0xb0
    [<ffffffff811d4898>] kmem_cache_alloc_trace+0x1c8/0x240
    [<ffffffff814ae7d3>] con_do_clear_unimap.isra.2+0x83/0xe0
    [<ffffffff814ae9b2>] con_clear_unimap+0x22/0x40
    [<ffffffff814a8db8>] vt_ioctl+0xeb8/0x1170
    [<ffffffff8149b458>] tty_ioctl+0x208/0xca0
    [<ffffffff81207858>] do_vfs_ioctl+0x2f8/0x510
    [<ffffffff81207af1>] SyS_ioctl+0x81/0xa0
    [<ffffffff817ca2b2>] system_call_fastpath+0x16/0x75
    [<ffffffffffffffff>] 0xffffffffffffffff
unreferenced object 0xffff88002b619240 (size 256):
  comm "setfont", pid 503, jiffies 4294896503 (age 722.828s)
  hex dump (first 32 bytes):
    90 bc 84 d5 00 88 ff ff 58 85 84 d5 00 88 ff ff  ........X.......
    88 ac 84 d5 00 88 ff ff e0 b1 84 d5 00 88 ff ff  ................
  backtrace:
    [<ffffffff817b755e>] kmemleak_alloc+0x4e/0xb0
    [<ffffffff811d4898>] kmem_cache_alloc_trace+0x1c8/0x240
    [<ffffffff814ae286>] con_insert_unipair+0x86/0x170
    [<ffffffff814af107>] con_set_unimap+0x1b7/0x280
    [<ffffffff814a8d65>] vt_ioctl+0xe65/0x1170
    [<ffffffff8149b458>] tty_ioctl+0x208/0xca0
    [<ffffffff81207858>] do_vfs_ioctl+0x2f8/0x510
    [<ffffffff81207af1>] SyS_ioctl+0x81/0xa0
    [<ffffffff817ca2b2>] system_call_fastpath+0x16/0x75
    [<ffffffffffffffff>] 0xffffffffffffffff

Signed-off-by: Dongxing Zhang <dongxing.zhang@intel.com>
Signed-off-by: Xiaoming Wang <xiaoming.wang@intel.com>
Reviewed-by: Peter Hurley <peter@hurleysoftware.com>
Tested-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/vt/vt.c