From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dmitry Monakhov Subject: [PATCH 01/19] quota: protect getfmt call with dqonoff_mutex lock Date: Fri, 22 Oct 2010 21:34:46 +0400 Message-ID: <1287768904-27810-2-git-send-email-dmonakhov@openvz.org> References: <1287768904-27810-1-git-send-email-dmonakhov@openvz.org> Cc: jack@suse.cz, hch@infradead.org, Dmitry Monakhov To: linux-fsdevel@vger.kernel.org Return-path: Received: from mail-ew0-f46.google.com ([209.85.215.46]:45685 "EHLO mail-ew0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758095Ab0JVRfR (ORCPT ); Fri, 22 Oct 2010 13:35:17 -0400 Received: by ewy7 with SMTP id 7so1449570ewy.19 for ; Fri, 22 Oct 2010 10:35:16 -0700 (PDT) In-Reply-To: <1287768904-27810-1-git-send-email-dmonakhov@openvz.org> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: dqptr_sem hasn't any thing in common with quota files, quota file load protected with dqonoff_mutex, so we have to use it for reading fmt info. Signed-off-by: Dmitry Monakhov --- fs/quota/quota.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/quota/quota.c b/fs/quota/quota.c index b34bdb2..ce8db30 100644 --- a/fs/quota/quota.c +++ b/fs/quota/quota.c @@ -79,13 +79,13 @@ static int quota_getfmt(struct super_block *sb, int type, void __user *addr) { __u32 fmt; - down_read(&sb_dqopt(sb)->dqptr_sem); + mutex_lock(&sb_dqopt(sb)->dqonoff_mutex); if (!sb_has_quota_active(sb, type)) { - up_read(&sb_dqopt(sb)->dqptr_sem); + mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex); return -ESRCH; } fmt = sb_dqopt(sb)->info[type].dqi_format->qf_fmt_id; - up_read(&sb_dqopt(sb)->dqptr_sem); + mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex); if (copy_to_user(addr, &fmt, sizeof(fmt))) return -EFAULT; return 0; -- 1.6.5.2