]> git.baikalelectronics.ru Git - kernel.git/commit
ext4: ext4_bread usage audit
authorCarlos Maiolino <cmaiolino@redhat.com>
Thu, 27 Sep 2012 13:31:33 +0000 (09:31 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 27 Sep 2012 13:31:33 +0000 (09:31 -0400)
commit4111d4a7146d1471d4b21ef005d3b3f3cb78e158
tree7a6efd62087edb8103c6b409aa81e0229bdd4ef4
parented4a7802d573558afc21892210d16ca4541922ea
ext4: ext4_bread usage audit

When ext4_bread() returns NULL and err is set to zero, this means
there is no phyical block mapped to the specified logical block
number.  (Previous to commit 49bfa9c8df, err was uninitialized in this
case, which caused other problems.)

The directory handling routines use ext4_bread() in many places, the
fact that ext4_bread() now returns NULL with err set to zero could
cause problems since a number of these functions will simply return
the value of err if the result of ext4_bread() was the NULL pointer,
causing the caller of the function to think that the function was
successful.

Since directories should never contain holes, this case can only
happen if the file system is corrupted.  This commit audits all of the
callers of ext4_bread(), and makes sure they do the right thing if a
hole in a directory is found by ext4_bread().

Some ext4_bread() callers did not need any changes either because they
already had its own hole detector paths.

Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/ext4/namei.c