Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1978598ybe; Thu, 12 Sep 2019 02:33:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqycgQgiLhbijsi8Ec3XbmU6fie1r9kQ5HzVu3nAUE8myn+Jq9fQ6Mf+iDu8cfvULGmSDKP1 X-Received: by 2002:a17:906:cccc:: with SMTP id ot12mr34060029ejb.210.1568280834828; Thu, 12 Sep 2019 02:33:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568280834; cv=none; d=google.com; s=arc-20160816; b=dPnx+K8MKo78x/1G1pjpE6B3NEKhmiDXUNIsWFyQijg6Oip5ZTyfpKLpOKXKF0hNBH QooF1RZkTuRB6KGVRrtKSeBtN9MEz4sRBdlPqlna+0Z84nwweuRjH6qJw98XMuunFtnT fecTMAMkXbZ54WGXYwZHxcEB42vYKSaUtq53X6HowUf6DuipIQydmf0wNDfM/m6hvvoP j592blOmsG49IjzyjB25IueTZzNHkZ9gA29UNajqgbvLfD3t5AsYiz51Lo/EFLTkBkAB dtclyZIejE1gq3GnW7pcHpkI2Fk32P9Vxj4gJ1T6Cw3YDv4mXIpwGYg0I55itqpdoyWu E3gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=ySusEsEvIA1p7Ok5MeAC6hgYTUozA4I6kAXqI82zhqE=; b=X5G6Hz9iMbiYrYBuPH55326LXQY0YJ9nzfKMn2coxQ2blCX+51tZkmixWIcKbzlNf8 wovaiD/+WuI6d/oUlWTTREeyRKQ1H06EHMwC+oIYfacrd/tJgogOrnvDsHthSHmibGiA ebsT/dVoSWvsHQXE7K0wf9WJy7zpyH4HjxnSDXxWGBflNOowF69SDTfjOGWYp5XO8YbP UuF/W8uo0XYu9ZDAIcgF8bms14g6/7qMKYIy6oeE4EEmTTQZ6M3xeFeFQMIqdmFBmdWc GeREWwrLq/tFeZ/rDdPh5HsEWb8vBL5y18t0lXkf6sOZWjG47WrDriNZ/5fRm66sDtV6 J8Vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=ejjO79R3; 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 8si15625842edz.299.2019.09.12.02.33.31; Thu, 12 Sep 2019 02:33:54 -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; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=ejjO79R3; 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 S1730750AbfILJ2x (ORCPT + 99 others); Thu, 12 Sep 2019 05:28:53 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:39033 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730268AbfILJ2w (ORCPT ); Thu, 12 Sep 2019 05:28:52 -0400 Received: by mail-io1-f67.google.com with SMTP id d25so52941480iob.6 for ; Thu, 12 Sep 2019 02:28:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ySusEsEvIA1p7Ok5MeAC6hgYTUozA4I6kAXqI82zhqE=; b=ejjO79R3dG15jay2GvSB7zkWjnzn7JGpb2WokQ8V16v5w8JmDpD1ugMmEJijAjND7j Xymg+XPaHSscKaMChl399p9WZvVn+txz6OSLwbpTgQlls2BVfXXh6Swc1cAkR1QK1g/K WJtGq95B0KvPHNpdCwhvk+SNR1BNJw80XxtaM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ySusEsEvIA1p7Ok5MeAC6hgYTUozA4I6kAXqI82zhqE=; b=FWIph6AcsJn2p4QQuaHuecoHpIkt8GSJie+8r9ONOWsHLC5IFKF+Mmg+XaY5VkmLc8 ZGzo7LQiTC4YFJ/k4sHM3Y2QE+jRxFcYYkefC7xiYR0t4kV+jp/4SXxyXhYwq57dhd91 m6AP+uWX2vd087rHyWN8wI82rz0k/VEc5L0JgNPHCdBBVfb29u4BnOsEIYDdpnbN5C48 9F3b5qvDH0JTLak4rmg3hVDwG5QpbpRDwhAHC4QshFWJVGfOZsfScOQ4N/qsfwPbquGp aVSncNbg01HFHrxephREnyKW9ktToe3QRjX7puvPjgt+CQjXJ+YZR8Xzwmt3BXv56vss nwgQ== X-Gm-Message-State: APjAAAWBIHR4Wyqn8sLd+EtnBIQP6MR7rXD/9VQ66GqOelr7IocEOkEI bJHKiSgT9f4UHg9tkzcOIlRoXOghbnmG08H913arlQ== X-Received: by 2002:a6b:6602:: with SMTP id a2mr3022334ioc.63.1568280530746; Thu, 12 Sep 2019 02:28:50 -0700 (PDT) MIME-Version: 1.0 References: <1568265511-1622-1-git-send-email-dingxiang@cmss.chinamobile.com> In-Reply-To: From: Miklos Szeredi Date: Thu, 12 Sep 2019 11:28:39 +0200 Message-ID: Subject: Re: [PATCH V2] ovl: Fix dereferencing possible ERR_PTR() To: Amir Goldstein Cc: Ding Xiang , overlayfs , linux-kernel , Stephen Rothwell Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 12, 2019 at 8:02 AM Amir Goldstein wrote: > > On Thu, Sep 12, 2019 at 8:24 AM Ding Xiang > wrote: > > > > 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; > > > > Please fix the code in warning message instead of skipping the warning. Not sure that makes sense. ovl_encode_real_fh() will either return -EIO in case of an internal error with WARN_ON() or it will return -ENOMEM on memory allocation failure, which doesn't warrant a debug message. Thanks, Miklos