CVE-2021-47238
Severity CVSS v4.0:
Pending analysis
Type:
CWE-400
Uncontrolled Resource Consumption ('Resource Exhaustion')
Publication date:
21/05/2024
Last modified:
04/04/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
net: ipv4: fix memory leak in ip_mc_add1_src<br />
<br />
BUG: memory leak<br />
unreferenced object 0xffff888101bc4c00 (size 32):<br />
comm "syz-executor527", pid 360, jiffies 4294807421 (age 19.329s)<br />
hex dump (first 32 bytes):<br />
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................<br />
01 00 00 00 00 00 00 00 ac 14 14 bb 00 00 02 00 ................<br />
backtrace:<br />
[] kmalloc include/linux/slab.h:558 [inline]<br />
[] kzalloc include/linux/slab.h:688 [inline]<br />
[] ip_mc_add1_src net/ipv4/igmp.c:1971 [inline]<br />
[] ip_mc_add_src+0x95f/0xdb0 net/ipv4/igmp.c:2095<br />
[] ip_mc_source+0x84c/0xea0 net/ipv4/igmp.c:2416<br />
[] do_ip_setsockopt net/ipv4/ip_sockglue.c:1294 [inline]<br />
[] ip_setsockopt+0x114b/0x30c0 net/ipv4/ip_sockglue.c:1423<br />
[] raw_setsockopt+0x13d/0x170 net/ipv4/raw.c:857<br />
[] __sys_setsockopt+0x158/0x270 net/socket.c:2117<br />
[] __do_sys_setsockopt net/socket.c:2128 [inline]<br />
[] __se_sys_setsockopt net/socket.c:2125 [inline]<br />
[] __x64_sys_setsockopt+0xba/0x150 net/socket.c:2125<br />
[] do_syscall_64+0x40/0x80 arch/x86/entry/common.c:47<br />
[] entry_SYSCALL_64_after_hwframe+0x44/0xae<br />
<br />
In commit 24803f38a5c0 ("igmp: do not remove igmp souce list info when set<br />
link down"), the ip_mc_clear_src() in ip_mc_destroy_dev() was removed,<br />
because it was also called in igmpv3_clear_delrec().<br />
<br />
Rough callgraph:<br />
<br />
inetdev_destroy<br />
-> ip_mc_destroy_dev<br />
-> igmpv3_clear_delrec<br />
-> ip_mc_clear_src<br />
-> RCU_INIT_POINTER(dev->ip_ptr, NULL)<br />
<br />
However, ip_mc_clear_src() called in igmpv3_clear_delrec() doesn&#39;t<br />
release in_dev->mc_list->sources. And RCU_INIT_POINTER() assigns the<br />
NULL to dev->ip_ptr. As a result, in_dev cannot be obtained through<br />
inetdev_by_index() and then in_dev->mc_list->sources cannot be released<br />
by ip_mc_del1_src() in the sock_close. Rough call sequence goes like:<br />
<br />
sock_close<br />
-> __sock_release<br />
-> inet_release<br />
-> ip_mc_drop_socket<br />
-> inetdev_by_index<br />
-> ip_mc_leave_src<br />
-> ip_mc_del_src<br />
-> ip_mc_del1_src<br />
<br />
So we still need to call ip_mc_clear_src() in ip_mc_destroy_dev() to free<br />
in_dev->mc_list->sources.
Impact
Base Score 3.x
5.50
Severity 3.x
MEDIUM
Vulnerable products and versions
| CPE | From | Up to |
|---|---|---|
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 3.2.87 (including) | 3.3 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 3.16.42 (including) | 3.17 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 4.9 (including) | 4.9.274 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 4.10 (including) | 4.14.238 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 4.15 (including) | 4.19.196 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 4.20 (including) | 5.4.128 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.5 (including) | 5.10.46 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.11 (including) | 5.12.13 (excluding) |
| cpe:2.3:o:linux:linux_kernel:5.13:rc1:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:5.13:rc2:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:5.13:rc3:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:5.13:rc4:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:5.13:rc5:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:5.13:rc6:*:*:*:*:*:* |
To consult the complete list of CPE names with products and versions, see this page
References to Advisories, Solutions, and Tools
- https://git.kernel.org/stable/c/0dc13e75507faa17ac9f7562b4ef7bf8fcd78422
- https://git.kernel.org/stable/c/1e28018b5c83d5073f74a6fb72eabe8370b2f501
- https://git.kernel.org/stable/c/3dd2aeac2e9624cff9fa634710837e4f2e352758
- https://git.kernel.org/stable/c/6cff57eea3347f79f1867cc53e1093b6614138d8
- https://git.kernel.org/stable/c/77de6ee73f54a9a89c0afa0bf4c53b239aa9953a
- https://git.kernel.org/stable/c/ac31cc837cafb57a271babad8ccffbf733caa076
- https://git.kernel.org/stable/c/d8e2973029b8b2ce477b564824431f3385c77083
- https://git.kernel.org/stable/c/0dc13e75507faa17ac9f7562b4ef7bf8fcd78422
- https://git.kernel.org/stable/c/1e28018b5c83d5073f74a6fb72eabe8370b2f501
- https://git.kernel.org/stable/c/3dd2aeac2e9624cff9fa634710837e4f2e352758
- https://git.kernel.org/stable/c/6cff57eea3347f79f1867cc53e1093b6614138d8
- https://git.kernel.org/stable/c/77de6ee73f54a9a89c0afa0bf4c53b239aa9953a
- https://git.kernel.org/stable/c/ac31cc837cafb57a271babad8ccffbf733caa076
- https://git.kernel.org/stable/c/d8e2973029b8b2ce477b564824431f3385c77083



