Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1174310ybg; Thu, 4 Jun 2020 03:03:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyc5bdMwEog5Jj3qdMhnY6EQfKBuywBTd/Md2lG1KzPHb4KQc+Wbgk+BmzQDfCy6HpLcSP3 X-Received: by 2002:aa7:cc84:: with SMTP id p4mr3406606edt.157.1591264992259; Thu, 04 Jun 2020 03:03:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591264992; cv=none; d=google.com; s=arc-20160816; b=WQ0cqnm8DRU9Lfqr+1vULn8M42Ci93u9qYEphOttdSFufJyskBPJh7SzI8FcVbSRQ7 jMKDlX8Ru7Mbyqx0LceSfDs0iTNa8itAYZGVx4sFbukOSXFWAnQ94kbNU5O+K1D8CYnH DO6bTSsNHSkCHMatG2ljudSTL5UkjsGtX13i+XpAvatBXAHA+uzq9LclLYhqYkqICVID YWqhc7jkasoL3EwY5LVqxcOTT7OPkQ6mpjjsGvjD6qsHKnbiBOlvTvKb6sR4rppqEZ4B Jk3F3K4/0oY8XkR3QG7wHBEuV5EpROwZLVyVMzqfCmn/qjuvKWz0B2f5yhIXYlx+/+su pbgg== 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=1cyPRerltnuf6OiO7zJfaJBlJDvo/vDR9533o+NbRzk=; b=hrPmfxwEFswSONJxlN8BW4ObqAqZPUsDj2xo/MIcT1F3fJsiTEVhT/u9n87rBvbDW7 a1NFuBOctAxX07TpxJinhxUNCwvJWXNn3tiyLlihkVK/WD2Eu7VklTCLe2dmZ2SN6xEf NcGuDOpI0f8IeUtbXnXcMSGw2eB66QlBnMZ2QiWmFHf++0Dhl9q6cT6/WYRBIlsbUXbK 9drYNkBt8ERsh8/z0y/GWc9DpblewLzD2LUeusbXU4U5WCqE2J83cO6TDMNlDb8DduEG CAHSUmPbmpdVNkBMrD2zZD2CSR6an/PyA1kcmy2cXrlueH5Spdc/S8rzTc67MgB65jEy S6xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=f+Lz97I9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id eb11si1761459edb.302.2020.06.04.03.02.49; Thu, 04 Jun 2020 03:03:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=f+Lz97I9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728198AbgFDIz2 (ORCPT + 99 others); Thu, 4 Jun 2020 04:55:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726664AbgFDIz2 (ORCPT ); Thu, 4 Jun 2020 04:55:28 -0400 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05165C03E96D for ; Thu, 4 Jun 2020 01:55:28 -0700 (PDT) Received: by mail-ej1-x643.google.com with SMTP id l27so5229070ejc.1 for ; Thu, 04 Jun 2020 01:55:27 -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=1cyPRerltnuf6OiO7zJfaJBlJDvo/vDR9533o+NbRzk=; b=f+Lz97I9fYwRYsY1POv4BsWh7sUNv4BwjVfHmAFW+Z0LJmUxUd/I2VZj/A64TA7MPT pehLmYFlyB2KmT0oVWyHVVPADXZ4TH++UGj5eo9+51dg818r2EbyPG4wWWhVHyp98pBk Smrt++8CCAh/W90dkqBCeWHyBCw5gCvR/nIU0= 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=1cyPRerltnuf6OiO7zJfaJBlJDvo/vDR9533o+NbRzk=; b=IyyFsYHPFdYl9rj3Zis3mq0iZpXXu+agUX47enPLC3Hb8gfJh44j8W56ui8kkeMLxF IjZyZM0+wYohzubb3rDCSLhPt8WhNcKst+1LQlDGrTxK0VAVUhMd3nWKjV4xYzFVRrAz YSKnsbASA5Q0BIR9io4ViluSgYq7G8SFIVCBrndGPT52IsNZyCMJsGgNqdUEmz6S3dGP rWNtGaR3tfdR5HwGFMxRGY1I/uDc8GNmNSdgr1tOErj+nHkAeba8iG5GmLzq+xwWw1KG AhBTqFnr1luDsg7TiBDqjids24gpk4E8PJSWcogZ7UyhuclILy3scRu/HXNKMKDJMOD4 E/Nw== X-Gm-Message-State: AOAM532zRgtGtpG18dedfMs7KbNAlTwRtpAbNYGeWuJoBj1Tq+QDzKz+ 9eOhu1TN01cWMP4yjcn3j0fvVE1WjrvbtyaphwB9Jg== X-Received: by 2002:a17:906:1947:: with SMTP id b7mr2876662eje.320.1591260926736; Thu, 04 Jun 2020 01:55:26 -0700 (PDT) MIME-Version: 1.0 References: <874ks212uj.fsf@m5Zedd9JOGzJrf0> In-Reply-To: <874ks212uj.fsf@m5Zedd9JOGzJrf0> From: Miklos Szeredi Date: Thu, 4 Jun 2020 10:55:15 +0200 Message-ID: Subject: Re: [PATCH] overlayfs: initialize error in ovl_copy_xattr To: Yuxuan Shui Cc: overlayfs , linux-kernel@vger.kernel.org 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 Wed, May 27, 2020 at 5:20 AM Yuxuan Shui wrote: > > > In ovl_copy_xattr, if all the xattrs to be copied are overlayfs private > xattrs, the copy loop will terminate without assigning anything to the > error variable, thus returning an uninitialized value. > > If ovl_copy_xattr is called from ovl_clear_empty, this uninitialized > error value is put into a pointer by ERR_PTR(), causing potential > invalid memory accesses down the line. > > This commit initialize error with 0. This is the correct value because > when there's no xattr to copy, because all xattrs are private, > ovl_copy_xattr should succeed. > > This bug is discovered with the help of INIT_STACK_ALL and clang. > > Signed-off-by: Yuxuan Shui Thanks, applied. Miklos