Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1778100ybe; Wed, 11 Sep 2019 22:29:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqwg7Irr868axTsD4zQnAGYRrjRiEf22Y0Hxaj14DaJPQaSvHRARAlGAubFiDqh4gPGOx4Zb X-Received: by 2002:a17:906:5393:: with SMTP id g19mr22726310ejo.256.1568266153479; Wed, 11 Sep 2019 22:29:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568266153; cv=none; d=google.com; s=arc-20160816; b=TP9pC8oJLQBzAIrATYnOml9+LEbIhZC4XpmBB49p/BZHTPGEWFRhprPtnU8GnQ39W7 OIAoLhsDe8uur1seyZpN3h7xALN7ITdu3wud38OMxNhe4hqdwb6BfobNV75jZwOYSCFm QmebE+ezSu1Z2FWyexryoTDLsvwpFZL1hZj9/eCaMehXQt6qdD1ZU10Hqvf9GqbqGcLe mdYl35NelLckb+Fxy6irVXsbThYrIR8uGpgPrLAQskCgu5xk83X7nSouN+0jwDgsX7HG bLq4AQfvf8fvCNm81Ij1KSwokd2WHeaWY11MG7gsZ0ntZXx67u8ImvIjBDK5Rwv8Wea2 qd1A== 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; bh=two5Szkn7zld7xFACwDQxKtKxYPQoGvdzHBNICgwiD4=; b=zDzjytuz2vYan2y8nRThZIJbMaeh3sfGtf6kCkjfH+TbqIeTbS99WfnfZT4x5yzT9B 7Z1GmpDNsjsL0R9U5GEEwNnb74f6X3D9Ry70ov90I022vQNoCOHvmxDa7TgKD9fP4f3N lglGaCm9bd9Hz5DwEeMjiDM3olVIBlFq56y+kuota/5JdU1DIvqn7FDTeEOgP4v27Yne 70Vz1M00asfUR7sMEwOyE+iIgyevU4M2tEi1XB7vjBM93pcODCmwvs0ou1KruHq/OoHh Ekre2coBJIByw9jZZeVNaTH+haCt3FlnFLoASoJYBbKGXJ4487CB6TkVzDddKgV7PhQf 9Cyg== 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 y17si8392275edt.101.2019.09.11.22.28.50; Wed, 11 Sep 2019 22:29:13 -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 S1727576AbfILFTH (ORCPT + 99 others); Thu, 12 Sep 2019 01:19:07 -0400 Received: from cmccmta1.chinamobile.com ([221.176.66.79]:3068 "EHLO cmccmta1.chinamobile.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726222AbfILFTG (ORCPT ); Thu, 12 Sep 2019 01:19:06 -0400 Received: from spf.mail.chinamobile.com (unknown[172.16.121.11]) by rmmx-syy-dmz-app03-12003 (RichMail) with SMTP id 2ee35d79d533104-04883; Thu, 12 Sep 2019 13:18:47 +0800 (CST) X-RM-TRANSID: 2ee35d79d533104-04883 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from localhost.localdomain (unknown[223.105.0.243]) by rmsmtp-syy-appsvr06-12006 (RichMail) with SMTP id 2ee65d79d536400-208ae; Thu, 12 Sep 2019 13:18:47 +0800 (CST) X-RM-TRANSID: 2ee65d79d536400-208ae From: Ding Xiang To: miklos@szeredi.hu, linux-unionfs@vger.kernel.org Cc: linux-kernel@vger.kernel.org, sfr@canb.auug.org.au Subject: [PATCH V2] ovl: Fix dereferencing possible ERR_PTR() Date: Thu, 12 Sep 2019 13:18:31 +0800 Message-Id: <1568265511-1622-1-git-send-email-dingxiang@cmss.chinamobile.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org if ovl_encode_real_fh() fails, no memory was allocated and the error in the error-valued pointer should be returned. V1->V2: fix SHA1 length problem Fixes: 9b6faee07470 ("ovl: check ERR_PTR() return value from ovl_encode_fh()") Signed-off-by: Ding Xiang --- fs/overlayfs/export.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/overlayfs/export.c b/fs/overlayfs/export.c index cb8ec1f..50ade19 100644 --- a/fs/overlayfs/export.c +++ b/fs/overlayfs/export.c @@ -229,7 +229,7 @@ static int ovl_d_to_fh(struct dentry *dentry, char *buf, int buflen) ovl_dentry_upper(dentry), !enc_lower); err = PTR_ERR(fh); if (IS_ERR(fh)) - goto fail; + return err; err = -EOVERFLOW; if (fh->len > buflen) -- 1.9.1