In the Linux kernel, the following vulnerability has been resolved:
media: ov2740: Fix memleak in ov2740initcontrols()
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>] _kmallocnode+0x44/0x1b0 [<0000000039c802f4>] kvmallocnode+0x34/0x180 [<000000009b8b5c63>] v4l2ctrlhandlerinitclass+0x11d/0x180 [videodev] [<0000000038644056>] ov2740probe+0x37d/0x84f [ov2740] [<0000000092489f59>] i2cdeviceprobe+0x28d/0x680 [<000000001038babe>] reallyprobe+0x17c/0x3f0 [<0000000098c7af1c>] _driverprobedevice+0xe3/0x170 [<00000000e1b3dc24>] devicedriverattach+0x34/0x80 [<000000005a04a34d>] bindstore+0x10b/0x1a0 [<00000000ce25d4f2>] drvattrstore+0x49/0x70 [<000000007d9f4e9a>] sysfskfwrite+0x8c/0xb0 [<00000000be6cff0f>] kernfsfopwriteiter+0x216/0x2e0 [<0000000031ddb40a>] vfswrite+0x658/0x810 [<0000000041beecdd>] ksyswrite+0xd6/0x1b0 [<0000000023755840>] dosyscall64+0x38/0x90 [<00000000b2cc2da2>] entrySYSCALL64afterhwframe+0x63/0xcd
ov2740initcontrols() won't clean all the allocated resources in fail path, which may causes the memleaks. Add v4l2ctrlhandler_free() to prevent memleak.
[
{
"signature_type": "Function",
"digest": {
"function_hash": "8190765569511972611176251222789661475",
"length": 1886.0
},
"target": {
"file": "drivers/media/i2c/ov2740.c",
"function": "ov2740_init_controls"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3969b2ebc66039306f505c7c630c5530800f83c0",
"id": "CVE-2023-53349-1bf7ed00",
"deprecated": false,
"signature_version": "v1"
},
{
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"27230262803011116936655278608001800490",
"118923910963779285651577556222849391683",
"301427490703122866755618003259744834981",
"229793189733908535339405971288667993384",
"281497683376027217247610921967710701075"
]
},
"target": {
"file": "drivers/media/i2c/ov2740.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@fc33380ae06f438b652f66b9370b543976ac8a03",
"id": "CVE-2023-53349-2df96f68",
"deprecated": false,
"signature_version": "v1"
},
{
"signature_type": "Function",
"digest": {
"function_hash": "8190765569511972611176251222789661475",
"length": 1886.0
},
"target": {
"file": "drivers/media/i2c/ov2740.c",
"function": "ov2740_init_controls"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@fc33380ae06f438b652f66b9370b543976ac8a03",
"id": "CVE-2023-53349-4016b970",
"deprecated": false,
"signature_version": "v1"
},
{
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"27230262803011116936655278608001800490",
"118923910963779285651577556222849391683",
"301427490703122866755618003259744834981",
"229793189733908535339405971288667993384",
"281497683376027217247610921967710701075"
]
},
"target": {
"file": "drivers/media/i2c/ov2740.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@a163ee11345d8322321c28bd61631de32455b987",
"id": "CVE-2023-53349-5bb5da92",
"deprecated": false,
"signature_version": "v1"
},
{
"signature_type": "Function",
"digest": {
"function_hash": "57973560052960390588012357934424735393",
"length": 1882.0
},
"target": {
"file": "drivers/media/i2c/ov2740.c",
"function": "ov2740_init_controls"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@7c405ee63447f14eefcfe12a18aa749abbd596ea",
"id": "CVE-2023-53349-5c9435b2",
"deprecated": false,
"signature_version": "v1"
},
{
"signature_type": "Function",
"digest": {
"function_hash": "8190765569511972611176251222789661475",
"length": 1886.0
},
"target": {
"file": "drivers/media/i2c/ov2740.c",
"function": "ov2740_init_controls"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@a163ee11345d8322321c28bd61631de32455b987",
"id": "CVE-2023-53349-63e3d078",
"deprecated": false,
"signature_version": "v1"
},
{
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"27230262803011116936655278608001800490",
"118923910963779285651577556222849391683",
"301427490703122866755618003259744834981",
"229793189733908535339405971288667993384",
"281497683376027217247610921967710701075"
]
},
"target": {
"file": "drivers/media/i2c/ov2740.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@2d899592ed7829d0d5140853bac4d58742a6b8af",
"id": "CVE-2023-53349-810dca88",
"deprecated": false,
"signature_version": "v1"
},
{
"signature_type": "Function",
"digest": {
"function_hash": "57973560052960390588012357934424735393",
"length": 1882.0
},
"target": {
"file": "drivers/media/i2c/ov2740.c",
"function": "ov2740_init_controls"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@2d899592ed7829d0d5140853bac4d58742a6b8af",
"id": "CVE-2023-53349-93611d5d",
"deprecated": false,
"signature_version": "v1"
},
{
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"27230262803011116936655278608001800490",
"118923910963779285651577556222849391683",
"301427490703122866755618003259744834981",
"229793189733908535339405971288667993384",
"281497683376027217247610921967710701075"
]
},
"target": {
"file": "drivers/media/i2c/ov2740.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@7c405ee63447f14eefcfe12a18aa749abbd596ea",
"id": "CVE-2023-53349-a4c71f45",
"deprecated": false,
"signature_version": "v1"
},
{
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"27230262803011116936655278608001800490",
"118923910963779285651577556222849391683",
"301427490703122866755618003259744834981",
"229793189733908535339405971288667993384",
"281497683376027217247610921967710701075"
]
},
"target": {
"file": "drivers/media/i2c/ov2740.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3969b2ebc66039306f505c7c630c5530800f83c0",
"id": "CVE-2023-53349-d18d898b",
"deprecated": false,
"signature_version": "v1"
}
]