Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 118735
b: refs/heads/master
c: f6087fb
h: refs/heads/master
i:
  118733: 03c3913
  118731: 7419f94
  118727: a56db95
  118719: 757b70d
v: v3
  • Loading branch information
Joel Becker authored and Mark Fasheh committed Nov 10, 2008
1 parent 285da3f commit 1a0c2bc
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c988fd045f1195e62c0970384903ab9da26a9359
refs/heads/master: f6087fb799e097e7c9d912daa75701de9d62dc53
3 changes: 3 additions & 0 deletions trunk/fs/ocfs2/ocfs2.h
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,9 @@ static inline int ocfs2_uses_extended_slot_map(struct ocfs2_super *osb)
(____gd)->bg_signature); \
} while (0)

#define OCFS2_IS_VALID_XATTR_BLOCK(ptr) \
(!strcmp((ptr)->xb_signature, OCFS2_XATTR_BLOCK_SIGNATURE))

static inline unsigned long ino_from_blkno(struct super_block *sb,
u64 blkno)
{
Expand Down
38 changes: 16 additions & 22 deletions trunk/fs/ocfs2/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -555,14 +555,12 @@ static int ocfs2_xattr_block_list(struct inode *inode,
mlog_errno(ret);
return ret;
}
/*Verify the signature of xattr block*/
if (memcmp((void *)blk_bh->b_data, OCFS2_XATTR_BLOCK_SIGNATURE,
strlen(OCFS2_XATTR_BLOCK_SIGNATURE))) {
ret = -EFAULT;
goto cleanup;
}

xb = (struct ocfs2_xattr_block *)blk_bh->b_data;
if (!OCFS2_IS_VALID_XATTR_BLOCK(xb)) {
ret = -EIO;
goto cleanup;
}

if (!(le16_to_cpu(xb->xb_flags) & OCFS2_XATTR_INDEXED)) {
struct ocfs2_xattr_header *header = &xb->xb_attrs.xb_header;
Expand Down Expand Up @@ -779,15 +777,14 @@ static int ocfs2_xattr_block_get(struct inode *inode,
mlog_errno(ret);
return ret;
}
/*Verify the signature of xattr block*/
if (memcmp((void *)blk_bh->b_data, OCFS2_XATTR_BLOCK_SIGNATURE,
strlen(OCFS2_XATTR_BLOCK_SIGNATURE))) {
ret = -EFAULT;

xb = (struct ocfs2_xattr_block *)blk_bh->b_data;
if (!OCFS2_IS_VALID_XATTR_BLOCK(xb)) {
ret = -EIO;
goto cleanup;
}

xs->xattr_bh = blk_bh;
xb = (struct ocfs2_xattr_block *)blk_bh->b_data;

if (!(le16_to_cpu(xb->xb_flags) & OCFS2_XATTR_INDEXED)) {
xs->header = &xb->xb_attrs.xb_header;
Expand Down Expand Up @@ -1527,10 +1524,9 @@ static int ocfs2_xattr_free_block(struct inode *inode,
goto out;
}

/*Verify the signature of xattr block*/
if (memcmp((void *)blk_bh->b_data, OCFS2_XATTR_BLOCK_SIGNATURE,
strlen(OCFS2_XATTR_BLOCK_SIGNATURE))) {
ret = -EFAULT;
xb = (struct ocfs2_xattr_block *)blk_bh->b_data;
if (!OCFS2_IS_VALID_XATTR_BLOCK(xb)) {
ret = -EIO;
goto out;
}

Expand All @@ -1540,7 +1536,6 @@ static int ocfs2_xattr_free_block(struct inode *inode,
goto out;
}

xb = (struct ocfs2_xattr_block *)blk_bh->b_data;
blk = le64_to_cpu(xb->xb_blkno);
bit = le16_to_cpu(xb->xb_suballoc_bit);
bg_blkno = ocfs2_which_suballoc_group(blk, bit);
Expand Down Expand Up @@ -1784,15 +1779,14 @@ static int ocfs2_xattr_block_find(struct inode *inode,
mlog_errno(ret);
return ret;
}
/*Verify the signature of xattr block*/
if (memcmp((void *)blk_bh->b_data, OCFS2_XATTR_BLOCK_SIGNATURE,
strlen(OCFS2_XATTR_BLOCK_SIGNATURE))) {
ret = -EFAULT;
goto cleanup;

xb = (struct ocfs2_xattr_block *)blk_bh->b_data;
if (!OCFS2_IS_VALID_XATTR_BLOCK(xb)) {
ret = -EIO;
goto cleanup;
}

xs->xattr_bh = blk_bh;
xb = (struct ocfs2_xattr_block *)blk_bh->b_data;

if (!(le16_to_cpu(xb->xb_flags) & OCFS2_XATTR_INDEXED)) {
xs->header = &xb->xb_attrs.xb_header;
Expand Down

0 comments on commit 1a0c2bc

Please sign in to comment.