Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2300172ybl; Thu, 19 Dec 2019 11:13:11 -0800 (PST) X-Google-Smtp-Source: APXvYqzK4TLXXePE96w3sEWszLAC16EBs4G2uEVuRh29rIkwabkOZN7L2C1c288gDnEoOvvVWFif X-Received: by 2002:aca:d787:: with SMTP id o129mr946254oig.75.1576782791293; Thu, 19 Dec 2019 11:13:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576782791; cv=none; d=google.com; s=arc-20160816; b=qgXvecD+MOcLWWxrcL0KjL6+ilVBbg7hqoGFAIfD+geAjlrIPvrwxLQhDVyIk9zILV 2dq/hkG6T3Qw6Qf4+SVqvOVKuT+I/kSK6lHwnYzgZYtXrk7C7anrBy5E+otTRBh8pDNF w6RG9uUbBx5LqHC6kqtzKqS4Zpk09UpkckkVOlPzQHNC0SQ3obtmHUjdLZgRUQVG1hKi U0uhs9oXjaHh+Xb1MZ0CJmDrv2Yql2hfMri2mTMaolnxlkA0Mt7oTSaikacbpKQfS9V6 xlqMbBDeDLZnmWsCBS36zBhz2PyMHNu+RVic4UmpgskbOsxpjg9admotbZ4gzFw0/XUq TIYQ== 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=/yVFPgYX616ViVoIg9KAZBcfBuq595N9Iyn8apTdMPY=; b=cikWgn5/G1LRjzCyc5mdq0j96siYauVQT0jC4H3edQfvhumltjEmyfoomv1CrdAt7Y EPeGtz5AF0EENWjT/GeGscrRnUidUHVKp+3JQ5s0ZrdDM55bKtRpNmIozQzhebGsQnRf DxVFfWTFpJJ9uIJ6ATVHGPMCUF3B6sYl153iZFyWbEpXBHhpbwFauEGwxNIHBuebA9zS UxwdbBYhrw2fYMLt7aOSKntHKJDxgggwgVn8W6YAqR/M3GTReWG7w+X6+flG1bNDrAp/ C8Sc92XBggP0b7XqJADVzcC1Mf9OavEsiWvbkQWgRX5Ok17QBlkXpYC9MGv2ySsktM/A vDOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="V3PT/XZC"; 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 y130si3326336oiy.28.2019.12.19.11.12.59; Thu, 19 Dec 2019 11:13:11 -0800 (PST) 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="V3PT/XZC"; 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 S1727169AbfLSShT (ORCPT + 99 others); Thu, 19 Dec 2019 13:37:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:54732 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727791AbfLSShP (ORCPT ); Thu, 19 Dec 2019 13:37:15 -0500 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 624AA20716; Thu, 19 Dec 2019 18:37:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576780634; bh=43saCZAc0s4ncF9r0XGHpoXWpMn26EU8d9AjHPHuwdQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V3PT/XZChQd+KEPVoDWVOytvz2oo9aAc/QmJedPxgAsClieJcw1ASblJfNiMDYoFf M93REmmXDkGN15ZBT2XYuv2xE7GUGoy9IHDYdQuXy5JnF4BLn9QUneDk59+T0A9At8 2/GoVryL5pCWi5ZO2TWhJ84AGv+M0RYH9lFYCQi8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miklos Szeredi Subject: [PATCH 4.4 054/162] fuse: verify nlink Date: Thu, 19 Dec 2019 19:32:42 +0100 Message-Id: <20191219183211.169480687@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191219183150.477687052@linuxfoundation.org> References: <20191219183150.477687052@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: Miklos Szeredi commit c634da718db9b2fac201df2ae1b1b095344ce5eb upstream. When adding a new hard link, make sure that i_nlink doesn't overflow. Fixes: ac45d61357e8 ("fuse: fix nlink after unlink") Cc: # v3.4 Signed-off-by: Miklos Szeredi Signed-off-by: Greg Kroah-Hartman --- fs/fuse/dir.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -812,7 +812,8 @@ static int fuse_link(struct dentry *entr spin_lock(&fc->lock); fi->attr_version = ++fc->attr_version; - inc_nlink(inode); + if (likely(inode->i_nlink < UINT_MAX)) + inc_nlink(inode); spin_unlock(&fc->lock); fuse_invalidate_attr(inode); fuse_update_ctime(inode);