ext4: add ext4_sb_bread() to disambiguate ENOMEM cases
authorTheodore Ts'o <tytso@mit.edu>
Sun, 25 Nov 2018 22:20:31 +0000 (17:20 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 9 Jan 2019 16:14:49 +0000 (17:14 +0100)
commit9da1f6d06b7a6d068e68fcfd7cbbf6b586d888e1
tree3c020bbf9c3b7482ef6fb3d96df564cbd9b65ee9
parent9f0fc584b6f83d7cb0ec562e44e9ce98bd33b200
ext4: add ext4_sb_bread() to disambiguate ENOMEM cases

commit fb265c9cb49e2074ddcdd4de99728aefdd3b3592 upstream.

Today, when sb_bread() returns NULL, this can either be because of an
I/O error or because the system failed to allocate the buffer.  Since
it's an old interface, changing would require changing many call
sites.

So instead we create our own ext4_sb_bread(), which also allows us to
set the REQ_META flag.

Also fixed a problem in the xattr code where a NULL return in a
function could also mean that the xattr was not found, which could
lead to the wrong error getting returned to userspace.

Fixes: ac27a0ec112a ("ext4: initial copy of files from ext3")
Cc: stable@kernel.org # 2.6.19
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/ext4.h
fs/ext4/migrate.c
fs/ext4/resize.c
fs/ext4/super.c
fs/ext4/xattr.c