Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 154306 - Kernel: Bug in error recovery in fs/buffer.c::__block_prepare_write() (CVE-2006-4813)
Summary: Kernel: Bug in error recovery in fs/buffer.c::__block_prepare_write() (CVE-20...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Security
Classification: Unclassified
Component: Kernel (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Security
URL: http://www.kernel.org/git/?p=linux/ke...
Whiteboard: [linux <2.6.13]
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-06 21:56 UTC by Sune Kloppenborg Jeppesen (RETIRED)
Modified: 2009-07-11 16:05 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2006-11-06 21:56:25 UTC
Not sure wether this is already fixed.

[PATCH] Bug in error recovery in fs/buffer.c::__block_prepare_write()
 
 fs/buffer.c::__block_prepare_write() has broken error recovery.  It calls
 the get_block() callback with "create = 1" and if that succeeds it
 immediately clears buffer_new on the just allocated buffer (which has
 buffer_new set).
 
 The bug is that if an error occurs and get_block() returns != 0, we break
 from this loop and go into recovery code.  This code has this comment:
 
 /* Error case: */
 /*
  * Zero out any newly allocated blocks to avoid exposing stale
  * data.  If BH_New is set, we know that the block was newly
  * allocated in the above loop.
  */
 
 So the intent is obviously good in that it wants to clear just allocated
 and hence not zeroed buffers.  However the code recognises allocated
 buffers by checking for buffer_new being set.
 
 Unfortunately __block_prepare_write() as discussed above already cleared
 buffer_new on all allocated buffers thus no buffers will be cleared during
 error recovery and old data will be leaked.
 
 The simplest way I can see to fix this is to make the current recovery code
 work by _not_ clearing buffer_new after calling get_block() in
 __block_prepare_write().
 
 We cannot safely allow buffer_new buffers to "leak out" of
 __block_prepare_write(), thus we simply do a quick loop over the buffers
 clearing buffer_new on each of them if it is set just before returning
 "success" from __block_prepare_write().
 
 Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
 Signed-off-by: Andrew Morton <akpm@osdl.org>
 Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Comment 1 Harlan Lieberman-Berg (RETIRED) gentoo-dev 2006-11-08 20:07:02 UTC
Openmosix-sources, you are affected, but hardmasked.  Closing bug as there are no stable affected sources.