remarkable-linux/drivers/misc/mei
Alexander Usyskin 5cb906c703 mei: don't unset read cb ptr on reset
Don't set read callback to NULL during reset as
this leads to memory leak of both cb and its buffer.
The memory is correctly freed during mei_release.

The memory leak is detectable by kmemleak if
application has open read call while system is going through
suspend/resume.

unreferenced object 0xecead780 (size 64):
  comm "AsyncTask #1", pid 1018, jiffies 4294949621 (age 152.440s)
  hex dump (first 32 bytes):
    00 01 10 00 00 02 20 00 00 bf 30 f1 00 00 00 00  ...... ...0.....
    00 00 00 00 00 00 00 00 36 01 00 00 00 70 da e2  ........6....p..
  backtrace:
    [<c1a60aec>] kmemleak_alloc+0x3c/0xa0
    [<c131ed56>] kmem_cache_alloc_trace+0xc6/0x190
    [<c16243c9>] mei_io_cb_init+0x29/0x50
    [<c1625722>] mei_cl_read_start+0x102/0x360
    [<c16268f3>] mei_read+0x103/0x4e0
    [<c1324b09>] vfs_read+0x89/0x160
    [<c1324d5f>] SyS_read+0x4f/0x80
    [<c1a7b318>] syscall_call+0x7/0xb
    [<ffffffff>] 0xffffffff
unreferenced object 0xe2da7000 (size 512):
  comm "AsyncTask #1", pid 1018, jiffies 4294949621 (age 152.440s)
  hex dump (first 32 bytes):
    00 6c da e2 7c 00 00 00 00 00 00 00 c0 eb 0c 59  .l..|..........Y
    1b 00 00 00 01 00 00 00 02 10 00 00 01 00 00 00  ................
  backtrace:
    [<c1a60aec>] kmemleak_alloc+0x3c/0xa0
    [<c131f127>] __kmalloc+0xe7/0x1d0
    [<c162447e>] mei_io_cb_alloc_resp_buf+0x2e/0x60
    [<c162574c>] mei_cl_read_start+0x12c/0x360
    [<c16268f3>] mei_read+0x103/0x4e0
    [<c1324b09>] vfs_read+0x89/0x160
    [<c1324d5f>] SyS_read+0x4f/0x80
    [<c1a7b318>] syscall_call+0x7/0xb
    [<ffffffff>] 0xffffffff

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-07 08:16:14 -08:00
..
amthif.c mei: fix syntax in comments and debug output 2014-01-08 15:28:27 -08:00
bus.c mei: bus: propagate error code returned by mei_me_cl_by_id 2013-10-29 16:20:43 -07:00
client.c mei: don't unset read cb ptr on reset 2014-02-07 08:16:14 -08:00
client.h Merge 3.12-rc3 into char-misc-next 2013-09-29 18:27:03 -07:00
debugfs.c mei: fix syntax in comments and debug output 2014-01-08 15:28:27 -08:00
hbm.c mei: revamp mei reset state machine 2014-01-13 14:57:21 -08:00
hbm.h mei: use hbm idle state to prevent spurious resets 2014-01-08 15:25:41 -08:00
hw-me-regs.h mei: add 9 series PCH mei device ids 2013-12-05 09:48:23 -08:00
hw-me.c mei: revamp mei reset state machine 2014-01-13 14:57:21 -08:00
hw-me.h mei: revamp mei_data2slots 2013-03-15 11:10:48 -07:00
hw.h mei: enable marking internal commands 2013-12-18 16:39:54 -08:00
init.c mei: limit the number of consecutive resets 2014-01-13 14:57:21 -08:00
interrupt.c mei: revamp mei reset state machine 2014-01-13 14:57:21 -08:00
Kconfig mei: move mei-me to separate module 2013-03-29 08:32:21 -07:00
main.c mei: fix syntax in comments and debug output 2014-01-08 15:28:27 -08:00
Makefile mei: nfc: Initial nfc implementation 2013-04-10 18:56:53 -07:00
mei_dev.h mei: limit the number of consecutive resets 2014-01-13 14:57:21 -08:00
nfc.c mei: fix syntax in comments and debug output 2014-01-08 15:28:27 -08:00
pci-me.c mei: revamp mei reset state machine 2014-01-13 14:57:21 -08:00
wd.c mei: enable marking internal commands 2013-12-18 16:39:54 -08:00