Commit b0d8c562 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Fix possible oops in vfs_quota_sync()

From: Jan Kara <jack@ucw.cz>

I'm sending you a fix of possible Oops in vfs_quota_sync().  Actually
nobody has run into that I found it when I was looking through the code.
parent 155717ab
...@@ -192,6 +192,8 @@ static struct list_head dquot_hash[NR_DQHASH]; ...@@ -192,6 +192,8 @@ static struct list_head dquot_hash[NR_DQHASH];
struct dqstats dqstats; struct dqstats dqstats;
static void dqput(struct dquot *dquot);
static inline int const hashfn(struct super_block *sb, unsigned int id, int type) static inline int const hashfn(struct super_block *sb, unsigned int id, int type)
{ {
return((((unsigned long)sb>>L1_CACHE_SHIFT) ^ id) * (MAXQUOTAS - type)) % NR_DQHASH; return((((unsigned long)sb>>L1_CACHE_SHIFT) ^ id) * (MAXQUOTAS - type)) % NR_DQHASH;
...@@ -339,8 +341,11 @@ static int vfs_quota_sync(struct super_block *sb, int type) ...@@ -339,8 +341,11 @@ static int vfs_quota_sync(struct super_block *sb, int type)
continue; continue;
if (!dquot_dirty(dquot)) if (!dquot_dirty(dquot))
continue; continue;
atomic_inc(&dquot->dq_count);
dqstats.lookups++;
spin_unlock(&dq_list_lock); spin_unlock(&dq_list_lock);
sb->dq_op->sync_dquot(dquot); sb->dq_op->sync_dquot(dquot);
dqput(dquot);
goto restart; goto restart;
} }
spin_unlock(&dq_list_lock); spin_unlock(&dq_list_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment