<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/net/sctp/proc.c, branch linux-4.9.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.9.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.9.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2018-09-15T07:42:56Z</updated>
<entry>
<title>sctp: hold transport before accessing its asoc in sctp_transport_get_next</title>
<updated>2018-09-15T07:42:56Z</updated>
<author>
<name>Xin Long</name>
</author>
<published>2018-08-27T10:38:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=36bf8bc54a59c14ce9b27283ff9f2225908fce1f'/>
<id>urn:sha1:36bf8bc54a59c14ce9b27283ff9f2225908fce1f</id>
<content type='text'>
[ Upstream commit bab1be79a5169ac748d8292b20c86d874022d7ba ]

As Marcelo noticed, in sctp_transport_get_next, it is iterating over
transports but then also accessing the association directly, without
checking any refcnts before that, which can cause an use-after-free
Read.

So fix it by holding transport before accessing the association. With
that, sctp_transport_hold calls can be removed in the later places.

Fixes: 626d16f50f39 ("sctp: export some apis or variables for sctp_diag and reuse some for proc")
Reported-by: syzbot+fe62a0c9aa6a85c6de16@syzkaller.appspotmail.com
Signed-off-by: Xin Long &lt;lucien.xin@gmail.com&gt;
Acked-by: Neil Horman &lt;nhorman@tuxdriver.com&gt;
Acked-by: Marcelo Ricardo Leitner &lt;marcelo.leitner@gmail.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: Suppress the "Comparison to NULL could be written" warnings</title>
<updated>2016-09-30T05:50:45Z</updated>
<author>
<name>Jia He</name>
</author>
<published>2016-09-30T03:29:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6d4a741cbbfa6612a479656654ca5edf7becc72c'/>
<id>urn:sha1:6d4a741cbbfa6612a479656654ca5edf7becc72c</id>
<content type='text'>
This is to suppress the checkpatch.pl warning "Comparison to NULL
could be written". No functional changes here.

Signed-off-by: Jia He &lt;hejianet@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>proc: Reduce cache miss in sctp_snmp_seq_show</title>
<updated>2016-09-30T05:50:44Z</updated>
<author>
<name>Jia He</name>
</author>
<published>2016-09-30T03:29:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7d64a94be2f9fadb1dd95742650f1fdbac69f25b'/>
<id>urn:sha1:7d64a94be2f9fadb1dd95742650f1fdbac69f25b</id>
<content type='text'>
This is to use the generic interfaces snmp_get_cpu_field{,64}_batch to
aggregate the data by going through all the items of each cpu sequentially.

Signed-off-by: Jia He &lt;hejianet@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net/sctp: always initialise sctp_ht_iter::start_fail</title>
<updated>2016-08-13T22:10:16Z</updated>
<author>
<name>Vegard Nossum</name>
</author>
<published>2016-08-12T07:50:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=54236ab09e9696a27baaae693c288920a26e8588'/>
<id>urn:sha1:54236ab09e9696a27baaae693c288920a26e8588</id>
<content type='text'>
sctp_transport_seq_start() does not currently clear iter-&gt;start_fail on
success, but relies on it being zero when it is allocated (by
seq_open_net()).

This can be a problem in the following sequence:

    open() // allocates iter (and implicitly sets iter-&gt;start_fail = 0)
    read()
     - iter-&gt;start() // fails and sets iter-&gt;start_fail = 1
     - iter-&gt;stop() // doesn't call sctp_transport_walk_stop() (correct)
    read() again
     - iter-&gt;start() // succeeds, but doesn't change iter-&gt;start_fail
     - iter-&gt;stop() // doesn't call sctp_transport_walk_stop() (wrong)

We should initialize sctp_ht_iter::start_fail to zero if -&gt;start()
succeeds, otherwise it's possible that we leave an old value of 1 there,
which will cause -&gt;stop() to not call sctp_transport_walk_stop(), which
causes all sorts of problems like not calling rcu_read_unlock() (and
preempt_enable()), eventually leading to more warnings like this:

    BUG: sleeping function called from invalid context at mm/slab.h:388
    in_atomic(): 0, irqs_disabled(): 0, pid: 16551, name: trinity-c2
    Preemption disabled at:[&lt;ffffffff819bceb6&gt;] rhashtable_walk_start+0x46/0x150

     [&lt;ffffffff81149abb&gt;] preempt_count_add+0x1fb/0x280
     [&lt;ffffffff83295892&gt;] _raw_spin_lock+0x12/0x40
     [&lt;ffffffff819bceb6&gt;] rhashtable_walk_start+0x46/0x150
     [&lt;ffffffff82ec665f&gt;] sctp_transport_walk_start+0x2f/0x60
     [&lt;ffffffff82edda1d&gt;] sctp_transport_seq_start+0x4d/0x150
     [&lt;ffffffff81439e50&gt;] traverse+0x170/0x850
     [&lt;ffffffff8143aeec&gt;] seq_read+0x7cc/0x1180
     [&lt;ffffffff814f996c&gt;] proc_reg_read+0xbc/0x180
     [&lt;ffffffff813d0384&gt;] do_loop_readv_writev+0x134/0x210
     [&lt;ffffffff813d2a95&gt;] do_readv_writev+0x565/0x660
     [&lt;ffffffff813d6857&gt;] vfs_readv+0x67/0xa0
     [&lt;ffffffff813d6c16&gt;] do_preadv+0x126/0x170
     [&lt;ffffffff813d710c&gt;] SyS_preadv+0xc/0x10
     [&lt;ffffffff8100334c&gt;] do_syscall_64+0x19c/0x410
     [&lt;ffffffff83296225&gt;] return_from_SYSCALL_64+0x0/0x6a
     [&lt;ffffffffffffffff&gt;] 0xffffffffffffffff

Notice that this is a subtly different stacktrace from the one in commit
5fc382d875 ("net/sctp: terminate rhashtable walk correctly").

Cc: Xin Long &lt;lucien.xin@gmail.com&gt;
Cc: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Cc: Eric W. Biederman &lt;ebiederm@xmission.com&gt;
Cc: Marcelo Ricardo Leitner &lt;marcelo.leitner@gmail.com&gt;
Signed-off-by: Vegard Nossum &lt;vegard.nossum@oracle.com&gt;
Acked-By: Neil Horman &lt;nhorman@tuxdriver.com&gt;
Acked-by: Marcelo Ricardo Leitner &lt;marcelo.leitner@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>sctp: fix some rhashtable functions using in sctp proc/diag</title>
<updated>2016-04-15T21:29:37Z</updated>
<author>
<name>Xin Long</name>
</author>
<published>2016-04-14T07:35:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=53fa10369c45a51947f06e8b622d2fa2cc64fda1'/>
<id>urn:sha1:53fa10369c45a51947f06e8b622d2fa2cc64fda1</id>
<content type='text'>
When rhashtable_walk_init return err, no release function should be
called, and when rhashtable_walk_start return err, we should only invoke
rhashtable_walk_exit to release the source.

But now when sctp_transport_walk_start return err, we just call
rhashtable_walk_stop/exit, and never care about if rhashtable_walk_init
or start return err, which is so bad.

We will fix it by calling rhashtable_walk_exit if rhashtable_walk_start
return err in sctp_transport_walk_start, and if sctp_transport_walk_start
return err, we do not need to call sctp_transport_walk_stop any more.

For sctp proc, we will use 'iter-&gt;start_fail' to decide if we will call
rhashtable_walk_stop/exit.

Signed-off-by: Xin Long &lt;lucien.xin@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>sctp: merge the seq_start/next/exits in remaddrs and assocs</title>
<updated>2016-04-15T21:29:36Z</updated>
<author>
<name>Xin Long</name>
</author>
<published>2016-04-14T07:35:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b5e2f4e6998a2b999da8fa0290b692f0bd85c8b7'/>
<id>urn:sha1:b5e2f4e6998a2b999da8fa0290b692f0bd85c8b7</id>
<content type='text'>
In sctp proc, these three functions in remaddrs and assocs are the
same. we should merge them into one.

Signed-off-by: Xin Long &lt;lucien.xin@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>sctp: export some apis or variables for sctp_diag and reuse some for proc</title>
<updated>2016-04-15T21:29:36Z</updated>
<author>
<name>Xin Long</name>
</author>
<published>2016-04-14T07:35:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=626d16f50f39bb9c44f98fd256cae2b864900a01'/>
<id>urn:sha1:626d16f50f39bb9c44f98fd256cae2b864900a01</id>
<content type='text'>
For some main variables in sctp.ko, we couldn't export it to other modules,
so we have to define some api to access them.

It will include sctp transport and endpoint's traversal.

There are some transport traversal functions for sctp_diag, we can also
use it for sctp_proc. cause they have the similar situation to traversal
transport.

v2-&gt;v3:
- rhashtable_walk_init need the parameter gfp, because of recent upstrem
  update

Signed-off-by: Xin Long &lt;lucien.xin@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>rhashtable: accept GFP flags in rhashtable_walk_init</title>
<updated>2016-04-05T08:56:32Z</updated>
<author>
<name>Bob Copeland</name>
</author>
<published>2016-03-02T15:09:19Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8f6fd83c6c5ec66a4a70c728535ddcdfef4f3697'/>
<id>urn:sha1:8f6fd83c6c5ec66a4a70c728535ddcdfef4f3697</id>
<content type='text'>
In certain cases, the 802.11 mesh pathtable code wants to
iterate over all of the entries in the forwarding table from
the receive path, which is inside an RCU read-side critical
section.  Enable walks inside atomic sections by allowing
GFP_ATOMIC allocations for the walker state.

Change all existing callsites to pass in GFP_KERNEL.

Acked-by: Thomas Graf &lt;tgraf@suug.ch&gt;
Signed-off-by: Bob Copeland &lt;me@bobcopeland.com&gt;
[also adjust gfs2/glock.c and rhashtable tests]
Signed-off-by: Johannes Berg &lt;johannes.berg@intel.com&gt;
</content>
</entry>
<entry>
<title>Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net</title>
<updated>2016-03-08T17:34:12Z</updated>
<author>
<name>David S. Miller</name>
</author>
<published>2016-03-08T17:34:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=810813c47a564416f6306ae214e2661366c987a7'/>
<id>urn:sha1:810813c47a564416f6306ae214e2661366c987a7</id>
<content type='text'>
Several cases of overlapping changes, as well as one instance
(vxlan) of a bug fix in 'net' overlapping with code movement
in 'net-next'.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>sctp: sctp_remaddr_seq_show use the wrong variable to dump transport info</title>
<updated>2016-03-01T22:35:44Z</updated>
<author>
<name>Xin Long</name>
</author>
<published>2016-02-28T02:33:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3d73e8fac8f84942f15307d6d9cb1dba843d3fb2'/>
<id>urn:sha1:3d73e8fac8f84942f15307d6d9cb1dba843d3fb2</id>
<content type='text'>
Now in sctp_remaddr_seq_show(), we use variable *tsp to get the param *v.
but *tsp is also used to traversal transport_addr_list, which will cover
the previous value, and make sctp_transport_put work on the wrong transport.

So fix it by adding a new variable to get the param *v.

Fixes: fba4c330c5b9 ("sctp: hold transport before we access t-&gt;asoc in sctp proc")
Signed-off-by: Xin Long &lt;lucien.xin@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
