1 From: Tiger Yang <tiger.yang@oracle.com>
2 Date: Sun, 2 Nov 2008 19:04:21 +0800
3 Subject: ocfs2: Check search result in ocfs2_xattr_block_get()
5 ocfs2_xattr_block_get() calls ocfs2_xattr_search() to find an external
6 xattr, but doesn't check the search result that is passed back via struct
7 ocfs2_xattr_search. Add a check for search result, and pass back -ENODATA if
8 the xattr search failed. This avoids a later NULL pointer error.
10 Signed-off-by: Tiger Yang <tiger.yang@oracle.com>
11 Signed-off-by: Mark Fasheh <mfasheh@suse.com>
13 fs/ocfs2/xattr.c | 7 ++++++-
14 1 files changed, 6 insertions(+), 1 deletions(-)
16 Index: linux-2.6.27-ocfs2/fs/ocfs2/xattr.c
17 ===================================================================
18 --- linux-2.6.27-ocfs2.orig/fs/ocfs2/xattr.c
19 +++ linux-2.6.27-ocfs2/fs/ocfs2/xattr.c
20 @@ -777,6 +777,11 @@ static int ocfs2_xattr_block_get(struct
24 + if (xs->not_found) {
29 xb = (struct ocfs2_xattr_block *)xs->xattr_bh->b_data;
30 size = le64_to_cpu(xs->here->xe_value_size);
32 @@ -860,7 +865,7 @@ static int ocfs2_xattr_get(struct inode
33 down_read(&oi->ip_xattr_sem);
34 ret = ocfs2_xattr_ibody_get(inode, name_index, name, buffer,
36 - if (ret == -ENODATA)
37 + if (ret == -ENODATA && di->i_xattr_loc)
38 ret = ocfs2_xattr_block_get(inode, name_index, name, buffer,
40 up_read(&oi->ip_xattr_sem);