<feed xmlns='http://www.w3.org/2005/Atom'>
<title>BMC/Intel-BMC/linux.git/net/ncsi, branch dev-4.17</title>
<subtitle>Intel OpenBMC Linux kernel source tree (mirror)</subtitle>
<id>https://git.radix-linux.su/BMC/Intel-BMC/linux.git/atom?h=dev-4.17</id>
<link rel='self' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/atom?h=dev-4.17'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/'/>
<updated>2018-06-19T05:48:34+00:00</updated>
<entry>
<title>net/ncsi: Use netdev_dbg for debug messages</title>
<updated>2018-06-19T05:48:34+00:00</updated>
<author>
<name>Joel Stanley</name>
<email>joel@jms.id.au</email>
</author>
<published>2018-06-18T07:09:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=47d9fc966744fa61e631905ff979874e5bf4bb3f'/>
<id>urn:sha1:47d9fc966744fa61e631905ff979874e5bf4bb3f</id>
<content type='text'>
This moves all of the netdev_printk(KERN_DEBUG, ...) messages over to
netdev_dbg.

As Joe explains:

&gt; netdev_dbg is not included in object code unless
&gt; DEBUG is defined or CONFIG_DYNAMIC_DEBUG is set.
&gt; And then, it is not emitted into the log unless
&gt; DEBUG is set or this specific netdev_dbg is enabled
&gt; via the dynamic debug control file.

Which is what we're after in this case.

OpenBMC-Staging-Count: 1
Acked-by: Samuel Mendoza-Jonas &lt;sam@mendozajonas.com&gt;
Signed-off-by: Joel Stanley &lt;joel@jms.id.au&gt;
</content>
</entry>
<entry>
<title>net/ncsi: Drop no more channels message</title>
<updated>2018-06-19T05:48:28+00:00</updated>
<author>
<name>Joel Stanley</name>
<email>joel@jms.id.au</email>
</author>
<published>2018-06-18T06:47:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=8e2b49ffab528168852f9b629582240f89d73472'/>
<id>urn:sha1:8e2b49ffab528168852f9b629582240f89d73472</id>
<content type='text'>
This does not provide useful information. As the ncsi maintainer said:

 &gt; either we get a channel or broadcom has gone out to lunch

OpenBMC-Staging-Count: 1
Acked-by: Samuel Mendoza-Jonas &lt;sam@mendozajonas.com&gt;
Signed-off-by: Joel Stanley &lt;joel@jms.id.au&gt;
</content>
</entry>
<entry>
<title>net/ncsi: Silence debug messages</title>
<updated>2018-06-19T05:48:23+00:00</updated>
<author>
<name>Joel Stanley</name>
<email>joel@jms.id.au</email>
</author>
<published>2018-06-18T06:24:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=63515728542e30a6ff811dff304c3003839c520d'/>
<id>urn:sha1:63515728542e30a6ff811dff304c3003839c520d</id>
<content type='text'>
In normal operation we see this series of messages as the host drives
the network device:

 ftgmac100 1e660000.ethernet eth0: NCSI: LSC AEN - channel 0 state down
 ftgmac100 1e660000.ethernet eth0: NCSI: suspending channel 0
 ftgmac100 1e660000.ethernet eth0: NCSI: configuring channel 0
 ftgmac100 1e660000.ethernet eth0: NCSI: channel 0 link down after config
 ftgmac100 1e660000.ethernet eth0: NCSI interface down
 ftgmac100 1e660000.ethernet eth0: NCSI: LSC AEN - channel 0 state up
 ftgmac100 1e660000.ethernet eth0: NCSI: configuring channel 0
 ftgmac100 1e660000.ethernet eth0: NCSI interface up
 ftgmac100 1e660000.ethernet eth0: NCSI: LSC AEN - channel 0 state down
 ftgmac100 1e660000.ethernet eth0: NCSI: suspending channel 0
 ftgmac100 1e660000.ethernet eth0: NCSI: configuring channel 0
 ftgmac100 1e660000.ethernet eth0: NCSI: channel 0 link down after config
 ftgmac100 1e660000.ethernet eth0: NCSI interface down
 ftgmac100 1e660000.ethernet eth0: NCSI: LSC AEN - channel 0 state up
 ftgmac100 1e660000.ethernet eth0: NCSI: configuring channel 0
 ftgmac100 1e660000.ethernet eth0: NCSI interface up

This makes all of these messages netdev_dbg. They are still useful to
debug eg. misbehaving network device firmware, but we do not need them
filling up the kernel logs in normal operation.

OpenBMC-Staging-Count: 1
Acked-by: Samuel Mendoza-Jonas &lt;sam@mendozajonas.com&gt;
Signed-off-by: Joel Stanley &lt;joel@jms.id.au&gt;
</content>
</entry>
<entry>
<title>net/ncsi: Avoid GFP_KERNEL in response handler</title>
<updated>2018-06-18T11:29:50+00:00</updated>
<author>
<name>Samuel Mendoza-Jonas</name>
<email>sam@mendozajonas.com</email>
</author>
<published>2018-05-31T07:02:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=31851d80a5fba8cb2a3d19bbac01fa3b5ac3b30a'/>
<id>urn:sha1:31851d80a5fba8cb2a3d19bbac01fa3b5ac3b30a</id>
<content type='text'>
ncsi_rsp_handler_gc() allocates the filter arrays using GFP_KERNEL in
softirq context, causing the below backtrace. This allocation is only a
few dozen bytes during probing so allocate with GFP_ATOMIC instead.

[   42.813372] BUG: sleeping function called from invalid context at mm/slab.h:416
[   42.820900] in_atomic(): 1, irqs_disabled(): 0, pid: 213, name: kworker/0:1
[   42.827893] INFO: lockdep is turned off.
[   42.832023] CPU: 0 PID: 213 Comm: kworker/0:1 Tainted: G        W       4.13.16-01441-gad99b38 #65
[   42.841007] Hardware name: Generic DT based system
[   42.845966] Workqueue: events ncsi_dev_work
[   42.850251] [&lt;8010a494&gt;] (unwind_backtrace) from [&lt;80107510&gt;] (show_stack+0x20/0x24)
[   42.858046] [&lt;80107510&gt;] (show_stack) from [&lt;80612770&gt;] (dump_stack+0x20/0x28)
[   42.865309] [&lt;80612770&gt;] (dump_stack) from [&lt;80148248&gt;] (___might_sleep+0x230/0x2b0)
[   42.873241] [&lt;80148248&gt;] (___might_sleep) from [&lt;80148334&gt;] (__might_sleep+0x6c/0xac)
[   42.881129] [&lt;80148334&gt;] (__might_sleep) from [&lt;80240d6c&gt;] (__kmalloc+0x210/0x2fc)
[   42.888737] [&lt;80240d6c&gt;] (__kmalloc) from [&lt;8060ad54&gt;] (ncsi_rsp_handler_gc+0xd0/0x170)
[   42.896770] [&lt;8060ad54&gt;] (ncsi_rsp_handler_gc) from [&lt;8060b454&gt;] (ncsi_rcv_rsp+0x16c/0x1d4)
[   42.905314] [&lt;8060b454&gt;] (ncsi_rcv_rsp) from [&lt;804d86c8&gt;] (__netif_receive_skb_core+0x3c8/0xb50)
[   42.914158] [&lt;804d86c8&gt;] (__netif_receive_skb_core) from [&lt;804d96cc&gt;] (__netif_receive_skb+0x20/0x7c)
[   42.923420] [&lt;804d96cc&gt;] (__netif_receive_skb) from [&lt;804de4b0&gt;] (netif_receive_skb_internal+0x78/0x6a4)
[   42.932931] [&lt;804de4b0&gt;] (netif_receive_skb_internal) from [&lt;804df980&gt;] (netif_receive_skb+0x78/0x158)
[   42.942292] [&lt;804df980&gt;] (netif_receive_skb) from [&lt;8042f204&gt;] (ftgmac100_poll+0x43c/0x4e8)
[   42.950855] [&lt;8042f204&gt;] (ftgmac100_poll) from [&lt;804e094c&gt;] (net_rx_action+0x278/0x4c4)
[   42.958918] [&lt;804e094c&gt;] (net_rx_action) from [&lt;801016a8&gt;] (__do_softirq+0xe0/0x4c4)
[   42.966716] [&lt;801016a8&gt;] (__do_softirq) from [&lt;8011cd9c&gt;] (do_softirq.part.4+0x50/0x78)
[   42.974756] [&lt;8011cd9c&gt;] (do_softirq.part.4) from [&lt;8011cebc&gt;] (__local_bh_enable_ip+0xf8/0x11c)
[   42.983579] [&lt;8011cebc&gt;] (__local_bh_enable_ip) from [&lt;804dde08&gt;] (__dev_queue_xmit+0x260/0x890)
[   42.992392] [&lt;804dde08&gt;] (__dev_queue_xmit) from [&lt;804df1f0&gt;] (dev_queue_xmit+0x1c/0x20)
[   43.000689] [&lt;804df1f0&gt;] (dev_queue_xmit) from [&lt;806099c0&gt;] (ncsi_xmit_cmd+0x1c0/0x244)
[   43.008763] [&lt;806099c0&gt;] (ncsi_xmit_cmd) from [&lt;8060dc14&gt;] (ncsi_dev_work+0x2e0/0x4c8)
[   43.016725] [&lt;8060dc14&gt;] (ncsi_dev_work) from [&lt;80133dfc&gt;] (process_one_work+0x214/0x6f8)
[   43.024940] [&lt;80133dfc&gt;] (process_one_work) from [&lt;80134328&gt;] (worker_thread+0x48/0x558)
[   43.033070] [&lt;80134328&gt;] (worker_thread) from [&lt;8013ba80&gt;] (kthread+0x130/0x174)
[   43.040506] [&lt;8013ba80&gt;] (kthread) from [&lt;80102950&gt;] (ret_from_fork+0x14/0x24)

Fixes: 062b3e1b6d4f ("net/ncsi: Refactor MAC, VLAN filters")
Signed-off-by: Samuel Mendoza-Jonas &lt;sam@mendozajonas.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
(cherry picked from commit b0949618826cbb64e9ba764bdd52aa14eaf5073d)
Signed-off-by: Joel Stanley &lt;joel@jms.id.au&gt;
</content>
</entry>
<entry>
<title>net: remove unnecessary genlmsg_cancel() calls</title>
<updated>2018-06-18T11:29:50+00:00</updated>
<author>
<name>YueHaibing</name>
<email>yuehaibing@huawei.com</email>
</author>
<published>2018-05-26T11:15:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=85b1485ea16be418e206ed6126c603891b2d236b'/>
<id>urn:sha1:85b1485ea16be418e206ed6126c603891b2d236b</id>
<content type='text'>
the message be freed immediately, no need to trim it
back to the previous size.

Inspired by commit 7a9b3ec1e19f ("nl80211: remove unnecessary genlmsg_cancel() calls")

Signed-off-by: YueHaibing &lt;yuehaibing@huawei.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
(cherry picked from commit c1c9a3c9663b2e15176758626278792862f1ed32)
Signed-off-by: Joel Stanley &lt;joel@jms.id.au&gt;
</content>
</entry>
<entry>
<title>net/ncsi: prevent a couple array underflows</title>
<updated>2018-06-18T11:29:50+00:00</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@oracle.com</email>
</author>
<published>2018-05-17T12:33:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=25c3c824b7dfa231bb17a1a9d39e826daade62a6'/>
<id>urn:sha1:25c3c824b7dfa231bb17a1a9d39e826daade62a6</id>
<content type='text'>
We recently refactored this code and introduced a static checker
warning.  Smatch complains that if cmd-&gt;index is zero then we would
underflow the arrays.  That's obviously true.

The question is whether we prevent cmd-&gt;index from being zero at a
different level.  I've looked at the code and I don't immediately see
a check for that.

Fixes: 062b3e1b6d4f ("net/ncsi: Refactor MAC, VLAN filters")
Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
(cherry picked from commit 990a9d4975c974b05a8abaaeca5bbcfc55d31dcb)
Signed-off-by: Joel Stanley &lt;joel@jms.id.au&gt;
</content>
</entry>
<entry>
<title>net/ncsi: Refactor MAC, VLAN filters</title>
<updated>2018-06-18T11:29:50+00:00</updated>
<author>
<name>Samuel Mendoza-Jonas</name>
<email>sam@mendozajonas.com</email>
</author>
<published>2018-04-17T04:23:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=3f08b8eea5a769e0b5f0fbb51d372f61b36e770c'/>
<id>urn:sha1:3f08b8eea5a769e0b5f0fbb51d372f61b36e770c</id>
<content type='text'>
The NCSI driver defines a generic ncsi_channel_filter struct that can be
used to store arbitrarily formatted filters, and several generic methods
of accessing data stored in such a filter.
However in both the driver and as defined in the NCSI specification
there are only two actual filters: VLAN ID filters and MAC address
filters. The splitting of the MAC filter into unicast, multicast, and
mixed is also technically not necessary as these are stored in the same
location in hardware.

To save complexity, particularly in the set up and accessing of these
generic filters, remove them in favour of two specific structs. These
can be acted on directly and do not need several generic helper
functions to use.

This also fixes a memory error found by KASAN on ARM32 (which is not
upstream yet), where response handlers accessing a filter's data field
could write past allocated memory.

[  114.926512] ==================================================================
[  114.933861] BUG: KASAN: slab-out-of-bounds in ncsi_configure_channel+0x4b8/0xc58
[  114.941304] Read of size 2 at addr 94888558 by task kworker/0:2/546
[  114.947593]
[  114.949146] CPU: 0 PID: 546 Comm: kworker/0:2 Not tainted 4.16.0-rc6-00119-ge156398bfcad #13
...
[  115.170233] The buggy address belongs to the object at 94888540
[  115.170233]  which belongs to the cache kmalloc-32 of size 32
[  115.181917] The buggy address is located 24 bytes inside of
[  115.181917]  32-byte region [94888540, 94888560)
[  115.192115] The buggy address belongs to the page:
[  115.196943] page:9eeac100 count:1 mapcount:0 mapping:94888000 index:0x94888fc1
[  115.204200] flags: 0x100(slab)
[  115.207330] raw: 00000100 94888000 94888fc1 0000003f 00000001 9eea2014 9eecaa74 96c003e0
[  115.215444] page dumped because: kasan: bad access detected
[  115.221036]
[  115.222544] Memory state around the buggy address:
[  115.227384]  94888400: fb fb fb fb fc fc fc fc 04 fc fc fc fc fc fc fc
[  115.233959]  94888480: 00 00 00 fc fc fc fc fc 00 04 fc fc fc fc fc fc
[  115.240529] &gt;94888500: 00 00 04 fc fc fc fc fc 00 00 04 fc fc fc fc fc
[  115.247077]                                             ^
[  115.252523]  94888580: 00 04 fc fc fc fc fc fc 06 fc fc fc fc fc fc fc
[  115.259093]  94888600: 00 00 06 fc fc fc fc fc 00 00 04 fc fc fc fc fc
[  115.265639] ==================================================================

Reported-by: Joel Stanley &lt;joel@jms.id.au&gt;
Signed-off-by: Samuel Mendoza-Jonas &lt;sam@mendozajonas.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
(cherry picked from commit 062b3e1b6d4f2a33c1d0fd7ae9b4550da5cf7e4b)
Signed-off-by: Joel Stanley &lt;joel@jms.id.au&gt;
</content>
</entry>
<entry>
<title>net/ncsi: Fix array size in dumpit handler</title>
<updated>2018-05-31T19:57:54+00:00</updated>
<author>
<name>Samuel Mendoza-Jonas</name>
<email>sam@mendozajonas.com</email>
</author>
<published>2018-05-31T04:10:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=0f51f3582f22e543b78c4e113220ed1c35acbd97'/>
<id>urn:sha1:0f51f3582f22e543b78c4e113220ed1c35acbd97</id>
<content type='text'>
With CONFIG_CC_STACKPROTECTOR enabled the kernel panics as below when
parsing a NCSI_CMD_PKG_INFO command:

[  150.149711] Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: 805cff08
[  150.149711]
[  150.159919] CPU: 0 PID: 1301 Comm: ncsi-netlink Not tainted 4.13.16-468cbec6d2c91239332cb91b1f0a73aafcb6f0c6 #1
[  150.170004] Hardware name: Generic DT based system
[  150.174852] [&lt;80109930&gt;] (unwind_backtrace) from [&lt;80106bc4&gt;] (show_stack+0x20/0x24)
[  150.182641] [&lt;80106bc4&gt;] (show_stack) from [&lt;805d36e4&gt;] (dump_stack+0x20/0x28)
[  150.189888] [&lt;805d36e4&gt;] (dump_stack) from [&lt;801163ac&gt;] (panic+0xdc/0x278)
[  150.196780] [&lt;801163ac&gt;] (panic) from [&lt;801162cc&gt;] (__stack_chk_fail+0x20/0x24)
[  150.204111] [&lt;801162cc&gt;] (__stack_chk_fail) from [&lt;805cff08&gt;] (ncsi_pkg_info_all_nl+0x244/0x258)
[  150.212912] [&lt;805cff08&gt;] (ncsi_pkg_info_all_nl) from [&lt;804f939c&gt;] (genl_lock_dumpit+0x3c/0x54)
[  150.221535] [&lt;804f939c&gt;] (genl_lock_dumpit) from [&lt;804f873c&gt;] (netlink_dump+0xf8/0x284)
[  150.229550] [&lt;804f873c&gt;] (netlink_dump) from [&lt;804f8d44&gt;] (__netlink_dump_start+0x124/0x17c)
[  150.237992] [&lt;804f8d44&gt;] (__netlink_dump_start) from [&lt;804f9880&gt;] (genl_rcv_msg+0x1c8/0x3d4)
[  150.246440] [&lt;804f9880&gt;] (genl_rcv_msg) from [&lt;804f9174&gt;] (netlink_rcv_skb+0xd8/0x134)
[  150.254361] [&lt;804f9174&gt;] (netlink_rcv_skb) from [&lt;804f96a4&gt;] (genl_rcv+0x30/0x44)
[  150.261850] [&lt;804f96a4&gt;] (genl_rcv) from [&lt;804f7790&gt;] (netlink_unicast+0x198/0x234)
[  150.269511] [&lt;804f7790&gt;] (netlink_unicast) from [&lt;804f7ffc&gt;] (netlink_sendmsg+0x368/0x3b0)
[  150.277783] [&lt;804f7ffc&gt;] (netlink_sendmsg) from [&lt;804abea4&gt;] (sock_sendmsg+0x24/0x34)
[  150.285625] [&lt;804abea4&gt;] (sock_sendmsg) from [&lt;804ac1dc&gt;] (___sys_sendmsg+0x244/0x260)
[  150.293556] [&lt;804ac1dc&gt;] (___sys_sendmsg) from [&lt;804ad98c&gt;] (__sys_sendmsg+0x5c/0x9c)
[  150.301400] [&lt;804ad98c&gt;] (__sys_sendmsg) from [&lt;804ad9e4&gt;] (SyS_sendmsg+0x18/0x1c)
[  150.308984] [&lt;804ad9e4&gt;] (SyS_sendmsg) from [&lt;80102640&gt;] (ret_fast_syscall+0x0/0x3c)
[  150.316743] ---[ end Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: 805cff08

This turns out to be because the attrs array in ncsi_pkg_info_all_nl()
is initialised to a length of NCSI_ATTR_MAX which is the maximum
attribute number, not the number of attributes.

Fixes: 955dc68cb9b2 ("net/ncsi: Add generic netlink family")
Signed-off-by: Samuel Mendoza-Jonas &lt;sam@mendozajonas.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net/ncsi: check for null return from call to nla_nest_start</title>
<updated>2018-03-27T14:38:26+00:00</updated>
<author>
<name>Colin Ian King</name>
<email>colin.king@canonical.com</email>
</author>
<published>2018-03-26T11:27:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=8daf1a2d7e40685054ebae680733d822ced6df62'/>
<id>urn:sha1:8daf1a2d7e40685054ebae680733d822ced6df62</id>
<content type='text'>
The call to nla_nest_start calls nla_put which can lead to a NULL
return so it's possible for attr to become NULL and we can potentially
get a NULL pointer dereference on attr.  Fix this by checking for
a NULL return.

Detected by CoverityScan, CID#1466125 ("Dereference null return")

Fixes: 955dc68cb9b2 ("net/ncsi: Add generic netlink family")
Signed-off-by: Colin Ian King &lt;colin.king@canonical.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net/ncsi: unlock on error in ncsi_set_interface_nl()</title>
<updated>2018-03-09T02:49:58+00:00</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@oracle.com</email>
</author>
<published>2018-03-08T09:36:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=054f34da60dfa46457ca39dd111bb2b393575dab'/>
<id>urn:sha1:054f34da60dfa46457ca39dd111bb2b393575dab</id>
<content type='text'>
There are two error paths which are missing unlocks in this function.

Fixes: 955dc68cb9b2 ("net/ncsi: Add generic netlink family")
Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
