<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-dev/net/802, branch master</title>
<subtitle>Linux kernel development work - see feature branches</subtitle>
<id>https://git.zx2c4.com/linux-dev/atom/net/802?h=master</id>
<link rel='self' href='https://git.zx2c4.com/linux-dev/atom/net/802?h=master'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/'/>
<updated>2022-10-11T23:42:55Z</updated>
<entry>
<title>treewide: use prandom_u32_max() when possible, part 1</title>
<updated>2022-10-11T23:42:55Z</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2022-10-05T14:43:38Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=81895a65ec63ee1daec3255dc1a06675d2fbe915'/>
<id>urn:sha1:81895a65ec63ee1daec3255dc1a06675d2fbe915</id>
<content type='text'>
Rather than incurring a division or requesting too many random bytes for
the given range, use the prandom_u32_max() function, which only takes
the minimum required bytes from the RNG and avoids divisions. This was
done mechanically with this coccinelle script:

@basic@
expression E;
type T;
identifier get_random_u32 =~ "get_random_int|prandom_u32|get_random_u32";
typedef u64;
@@
(
- ((T)get_random_u32() % (E))
+ prandom_u32_max(E)
|
- ((T)get_random_u32() &amp; ((E) - 1))
+ prandom_u32_max(E * XXX_MAKE_SURE_E_IS_POW2)
|
- ((u64)(E) * get_random_u32() &gt;&gt; 32)
+ prandom_u32_max(E)
|
- ((T)get_random_u32() &amp; ~PAGE_MASK)
+ prandom_u32_max(PAGE_SIZE)
)

@multi_line@
identifier get_random_u32 =~ "get_random_int|prandom_u32|get_random_u32";
identifier RAND;
expression E;
@@

-       RAND = get_random_u32();
        ... when != RAND
-       RAND %= (E);
+       RAND = prandom_u32_max(E);

// Find a potential literal
@literal_mask@
expression LITERAL;
type T;
identifier get_random_u32 =~ "get_random_int|prandom_u32|get_random_u32";
position p;
@@

        ((T)get_random_u32()@p &amp; (LITERAL))

// Add one to the literal.
@script:python add_one@
literal &lt;&lt; literal_mask.LITERAL;
RESULT;
@@

value = None
if literal.startswith('0x'):
        value = int(literal, 16)
elif literal[0] in '123456789':
        value = int(literal, 10)
if value is None:
        print("I don't know how to handle %s" % (literal))
        cocci.include_match(False)
elif value == 2**32 - 1 or value == 2**31 - 1 or value == 2**24 - 1 or value == 2**16 - 1 or value == 2**8 - 1:
        print("Skipping 0x%x for cleanup elsewhere" % (value))
        cocci.include_match(False)
elif value &amp; (value + 1) != 0:
        print("Skipping 0x%x because it's not a power of two minus one" % (value))
        cocci.include_match(False)
elif literal.startswith('0x'):
        coccinelle.RESULT = cocci.make_expr("0x%x" % (value + 1))
else:
        coccinelle.RESULT = cocci.make_expr("%d" % (value + 1))

// Replace the literal mask with the calculated result.
@plus_one@
expression literal_mask.LITERAL;
position literal_mask.p;
expression add_one.RESULT;
identifier FUNC;
@@

-       (FUNC()@p &amp; (LITERAL))
+       prandom_u32_max(RESULT)

@collapse_ret@
type T;
identifier VAR;
expression E;
@@

 {
-       T VAR;
-       VAR = (E);
-       return VAR;
+       return E;
 }

@drop_var@
type T;
identifier VAR;
@@

 {
-       T VAR;
        ... when != VAR
 }

Reviewed-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Reviewed-by: Kees Cook &lt;keescook@chromium.org&gt;
Reviewed-by: Yury Norov &lt;yury.norov@gmail.com&gt;
Reviewed-by: KP Singh &lt;kpsingh@kernel.org&gt;
Reviewed-by: Jan Kara &lt;jack@suse.cz&gt; # for ext4 and sbitmap
Reviewed-by: Christoph Böhmwalder &lt;christoph.boehmwalder@linbit.com&gt; # for drbd
Acked-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Acked-by: Heiko Carstens &lt;hca@linux.ibm.com&gt; # for s390
Acked-by: Ulf Hansson &lt;ulf.hansson@linaro.org&gt; # for mmc
Acked-by: Darrick J. Wong &lt;djwong@kernel.org&gt; # for xfs
Signed-off-by: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
</content>
</entry>
<entry>
<title>net: 802: Use memset_startat() to clear struct fields</title>
<updated>2021-11-19T11:23:23Z</updated>
<author>
<name>Kees Cook</name>
<email>keescook@chromium.org</email>
</author>
<published>2021-11-18T20:30:45Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=e3617433c3da3d0859a4bc67f3f975e87f650ebf'/>
<id>urn:sha1:e3617433c3da3d0859a4bc67f3f975e87f650ebf</id>
<content type='text'>
In preparation for FORTIFY_SOURCE performing compile-time and run-time
field bounds checking for memset(), avoid intentionally writing across
neighboring fields.

Use memset_startat() so memset() doesn't get confused about writing
beyond the destination member that is intended to be the starting point
of zeroing through the end of the struct.

Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>llc/snap: constify dev_addr passing</title>
<updated>2021-10-13T16:40:46Z</updated>
<author>
<name>Jakub Kicinski</name>
<email>kuba@kernel.org</email>
</author>
<published>2021-10-12T15:58:37Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=2ef6db76bac0f3006daceb9eeeaf5f09820b1caf'/>
<id>urn:sha1:2ef6db76bac0f3006daceb9eeeaf5f09820b1caf</id>
<content type='text'>
In preparation for netdev-&gt;dev_addr being constant
make all relevant arguments in LLC and SNAP constant.

Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>net: use dev_addr_set()</title>
<updated>2021-10-09T10:55:01Z</updated>
<author>
<name>Jakub Kicinski</name>
<email>kuba@kernel.org</email>
</author>
<published>2021-10-08T17:53:39Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=ea52a0b58e41c3b2b9e97ff13fe0da9c9e430ea8'/>
<id>urn:sha1:ea52a0b58e41c3b2b9e97ff13fe0da9c9e430ea8</id>
<content type='text'>
Use dev_addr_set() instead of writing directly to netdev-&gt;dev_addr
in various misc and old drivers.

Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: 802: remove dead leftover after ipx driver removal</title>
<updated>2021-08-13T23:30:35Z</updated>
<author>
<name>Lukas Bulwahn</name>
<email>lukas.bulwahn@gmail.com</email>
</author>
<published>2021-08-12T08:38:05Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=d8d9ba8dc9c77358cd7ea73e4e44e8952c9baf35'/>
<id>urn:sha1:d8d9ba8dc9c77358cd7ea73e4e44e8952c9baf35</id>
<content type='text'>
Commit 7a2e838d28cf ("staging: ipx: delete it from the tree") removes the
ipx driver and the config IPX. Since then, there is some dead leftover in
./net/802/, that was once used by the IPX driver, but has no other user.

Remove this dead leftover.

Signed-off-by: Lukas Bulwahn &lt;lukas.bulwahn@gmail.com&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>net/802/garp: fix memleak in garp_request_join()</title>
<updated>2021-07-01T18:21:57Z</updated>
<author>
<name>Yang Yingliang</name>
<email>yangyingliang@huawei.com</email>
</author>
<published>2021-06-29T11:53:28Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=42ca63f980842918560b25f0244307fd83b4777c'/>
<id>urn:sha1:42ca63f980842918560b25f0244307fd83b4777c</id>
<content type='text'>
I got kmemleak report when doing fuzz test:

BUG: memory leak
unreferenced object 0xffff88810c909b80 (size 64):
  comm "syz", pid 957, jiffies 4295220394 (age 399.090s)
  hex dump (first 32 bytes):
    01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00 00 00 00 00 00 00 00 08 00 00 00 01 02 00 04  ................
  backtrace:
    [&lt;00000000ca1f2e2e&gt;] garp_request_join+0x285/0x3d0
    [&lt;00000000bf153351&gt;] vlan_gvrp_request_join+0x15b/0x190
    [&lt;0000000024005e72&gt;] vlan_dev_open+0x706/0x980
    [&lt;00000000dc20c4d4&gt;] __dev_open+0x2bb/0x460
    [&lt;0000000066573004&gt;] __dev_change_flags+0x501/0x650
    [&lt;0000000035b42f83&gt;] rtnl_configure_link+0xee/0x280
    [&lt;00000000a5e69de0&gt;] __rtnl_newlink+0xed5/0x1550
    [&lt;00000000a5258f4a&gt;] rtnl_newlink+0x66/0x90
    [&lt;00000000506568ee&gt;] rtnetlink_rcv_msg+0x439/0xbd0
    [&lt;00000000b7eaeae1&gt;] netlink_rcv_skb+0x14d/0x420
    [&lt;00000000c373ce66&gt;] netlink_unicast+0x550/0x750
    [&lt;00000000ec74ce74&gt;] netlink_sendmsg+0x88b/0xda0
    [&lt;00000000381ff246&gt;] sock_sendmsg+0xc9/0x120
    [&lt;000000008f6a2db3&gt;] ____sys_sendmsg+0x6e8/0x820
    [&lt;000000008d9c1735&gt;] ___sys_sendmsg+0x145/0x1c0
    [&lt;00000000aa39dd8b&gt;] __sys_sendmsg+0xfe/0x1d0

Calling garp_request_leave() after garp_request_join(), the attr-&gt;state
is set to GARP_APPLICANT_VO, garp_attr_destroy() won't be called in last
transmit event in garp_uninit_applicant(), the attr of applicant will be
leaked. To fix this leak, iterate and free each attr of applicant before
rerturning from garp_uninit_applicant().

Reported-by: Hulk Robot &lt;hulkci@huawei.com&gt;
Signed-off-by: Yang Yingliang &lt;yangyingliang@huawei.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net/802/mrp: fix memleak in mrp_request_join()</title>
<updated>2021-07-01T18:14:35Z</updated>
<author>
<name>Yang Yingliang</name>
<email>yangyingliang@huawei.com</email>
</author>
<published>2021-06-29T07:22:37Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=996af62167d0e0ec69b938a3561e96f84ffff1aa'/>
<id>urn:sha1:996af62167d0e0ec69b938a3561e96f84ffff1aa</id>
<content type='text'>
I got kmemleak report when doing fuzz test:

BUG: memory leak
unreferenced object 0xffff88810c239500 (size 64):
comm "syz-executor940", pid 882, jiffies 4294712870 (age 14.631s)
hex dump (first 32 bytes):
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 01 00 00 00 01 02 00 04 ................
backtrace:
[&lt;00000000a323afa4&gt;] slab_alloc_node mm/slub.c:2972 [inline]
[&lt;00000000a323afa4&gt;] slab_alloc mm/slub.c:2980 [inline]
[&lt;00000000a323afa4&gt;] __kmalloc+0x167/0x340 mm/slub.c:4130
[&lt;000000005034ca11&gt;] kmalloc include/linux/slab.h:595 [inline]
[&lt;000000005034ca11&gt;] mrp_attr_create net/802/mrp.c:276 [inline]
[&lt;000000005034ca11&gt;] mrp_request_join+0x265/0x550 net/802/mrp.c:530
[&lt;00000000fcfd81f3&gt;] vlan_mvrp_request_join+0x145/0x170 net/8021q/vlan_mvrp.c:40
[&lt;000000009258546e&gt;] vlan_dev_open+0x477/0x890 net/8021q/vlan_dev.c:292
[&lt;0000000059acd82b&gt;] __dev_open+0x281/0x410 net/core/dev.c:1609
[&lt;000000004e6dc695&gt;] __dev_change_flags+0x424/0x560 net/core/dev.c:8767
[&lt;00000000471a09af&gt;] rtnl_configure_link+0xd9/0x210 net/core/rtnetlink.c:3122
[&lt;0000000037a4672b&gt;] __rtnl_newlink+0xe08/0x13e0 net/core/rtnetlink.c:3448
[&lt;000000008d5d0fda&gt;] rtnl_newlink+0x64/0xa0 net/core/rtnetlink.c:3488
[&lt;000000004882fe39&gt;] rtnetlink_rcv_msg+0x369/0xa10 net/core/rtnetlink.c:5552
[&lt;00000000907e6c54&gt;] netlink_rcv_skb+0x134/0x3d0 net/netlink/af_netlink.c:2504
[&lt;00000000e7d7a8c4&gt;] netlink_unicast_kernel net/netlink/af_netlink.c:1314 [inline]
[&lt;00000000e7d7a8c4&gt;] netlink_unicast+0x4a0/0x6a0 net/netlink/af_netlink.c:1340
[&lt;00000000e0645d50&gt;] netlink_sendmsg+0x78e/0xc90 net/netlink/af_netlink.c:1929
[&lt;00000000c24559b7&gt;] sock_sendmsg_nosec net/socket.c:654 [inline]
[&lt;00000000c24559b7&gt;] sock_sendmsg+0x139/0x170 net/socket.c:674
[&lt;00000000fc210bc2&gt;] ____sys_sendmsg+0x658/0x7d0 net/socket.c:2350
[&lt;00000000be4577b5&gt;] ___sys_sendmsg+0xf8/0x170 net/socket.c:2404

Calling mrp_request_leave() after mrp_request_join(), the attr-&gt;state
is set to MRP_APPLICANT_VO, mrp_attr_destroy() won't be called in last
TX event in mrp_uninit_applicant(), the attr of applicant will be leaked.
To fix this leak, iterate and free each attr of applicant before rerturning
from mrp_uninit_applicant().

Reported-by: Hulk Robot &lt;hulkci@huawei.com&gt;
Signed-off-by: Yang Yingliang &lt;yangyingliang@huawei.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: 802: psnap.c: Use built-in RCU list checking</title>
<updated>2020-02-24T21:02:53Z</updated>
<author>
<name>Madhuparna Bhowmik</name>
<email>madhuparnabhowmik10@gmail.com</email>
</author>
<published>2020-02-21T16:19:47Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=0a087bf232c35dbec3769c4402ca737995d7b734'/>
<id>urn:sha1:0a087bf232c35dbec3769c4402ca737995d7b734</id>
<content type='text'>
list_for_each_entry_rcu() has built-in RCU and lock checking.

Pass cond argument to list_for_each_entry_rcu() to silence
false lockdep warning when CONFIG_PROVE_RCU_LIST is enabled
by default.

Signed-off-by: Madhuparna Bhowmik &lt;madhuparnabhowmik10@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>treewide: Use sizeof_field() macro</title>
<updated>2019-12-09T18:36:44Z</updated>
<author>
<name>Pankaj Bharadiya</name>
<email>pankaj.laxminarayan.bharadiya@intel.com</email>
</author>
<published>2019-12-09T18:31:43Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=c593642c8be046915ca3a4a300243a68077cd207'/>
<id>urn:sha1:c593642c8be046915ca3a4a300243a68077cd207</id>
<content type='text'>
Replace all the occurrences of FIELD_SIZEOF() with sizeof_field() except
at places where these are defined. Later patches will remove the unused
definition of FIELD_SIZEOF().

This patch is generated using following script:

EXCLUDE_FILES="include/linux/stddef.h|include/linux/kernel.h"

git grep -l -e "\bFIELD_SIZEOF\b" | while read file;
do

	if [[ "$file" =~ $EXCLUDE_FILES ]]; then
		continue
	fi
	sed -i  -e 's/\bFIELD_SIZEOF\b/sizeof_field/g' $file;
done

Signed-off-by: Pankaj Bharadiya &lt;pankaj.laxminarayan.bharadiya@intel.com&gt;
Link: https://lore.kernel.org/r/20190924105839.110713-3-pankaj.laxminarayan.bharadiya@intel.com
Co-developed-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Acked-by: David Miller &lt;davem@davemloft.net&gt; # for net
</content>
</entry>
<entry>
<title>treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500</title>
<updated>2019-06-19T15:09:55Z</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2019-06-04T08:11:33Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=d2912cb15bdda8ba4a5dd73396ad62641af2f520'/>
<id>urn:sha1:d2912cb15bdda8ba4a5dd73396ad62641af2f520</id>
<content type='text'>
Based on 2 normalized pattern(s):

  this program is free software you can redistribute it and or modify
  it under the terms of the gnu general public license version 2 as
  published by the free software foundation

  this program is free software you can redistribute it and or modify
  it under the terms of the gnu general public license version 2 as
  published by the free software foundation #

extracted by the scancode license scanner the SPDX license identifier

  GPL-2.0-only

has been chosen to replace the boilerplate/reference in 4122 file(s).

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Reviewed-by: Enrico Weigelt &lt;info@metux.net&gt;
Reviewed-by: Kate Stewart &lt;kstewart@linuxfoundation.org&gt;
Reviewed-by: Allison Randal &lt;allison@lohutok.net&gt;
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190604081206.933168790@linutronix.de
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
