Shang XiaoJing
2d899592ed
media: ov2740: Fix memleak in ov2740_init_controls()
There is a kmemleak when testing the media/i2c/ov2740.c with bpf mock
device:
unreferenced object 0xffff8881090e19e0 (size 16):
comm "51-i2c-ov2740", pid 278, jiffies 4294781584 (age 23.613s)
hex dump (first 16 bytes):
00 f3 7c 0b 81 88 ff ff 80 75 6a 09 81 88 ff ff ..|......uj.....
backtrace:
[<000000004e9fad8f>] __kmalloc_node+0x44/0x1b0
[<0000000039c802f4>] kvmalloc_node+0x34/0x180
[<000000009b8b5c63>] v4l2_ctrl_handler_init_class+0x11d/0x180
[videodev]
[<0000000038644056>] ov2740_probe+0x37d/0x84f [ov2740]
[<0000000092489f59>] i2c_device_probe+0x28d/0x680
[<000000001038babe>] really_probe+0x17c/0x3f0
[<0000000098c7af1c>] __driver_probe_device+0xe3/0x170
[<00000000e1b3dc24>] device_driver_attach+0x34/0x80
[<000000005a04a34d>] bind_store+0x10b/0x1a0
[<00000000ce25d4f2>] drv_attr_store+0x49/0x70
[<000000007d9f4e9a>] sysfs_kf_write+0x8c/0xb0
[<00000000be6cff0f>] kernfs_fop_write_iter+0x216/0x2e0
[<0000000031ddb40a>] vfs_write+0x658/0x810
[<0000000041beecdd>] ksys_write+0xd6/0x1b0
[<0000000023755840>] do_syscall_64+0x38/0x90
[<00000000b2cc2da2>] entry_SYSCALL_64_after_hwframe+0x63/0xcd
ov2740_init_controls() won't clean all the allocated resources in fail
path, which may causes the memleaks. Add v4l2_ctrl_handler_free() to
prevent memleak.
Fixes: 866edc8951 ("media: i2c: Add ov2740 image sensor driver")
Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2023-02-03 14:52:11 +01:00
..
2022-12-16 13:04:15 -06:00
2022-12-25 13:38:09 -08:00
2022-12-13 15:22:14 -08:00
2022-12-13 10:54:19 -08:00
2022-12-25 13:38:09 -08:00
2022-12-19 12:33:32 -06:00
2022-12-25 13:38:09 -08:00
2022-12-25 13:38:09 -08:00
2022-12-16 03:49:24 -08:00
2022-12-20 03:13:45 +01:00
2022-12-13 13:46:07 -08:00
2022-12-12 12:52:02 -08:00
2022-12-12 16:39:38 -08:00
2022-12-19 07:13:33 -06:00
2022-12-19 07:13:33 -06:00
2022-12-08 13:03:47 -08:00
2022-12-19 08:54:17 -06:00
2022-12-16 03:54:54 -08:00
2022-12-12 15:40:03 +01:00
2022-12-16 03:49:24 -08:00
2022-12-21 09:37:14 -08:00
2022-12-16 03:49:24 -08:00
2022-12-21 09:41:28 -08:00
2022-12-25 13:38:09 -08:00
2022-12-25 13:38:09 -08:00
2022-12-13 15:47:48 -08:00
2022-12-13 13:09:38 -08:00
2022-12-15 14:47:10 -08:00
2022-12-11 21:25:58 +01:00
2022-12-16 03:49:24 -08:00
2022-12-17 08:23:42 -06:00
2022-12-25 13:38:09 -08:00
2022-12-19 08:34:39 -06:00
2022-12-14 15:23:49 -08:00
2022-12-25 13:38:09 -08:00
2022-12-25 13:38:09 -08:00
2022-12-21 09:31:18 -08:00
2022-12-13 10:58:09 -08:00
2023-02-03 14:52:11 +01:00
2022-12-13 15:22:14 -08:00
2022-12-09 10:29:58 +01:00
2022-12-21 09:19:24 -08:00
2022-12-23 12:00:24 -08:00
2022-12-13 13:41:26 -08:00
2022-12-13 12:32:07 -08:00
2022-12-25 13:38:09 -08:00
2022-12-25 13:38:09 -08:00
2022-12-22 11:22:31 -08:00
2022-12-16 03:49:24 -08:00
2022-12-20 08:48:24 -06:00
2022-12-17 23:19:38 +01:00
2022-12-19 08:40:58 -06:00
2022-12-25 13:38:09 -08:00
2022-12-14 15:23:49 -08:00
2022-12-19 08:40:58 -06:00
2022-12-13 13:03:06 -08:00
2022-12-16 03:22:53 -08:00
2022-12-17 08:39:31 -06:00
2022-12-13 15:47:48 -08:00
2022-12-21 09:41:28 -08:00
2022-12-11 19:30:20 -08:00
2022-12-23 14:38:00 -08:00
2022-12-07 11:20:55 -07:00
2022-12-21 09:19:24 -08:00
2022-12-16 03:54:54 -08:00
2022-12-25 13:38:09 -08:00
2022-12-19 16:07:59 -06:00
2022-12-19 08:47:33 -06:00
2022-12-23 14:44:08 -08:00
2023-01-22 09:57:19 +01:00
2022-12-14 08:58:51 -08:00
2022-12-12 10:17:08 -08:00
2022-12-15 10:16:04 -08:00
2022-12-25 13:38:09 -08:00
2022-12-14 08:58:51 -08:00
2022-12-25 13:38:09 -08:00
2022-12-16 03:54:54 -08:00
2022-12-21 09:24:39 -08:00
2022-12-16 03:49:24 -08:00
2022-12-17 08:34:01 -06:00
2022-12-13 11:59:58 -08:00