linux-brain/drivers/parport
YueHaibing 38ea8c0429 parport: Fix mem leak in parport_register_dev_model
[ Upstream commit 1c7ebeabc9 ]

BUG: memory leak
unreferenced object 0xffff8881df48cda0 (size 16):
  comm "syz-executor.0", pid 5077, jiffies 4295994670 (age 22.280s)
  hex dump (first 16 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<00000000d2d0d5fe>] parport_register_dev_model+0x141/0x6e0 [parport]
    [<00000000782f6dab>] 0xffffffffc15d1196
    [<00000000d2ca6ae4>] platform_drv_probe+0x7e/0x100
    [<00000000628c2a94>] really_probe+0x342/0x4d0
    [<000000006874f5da>] driver_probe_device+0x8c/0x170
    [<00000000424de37a>] __device_attach_driver+0xda/0x100
    [<000000002acab09a>] bus_for_each_drv+0xfe/0x170
    [<000000003d9e5f31>] __device_attach+0x190/0x230
    [<0000000035d32f80>] bus_probe_device+0x123/0x140
    [<00000000a05ba627>] device_add+0x7cc/0xce0
    [<000000003f7560bf>] platform_device_add+0x230/0x3c0
    [<000000002a0be07d>] 0xffffffffc15d0949
    [<000000007361d8d2>] port_check+0x3b/0x50 [parport]
    [<000000004d67200f>] bus_for_each_dev+0x115/0x180
    [<000000003ccfd11c>] __parport_register_driver+0x1f0/0x210 [parport]
    [<00000000987f06fc>] 0xffffffffc15d803e

After commit 4e5a74f1db ("parport: Revert "parport: fix
memory leak""), free_pardevice do not free par_dev->state,
we should free it in error path of parport_register_dev_model
before return.

Reported-by: Hulk Robot <hulkci@huawei.com>
Fixes: 4e5a74f1db ("parport: Revert "parport: fix memory leak"")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-06-25 11:36:51 +08:00
..
BUGS-parport
daisy.c parport: cleanup statics initialization to NULL or 0 2017-08-28 17:25:43 +02:00
ieee1284_ops.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ieee1284.c sched/headers: Prepare to move signal wakeup & sigpending methods from <linux/sched.h> into <linux/sched/signal.h> 2017-03-02 08:42:32 +01:00
Kconfig parport: fix menu breakage 2014-07-25 18:00:23 -07:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
multiface.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
parport_amiga.c parport: drop owner assignment from platform_drivers 2014-10-20 16:21:20 +02:00
parport_atari.c parport: cleanup statics initialization to NULL or 0 2017-08-28 17:25:43 +02:00
parport_ax88796.c parport: use release_mem_region instead of release_resource 2017-08-28 17:25:43 +02:00
parport_cs.c drivers/parport: use module_pcmcia_driver() in pcmcia drivers 2013-03-15 12:26:38 -07:00
parport_gsc.c parisc/parport_gsc: Fix section mismatches 2017-08-22 16:34:36 +02:00
parport_gsc.h parisc: parport0: fix this legacy no-device port driver! 2013-06-01 14:46:42 +02:00
parport_ip32.c parport: cleanup statics initialization to NULL or 0 2017-08-28 17:25:43 +02:00
parport_mfc3.c parport: cleanup statics initialization to NULL or 0 2017-08-28 17:25:43 +02:00
parport_pc.c parport_pc: fix find_superio io compare code, should use equal test. 2019-03-23 14:35:24 +01:00
parport_serial.c parport: Add support for the WCH382 2S/1P multi-IO card 2014-11-06 14:58:21 -08:00
parport_sunbpp.c parport: sunbpp: fix error return code 2018-09-26 08:38:12 +02:00
probe.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
procfs.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
share.c parport: Fix mem leak in parport_register_dev_model 2019-06-25 11:36:51 +08:00
TODO-parport