<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/net/caif/caif_socket.c, branch v3.2.75</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.2.75</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.2.75'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2015-08-06T23:32:16Z</updated>
<entry>
<title>unix/caif: sk_socket can disappear when state is unlocked</title>
<updated>2015-08-06T23:32:16Z</updated>
<author>
<name>Mark Salyzyn</name>
<email>salyzyn@android.com</email>
</author>
<published>2015-05-26T15:22:19Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=f25e48cb938644c632f140c8bc92e0c4210ce20b'/>
<id>urn:sha1:f25e48cb938644c632f140c8bc92e0c4210ce20b</id>
<content type='text'>
[ Upstream commit b48732e4a48d80ed4a14812f0bab09560846514e ]

got a rare NULL pointer dereference in clear_bit

Signed-off-by: Mark Salyzyn &lt;salyzyn@android.com&gt;
Acked-by: Hannes Frederic Sowa &lt;hannes@stressinduktion.org&gt;
----
v2: switch to sock_flag(sk, SOCK_DEAD) and added net/caif/caif_socket.c
v3: return -ECONNRESET in upstream caller of wait function for SOCK_DEAD
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>caif: fix MSG_OOB test in caif_seqpkt_recvmsg()</title>
<updated>2015-05-09T22:16:39Z</updated>
<author>
<name>Al Viro</name>
<email>viro@ZenIV.linux.org.uk</email>
</author>
<published>2015-03-14T05:22:21Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=57a2e91f726284b567850ffd29ff5456a25d6abb'/>
<id>urn:sha1:57a2e91f726284b567850ffd29ff5456a25d6abb</id>
<content type='text'>
[ Upstream commit 3eeff778e00c956875c70b145c52638c313dfb23 ]

It should be checking flags, not msg-&gt;msg_flags.  It's -&gt;sendmsg()
instances that need to look for that in -&gt;msg_flags, -&gt;recvmsg() ones
(including the other -&gt;recvmsg() instance in that file, as well as
unix_dgram_recvmsg() this one claims to be imitating) check in flags.
Braino had been introduced in commit dcda13 ("caif: Bugfix - use MSG_TRUNC
in receive") back in 2010, so it goes quite a while back.

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>net: rework recvmsg handler msg_name and msg_namelen logic</title>
<updated>2014-01-03T04:33:33Z</updated>
<author>
<name>Hannes Frederic Sowa</name>
<email>hannes@stressinduktion.org</email>
</author>
<published>2013-11-21T02:14:22Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=a598f7fa9c24c3ef458043d59c237b8fc5d1adad'/>
<id>urn:sha1:a598f7fa9c24c3ef458043d59c237b8fc5d1adad</id>
<content type='text'>
[ Upstream commit f3d3342602f8bcbf37d7c46641cb9bca7618eb1c ]

This patch now always passes msg-&gt;msg_namelen as 0. recvmsg handlers must
set msg_namelen to the proper size &lt;= sizeof(struct sockaddr_storage)
to return msg_name to the user.

This prevents numerous uninitialized memory leaks we had in the
recvmsg handlers and makes it harder for new code to accidentally leak
uninitialized memory.

Optimize for the case recvfrom is called with NULL as address. We don't
need to copy the address at all, so set it to NULL before invoking the
recvmsg handler. We can do so, because all the recvmsg handlers must
cope with the case a plain read() is called on them. read() also sets
msg_name to NULL.

Also document these changes in include/linux/net.h as suggested by David
Miller.

Changes since RFC:

Set msg-&gt;msg_name = NULL if user specified a NULL in msg_name but had a
non-null msg_namelen in verify_iovec/verify_compat_iovec. This doesn't
affect sendto as it would bail out earlier while trying to copy-in the
address. It also more naturally reflects the logic by the callers of
verify_iovec.

With this change in place I could remove "
if (!uaddr || msg_sys-&gt;msg_namelen == 0)
	msg-&gt;msg_name = NULL
".

This change does not alter the user visible error logic as we ignore
msg_namelen as long as msg_name is NULL.

Also remove two unnecessary curly brackets in ___sys_recvmsg and change
comments to netdev style.

Cc: David Miller &lt;davem@davemloft.net&gt;
Suggested-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Signed-off-by: Hannes Frederic Sowa &lt;hannes@stressinduktion.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>caif: Fix missing msg_namelen update in  caif_seqpkt_recvmsg()</title>
<updated>2013-05-13T14:02:39Z</updated>
<author>
<name>Mathias Krause</name>
<email>minipli@googlemail.com</email>
</author>
<published>2013-04-07T01:51:52Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=5bf0d2c0fe1a954f937be4ad1b3c63b34e08dc52'/>
<id>urn:sha1:5bf0d2c0fe1a954f937be4ad1b3c63b34e08dc52</id>
<content type='text'>
[ Upstream commit 2d6fbfe733f35c6b355c216644e08e149c61b271 ]

The current code does not fill the msg_name member in case it is set.
It also does not set the msg_namelen member to 0 and therefore makes
net/socket.c leak the local, uninitialized sockaddr_storage variable
to userland -- 128 bytes of kernel stack memory.

Fix that by simply setting msg_namelen to 0 as obviously nobody cared
about caif_seqpkt_recvmsg() not filling the msg_name in case it was
set.

Cc: Sjur Braendeland &lt;sjur.brandeland@stericsson.com&gt;
Signed-off-by: Mathias Krause &lt;minipli@googlemail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>caif: Fixes freeze on Link layer removal.</title>
<updated>2011-05-23T00:11:47Z</updated>
<author>
<name>sjur.brandeland@stericsson.com</name>
<email>sjur.brandeland@stericsson.com</email>
</author>
<published>2011-05-22T11:18:51Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=54e90fb5ca8050156d3e748ddc690ed6ea9d71ac'/>
<id>urn:sha1:54e90fb5ca8050156d3e748ddc690ed6ea9d71ac</id>
<content type='text'>
CAIF Socket layer - caif_socket.c:
- Plug mem-leak at reconnect.
- Always call disconnect to cleanup CAIF stack.
- Disconnect will always report success.

CAIF configuration layer - cfcnfg.c
- Disconnect must dismantle the caif stack correctly
- Protect against faulty removals (check on id zero)

CAIF mux layer - cfmuxl.c
- When inserting new service layer in the MUX remove
  any old entries with the same ID.
- When removing CAIF Link layer, remove the associated
  service layers before notifying service layers.

Signed-off-by: Sjur Brændeland &lt;sjur.brandeland@stericsson.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>caif: remove unesesarry exports</title>
<updated>2011-05-15T21:45:56Z</updated>
<author>
<name>sjur.brandeland@stericsson.com</name>
<email>sjur.brandeland@stericsson.com</email>
</author>
<published>2011-05-13T02:44:08Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=3f874adc4ae80828b79e8aac6891c108c1f6be6d'/>
<id>urn:sha1:3f874adc4ae80828b79e8aac6891c108c1f6be6d</id>
<content type='text'>
Signed-off-by: Sjur Brændeland &lt;sjur.brandeland@stericsson.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>caif: Bugfix debugfs directory name must be unique.</title>
<updated>2011-05-15T21:45:56Z</updated>
<author>
<name>sjur.brandeland@stericsson.com</name>
<email>sjur.brandeland@stericsson.com</email>
</author>
<published>2011-05-13T02:44:07Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=33b2f5598b4ee68021364a7b795c09ad66bc0aa8'/>
<id>urn:sha1:33b2f5598b4ee68021364a7b795c09ad66bc0aa8</id>
<content type='text'>
Race condition caused debugfs_create_dir() to fail due to duplicate
name. Use atomic counter to create unique directory name.

net_ratelimit() is introduced to limit debug printouts.

Signed-off-by: Sjur Brændeland &lt;sjur.brandeland@stericsson.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>caif: Handle dev_queue_xmit errors.</title>
<updated>2011-05-15T21:45:56Z</updated>
<author>
<name>sjur.brandeland@stericsson.com</name>
<email>sjur.brandeland@stericsson.com</email>
</author>
<published>2011-05-13T02:44:06Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=c85c2951d4da1236e32f1858db418221e624aba5'/>
<id>urn:sha1:c85c2951d4da1236e32f1858db418221e624aba5</id>
<content type='text'>
Do proper handling of dev_queue_xmit errors in order to
avoid double free of skb and leaks in error conditions.
In cfctrl pending requests are removed when CAIF Link layer goes down.

Signed-off-by: Sjur Brændeland &lt;sjur.brandeland@stericsson.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>caif: prepare support for namespaces</title>
<updated>2011-05-15T21:45:55Z</updated>
<author>
<name>sjur.brandeland@stericsson.com</name>
<email>sjur.brandeland@stericsson.com</email>
</author>
<published>2011-05-13T02:44:05Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=bee925db9a77a5736596dcf6f91d0879f5ee915b'/>
<id>urn:sha1:bee925db9a77a5736596dcf6f91d0879f5ee915b</id>
<content type='text'>
Use struct net to reference CAIF configuration object instead of static variables.
Refactor functions caif_connect_client, caif_disconnect_client and squach
files cfcnfg.c and caif_config_utils.

Signed-off-by: Sjur Brændeland &lt;sjur.brandeland@stericsson.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>caif: Protected in-flight packets using dev or sock refcont.</title>
<updated>2011-05-15T21:45:55Z</updated>
<author>
<name>sjur.brandeland@stericsson.com</name>
<email>sjur.brandeland@stericsson.com</email>
</author>
<published>2011-05-13T02:44:04Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=b3ccfbe4098a5542177d0f34e8979f32e7d606e1'/>
<id>urn:sha1:b3ccfbe4098a5542177d0f34e8979f32e7d606e1</id>
<content type='text'>
CAIF Socket Layer and ip-interface registers reference counters
in CAIF service layer. The functions sock_hold, sock_put and
dev_hold, dev_put are used by CAIF Stack to protect from freeing
memory while packets are in-flight.

Signed-off-by: Sjur Brændeland &lt;sjur.brandeland@stericsson.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
