]>
Commit | Line | Data |
---|---|---|
82094b55 AF |
1 | Subject: Check for existence of osb in kill_sb |
2 | Reference: bnc#552602 | |
3 | From: Goldwyn Rodrigues <rgoldwyn@novell.com> | |
4 | ||
5 | In case of an error while mounting, for example - slots full, the volume | |
6 | dismounts and calls kill_sb. However, osb is not initialized as yet, | |
7 | and results in a NULL pointer dereference. Check if osb is initialized | |
8 | before operating on it. | |
9 | ||
10 | Signed-off-by: Goldwyn Rodrigues <rgoldwyn@novell.com> | |
11 | Signed-off-by: Coly Li <coly.li@suse.de> | |
12 | --- | |
13 | ocfs2/super.c | 13 +++++++------ | |
14 | 1 file changed, 7 insertions(+), 6 deletions(-) | |
15 | ||
16 | Index: fs/ocfs2/super.c | |
17 | =================================================================== | |
18 | --- a/fs/ocfs2/super.c 2009-11-05 00:59:58.000000000 +0100 | |
19 | +++ b/fs/ocfs2/super.c 2009-11-05 17:49:51.000000000 +0100 | |
20 | @@ -1019,12 +1019,13 @@ static void ocfs2_kill_sb(struct super_b | |
21 | struct ocfs2_super *osb = OCFS2_SB(sb); | |
22 | ||
23 | /* Prevent further queueing of inode drop events */ | |
24 | - spin_lock(&dentry_list_lock); | |
25 | - ocfs2_set_osb_flag(osb, OCFS2_OSB_DROP_DENTRY_LOCK_IMMED); | |
26 | - spin_unlock(&dentry_list_lock); | |
27 | - /* Wait for work to finish and/or remove it */ | |
28 | - cancel_work_sync(&osb->dentry_lock_work); | |
29 | - | |
30 | + if (osb) { | |
31 | + spin_lock(&dentry_list_lock); | |
32 | + ocfs2_set_osb_flag(osb, OCFS2_OSB_DROP_DENTRY_LOCK_IMMED); | |
33 | + spin_unlock(&dentry_list_lock); | |
34 | + /* Wait for work to finish and/or remove it */ | |
35 | + cancel_work_sync(&osb->dentry_lock_work); | |
36 | + } | |
37 | kill_block_super(sb); | |
38 | } | |
39 |