<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/lib, branch v2.6.32.15</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>flex_array: fix the panic when calling flex_array_alloc() without __GFP_ZERO</title>
<updated>2010-05-12T21:57:00+00:00</updated>
<author>
<name>Changli Gao</name>
<email>xiaosuo@gmail.com</email>
</author>
<published>2010-04-23T17:17:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=669805f0492eb6415a6c621fcd1ef6e29fee32b8'/>
<id>669805f0492eb6415a6c621fcd1ef6e29fee32b8</id>
<content type='text'>
commit e59464c735db19619cde2aa331609adb02005f5b upstream.

memset() is called with the wrong address and the kernel panics.

Signed-off-by: Changli Gao &lt;xiaosuo@gmail.com&gt;
Cc: Patrick McHardy &lt;kaber@trash.net&gt;
Acked-by: David Rientjes &lt;rientjes@google.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit e59464c735db19619cde2aa331609adb02005f5b upstream.

memset() is called with the wrong address and the kernel panics.

Signed-off-by: Changli Gao &lt;xiaosuo@gmail.com&gt;
Cc: Patrick McHardy &lt;kaber@trash.net&gt;
Acked-by: David Rientjes &lt;rientjes@google.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>block: Backport of various I/O topology fixes from 2.6.33 and 2.6.34</title>
<updated>2010-04-01T22:58:56+00:00</updated>
<author>
<name>Martin K. Petersen</name>
<email>martin.petersen@oracle.com</email>
</author>
<published>2010-03-17T00:30:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=9b2ff973b075293e16e148e57a1856498e23e95d'/>
<id>9b2ff973b075293e16e148e57a1856498e23e95d</id>
<content type='text'>
block: Backport of various I/O topology fixes from 2.6.33 and 2.6.34

The stacking code incorrectly scaled up the data offset in some cases
causing misaligned devices to report alignment.  Rewrite the stacking
algorithm to remedy this.  

(Upstream commit 9504e0864b58b4a304820dcf3755f1da80d5e72f)

The top device misalignment flag would not be set if the added bottom
device was already misaligned as opposed to causing a stacking failure.
    
Also massage the reporting so that an error is only returned if adding
the bottom device caused the misalignment.  I.e. don't return an error
if the top is already flagged as misaligned.

(Upstream commit fe0b393f2c0a0d23a9bc9ed7dc51a1ee511098bd)


lcm() was defined to take integer-sized arguments.  The supplied
arguments are multiplied, however, causing us to overflow given
sufficiently large input.  That in turn led to incorrect optimal I/O
size reporting in some cases.  Switch lcm() over to unsigned long
similar to gcd() and move the function from blk-settings.c to lib.

Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Reviewed-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
block: Backport of various I/O topology fixes from 2.6.33 and 2.6.34

The stacking code incorrectly scaled up the data offset in some cases
causing misaligned devices to report alignment.  Rewrite the stacking
algorithm to remedy this.  

(Upstream commit 9504e0864b58b4a304820dcf3755f1da80d5e72f)

The top device misalignment flag would not be set if the added bottom
device was already misaligned as opposed to causing a stacking failure.
    
Also massage the reporting so that an error is only returned if adding
the bottom device caused the misalignment.  I.e. don't return an error
if the top is already flagged as misaligned.

(Upstream commit fe0b393f2c0a0d23a9bc9ed7dc51a1ee511098bd)


lcm() was defined to take integer-sized arguments.  The supplied
arguments are multiplied, however, causing us to overflow given
sufficiently large input.  That in turn led to incorrect optimal I/O
size reporting in some cases.  Switch lcm() over to unsigned long
similar to gcd() and move the function from blk-settings.c to lib.

Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Reviewed-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>idr: fix a critical misallocation bug, take#2</title>
<updated>2010-03-15T15:49:37+00:00</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2010-02-22T20:44:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=5e0bf19b7e58825aac1c02df5e54fab697b910e5'/>
<id>5e0bf19b7e58825aac1c02df5e54fab697b910e5</id>
<content type='text'>
commit d2e7276b6b5e4bc2148891a056d5862c5314342d upstream.

This is retry of reverted 859ddf09743a8cc680af33f7259ccd0fd36bfe9d
("idr: fix a critical misallocation bug") which contained two bugs.

* pa[idp-&gt;layers] should be cleared even if it's not used by
  sub_alloc() because it's used by mark idr_mark_full().

* The original condition check also assigned pa[l] to p which the new
  code didn't do thus leaving p pointing at the wrong layer.

Both problems have been fixed and the idr code has received good amount
testing using userland testing setup where simple bitmap allocator is
run parallel to verify the result of idr allocation.

The bug this patch fixes is caused by sub_alloc() optimization path
bypassing out-of-room condition check and restarting allocation loop
with starting value higher than maximum allowed value.  For detailed
description, please read commit message of 859ddf09.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Based-on-patch-from: Eric Paris &lt;eparis@redhat.com&gt;
Reported-by: Eric Paris &lt;eparis@redhat.com&gt;
Tested-by: Stefan Lippers-Hollmann &lt;s.l-h@gmx.de&gt;
Tested-by: Serge Hallyn &lt;serue@us.ibm.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit d2e7276b6b5e4bc2148891a056d5862c5314342d upstream.

This is retry of reverted 859ddf09743a8cc680af33f7259ccd0fd36bfe9d
("idr: fix a critical misallocation bug") which contained two bugs.

* pa[idp-&gt;layers] should be cleared even if it's not used by
  sub_alloc() because it's used by mark idr_mark_full().

* The original condition check also assigned pa[l] to p which the new
  code didn't do thus leaving p pointing at the wrong layer.

Both problems have been fixed and the idr code has received good amount
testing using userland testing setup where simple bitmap allocator is
run parallel to verify the result of idr allocation.

The bug this patch fixes is caused by sub_alloc() optimization path
bypassing out-of-room condition check and restarting allocation loop
with starting value higher than maximum allowed value.  For detailed
description, please read commit message of 859ddf09.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Based-on-patch-from: Eric Paris &lt;eparis@redhat.com&gt;
Reported-by: Eric Paris &lt;eparis@redhat.com&gt;
Tested-by: Stefan Lippers-Hollmann &lt;s.l-h@gmx.de&gt;
Tested-by: Serge Hallyn &lt;serue@us.ibm.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>dma-debug: allow DMA_BIDIRECTIONAL mappings to be synced with DMA_FROM_DEVICE and</title>
<updated>2010-01-18T18:19:33+00:00</updated>
<author>
<name>Krzysztof Halasa</name>
<email>khc@pm.waw.pl</email>
</author>
<published>2010-01-08T22:42:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=ecac13f4da35b215152e8dab78470662e1b9685d'/>
<id>ecac13f4da35b215152e8dab78470662e1b9685d</id>
<content type='text'>
commit 42d53b4ff7d61487d18274ebdf1f70c1aef6f122 upstream.

There is no need to perform full BIDIR sync (copying the buffers in case
of swiotlb and similar schemes) if we know that the owner (CPU or device)
hasn't altered the data.

Addresses the false-positive reported at
http://bugzilla.kernel.org/show_bug.cgi?id=14169

Signed-off-by: Krzysztof Halasa &lt;khc@pm.waw.pl&gt;
Cc: David Miller &lt;davem@davemloft.net&gt;
Cc: Joerg Roedel &lt;joerg.roedel@amd.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 42d53b4ff7d61487d18274ebdf1f70c1aef6f122 upstream.

There is no need to perform full BIDIR sync (copying the buffers in case
of swiotlb and similar schemes) if we know that the owner (CPU or device)
hasn't altered the data.

Addresses the false-positive reported at
http://bugzilla.kernel.org/show_bug.cgi?id=14169

Signed-off-by: Krzysztof Halasa &lt;khc@pm.waw.pl&gt;
Cc: David Miller &lt;davem@davemloft.net&gt;
Cc: Joerg Roedel &lt;joerg.roedel@amd.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>lib/rational.c needs module.h</title>
<updated>2010-01-18T18:19:33+00:00</updated>
<author>
<name>Sascha Hauer</name>
<email>s.hauer@pengutronix.de</email>
</author>
<published>2010-01-08T22:42:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=f21efc5709f5e0285389a10ede7e3cef54977029'/>
<id>f21efc5709f5e0285389a10ede7e3cef54977029</id>
<content type='text'>
commit 7ee3aebe31d2cb22c84e1c8f48182947b13a3607 upstream.

lib/rational.c:62: warning: data definition has no type or storage class
lib/rational.c:62: warning: type defaults to 'int' in declaration of 'EXPORT_SYMBOL'
lib/rational.c:62: warning: parameter names (without types) in function declaration

Signed-off-by: Sascha Hauer &lt;s.hauer@pengutronix.de&gt;
Signed-off-by: Uwe Kleine-König &lt;u.kleine-koenig@pengutronix.de&gt;
Acked-by: WANG Cong &lt;xiyou.wangcong@gmail.com&gt;
Cc: Oskar Schirmer &lt;os@emlix.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 7ee3aebe31d2cb22c84e1c8f48182947b13a3607 upstream.

lib/rational.c:62: warning: data definition has no type or storage class
lib/rational.c:62: warning: type defaults to 'int' in declaration of 'EXPORT_SYMBOL'
lib/rational.c:62: warning: parameter names (without types) in function declaration

Signed-off-by: Sascha Hauer &lt;s.hauer@pengutronix.de&gt;
Signed-off-by: Uwe Kleine-König &lt;u.kleine-koenig@pengutronix.de&gt;
Acked-by: WANG Cong &lt;xiyou.wangcong@gmail.com&gt;
Cc: Oskar Schirmer &lt;os@emlix.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>dma-debug: Fix bug causing build warning</title>
<updated>2010-01-06T23:03:52+00:00</updated>
<author>
<name>Ingo Molnar</name>
<email>mingo@elte.hu</email>
</author>
<published>2009-12-31T14:16:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=6cb5fcc95450e4a8e7423128dec3d43caac8f42b'/>
<id>6cb5fcc95450e4a8e7423128dec3d43caac8f42b</id>
<content type='text'>
commit a8fe9ea200ea21421ea750423d1d4d4f7ce037cf upstream.

Stephen Rothwell reported the following build warning:

 lib/dma-debug.c: In function 'dma_debug_device_change':
 lib/dma-debug.c:680: warning: 'return' with no value, in function returning non-void

Introduced by commit f797d9881b62c2ddb1d2e7bd80d87141949c84aa
("dma-debug: Do not add notifier when dma debugging is disabled").

Return 0 [notify-done] when disabled. (this is standard bus notifier behavior.)

Signed-off-by: Shaun Ruffell &lt;sruffell@digium.com&gt;
Signed-off-by: Joerg Roedel &lt;joerg.roedel@amd.com&gt;
Cc: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
LKML-Reference: &lt;20091231125624.GA14666@liondog.tnic&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit a8fe9ea200ea21421ea750423d1d4d4f7ce037cf upstream.

Stephen Rothwell reported the following build warning:

 lib/dma-debug.c: In function 'dma_debug_device_change':
 lib/dma-debug.c:680: warning: 'return' with no value, in function returning non-void

Introduced by commit f797d9881b62c2ddb1d2e7bd80d87141949c84aa
("dma-debug: Do not add notifier when dma debugging is disabled").

Return 0 [notify-done] when disabled. (this is standard bus notifier behavior.)

Signed-off-by: Shaun Ruffell &lt;sruffell@digium.com&gt;
Signed-off-by: Joerg Roedel &lt;joerg.roedel@amd.com&gt;
Cc: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
LKML-Reference: &lt;20091231125624.GA14666@liondog.tnic&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>dma-debug: Do not add notifier when dma debugging is disabled.</title>
<updated>2010-01-06T23:03:51+00:00</updated>
<author>
<name>Shaun Ruffell</name>
<email>sruffell@digium.com</email>
</author>
<published>2009-12-18T00:00:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=120dbaa5f31dfea13be03da90d90dc2cfed77841'/>
<id>120dbaa5f31dfea13be03da90d90dc2cfed77841</id>
<content type='text'>
commit f797d9881b62c2ddb1d2e7bd80d87141949c84aa upstream.

If CONFIG_HAVE_DMA_API_DEBUG is defined and "dma_debug=off" is
specified on the kernel command line, when you detach a driver from a
device you can cause the following NULL pointer dereference:

BUG: unable to handle kernel NULL pointer dereference at (null)
IP: [&lt;c0580d35&gt;] dma_debug_device_change+0x5d/0x117

The problem is that the dma_debug_device_change notifier function is
added to the bus notifier chain even though the dma_entry_hash array
was never initialized.  If dma debugging is disabled, this patch both
prevents dma_debug_device_change notifiers from being added to the
chain, and additionally ensures that the dma_debug_device_change
notifier function is a no-op.

Signed-off-by: Shaun Ruffell &lt;sruffell@digium.com&gt;
Signed-off-by: Joerg Roedel &lt;joerg.roedel@amd.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit f797d9881b62c2ddb1d2e7bd80d87141949c84aa upstream.

If CONFIG_HAVE_DMA_API_DEBUG is defined and "dma_debug=off" is
specified on the kernel command line, when you detach a driver from a
device you can cause the following NULL pointer dereference:

BUG: unable to handle kernel NULL pointer dereference at (null)
IP: [&lt;c0580d35&gt;] dma_debug_device_change+0x5d/0x117

The problem is that the dma_debug_device_change notifier function is
added to the bus notifier chain even though the dma_entry_hash array
was never initialized.  If dma debugging is disabled, this patch both
prevents dma_debug_device_change notifiers from being added to the
chain, and additionally ensures that the dma_debug_device_change
notifier function is a no-op.

Signed-off-by: Shaun Ruffell &lt;sruffell@digium.com&gt;
Signed-off-by: Joerg Roedel &lt;joerg.roedel@amd.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>FS-Cache: Don't delete pending pages from the page-store tracking tree</title>
<updated>2009-11-19T18:11:29+00:00</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2009-11-19T18:11:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=285e728b0ac55b53a673114096168d6f74930167'/>
<id>285e728b0ac55b53a673114096168d6f74930167</id>
<content type='text'>
Don't delete pending pages from the page-store tracking tree, but rather send
them for another write as they've presumably been updated.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Don't delete pending pages from the page-store tracking tree, but rather send
them for another write as they've presumably been updated.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>FS-Cache: Use radix tree preload correctly in tracking of pages to be stored</title>
<updated>2009-11-19T18:11:14+00:00</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2009-11-19T18:11:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=b34df792b4e9e311db47fad27949095d0629c197'/>
<id>b34df792b4e9e311db47fad27949095d0629c197</id>
<content type='text'>
__fscache_write_page() attempts to load the radix tree preallocation pool for
the CPU it is on before calling radix_tree_insert(), as the insertion must be
done inside a pair of spinlocks.

Use of the preallocation pool, however, is contingent on the radix tree being
initialised without __GFP_WAIT specified.  __fscache_acquire_cookie() was
passing GFP_NOFS to INIT_RADIX_TREE() - but that includes __GFP_WAIT.

The solution is to AND out __GFP_WAIT.

Additionally, the banner comment to radix_tree_preload() is altered to make
note of this prerequisite.  Possibly there should be a WARN_ON() too.

Without this fix, I have seen the following recursive deadlock caused by
radix_tree_insert() attempting to allocate memory inside the spinlocked
region, which resulted in FS-Cache being called back into to release memory -
which required the spinlock already held.

=============================================
[ INFO: possible recursive locking detected ]
2.6.32-rc6-cachefs #24
---------------------------------------------
nfsiod/7916 is trying to acquire lock:
 (&amp;cookie-&gt;lock){+.+.-.}, at: [&lt;ffffffffa0076872&gt;] __fscache_uncache_page+0xdb/0x160 [fscache]

but task is already holding lock:
 (&amp;cookie-&gt;lock){+.+.-.}, at: [&lt;ffffffffa0076acc&gt;] __fscache_write_page+0x15c/0x3f3 [fscache]

other info that might help us debug this:
5 locks held by nfsiod/7916:
 #0:  (nfsiod){+.+.+.}, at: [&lt;ffffffff81048290&gt;] worker_thread+0x19a/0x2e2
 #1:  (&amp;task-&gt;u.tk_work#2){+.+.+.}, at: [&lt;ffffffff81048290&gt;] worker_thread+0x19a/0x2e2
 #2:  (&amp;cookie-&gt;lock){+.+.-.}, at: [&lt;ffffffffa0076acc&gt;] __fscache_write_page+0x15c/0x3f3 [fscache]
 #3:  (&amp;object-&gt;lock#2){+.+.-.}, at: [&lt;ffffffffa0076b07&gt;] __fscache_write_page+0x197/0x3f3 [fscache]
 #4:  (&amp;cookie-&gt;stores_lock){+.+...}, at: [&lt;ffffffffa0076b0f&gt;] __fscache_write_page+0x19f/0x3f3 [fscache]

stack backtrace:
Pid: 7916, comm: nfsiod Not tainted 2.6.32-rc6-cachefs #24
Call Trace:
 [&lt;ffffffff8105ac7f&gt;] __lock_acquire+0x1649/0x16e3
 [&lt;ffffffff81059ded&gt;] ? __lock_acquire+0x7b7/0x16e3
 [&lt;ffffffff8100e27d&gt;] ? dump_trace+0x248/0x257
 [&lt;ffffffff8105ad70&gt;] lock_acquire+0x57/0x6d
 [&lt;ffffffffa0076872&gt;] ? __fscache_uncache_page+0xdb/0x160 [fscache]
 [&lt;ffffffff8135467c&gt;] _spin_lock+0x2c/0x3b
 [&lt;ffffffffa0076872&gt;] ? __fscache_uncache_page+0xdb/0x160 [fscache]
 [&lt;ffffffffa0076872&gt;] __fscache_uncache_page+0xdb/0x160 [fscache]
 [&lt;ffffffffa0077eb7&gt;] ? __fscache_check_page_write+0x0/0x71 [fscache]
 [&lt;ffffffffa00b4755&gt;] nfs_fscache_release_page+0x86/0xc4 [nfs]
 [&lt;ffffffffa00907f0&gt;] nfs_release_page+0x3c/0x41 [nfs]
 [&lt;ffffffff81087ffb&gt;] try_to_release_page+0x32/0x3b
 [&lt;ffffffff81092c2b&gt;] shrink_page_list+0x316/0x4ac
 [&lt;ffffffff81058a9b&gt;] ? mark_held_locks+0x52/0x70
 [&lt;ffffffff8135451b&gt;] ? _spin_unlock_irq+0x2b/0x31
 [&lt;ffffffff81093153&gt;] shrink_inactive_list+0x392/0x67c
 [&lt;ffffffff81058a9b&gt;] ? mark_held_locks+0x52/0x70
 [&lt;ffffffff810934ca&gt;] shrink_list+0x8d/0x8f
 [&lt;ffffffff81093744&gt;] shrink_zone+0x278/0x33c
 [&lt;ffffffff81052c70&gt;] ? ktime_get_ts+0xad/0xba
 [&lt;ffffffff8109453b&gt;] try_to_free_pages+0x22e/0x392
 [&lt;ffffffff8109184c&gt;] ? isolate_pages_global+0x0/0x212
 [&lt;ffffffff8108e16b&gt;] __alloc_pages_nodemask+0x3dc/0x5cf
 [&lt;ffffffff810ae24a&gt;] cache_alloc_refill+0x34d/0x6c1
 [&lt;ffffffff811bcf74&gt;] ? radix_tree_node_alloc+0x52/0x5c
 [&lt;ffffffff810ae929&gt;] kmem_cache_alloc+0xb2/0x118
 [&lt;ffffffff811bcf74&gt;] radix_tree_node_alloc+0x52/0x5c
 [&lt;ffffffff811bcfd5&gt;] radix_tree_insert+0x57/0x19c
 [&lt;ffffffffa0076b53&gt;] __fscache_write_page+0x1e3/0x3f3 [fscache]
 [&lt;ffffffffa00b4248&gt;] __nfs_readpage_to_fscache+0x58/0x11e [nfs]
 [&lt;ffffffffa009bb77&gt;] nfs_readpage_release+0x34/0x9b [nfs]
 [&lt;ffffffffa009c0d9&gt;] nfs_readpage_release_full+0x32/0x4b [nfs]
 [&lt;ffffffffa0006cff&gt;] rpc_release_calldata+0x12/0x14 [sunrpc]
 [&lt;ffffffffa0006e2d&gt;] rpc_free_task+0x59/0x61 [sunrpc]
 [&lt;ffffffffa0006f03&gt;] rpc_async_release+0x10/0x12 [sunrpc]
 [&lt;ffffffff810482e5&gt;] worker_thread+0x1ef/0x2e2
 [&lt;ffffffff81048290&gt;] ? worker_thread+0x19a/0x2e2
 [&lt;ffffffff81352433&gt;] ? thread_return+0x3e/0x101
 [&lt;ffffffffa0006ef3&gt;] ? rpc_async_release+0x0/0x12 [sunrpc]
 [&lt;ffffffff8104bff5&gt;] ? autoremove_wake_function+0x0/0x34
 [&lt;ffffffff81058d25&gt;] ? trace_hardirqs_on+0xd/0xf
 [&lt;ffffffff810480f6&gt;] ? worker_thread+0x0/0x2e2
 [&lt;ffffffff8104bd21&gt;] kthread+0x7a/0x82
 [&lt;ffffffff8100beda&gt;] child_rip+0xa/0x20
 [&lt;ffffffff8100b87c&gt;] ? restore_args+0x0/0x30
 [&lt;ffffffff8104c2b9&gt;] ? add_wait_queue+0x15/0x44
 [&lt;ffffffff8104bca7&gt;] ? kthread+0x0/0x82
 [&lt;ffffffff8100bed0&gt;] ? child_rip+0x0/0x20

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
__fscache_write_page() attempts to load the radix tree preallocation pool for
the CPU it is on before calling radix_tree_insert(), as the insertion must be
done inside a pair of spinlocks.

Use of the preallocation pool, however, is contingent on the radix tree being
initialised without __GFP_WAIT specified.  __fscache_acquire_cookie() was
passing GFP_NOFS to INIT_RADIX_TREE() - but that includes __GFP_WAIT.

The solution is to AND out __GFP_WAIT.

Additionally, the banner comment to radix_tree_preload() is altered to make
note of this prerequisite.  Possibly there should be a WARN_ON() too.

Without this fix, I have seen the following recursive deadlock caused by
radix_tree_insert() attempting to allocate memory inside the spinlocked
region, which resulted in FS-Cache being called back into to release memory -
which required the spinlock already held.

=============================================
[ INFO: possible recursive locking detected ]
2.6.32-rc6-cachefs #24
---------------------------------------------
nfsiod/7916 is trying to acquire lock:
 (&amp;cookie-&gt;lock){+.+.-.}, at: [&lt;ffffffffa0076872&gt;] __fscache_uncache_page+0xdb/0x160 [fscache]

but task is already holding lock:
 (&amp;cookie-&gt;lock){+.+.-.}, at: [&lt;ffffffffa0076acc&gt;] __fscache_write_page+0x15c/0x3f3 [fscache]

other info that might help us debug this:
5 locks held by nfsiod/7916:
 #0:  (nfsiod){+.+.+.}, at: [&lt;ffffffff81048290&gt;] worker_thread+0x19a/0x2e2
 #1:  (&amp;task-&gt;u.tk_work#2){+.+.+.}, at: [&lt;ffffffff81048290&gt;] worker_thread+0x19a/0x2e2
 #2:  (&amp;cookie-&gt;lock){+.+.-.}, at: [&lt;ffffffffa0076acc&gt;] __fscache_write_page+0x15c/0x3f3 [fscache]
 #3:  (&amp;object-&gt;lock#2){+.+.-.}, at: [&lt;ffffffffa0076b07&gt;] __fscache_write_page+0x197/0x3f3 [fscache]
 #4:  (&amp;cookie-&gt;stores_lock){+.+...}, at: [&lt;ffffffffa0076b0f&gt;] __fscache_write_page+0x19f/0x3f3 [fscache]

stack backtrace:
Pid: 7916, comm: nfsiod Not tainted 2.6.32-rc6-cachefs #24
Call Trace:
 [&lt;ffffffff8105ac7f&gt;] __lock_acquire+0x1649/0x16e3
 [&lt;ffffffff81059ded&gt;] ? __lock_acquire+0x7b7/0x16e3
 [&lt;ffffffff8100e27d&gt;] ? dump_trace+0x248/0x257
 [&lt;ffffffff8105ad70&gt;] lock_acquire+0x57/0x6d
 [&lt;ffffffffa0076872&gt;] ? __fscache_uncache_page+0xdb/0x160 [fscache]
 [&lt;ffffffff8135467c&gt;] _spin_lock+0x2c/0x3b
 [&lt;ffffffffa0076872&gt;] ? __fscache_uncache_page+0xdb/0x160 [fscache]
 [&lt;ffffffffa0076872&gt;] __fscache_uncache_page+0xdb/0x160 [fscache]
 [&lt;ffffffffa0077eb7&gt;] ? __fscache_check_page_write+0x0/0x71 [fscache]
 [&lt;ffffffffa00b4755&gt;] nfs_fscache_release_page+0x86/0xc4 [nfs]
 [&lt;ffffffffa00907f0&gt;] nfs_release_page+0x3c/0x41 [nfs]
 [&lt;ffffffff81087ffb&gt;] try_to_release_page+0x32/0x3b
 [&lt;ffffffff81092c2b&gt;] shrink_page_list+0x316/0x4ac
 [&lt;ffffffff81058a9b&gt;] ? mark_held_locks+0x52/0x70
 [&lt;ffffffff8135451b&gt;] ? _spin_unlock_irq+0x2b/0x31
 [&lt;ffffffff81093153&gt;] shrink_inactive_list+0x392/0x67c
 [&lt;ffffffff81058a9b&gt;] ? mark_held_locks+0x52/0x70
 [&lt;ffffffff810934ca&gt;] shrink_list+0x8d/0x8f
 [&lt;ffffffff81093744&gt;] shrink_zone+0x278/0x33c
 [&lt;ffffffff81052c70&gt;] ? ktime_get_ts+0xad/0xba
 [&lt;ffffffff8109453b&gt;] try_to_free_pages+0x22e/0x392
 [&lt;ffffffff8109184c&gt;] ? isolate_pages_global+0x0/0x212
 [&lt;ffffffff8108e16b&gt;] __alloc_pages_nodemask+0x3dc/0x5cf
 [&lt;ffffffff810ae24a&gt;] cache_alloc_refill+0x34d/0x6c1
 [&lt;ffffffff811bcf74&gt;] ? radix_tree_node_alloc+0x52/0x5c
 [&lt;ffffffff810ae929&gt;] kmem_cache_alloc+0xb2/0x118
 [&lt;ffffffff811bcf74&gt;] radix_tree_node_alloc+0x52/0x5c
 [&lt;ffffffff811bcfd5&gt;] radix_tree_insert+0x57/0x19c
 [&lt;ffffffffa0076b53&gt;] __fscache_write_page+0x1e3/0x3f3 [fscache]
 [&lt;ffffffffa00b4248&gt;] __nfs_readpage_to_fscache+0x58/0x11e [nfs]
 [&lt;ffffffffa009bb77&gt;] nfs_readpage_release+0x34/0x9b [nfs]
 [&lt;ffffffffa009c0d9&gt;] nfs_readpage_release_full+0x32/0x4b [nfs]
 [&lt;ffffffffa0006cff&gt;] rpc_release_calldata+0x12/0x14 [sunrpc]
 [&lt;ffffffffa0006e2d&gt;] rpc_free_task+0x59/0x61 [sunrpc]
 [&lt;ffffffffa0006f03&gt;] rpc_async_release+0x10/0x12 [sunrpc]
 [&lt;ffffffff810482e5&gt;] worker_thread+0x1ef/0x2e2
 [&lt;ffffffff81048290&gt;] ? worker_thread+0x19a/0x2e2
 [&lt;ffffffff81352433&gt;] ? thread_return+0x3e/0x101
 [&lt;ffffffffa0006ef3&gt;] ? rpc_async_release+0x0/0x12 [sunrpc]
 [&lt;ffffffff8104bff5&gt;] ? autoremove_wake_function+0x0/0x34
 [&lt;ffffffff81058d25&gt;] ? trace_hardirqs_on+0xd/0xf
 [&lt;ffffffff810480f6&gt;] ? worker_thread+0x0/0x2e2
 [&lt;ffffffff8104bd21&gt;] kthread+0x7a/0x82
 [&lt;ffffffff8100beda&gt;] child_rip+0xa/0x20
 [&lt;ffffffff8100b87c&gt;] ? restore_args+0x0/0x30
 [&lt;ffffffff8104c2b9&gt;] ? add_wait_queue+0x15/0x44
 [&lt;ffffffff8104bca7&gt;] ? kthread+0x0/0x82
 [&lt;ffffffff8100bed0&gt;] ? child_rip+0x0/0x20

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>strcmp: fix overflow and possibly signedness error</title>
<updated>2009-11-19T01:18:13+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2009-11-18T21:31:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=a414f01ac2899f273ef8fe98fa44158ac12793f2'/>
<id>a414f01ac2899f273ef8fe98fa44158ac12793f2</id>
<content type='text'>
Doing the strcmp return value as

	signed char __res = *cs - *ct;

is wrong for two reasons.  The subtraction can overflow because __res
doesn't use a type big enough.  Moreover the compared bytes should be
interpreted as unsigned char as specified by POSIX.

The same problem is fixed in strncmp.

Signed-off-by: Uwe Kleine-König &lt;u.kleine-koenig@pengutronix.de&gt;
Cc: Michael Buesch &lt;mb@bu3sch.de&gt;
Cc: Andreas Schwab &lt;schwab@linux-m68k.org&gt;
Cc: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Doing the strcmp return value as

	signed char __res = *cs - *ct;

is wrong for two reasons.  The subtraction can overflow because __res
doesn't use a type big enough.  Moreover the compared bytes should be
interpreted as unsigned char as specified by POSIX.

The same problem is fixed in strncmp.

Signed-off-by: Uwe Kleine-König &lt;u.kleine-koenig@pengutronix.de&gt;
Cc: Michael Buesch &lt;mb@bu3sch.de&gt;
Cc: Andreas Schwab &lt;schwab@linux-m68k.org&gt;
Cc: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
