From patchwork Thu May 18 13:34:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 100105 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp724182qge; Thu, 18 May 2017 06:36:11 -0700 (PDT) X-Received: by 10.84.237.1 with SMTP id s1mr5036175plk.157.1495114571589; Thu, 18 May 2017 06:36:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495114571; cv=none; d=google.com; s=arc-20160816; b=zOyxtnX+DepaXtLvdZ+jhJw4rozC8oCrQmfd5Mo5eG/yg9OeH0NiWQkxyEdqyIwimF aAdBmcCDEsWXg4a5RvVx6NM084CFbhaaN8yJ7OImFzbdkmz7mDq8yv3MDoO1bDBoTD/a m4qxbaAGrl39MtBC9P/zTIgzxC+Sx2MK0iNZSE+h+FjcfzJqN5iJ4whdpUsJxLp1BLBQ wS9GDt8n2mmCvrZ/95GY2XUsDmprM83pu9syUyx9p+W88XLxKvREuKT9bPhDKtZ9SOLm mIRf0HvjyCXsKrwIYjlTG3iKCXwERwig+PhxICMwc2oJbF57h+z0+wC/LoBKeH1JqjCb 7sPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=qJOaEusATj8mAsMCCy5c4FVbHASgeQgSEgsK03V0sCI=; b=Z6C0incQPY4ypz4unEAjwpApOciUUeuIp3og+ppHuDA3AqU6nwsAfCgqMrUliFFivh vQuve4KfCy19F0/a2v0NQr6A3R1AypEKQ+4baebNhcHUklPkB8tEfeAXQJcmWoOzwL3b XrrGpsMI+sU24ze6ZR/SOMP2DOLQ6LoAP0evNIvsmY87huoHm14zSfH4oI9G9GU7Avuh gAT0bFj6xPfsX7CEvc+MWL5ve2fEnFn9a4lP8ALzYauzyEZVcu2ywugI7702kZODnCf3 XvZIrI6QlU/seFeM93fya2jdrYSEBPk+3mnLa2xGf6AoZ7YZXpmJJJ20ecEdgMbEwdk2 KA6w== ARC-Authentication-Results: i=1; mx.google.com; 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 y1si5224584pli.180.2017.05.18.06.36.11; Thu, 18 May 2017 06:36:11 -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; 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 S1755604AbdERNfl (ORCPT + 25 others); Thu, 18 May 2017 09:35:41 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:58872 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755043AbdERNff (ORCPT ); Thu, 18 May 2017 09:35:35 -0400 Received: from wuerfel.lan ([78.42.17.5]) by mrelayeu.kundenserver.de (mreue104 [212.227.15.145]) with ESMTPA (Nemesis) id 0LyDKf-1e55RQ3MVp-015dmD; Thu, 18 May 2017 15:35:01 +0200 From: Arnd Bergmann To: Miklos Szeredi Cc: Arnd Bergmann , Amir Goldstein , linux-unionfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ovl: fix ovl_rename error handling Date: Thu, 18 May 2017 15:34:40 +0200 Message-Id: <20170518133500.1890143-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:PCC4XEEc210gTGHGhaFXtYEFloAg7PMvNop6ou88ZEmkjoXDhbS Qw8+P/B+IzszIPi86eEumZ/Km1BrAQpRft6rwxULp4cQ0jH3sapXEIQKlzBZmS1BIp/79F7 if907Y+UV7jMlnuhAmPlPvV6ce9Zci8v2cDr8goDB0olQuqSfK90sDDpMrJTywcxzDHmM4U 2EIn9meY+H+X/RVcIFPzQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:Pyh8a9xMwo4=:g85R9LplUGbefEEDQ7w9ag +brcWMP1fcjlDdYUfBDAjAVn79mZ/WVSfsN6UQKRAHwT2wtS3efePJ9QvWuWDbHZA2r8viQKr 9Ix6+eD6OzyVgTLzLxe3mUng39g3acBMd75F5tU0E8GPlu5ZkKbUrrnODkpwtu7S+JRVuxsFo SmhEv3JmZmjHyzZLO4n7FBSgJ2G77wulL7KYG+sgZOhdaNTYQsjlKJ51A9C7d53x7x5siw7w5 6UtDZlZuj/vjkMUXbAuPMxcfMbGekYbCT/mjPA1bWSo8/RAW+k8vtE28T/G8K99sS+zTrmuOH Jdlzb6fqkJeb5izxTzCIL/Ar+vOut0YwC0niv1Lq5F9eov4qgrgXouLwxD7+MGjbdAHI3N39p HlITzji1vG1KIHFcCz3hXHnUgElcvsiZTW+qpNCQy2LC3CCABQqg5Fb372U9cBrykcI6ZhbzQ wzrDsLE9UR7c0GQs7h9dA683Hpiiw6TNgiiP11/eOvz/f+P2GjQt+I2qU3OBSGkkqUVGaRfaP eE8KBORIpXXBZjnF6KtyvUCse98duKMMuibXLJGa+tKvIiHAC0947ZmSpoaX4emJI42Zx0SUb +Ji3s9X/mvqIL+13MatrtH9W3LEKYaBQhZmw5Gnj2Iw4Nv5hb+s3nbpBrq0t+sNb9Mwl9ABVs 2O7JnyWmUIhc0XyQQ2rPx8leNFtMxoVflUP/uqyr5Y4ouDF8z8m/RpTtC54F34q4c+dU= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We try to clean up two objects before they got initialized: fs/overlayfs/dir.c: In function 'ovl_rename': fs/overlayfs/dir.c:1060:2: error: 'newdentry' may be used uninitialized in this function [-Werror=maybe-uninitialized] fs/overlayfs/dir.c:891:17: note: 'newdentry' was declared here fs/overlayfs/dir.c:1062:2: error: 'olddentry' may be used uninitialized in this function [-Werror=maybe-uninitialized] fs/overlayfs/dir.c:890:17: note: 'olddentry' was declared here Assuming that no special cleanup is required for the new code, the correct branch target should be "out_revert_creds" to clean up everything that got initialized up to then. Fixes: 02cac3227a28 ("ovl: mark upper dir with type origin entries "impure"") Signed-off-by: Arnd Bergmann --- fs/overlayfs/dir.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.9.0 diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c index 5ad6ccf2159e..9b221cf50cb7 100644 --- a/fs/overlayfs/dir.c +++ b/fs/overlayfs/dir.c @@ -973,13 +973,13 @@ static int ovl_rename(struct inode *olddir, struct dentry *old, if (ovl_type_origin(old) && !ovl_type_merge(new->d_parent)) { err = ovl_set_impure(new->d_parent, new_upperdir); if (err) - goto out_dput; + goto out_revert_creds; } if (!overwrite && ovl_type_origin(new) && !ovl_type_merge(old->d_parent)) { err = ovl_set_impure(old->d_parent, old_upperdir); if (err) - goto out_dput; + goto out_revert_creds; } }