Skip to contentSkip to conversation

dqout dereference bug

PATCH Dave Jones 2 participants 2 messages Apr 16, 2004 – Apr 19, 2004 VFS

lore
Share & tools
lore

Dave Jones

author
#0 lore raw
fs/dquot.c renamed from fs/dquot.c~ +3 -1
@@ -1145,11 +1145,13 @@
 int vfs_quota_off(struct super_block *sb, int type)
 {
 	int cnt;
-	struct quota_info *dqopt = sb_dqopt(sb);
+	struct quota_info *dqopt;
 
 	if (!sb)
 		goto out;
 
+	dqopt = sb_dqopt(sb);
+
 	/* We need to serialize quota_off() for device */
 	down(&dqopt->dqonoff_sem);
 	for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
reviewer
#1 lore raw

Yes, the patch is right. The case sb == NULL should not happen but
it's always good to have clean code :). Linus/Andrew please apply.

Honza

Signature · 21 lines
Jan Kara <[email protected]>
SuSE CR Labs


--- linux-2.6.5/fs/dquot.c~	2004-04-16 22:30:05.000000000 +0100
+++ linux-2.6.5/fs/dquot.c	2004-04-16 22:30:48.000000000 +0100
@@ -1145,11 +1145,13 @@
 int vfs_quota_off(struct super_block *sb, int type)
 {
 	int cnt;
-	struct quota_info *dqopt = sb_dqopt(sb);
+	struct quota_info *dqopt;
 
 	if (!sb)
 		goto out;
 
+	dqopt = sb_dqopt(sb);
+
 	/* We need to serialize quota_off() for device */
 	down(&dqopt->dqonoff_sem);
 	for (cnt = 0; cnt < MAXQUOTAS; cnt++) {