From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeff Mahoney Subject: [PATCH] quota: add missing use of dq_data_lock in __dquot_initialize Date: Wed, 27 Feb 2013 14:43:09 -0500 Message-ID: <512E61CD.5020501@suse.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Jan Kara To: Linux FS Maling List Return-path: Received: from cantor2.suse.de ([195.135.220.15]:51577 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751916Ab3B0TnO (ORCPT ); Wed, 27 Feb 2013 14:43:14 -0500 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id A6A5CA39D2 for ; Wed, 27 Feb 2013 20:43:13 +0100 (CET) Sender: linux-fsdevel-owner@vger.kernel.org List-ID: The bulk of __dquot_initialize runs under the dqptr_sem which protects the inode->i_dquot pointers. It doesn't protect the dereferenced contents, though. Those are protected by the dq_data_lock, which is missing around the dquot_resv_space call. Cc: Jan Kara Signed-off-by: Jeff Mahoney -- fs/quota/dquot.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c @@ -1439,8 +1439,11 @@ static void __dquot_initialize(struct in * did a write before quota was turned on */ rsv = inode_get_rsv_space(inode); - if (unlikely(rsv)) + if (unlikely(rsv)) { + spin_lock(&dq_data_lock); dquot_resv_space(inode->i_dquot[cnt], rsv); + spin_unlock(&dq_data_lock); + } } } out_err: -- Jeff Mahoney SUSE Labs