<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/net/ipv4/igmp.c, branch linux-5.1.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.</subtitle>
<id>https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-5.1.y</id>
<link rel='self' href='https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-5.1.y'/>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/'/>
<updated>2019-07-28T06:28:24Z</updated>
<entry>
<title>igmp: fix memory leak in igmpv3_del_delrec()</title>
<updated>2019-07-28T06:28:24Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2019-06-27T08:27:01Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=ce6994f56e7a6e1ac0630328e65fa2d9d919786d'/>
<id>urn:sha1:ce6994f56e7a6e1ac0630328e65fa2d9d919786d</id>
<content type='text'>
[ Upstream commit e5b1c6c6277d5a283290a8c033c72544746f9b5b ]

im-&gt;tomb and/or im-&gt;sources might not be NULL, but we
currently overwrite their values blindly.

Using swap() will make sure the following call to kfree_pmc(pmc)
will properly free the psf structures.

Tested with the C repro provided by syzbot, which basically does :

 socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 3
 setsockopt(3, SOL_IP, IP_ADD_MEMBERSHIP, "\340\0\0\2\177\0\0\1\0\0\0\0", 12) = 0
 ioctl(3, SIOCSIFFLAGS, {ifr_name="lo", ifr_flags=0}) = 0
 setsockopt(3, SOL_IP, IP_MSFILTER, "\340\0\0\2\177\0\0\1\1\0\0\0\1\0\0\0\377\377\377\377", 20) = 0
 ioctl(3, SIOCSIFFLAGS, {ifr_name="lo", ifr_flags=IFF_UP}) = 0
 exit_group(0)                    = ?

BUG: memory leak
unreferenced object 0xffff88811450f140 (size 64):
  comm "softirq", pid 0, jiffies 4294942448 (age 32.070s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 ff ff ff ff 00 00 00 00  ................
    00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00  ................
  backtrace:
    [&lt;00000000c7bad083&gt;] kmemleak_alloc_recursive include/linux/kmemleak.h:43 [inline]
    [&lt;00000000c7bad083&gt;] slab_post_alloc_hook mm/slab.h:439 [inline]
    [&lt;00000000c7bad083&gt;] slab_alloc mm/slab.c:3326 [inline]
    [&lt;00000000c7bad083&gt;] kmem_cache_alloc_trace+0x13d/0x280 mm/slab.c:3553
    [&lt;000000009acc4151&gt;] kmalloc include/linux/slab.h:547 [inline]
    [&lt;000000009acc4151&gt;] kzalloc include/linux/slab.h:742 [inline]
    [&lt;000000009acc4151&gt;] ip_mc_add1_src net/ipv4/igmp.c:1976 [inline]
    [&lt;000000009acc4151&gt;] ip_mc_add_src+0x36b/0x400 net/ipv4/igmp.c:2100
    [&lt;000000004ac14566&gt;] ip_mc_msfilter+0x22d/0x310 net/ipv4/igmp.c:2484
    [&lt;0000000052d8f995&gt;] do_ip_setsockopt.isra.0+0x1795/0x1930 net/ipv4/ip_sockglue.c:959
    [&lt;000000004ee1e21f&gt;] ip_setsockopt+0x3b/0xb0 net/ipv4/ip_sockglue.c:1248
    [&lt;0000000066cdfe74&gt;] udp_setsockopt+0x4e/0x90 net/ipv4/udp.c:2618
    [&lt;000000009383a786&gt;] sock_common_setsockopt+0x38/0x50 net/core/sock.c:3126
    [&lt;00000000d8ac0c94&gt;] __sys_setsockopt+0x98/0x120 net/socket.c:2072
    [&lt;000000001b1e9666&gt;] __do_sys_setsockopt net/socket.c:2083 [inline]
    [&lt;000000001b1e9666&gt;] __se_sys_setsockopt net/socket.c:2080 [inline]
    [&lt;000000001b1e9666&gt;] __x64_sys_setsockopt+0x26/0x30 net/socket.c:2080
    [&lt;00000000420d395e&gt;] do_syscall_64+0x76/0x1a0 arch/x86/entry/common.c:301
    [&lt;000000007fd83a4b&gt;] entry_SYSCALL_64_after_hwframe+0x44/0xa9

Fixes: 24803f38a5c0 ("igmp: do not remove igmp souce list info when set link down")
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Cc: Hangbin Liu &lt;liuhangbin@gmail.com&gt;
Reported-by: syzbot+6ca1abd0db68b5173a4f@syzkaller.appspotmail.com
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>ipv4/igmp: fix build error if !CONFIG_IP_MULTICAST</title>
<updated>2019-06-04T05:59:40Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2019-05-23T01:35:16Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=cf5bf3e6dcbbf280e8224ab34720a4b35a3254a5'/>
<id>urn:sha1:cf5bf3e6dcbbf280e8224ab34720a4b35a3254a5</id>
<content type='text'>
[ Upstream commit 903869bd10e6719b9df6718e785be7ec725df59f ]

ip_sf_list_clear_all() needs to be defined even if !CONFIG_IP_MULTICAST

Fixes: 3580d04aa674 ("ipv4/igmp: fix another memory leak in igmpv3_del_delrec()")
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Reported-by: kbuild test robot &lt;lkp@intel.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>ipv4/igmp: fix another memory leak in igmpv3_del_delrec()</title>
<updated>2019-06-04T05:59:40Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2019-05-22T23:51:22Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=68d7cdb3bed74e609975e64476429660abf7d67c'/>
<id>urn:sha1:68d7cdb3bed74e609975e64476429660abf7d67c</id>
<content type='text'>
[ Upstream commit 3580d04aa674383c42de7b635d28e52a1e5bc72c ]

syzbot reported memory leaks [1] that I have back tracked to
a missing cleanup from igmpv3_del_delrec() when
(im-&gt;sfmode != MCAST_INCLUDE)

Add ip_sf_list_clear_all() and kfree_pmc() helpers to explicitely
handle the cleanups before freeing.

[1]

BUG: memory leak
unreferenced object 0xffff888123e32b00 (size 64):
  comm "softirq", pid 0, jiffies 4294942968 (age 8.010s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 e0 00 00 01 00 00 00 00  ................
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [&lt;000000006105011b&gt;] kmemleak_alloc_recursive include/linux/kmemleak.h:55 [inline]
    [&lt;000000006105011b&gt;] slab_post_alloc_hook mm/slab.h:439 [inline]
    [&lt;000000006105011b&gt;] slab_alloc mm/slab.c:3326 [inline]
    [&lt;000000006105011b&gt;] kmem_cache_alloc_trace+0x13d/0x280 mm/slab.c:3553
    [&lt;000000004bba8073&gt;] kmalloc include/linux/slab.h:547 [inline]
    [&lt;000000004bba8073&gt;] kzalloc include/linux/slab.h:742 [inline]
    [&lt;000000004bba8073&gt;] ip_mc_add1_src net/ipv4/igmp.c:1961 [inline]
    [&lt;000000004bba8073&gt;] ip_mc_add_src+0x36b/0x400 net/ipv4/igmp.c:2085
    [&lt;00000000a46a65a0&gt;] ip_mc_msfilter+0x22d/0x310 net/ipv4/igmp.c:2475
    [&lt;000000005956ca89&gt;] do_ip_setsockopt.isra.0+0x1795/0x1930 net/ipv4/ip_sockglue.c:957
    [&lt;00000000848e2d2f&gt;] ip_setsockopt+0x3b/0xb0 net/ipv4/ip_sockglue.c:1246
    [&lt;00000000b9db185c&gt;] udp_setsockopt+0x4e/0x90 net/ipv4/udp.c:2616
    [&lt;000000003028e438&gt;] sock_common_setsockopt+0x38/0x50 net/core/sock.c:3130
    [&lt;0000000015b65589&gt;] __sys_setsockopt+0x98/0x120 net/socket.c:2078
    [&lt;00000000ac198ef0&gt;] __do_sys_setsockopt net/socket.c:2089 [inline]
    [&lt;00000000ac198ef0&gt;] __se_sys_setsockopt net/socket.c:2086 [inline]
    [&lt;00000000ac198ef0&gt;] __x64_sys_setsockopt+0x26/0x30 net/socket.c:2086
    [&lt;000000000a770437&gt;] do_syscall_64+0x76/0x1a0 arch/x86/entry/common.c:301
    [&lt;00000000d3adb93b&gt;] entry_SYSCALL_64_after_hwframe+0x44/0xa9

Fixes: 9c8bb163ae78 ("igmp, mld: Fix memory leak in igmpv3/mld_del_delrec()")
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Cc: Hangbin Liu &lt;liuhangbin@gmail.com&gt;
Reported-by: syzbot &lt;syzkaller@googlegroups.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>net: remove unneeded switch fall-through</title>
<updated>2019-02-21T21:48:00Z</updated>
<author>
<name>Li RongQing</name>
<email>lirongqing@baidu.com</email>
</author>
<published>2019-02-19T02:15:56Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=a2b5a3fa2ce10411130b496ad0e55ef5a4971fd9'/>
<id>urn:sha1:a2b5a3fa2ce10411130b496ad0e55ef5a4971fd9</id>
<content type='text'>
This case block has been terminated by a return, so not need
a switch fall-through

Signed-off-by: Li RongQing &lt;lirongqing@baidu.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: Fix ip_mc_{dec,inc}_group allocation context</title>
<updated>2019-02-03T20:11:12Z</updated>
<author>
<name>Florian Fainelli</name>
<email>f.fainelli@gmail.com</email>
</author>
<published>2019-02-02T04:20:52Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=9fb20801dab46238706267896df1b3938d977129'/>
<id>urn:sha1:9fb20801dab46238706267896df1b3938d977129</id>
<content type='text'>
After 4effd28c1245 ("bridge: join all-snoopers multicast address"), I
started seeing the following sleep in atomic warnings:

[   26.763893] BUG: sleeping function called from invalid context at mm/slab.h:421
[   26.771425] in_atomic(): 1, irqs_disabled(): 0, pid: 1658, name: sh
[   26.777855] INFO: lockdep is turned off.
[   26.781916] CPU: 0 PID: 1658 Comm: sh Not tainted 5.0.0-rc4 #20
[   26.787943] Hardware name: BCM97278SV (DT)
[   26.792118] Call trace:
[   26.794645]  dump_backtrace+0x0/0x170
[   26.798391]  show_stack+0x24/0x30
[   26.801787]  dump_stack+0xa4/0xe4
[   26.805182]  ___might_sleep+0x208/0x218
[   26.809102]  __might_sleep+0x78/0x88
[   26.812762]  kmem_cache_alloc_trace+0x64/0x28c
[   26.817301]  igmp_group_dropped+0x150/0x230
[   26.821573]  ip_mc_dec_group+0x1b0/0x1f8
[   26.825585]  br_ip4_multicast_leave_snoopers.isra.11+0x174/0x190
[   26.831704]  br_multicast_toggle+0x78/0xcc
[   26.835887]  store_bridge_parm+0xc4/0xfc
[   26.839894]  multicast_snooping_store+0x3c/0x4c
[   26.844517]  dev_attr_store+0x44/0x5c
[   26.848262]  sysfs_kf_write+0x50/0x68
[   26.852006]  kernfs_fop_write+0x14c/0x1b4
[   26.856102]  __vfs_write+0x60/0x190
[   26.859668]  vfs_write+0xc8/0x168
[   26.863059]  ksys_write+0x70/0xc8
[   26.866449]  __arm64_sys_write+0x24/0x30
[   26.870458]  el0_svc_common+0xa0/0x11c
[   26.874291]  el0_svc_handler+0x38/0x70
[   26.878120]  el0_svc+0x8/0xc

while toggling the bridge's multicast_snooping attribute dynamically.

Pass a gfp_t down to igmpv3_add_delrec(), introduce
__igmp_group_dropped() and introduce __ip_mc_dec_group() to take a gfp_t
argument.

Similarly introduce ____ip_mc_inc_group() and __ip_mc_inc_group() to
allow caller to specify gfp_t.

IPv6 part of the patch appears fine.

Fixes: 4effd28c1245 ("bridge: join all-snoopers multicast address")
Signed-off-by: Florian Fainelli &lt;f.fainelli@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>bridge: simplify ip_mc_check_igmp() and ipv6_mc_check_mld() internals</title>
<updated>2019-01-23T01:18:08Z</updated>
<author>
<name>Linus Lüssing</name>
<email>linus.luessing@c0d3.blue</email>
</author>
<published>2019-01-21T06:26:26Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=a2e2ca3bebe273055a212d754ffe4e0264192d74'/>
<id>urn:sha1:a2e2ca3bebe273055a212d754ffe4e0264192d74</id>
<content type='text'>
With this patch the internal use of the skb_trimmed is reduced to
the ICMPv6/IGMP checksum verification. And for the length checks
the newly introduced helper functions are used instead of calculating
and checking with skb-&gt;len directly.

These changes should hopefully make it easier to verify that length
checks are performed properly.

Signed-off-by: Linus Lüssing &lt;linus.luessing@c0d3.blue&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>bridge: simplify ip_mc_check_igmp() and ipv6_mc_check_mld() calls</title>
<updated>2019-01-23T01:18:08Z</updated>
<author>
<name>Linus Lüssing</name>
<email>linus.luessing@c0d3.blue</email>
</author>
<published>2019-01-21T06:26:25Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=ba5ea614622dca6d675b4cc8a97270569ae13a23'/>
<id>urn:sha1:ba5ea614622dca6d675b4cc8a97270569ae13a23</id>
<content type='text'>
This patch refactors ip_mc_check_igmp(), ipv6_mc_check_mld() and
their callers (more precisely, the Linux bridge) to not rely on
the skb_trimmed parameter anymore.

An skb with its tail trimmed to the IP packet length was initially
introduced for the following three reasons:

1) To be able to verify the ICMPv6 checksum.
2) To be able to distinguish the version of an IGMP or MLD query.
   They are distinguishable only by their size.
3) To avoid parsing data for an IGMPv3 or MLDv2 report that is
   beyond the IP packet but still within the skb.

The first case still uses a cloned and potentially trimmed skb to
verfiy. However, there is no need to propagate it to the caller.
For the second and third case explicit IP packet length checks were
added.

This hopefully makes ip_mc_check_igmp() and ipv6_mc_check_mld() easier
to read and verfiy, as well as easier to use.

Signed-off-by: Linus Lüssing &lt;linus.luessing@c0d3.blue&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>ipv4/igmp: fix v1/v2 switchback timeout based on rfc3376, 8.12</title>
<updated>2018-10-30T03:26:06Z</updated>
<author>
<name>Hangbin Liu</name>
<email>liuhangbin@gmail.com</email>
</author>
<published>2018-10-26T03:30:35Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=966c37f2d77eb44d47af8e919267b1ba675b2eca'/>
<id>urn:sha1:966c37f2d77eb44d47af8e919267b1ba675b2eca</id>
<content type='text'>
Similiar with ipv6 mcast commit 89225d1ce6af3 ("net: ipv6: mld: fix v1/v2
switchback timeout to rfc3810, 9.12.")

i) RFC3376 8.12. Older Version Querier Present Timeout says:

   The Older Version Querier Interval is the time-out for transitioning
   a host back to IGMPv3 mode once an older version query is heard.
   When an older version query is received, hosts set their Older
   Version Querier Present Timer to Older Version Querier Interval.

   This value MUST be ((the Robustness Variable) times (the Query
   Interval in the last Query received)) plus (one Query Response
   Interval).

Currently we only use a hardcode value IGMP_V1/v2_ROUTER_PRESENT_TIMEOUT.
Fix it by adding two new items mr_qi(Query Interval) and mr_qri(Query Response
Interval) in struct in_device.

Now we can calculate the switchback time via (mr_qrv * mr_qi) + mr_qri.
We need update these values when receive IGMPv3 queries.

Reported-by: Ying Xu &lt;yinxu@redhat.com&gt;
Signed-off-by: Hangbin Liu &lt;liuhangbin@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>igmp: fix incorrect unsolicit report count after link down and up</title>
<updated>2018-09-02T20:39:37Z</updated>
<author>
<name>Hangbin Liu</name>
<email>liuhangbin@gmail.com</email>
</author>
<published>2018-08-29T10:06:10Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=ff06525fcb8ae3c302ac1319bf6c07c026dea964'/>
<id>urn:sha1:ff06525fcb8ae3c302ac1319bf6c07c026dea964</id>
<content type='text'>
After link down and up, i.e. when call ip_mc_up(), we doesn't init
im-&gt;unsolicit_count. So after igmp_timer_expire(), we will not start
timer again and only send one unsolicit report at last.

Fix it by initializing im-&gt;unsolicit_count in igmp_group_added(), so
we can respect igmp robustness value.

Fixes: 24803f38a5c0b ("igmp: do not remove igmp souce list info when set link down")
Signed-off-by: Hangbin Liu &lt;liuhangbin@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>igmp: fix incorrect unsolicit report count when join group</title>
<updated>2018-09-02T20:39:37Z</updated>
<author>
<name>Hangbin Liu</name>
<email>liuhangbin@gmail.com</email>
</author>
<published>2018-08-29T10:06:08Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=4fb7253e4f9a8f06a986a3b317e2f79d9b43d552'/>
<id>urn:sha1:4fb7253e4f9a8f06a986a3b317e2f79d9b43d552</id>
<content type='text'>
We should not start timer if im-&gt;unsolicit_count equal to 0 after decrease.
Or we will send one more unsolicit report message. i.e. 3 instead of 2 by
default.

Fixes: 1da177e4c3f41 ("Linux-2.6.12-rc2")
Signed-off-by: Hangbin Liu &lt;liuhangbin@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
