Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3882749pxb; Tue, 17 Nov 2020 06:08:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJw6zNJNh5mLvYG1Z479ubfPaVXcaP60pLZiris788XeCqq8xz5AMIAlGkD6OsrKpqdj/x76 X-Received: by 2002:a50:de45:: with SMTP id a5mr20497430edl.91.1605622118308; Tue, 17 Nov 2020 06:08:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605622118; cv=none; d=google.com; s=arc-20160816; b=XZdteYhoVBwUyg4F6vr4rUCKHAcJlxSzze5hCZj4L/kuq4y7eVeKosbEyJCByDO0dK MzjdC8VnyEm2ZuM0CbbyF+0QA2PI4gnsUrMcr04pFOIe8F3o9PzPK1NkN4jEUhL2DnhA 1UWfOl1R0e0PZXhdLUhbcnXifbefHksmU//ZgE6MvoYYYQeVJB+9VoLnZaz9deJDosBa gK5hfqlLoJX8iD8M0tBTo+4/eTaTFKovuHKeTgNvLNPQ38NdOhWNc4eun37CB8Nkzwbr WBxdy2R0521Gm+bcS9mhkizH2qetST6Kl+dP7Pru3plW/JrM0x8+8OSCRslt9+VQk/u0 iPAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=h/GVLb/TTAigLbikzmH6Npz/qlHMPIXZfgqC6fMi+zg=; b=VkVSGbR+BNMvcW4bssZeE9Wq7W1XouRhRYGGFIyKQWuhjnYTSAdYsIuQTo/wGXtJC6 lZFaMLw+OsUL3zxB/KS7xhdhbIRWIm9tZdQWa7ripBAYOj6YKQidm/wdvqnwPGb9F2o6 qeu771pyiCZKhFxIUc0tRR+OklZM2tSelDLeV03H91Ys9XscqFf7CNmvKTsLF6S8C2go 8/9RIm4pQ8XOAEkQq+cxfPr8qDVosjIW1fM9xuNaQrJZNdQMwiYgYiwiyzXpaCW45oH2 4P5UCx6C0JAhi02bUlY/tJ+xGm7yR9F/jrP2rC1F+EoF8MQt2zQGBc7GBEKNI0UZwCS9 Q1MA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ToAop64p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a6si13416494ejj.398.2020.11.17.06.08.14; Tue, 17 Nov 2020 06:08:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ToAop64p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729370AbgKQNJD (ORCPT + 99 others); Tue, 17 Nov 2020 08:09:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:37476 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729317AbgKQNIs (ORCPT ); Tue, 17 Nov 2020 08:08:48 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 B9BC4238E6; Tue, 17 Nov 2020 13:08:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605618528; bh=htQs+Zjnuk/vZn7s9XxNdJaGv3PG71BxdwzGEUq8XI4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ToAop64pJtO/Vhq31nIJkC4jmWm2aR90jKeWCGjZDyfNukKIoRD7f4HJN78Ek4C5W 1Ih8qPDN9ug2XJ5RKaAG79u2YWBFZeZ11A6p/dZQEsGbTSz6vAj8yhirW6VwA2SA+i BeB3rv8nV86ve7plHuF5m4obobutOOnHOiAehEzI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Tao Ma , Joseph Qi , Andreas Dilger , Theodore Tso , stable@kernel.org Subject: [PATCH 4.4 33/64] ext4: unlock xattr_sem properly in ext4_inline_data_truncate() Date: Tue, 17 Nov 2020 14:04:56 +0100 Message-Id: <20201117122107.788461293@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122106.144800239@linuxfoundation.org> References: <20201117122106.144800239@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joseph Qi commit 7067b2619017d51e71686ca9756b454de0e5826a upstream. It takes xattr_sem to check inline data again but without unlock it in case not have. So unlock it before return. Fixes: aef1c8513c1f ("ext4: let ext4_truncate handle inline data correctly") Reported-by: Dan Carpenter Cc: Tao Ma Signed-off-by: Joseph Qi Reviewed-by: Andreas Dilger Link: https://lore.kernel.org/r/1604370542-124630-1-git-send-email-joseph.qi@linux.alibaba.com Signed-off-by: Theodore Ts'o Cc: stable@kernel.org Signed-off-by: Greg Kroah-Hartman --- fs/ext4/inline.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/ext4/inline.c +++ b/fs/ext4/inline.c @@ -1892,6 +1892,7 @@ void ext4_inline_data_truncate(struct in ext4_write_lock_xattr(inode, &no_expand); if (!ext4_has_inline_data(inode)) { + ext4_write_unlock_xattr(inode, &no_expand); *has_inline = 0; ext4_journal_stop(handle); return;