]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/patches/suse-2.6.27.25/patches.fixes/ocfs2-Check-search-result-in-ocfs2_xattr_block_get.patch
Reenabled linux-xen and xen-image build
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.25 / patches.fixes / ocfs2-Check-search-result-in-ocfs2_xattr_block_get.patch
CommitLineData
00e5a55c
BS
1From: Tiger Yang <tiger.yang@oracle.com>
2Date: Sun, 2 Nov 2008 19:04:21 +0800
3Subject: ocfs2: Check search result in ocfs2_xattr_block_get()
4
5ocfs2_xattr_block_get() calls ocfs2_xattr_search() to find an external
6xattr, but doesn't check the search result that is passed back via struct
7ocfs2_xattr_search. Add a check for search result, and pass back -ENODATA if
8the xattr search failed. This avoids a later NULL pointer error.
9
10Signed-off-by: Tiger Yang <tiger.yang@oracle.com>
11Signed-off-by: Mark Fasheh <mfasheh@suse.com>
12---
13 fs/ocfs2/xattr.c | 7 ++++++-
14 1 files changed, 6 insertions(+), 1 deletions(-)
15
16Index: 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
21 goto cleanup;
22 }
23
24+ if (xs->not_found) {
25+ ret = -ENODATA;
26+ goto cleanup;
27+ }
28+
29 xb = (struct ocfs2_xattr_block *)xs->xattr_bh->b_data;
30 size = le64_to_cpu(xs->here->xe_value_size);
31 if (buffer) {
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,
35 buffer_size, &xis);
36- if (ret == -ENODATA)
37+ if (ret == -ENODATA && di->i_xattr_loc)
38 ret = ocfs2_xattr_block_get(inode, name_index, name, buffer,
39 buffer_size, &xbs);
40 up_read(&oi->ip_xattr_sem);