Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp824244ybl; Wed, 11 Dec 2019 08:04:23 -0800 (PST) X-Google-Smtp-Source: APXvYqx0TeMxvhxtN69HCvPqE/U499977Y6nTd2tDI8Kx/xxp5mLu/+z/paK/ramu1b2dNCMgjry X-Received: by 2002:a9d:6005:: with SMTP id h5mr2953681otj.153.1576080263091; Wed, 11 Dec 2019 08:04:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576080263; cv=none; d=google.com; s=arc-20160816; b=Fgy466H2dyQNUdYPVMRG2q8u0mYtV2B3KFCqOXoMbK1Z1f31/+aa6VhlykZA8BuU6n sGKnZONIgS/p9DG0v/xFR5UwS7ozaLUPYiVaT2XU/buMdWHlthoX9KCTL/zB/9Y7VmvG LY6noHEk9knKzeRyCBFqUhD1Vl+tOBq43BmmBxYaTVobw1f05VFEIt3YQHnHZCChyDkw vTCF1VDE9ZbeKg88KhjQkaRrHYwFxYS1d73p8a9aW1ftizVUviL+L7inbOw1/HL1kQqK o4qjllco7/lG2mpFmBfpZ1A5MRAI6nAr3geVMBbxK0C3kYdcGKmb276iau+l12QA4rRI uTtg== 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=E6yUJxVLWDsWUjVruwvTKMLYksvad4bqjPBkxugCN9k=; b=mKWUluqQtJWOoiHC7ULn4AX63QAwlRDcVw1ueqIp39T35nOWagejhDiGXW4xKedYFQ nzqP4HZ0fcf2A1PU38uR9JHMnP0DolevcfTLPhUYFjVFzqFXo7Zcq+B6QfEAdcRKQBmc 09FusIK2zJ22xlYdvCJyprZqqMkecSkoEPBqrBlCTK2l+/5z2tIWfCMEjx2gQ8GuiHrT MFdcmCLObZTBqRCyWIDq+/+O1ADc+5KZzZu4Dr3LXj0xvlZZ9RXjynkUCWJh3RvD7l0W 589KPOUSwQnzowF0qPyJjSgscZpwwSFxhEqqBddwSRnYCpYQeWhpYrvh/SUHmjhiG1C9 VUpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="gSs4kW/B"; 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 u21si1192297otq.137.2019.12.11.08.04.06; Wed, 11 Dec 2019 08:04:23 -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="gSs4kW/B"; 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 S1730924AbfLKPN0 (ORCPT + 99 others); Wed, 11 Dec 2019 10:13:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:36470 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730839AbfLKPNQ (ORCPT ); Wed, 11 Dec 2019 10:13:16 -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 EEC3024681; Wed, 11 Dec 2019 15:13:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576077195; bh=9xd/VABcza9uEglJOSz/DEebvYrkbh5MIhe0PXjV2sU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gSs4kW/BX8LMGxV0ky/u9piWs5XtptCTI+RjIB5eCLYEdu2hChTudNalKrtoGZTHC Z+ZZ/S8YPhbvSGd08w+XFU0V58jO6r8l21+WG2uJ2ivw3kVFkM2NUfq3YgSucNSvrs P8f/m4OCOi1BdjfAW6Vq3+iVnD4sLjKqtrcL+q8E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miklos Szeredi Subject: [PATCH 5.3 045/105] fuse: verify nlink Date: Wed, 11 Dec 2019 16:05:34 +0100 Message-Id: <20191211150239.290851608@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191211150221.153659747@linuxfoundation.org> References: <20191211150221.153659747@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 @@ -814,7 +814,8 @@ static int fuse_link(struct dentry *entr spin_lock(&fi->lock); fi->attr_version = atomic64_inc_return(&fc->attr_version); - inc_nlink(inode); + if (likely(inode->i_nlink < UINT_MAX)) + inc_nlink(inode); spin_unlock(&fi->lock); fuse_invalidate_attr(inode); fuse_update_ctime(inode);