<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/infiniband/core, branch linux-2.6.35.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-2.6.35.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-2.6.35.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2011-03-31T18:58:38Z</updated>
<entry>
<title>IB/cm: Bump reference count on cm_id before invoking callback</title>
<updated>2011-03-31T18:58:38Z</updated>
<author>
<name>Sean Hefty</name>
</author>
<published>2011-02-23T16:17:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ca78068b35522c820207b36191cba1385163f198'/>
<id>urn:sha1:ca78068b35522c820207b36191cba1385163f198</id>
<content type='text'>
commit 29963437a48475036353b95ab142bf199adb909e upstream.

When processing a SIDR REQ, the ib_cm allocates a new cm_id.  The
refcount of the cm_id is initialized to 1.  However, cm_process_work
will decrement the refcount after invoking all callbacks.  The result
is that the cm_id will end up with refcount set to 0 by the end of the
sidr req handler.

If a user tries to destroy the cm_id, the destruction will proceed,
under the incorrect assumption that no other threads are referencing
the cm_id.  This can lead to a crash when the cm callback thread tries
to access the cm_id.

This problem was noticed as part of a larger investigation with kernel
crashes in the rdma_cm when running on a real time OS.

Signed-off-by: Sean Hefty &lt;sean.hefty@intel.com&gt;
Acked-by: Doug Ledford &lt;dledford@redhat.com&gt;
Signed-off-by: Roland Dreier &lt;roland@purestorage.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
Signed-off-by: Andi Kleen &lt;ak@linux.intel.com&gt;

</content>
</entry>
<entry>
<title>RDMA/cma: Fix crash in request handlers</title>
<updated>2011-03-31T18:58:38Z</updated>
<author>
<name>Sean Hefty</name>
</author>
<published>2011-02-23T16:11:32Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=af8c55e566b98985bde53ce09e72afcc6db04d4f'/>
<id>urn:sha1:af8c55e566b98985bde53ce09e72afcc6db04d4f</id>
<content type='text'>
commit 25ae21a10112875763c18b385624df713a288a05 upstream.

Doug Ledford and Red Hat reported a crash when running the rdma_cm on
a real-time OS.  The crash has the following call trace:

    cm_process_work
       cma_req_handler
          cma_disable_callback
          rdma_create_id
             kzalloc
             init_completion
          cma_get_net_info
          cma_save_net_info
          cma_any_addr
             cma_zero_addr
          rdma_translate_ip
             rdma_copy_addr
          cma_acquire_dev
             rdma_addr_get_sgid
             ib_find_cached_gid
             cma_attach_to_dev
          ucma_event_handler
             kzalloc
             ib_copy_ah_attr_to_user
          cma_comp

[ preempted ]

    cma_write
        copy_from_user
        ucma_destroy_id
           copy_from_user
           _ucma_find_context
           ucma_put_ctx
           ucma_free_ctx
              rdma_destroy_id
                 cma_exch
                 cma_cancel_operation
                 rdma_node_get_transport

        rt_mutex_slowunlock
        bad_area_nosemaphore
        oops_enter

They were able to reproduce the crash multiple times with the
following details:

    Crash seems to always happen on the:
            mutex_unlock(&amp;conn_id-&gt;handler_mutex);
    as conn_id looks to have been freed during this code path.

An examination of the code shows that a race exists in the request
handlers.  When a new connection request is received, the rdma_cm
allocates a new connection identifier.  This identifier has a single
reference count on it.  If a user calls rdma_destroy_id() from another
thread after receiving a callback, rdma_destroy_id will proceed to
destroy the id and free the associated memory.  However, the request
handlers may still be in the process of running.  When control returns
to the request handlers, they can attempt to access the newly created
identifiers.

Fix this by holding a reference on the newly created rdma_cm_id until
the request handler is through accessing it.

Signed-off-by: Sean Hefty &lt;sean.hefty@intel.com&gt;
Acked-by: Doug Ledford &lt;dledford@redhat.com&gt;
Signed-off-by: Roland Dreier &lt;roland@purestorage.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
Signed-off-by: Andi Kleen &lt;ak@linux.intel.com&gt;

</content>
</entry>
<entry>
<title>IB/uverbs: Handle large number of entries in poll CQ</title>
<updated>2011-02-06T19:03:29Z</updated>
<author>
<name>Dan Carpenter</name>
</author>
<published>2010-10-13T09:13:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=83ec6d3cccb0cd67613880b32c85fec88233d681'/>
<id>urn:sha1:83ec6d3cccb0cd67613880b32c85fec88233d681</id>
<content type='text'>
commit 7182afea8d1afd432a17c18162cc3fd441d0da93 upstream.

In ib_uverbs_poll_cq() code there is a potential integer overflow if
userspace passes in a large cmd.ne.  The calls to kmalloc() would
allocate smaller buffers than intended, leading to memory corruption.
There iss also an information leak if resp wasn't all used.
Unprivileged userspace may call this function, although only if an
RDMA device that uses this function is present.

Fix this by copying CQ entries one at a time, which avoids the
allocation entirely, and also by moving this copying into a function
that makes sure to initialize all memory copied to userspace.

Special thanks to Jason Gunthorpe &lt;jgunthorpe@obsidianresearch.com&gt;
for his help and advice.

Signed-off-by: Dan Carpenter &lt;error27@gmail.com&gt;
Signed-off-by: Andi Kleen &lt;ak@linux.intel.com&gt;

[ Monkey around with things a bit to avoid bad code generation by gcc
  when designated initializers are used.  - Roland ]

Signed-off-by: Roland Dreier &lt;rolandd@cisco.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>IB/ucm: Use memdup_user()</title>
<updated>2010-05-26T04:10:57Z</updated>
<author>
<name>Julia Lawall</name>
</author>
<published>2010-05-22T08:21:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e642df6a0be93316c0a886766057c4cc510c123d'/>
<id>urn:sha1:e642df6a0be93316c0a886766057c4cc510c123d</id>
<content type='text'>
Use memdup_user when user data is immediately copied into the
allocated region.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// &lt;smpl&gt;
@@
expression from,to,size,flag;
position p;
identifier l1,l2;
@@

-  to = \(kmalloc@p\|kzalloc@p\)(size,flag);
+  to = memdup_user(from,size);
   if (
-      to==NULL
+      IS_ERR(to)
                 || ...) {
   &lt;+... when != goto l1;
-  -ENOMEM
+  PTR_ERR(to)
   ...+&gt;
   }
-  if (copy_from_user(to, from, size) != 0) {
-    &lt;+... when != goto l2;
-    -EFAULT
-    ...+&gt;
-  }
// &lt;/smpl&gt;

Signed-off-by: Julia Lawall &lt;julia@diku.dk&gt;
</content>
</entry>
<entry>
<title>Merge branches 'cxgb4', 'misc', 'mlx4', 'nes' and 'qib' into for-next</title>
<updated>2010-05-25T16:54:03Z</updated>
<author>
<name>Roland Dreier</name>
</author>
<published>2010-05-25T16:54:03Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=acdc30b56abc0db7d409a13e9b6c72ea23b6f90d'/>
<id>urn:sha1:acdc30b56abc0db7d409a13e9b6c72ea23b6f90d</id>
<content type='text'>
</content>
</entry>
<entry>
<title>IB/mad: Make needlessly global mad_sendq_size/mad_recvq_size static</title>
<updated>2010-05-24T04:39:31Z</updated>
<author>
<name>Roland Dreier</name>
</author>
<published>2010-05-24T04:39:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1693395511a2840f67dd3184212a072ac7f07524'/>
<id>urn:sha1:1693395511a2840f67dd3184212a072ac7f07524</id>
<content type='text'>
Signed-off-by: Roland Dreier &lt;rolandd@cisco.com&gt;
</content>
</entry>
<entry>
<title>IB/core: Allow device-specific per-port sysfs files</title>
<updated>2010-05-21T17:34:44Z</updated>
<author>
<name>Ralph Campbell</name>
</author>
<published>2010-05-07T00:03:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9a6edb60ec10d86b1025a0cdad68fd89f1ddaf02'/>
<id>urn:sha1:9a6edb60ec10d86b1025a0cdad68fd89f1ddaf02</id>
<content type='text'>
Add a new parameter to ib_register_device() so that low-level device
drivers can pass in a pointer to a callback function that will be
called for each port that is registered in sysfs.  This allows
low-level device drivers to create files in

    /sys/class/infiniband/&lt;hca&gt;/ports/&lt;N&gt;/

without having to poke through the internals of the RDMA sysfs handling.

There is no need for an unregister function since the kobject
reference will go to zero when ib_unregister_device() is called.

Signed-off-by: Ralph Campbell &lt;ralph.campbell@qlogic.com&gt;
Signed-off-by: Roland Dreier &lt;rolandd@cisco.com&gt;
</content>
</entry>
<entry>
<title>Merge branches 'amso1100', 'bkl', 'cma', 'cxgb3', 'cxgb4', 'ipoib', 'iser', 'masked-atomics', 'misc', 'mthca' and 'nes' into for-next</title>
<updated>2010-05-16T03:06:01Z</updated>
<author>
<name>Roland Dreier</name>
</author>
<published>2010-05-16T03:06:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ffebedb7ab3f7964a70a1771547b26af38a189d2'/>
<id>urn:sha1:ffebedb7ab3f7964a70a1771547b26af38a189d2</id>
<content type='text'>
</content>
</entry>
<entry>
<title>IB/core: Use kmemdup() instead of kmalloc()+memcpy()</title>
<updated>2010-05-16T03:05:07Z</updated>
<author>
<name>Julia Lawall</name>
</author>
<published>2010-05-15T21:22:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9893e742a0d942dda2277e9f3e19b726900adf27'/>
<id>urn:sha1:9893e742a0d942dda2277e9f3e19b726900adf27</id>
<content type='text'>
Use kmemdup when some other buffer is immediately copied into the
allocated region.

A simplified version of the semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)

// &lt;smpl&gt;
@@
expression from,to,size,flag;
statement S;
@@

-  to = \(kmalloc\|kzalloc\)(size,flag);
+  to = kmemdup(from,size,flag);
   if (to==NULL || ...) S
-  memcpy(to, from, size);
// &lt;/smpl&gt;

Signed-off-by: Julia Lawall &lt;julia@diku.dk&gt;
Signed-off-by: Roland Dreier &lt;rolandd@cisco.com&gt;
</content>
</entry>
<entry>
<title>RDMA/cma: Randomize local port allocation</title>
<updated>2010-04-21T23:18:40Z</updated>
<author>
<name>Tetsuo Handa</name>
</author>
<published>2010-04-15T02:29:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5d7220e8dc24feed4bbd66667b7696906a147ac4'/>
<id>urn:sha1:5d7220e8dc24feed4bbd66667b7696906a147ac4</id>
<content type='text'>
Randomize local port allocation in the way sctp_get_port_local() does.
Update rover at the end of loop since we're likely to pick a valid port
on the first try.

Signed-off-by: Tetsuo Handa &lt;penguin-kernel@I-love.SAKURA.ne.jp&gt;
Reviewed-by: Sean Hefty &lt;sean.hefty@intel.com&gt;
Signed-off-by: Roland Dreier &lt;rolandd@cisco.com&gt;
</content>
</entry>
</feed>
