<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/net/caif/caif_dev.c, branch v3.0.62</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/net/caif/caif_dev.c?h=v3.0.62</id>
<link rel='self' href='https://git.amat.us/linux/atom/net/caif/caif_dev.c?h=v3.0.62'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2012-08-09T15:27:51Z</updated>
<entry>
<title>caif: Fix access to freed pernet memory</title>
<updated>2012-08-09T15:27:51Z</updated>
<author>
<name>Sjur Brændeland</name>
<email>sjur.brandeland@stericsson.com</email>
</author>
<published>2012-07-15T10:10:14Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=22cb83b5a318697b09fe1d6e237703d8371ab1fe'/>
<id>urn:sha1:22cb83b5a318697b09fe1d6e237703d8371ab1fe</id>
<content type='text'>
[ Upstream commit 96f80d123eff05c3cd4701463786b87952a6c3ac ]

unregister_netdevice_notifier() must be called before
unregister_pernet_subsys() to avoid accessing already freed
pernet memory. This fixes the following oops when doing rmmod:

Call Trace:
 [&lt;ffffffffa0f802bd&gt;] caif_device_notify+0x4d/0x5a0 [caif]
 [&lt;ffffffff81552ba9&gt;] unregister_netdevice_notifier+0xb9/0x100
 [&lt;ffffffffa0f86dcc&gt;] caif_device_exit+0x1c/0x250 [caif]
 [&lt;ffffffff810e7734&gt;] sys_delete_module+0x1a4/0x300
 [&lt;ffffffff810da82d&gt;] ? trace_hardirqs_on_caller+0x15d/0x1e0
 [&lt;ffffffff813517de&gt;] ? trace_hardirqs_on_thunk+0x3a/0x3
 [&lt;ffffffff81696bad&gt;] system_call_fastpath+0x1a/0x1f

RIP
 [&lt;ffffffffa0f7f561&gt;] caif_get+0x51/0xb0 [caif]

Signed-off-by: Sjur Brændeland &lt;sjur.brandeland@stericsson.com&gt;
Acked-by: "Eric W. Biederman" &lt;ebiederm@xmission.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 caif: Register properly as a pernet subsystem.</title>
<updated>2012-02-03T17:19:03Z</updated>
<author>
<name>Eric W. Biederman</name>
<email>ebiederm@xmission.com</email>
</author>
<published>2012-01-26T14:04:53Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=62252cba2867cec7cc484ebb2d3ec705c41d9684'/>
<id>urn:sha1:62252cba2867cec7cc484ebb2d3ec705c41d9684</id>
<content type='text'>
[ Upstream commit 8a8ee9aff6c3077dd9c2c7a77478e8ed362b96c6 ]

caif is a subsystem and as such it needs to register with
register_pernet_subsys instead of register_pernet_device.

Among other problems using register_pernet_device was resulting in
net_generic being called before the caif_net structure was allocated.
Which has been causing net_generic to fail with either BUG_ON's or by
return NULL pointers.

A more ugly problem that could be caused is packets in flight why the
subsystem is shutting down.

To remove confusion also remove the cruft cause by inappropriately
trying to fix this bug.

With the aid of the previous patch I have tested this patch and
confirmed that using register_pernet_subsys makes the failure go away as
it should.

Signed-off-by: Eric W. Biederman &lt;ebiederm@xmission.com&gt;
Acked-by: Sjur Brændeland &lt;sjur.brandeland@stericsson.com&gt;
Tested-by: Sasha Levin &lt;levinsasha928@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>caif: Fix BUG() with network namespaces</title>
<updated>2011-11-11T17:35:47Z</updated>
<author>
<name>David Woodhouse</name>
<email>dwmw2@infradead.org</email>
</author>
<published>2011-10-24T21:25:21Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=5c2433cdc72a03446184e2f898be3b05095b5ed0'/>
<id>urn:sha1:5c2433cdc72a03446184e2f898be3b05095b5ed0</id>
<content type='text'>
commit 08613e4626c06ca408fc55071f6aedee36986a87 upstream.

The caif code will register its own pernet_operations, and then register
a netdevice_notifier. Each time the netdevice_notifier is triggered,
it'll do some stuff... including a lookup of its own pernet stuff with
net_generic().

If the net_generic() call ever returns NULL, the caif code will BUG().
That doesn't seem *so* unreasonable, I suppose — it does seem like it
should never happen.

However, it *does* happen. When we clone a network namespace,
setup_net() runs through all the pernet_operations one at a time. It
gets to loopback before it gets to caif. And loopback_net_init()
registers a netdevice... while caif hasn't been initialised. So the caif
netdevice notifier triggers, and immediately goes BUG().

We could imagine a complex and overengineered solution to this generic
class of problems, but this patch takes the simple approach. It just
makes caif_device_notify() *not* go looking for its pernet data
structures if the device it's being notified about isn't a caif device
in the first place.

Signed-off-by: David Woodhouse &lt;David.Woodhouse@intel.com&gt;
Acked-by: Sjur Brændeland &lt;sjur.brandeland@stericsson.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>caif: Plug memory leak for checksum error</title>
<updated>2011-05-23T00:11:49Z</updated>
<author>
<name>sjur.brandeland@stericsson.com</name>
<email>sjur.brandeland@stericsson.com</email>
</author>
<published>2011-05-22T11:18:54Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=69c867c90c7fe0773d9aa4e8bbf777f574be13d2'/>
<id>urn:sha1:69c867c90c7fe0773d9aa4e8bbf777f574be13d2</id>
<content type='text'>
In case of checksum error, the framing layer returns -EILSEQ, but
does not free the packet. Plug this hole by freeing the packet if
-EILSEQ is returned.

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.amat.us/linux/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.amat.us/linux/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: Use RCU instead of spin-lock in caif_dev.c</title>
<updated>2011-05-15T21:45:54Z</updated>
<author>
<name>sjur.brandeland@stericsson.com</name>
<email>sjur.brandeland@stericsson.com</email>
</author>
<published>2011-05-13T02:44:00Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=bd30ce4bc0b7dc859c1d1cba7ad87e08642418b0'/>
<id>urn:sha1:bd30ce4bc0b7dc859c1d1cba7ad87e08642418b0</id>
<content type='text'>
RCU read_lock and refcount is used to protect in-flight packets.

Use RCU and counters to manage freeing lower part of the CAIF stack if
CAIF-link layer is removed. Old solution based on delaying removal of
device is removed.

When CAIF link layer goes down the use of CAIF link layer is disabled
(by calling caif_set_phy_state()), but removal and freeing of the
lower part of the CAIF stack is done when Link layer is unregistered.

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: Fix set-but-unused variables.</title>
<updated>2011-04-17T23:57:55Z</updated>
<author>
<name>David S. Miller</name>
<email>davem@davemloft.net</email>
</author>
<published>2011-04-17T23:57:55Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=056693a38e56c520e208409d221cbc077282c19d'/>
<id>urn:sha1:056693a38e56c520e208409d221cbc077282c19d</id>
<content type='text'>
The variable 'caifdef' is set but unused in modemcmd().

Similarly for 'net' in receive(), and 'res' in
caif_device_notify() and caif_exit_net().

Just kill them off.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>caif: Don't resend if dev_queue_xmit fails.</title>
<updated>2011-04-11T22:08:48Z</updated>
<author>
<name>Sjur Brændeland</name>
<email>sjur.brandeland@stericsson.com</email>
</author>
<published>2011-04-11T10:43:51Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=4dd820c088d201e526840c9dbc2f0b87a0a41868'/>
<id>urn:sha1:4dd820c088d201e526840c9dbc2f0b87a0a41868</id>
<content type='text'>
If CAIF Link Layer returns an error, we no longer try to re-build the
CAIF packet and resend it. Instead, we simply return any transmission
errors to the socket client.

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: code cleanup</title>
<updated>2011-04-11T22:08:47Z</updated>
<author>
<name>Stephen Hemminger</name>
<email>shemminger@vyatta.com</email>
</author>
<published>2011-04-11T10:43:50Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=73d6ac633c6c0ca703f90db0b808d9593e46aef6'/>
<id>urn:sha1:73d6ac633c6c0ca703f90db0b808d9593e46aef6</id>
<content type='text'>
Cleanup of new CAIF code.
  * make local functions static
  * remove code that is never used
  * expand get_caif_conf() since wrapper is no longer needed
  * make args to comparison functions const
  * rename connect_req_to_link_param to keep exported names
    consistent

Compile tested only.

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