diff options
Diffstat (limited to 'fs/isofs/rock.c')
-rw-r--r-- | fs/isofs/rock.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/fs/isofs/rock.c b/fs/isofs/rock.c index e981c040a49b..8497c6bd5678 100644 --- a/fs/isofs/rock.c +++ b/fs/isofs/rock.c | |||
@@ -22,12 +22,21 @@ | |||
22 | 22 | ||
23 | #define SIG(A,B) ((A) | ((B) << 8)) /* isonum_721() */ | 23 | #define SIG(A,B) ((A) | ((B) << 8)) /* isonum_721() */ |
24 | 24 | ||
25 | /* This is a way of ensuring that we have something in the system | 25 | /* |
26 | use fields that is compatible with Rock Ridge */ | 26 | * This is a way of ensuring that we have something in the system |
27 | #define CHECK_SP(FAIL) \ | 27 | * use fields that is compatible with Rock Ridge. Return zero on success. |
28 | if(rr->u.SP.magic[0] != 0xbe) FAIL; \ | 28 | */ |
29 | if(rr->u.SP.magic[1] != 0xef) FAIL; \ | 29 | |
30 | ISOFS_SB(inode->i_sb)->s_rock_offset=rr->u.SP.skip; | 30 | static int check_sp(struct rock_ridge *rr, struct inode *inode) |
31 | { | ||
32 | if (rr->u.SP.magic[0] != 0xbe) | ||
33 | return -1; | ||
34 | if (rr->u.SP.magic[1] != 0xef) | ||
35 | return -1; | ||
36 | ISOFS_SB(inode->i_sb)->s_rock_offset = rr->u.SP.skip; | ||
37 | return 0; | ||
38 | } | ||
39 | |||
31 | /* We define a series of macros because each function must do exactly the | 40 | /* We define a series of macros because each function must do exactly the |
32 | same thing in certain places. We use the macros to ensure that everything | 41 | same thing in certain places. We use the macros to ensure that everything |
33 | is done correctly */ | 42 | is done correctly */ |
@@ -118,7 +127,8 @@ repeat: | |||
118 | goto out; | 127 | goto out; |
119 | break; | 128 | break; |
120 | case SIG('S', 'P'): | 129 | case SIG('S', 'P'): |
121 | CHECK_SP(goto out); | 130 | if (check_sp(rr, inode)) |
131 | goto out; | ||
122 | break; | 132 | break; |
123 | case SIG('C', 'E'): | 133 | case SIG('C', 'E'): |
124 | CHECK_CE; | 134 | CHECK_CE; |
@@ -212,7 +222,8 @@ repeat: | |||
212 | break; | 222 | break; |
213 | #endif | 223 | #endif |
214 | case SIG('S', 'P'): | 224 | case SIG('S', 'P'): |
215 | CHECK_SP(goto out); | 225 | if (check_sp(rr, inode)) |
226 | goto out; | ||
216 | break; | 227 | break; |
217 | case SIG('C', 'E'): | 228 | case SIG('C', 'E'): |
218 | CHECK_CE; | 229 | CHECK_CE; |
@@ -570,7 +581,8 @@ repeat: | |||
570 | goto out; | 581 | goto out; |
571 | break; | 582 | break; |
572 | case SIG('S', 'P'): | 583 | case SIG('S', 'P'): |
573 | CHECK_SP(goto out); | 584 | if (check_sp(rr, inode)) |
585 | goto out; | ||
574 | break; | 586 | break; |
575 | case SIG('S', 'L'): | 587 | case SIG('S', 'L'): |
576 | rpnt = get_symlink_chunk(rpnt, rr, | 588 | rpnt = get_symlink_chunk(rpnt, rr, |