Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp702547imj; Wed, 13 Feb 2019 16:04:51 -0800 (PST) X-Google-Smtp-Source: AHgI3Ia7NsT4fGhI0GEqmGVNyS1LcALeIUfj0wfkglfOprqNRg5mncOqESXH/eDZU/8wLOpUF5N9 X-Received: by 2002:a62:8dd9:: with SMTP id p86mr857352pfk.143.1550102691301; Wed, 13 Feb 2019 16:04:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550102691; cv=none; d=google.com; s=arc-20160816; b=LNtT0me5paJ1MouhzSUlhFHAfjO1/M+BkngQuh5TU9ZiKMiljCGuJQ/vytzBdEyjOr DnV/Olf1KIETz8YtRTonU3fGXcI6+szyQ2Z+ME7TpjPw1y9Ey0MpNK5l8ozuF2Patg9a wPgzYhLpssIrfSmxfxzDWda8aF6vTR07EWqeA0MBVCaiFw2MYUa/f5VfnefDtUIjbsGG nrNiL57dK6fPcfRwBfQfGXta2kZ+rpx31lHL2/seoGcVrDO52XyvSy4M0CSHJ3Vzt793 EVaODNconpgPvFHf29AwudQ9kbZa/DldLFFvuyFKp18vCIznd/zExaRqBU+sG94OHQI2 tLsw== 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=926u+PPmi1FkRWCXBwmcg5Pn96S14j8qJaHgL3WMLek=; b=Hq81b7nWvh7ljybnGQHC/1k8i5VPsGgU+WCoxsVadGl0ibIhBXvqJFucRhqTU3ecYk JPtaXAzJ/g09ThRgdgHFQRwhMvn0sFNO8jVJ8ylJxQNlo6YdkplNoqqgVhdeoFPZ3Q+z 0gXR9ZVOb1gJJzWYW7HkUxXB9y4qTLGICyZCVL3LSBgxNwtKGxrgF8+vEh85QS8heM3Q Ff6j0CZfa8seCIthli5We2XowCSyewQqcXWNSgyKrqUK604r9PU9hkjOsH8q4yTkQVmL RWEB84b2GXG0W+57krxOfK7DRbvFy/1lQ34R6ORq7WiOLmXfra6E+I+sjGLVbdvTIxxl CMWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SNcdkl5e; 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 e125si754586pfe.14.2019.02.13.16.04.34; Wed, 13 Feb 2019 16:04:51 -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=SNcdkl5e; 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 S2405733AbfBMSmx (ORCPT + 99 others); Wed, 13 Feb 2019 13:42:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:41336 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405719AbfBMSmu (ORCPT ); Wed, 13 Feb 2019 13:42:50 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 49113222D6; Wed, 13 Feb 2019 18:42:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550083369; bh=ylQp+Oh3HynHeB+aFAcdGpMsJWAPQalDgdB0rdcmTiE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SNcdkl5eQImK5alXinfAsawudCt7nYWAdDVhF71AWJrbnGG4J6tAbzFKvIcsgSGRo 9UriBNprQdWAl1/zOR/kWMcqNj9XKlqCImRg9nlmg84K3HHCct8BzX2xR9olPomgaT zFArZJNDBpjAT/IGfrXT+4fRzoeWFe4TN7bLtJ2E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org Subject: [PATCH 4.19 15/44] debugfs: fix debugfs_rename parameter checking Date: Wed, 13 Feb 2019 19:38:16 +0100 Message-Id: <20190213183652.935726211@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190213183651.648060257@linuxfoundation.org> References: <20190213183651.648060257@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Greg Kroah-Hartman commit d88c93f090f708c18195553b352b9f205e65418f upstream. debugfs_rename() needs to check that the dentries passed into it really are valid, as sometimes they are not (i.e. if the return value of another debugfs call is passed into this one.) So fix this up by properly checking if the two parent directories are errors (they are allowed to be NULL), and if the dentry to rename is not NULL or an error. Cc: stable Signed-off-by: Greg Kroah-Hartman --- fs/debugfs/inode.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c @@ -787,6 +787,13 @@ struct dentry *debugfs_rename(struct den struct dentry *dentry = NULL, *trap; struct name_snapshot old_name; + if (IS_ERR(old_dir)) + return old_dir; + if (IS_ERR(new_dir)) + return new_dir; + if (IS_ERR_OR_NULL(old_dentry)) + return old_dentry; + trap = lock_rename(new_dir, old_dir); /* Source or destination directories don't exist? */ if (d_really_is_negative(old_dir) || d_really_is_negative(new_dir))