Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5236178ybl; Tue, 27 Aug 2019 01:17:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqyY9hq+KtnZ2thvJPLbKBj05L7ExJXMJqtwWXg/ZBLPW5IwqJmotaZr+3k/ZaIGRSu9Tb5w X-Received: by 2002:a17:902:7886:: with SMTP id q6mr23574999pll.78.1566893876165; Tue, 27 Aug 2019 01:17:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566893876; cv=none; d=google.com; s=arc-20160816; b=U5zJSsLK7OL4cdCyA6MWSPG3jbHgW+dO4GgsP07MQOOw8qCb5SgCGanOQ4srsrdi5G SI42wAr7LBkL+zuJmA3awkvi37603ezfCQ4rGzG8SH+h+xLeQXpqHEpoIQlBhfB0nOge 4VgGu+xBiQaZjMwfKIosTP/tO60vUSql4+oSY6p6fON2tl9i2jbI2fs/bSuWuJwMRYQo GLw0Gnqac/zvNKX064F1euWsT/kV2ExOD28/clYMDVI1cAbcKPQaGxzeaQfko9SLV7kv gJbBs0iKq26cNqlG/Mq7kO6a+wrbOXyh3rAUkg6pDEMYKGFBbwJLYntl1RTe5ljGKGIm SSXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+8vGOSI1Ta2739SSYK2YbMrOhHio5O6XCsz0tuO6qFU=; b=0w+TF4aTUN16U/ej8QaUDP2/5kF7TvGWyn1HhAd/qA7CM+hIG+mQDHOw0Ie2UHnv4C OP51JDjv/zXOshjP92WT1T2kD9pJ5K46/SmO2E9CWJrMlF0sQopVc6GKk0WMVsQ4T/yp /mgzPPTp5P8v3iP4Yxyj3dmDTOOf5dJfcEuMN3MQ3rjgoWLHjC1jskucwiPDiIzQk9Fe ffPJkHdgAkWJql8WOHfOLIIznLVsQAfIzMml3I+vIKWFvAHDD6mKsOT8++j1+lT+92Jn qF34il4G+EnuYsCLlY0g6n/95WhVq8ByCvPihcVZXUdGWsChQPUTpxUYcydlWCEBwia2 IoDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="gV4Tw/ey"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m1si7987838pld.315.2019.08.27.01.17.40; Tue, 27 Aug 2019 01:17:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="gV4Tw/ey"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730252AbfH0IQF (ORCPT + 99 others); Tue, 27 Aug 2019 04:16:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:46268 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730081AbfH0Hyg (ORCPT ); Tue, 27 Aug 2019 03:54:36 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8517E206BA; Tue, 27 Aug 2019 07:54:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566892475; bh=zoZ7wu9PPhyAfaaWF3fMYsYbg80wjiSCDJEYLVog2go=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gV4Tw/ey62rsYDqzoMYM7+R9/8T/8lkXE0GABHJyVsM5fAEozjfLUfZe7oU8yUwl0 vzMMxeiTdA8s+t5ZN8n6QbmMAk+iAVKctBSVnfrue42kjt2DReOZpfkPvvrUj97jfr cUFWCHhGxeIcFZmG2Gn3ADF2UEYycjqseTozvbSY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, benjamin.moody@gmail.com, "Darrick J. Wong" , Dave Chinner , Salvatore Bonaccorso Subject: [PATCH 4.14 60/62] xfs: fix missing ILOCK unlock when xfs_setattr_nonsize fails due to EDQUOT Date: Tue, 27 Aug 2019 09:51:05 +0200 Message-Id: <20190827072703.922260797@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190827072659.803647352@linuxfoundation.org> References: <20190827072659.803647352@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Darrick J. Wong commit 1fb254aa983bf190cfd685d40c64a480a9bafaee upstream. Benjamin Moody reported to Debian that XFS partially wedges when a chgrp fails on account of being out of disk quota. I ran his reproducer script: # adduser dummy # adduser dummy plugdev # dd if=/dev/zero bs=1M count=100 of=test.img # mkfs.xfs test.img # mount -t xfs -o gquota test.img /mnt # mkdir -p /mnt/dummy # chown -c dummy /mnt/dummy # xfs_quota -xc 'limit -g bsoft=100k bhard=100k plugdev' /mnt (and then as user dummy) $ dd if=/dev/urandom bs=1M count=50 of=/mnt/dummy/foo $ chgrp plugdev /mnt/dummy/foo and saw: ================================================ WARNING: lock held when returning to user space! 5.3.0-rc5 #rc5 Tainted: G W ------------------------------------------------ chgrp/47006 is leaving the kernel with locks still held! 1 lock held by chgrp/47006: #0: 000000006664ea2d (&xfs_nondir_ilock_class){++++}, at: xfs_ilock+0xd2/0x290 [xfs] ...which is clearly caused by xfs_setattr_nonsize failing to unlock the ILOCK after the xfs_qm_vop_chown_reserve call fails. Add the missing unlock. Reported-by: benjamin.moody@gmail.com Fixes: 253f4911f297 ("xfs: better xfs_trans_alloc interface") Signed-off-by: Darrick J. Wong Reviewed-by: Dave Chinner Tested-by: Salvatore Bonaccorso Signed-off-by: Greg Kroah-Hartman --- fs/xfs/xfs_iops.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -789,6 +789,7 @@ xfs_setattr_nonsize( out_cancel: xfs_trans_cancel(tp); + xfs_iunlock(ip, XFS_ILOCK_EXCL); out_dqrele: xfs_qm_dqrele(udqp); xfs_qm_dqrele(gdqp);