Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1291885ybg; Fri, 18 Oct 2019 15:19:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqyYpVz5BmOePVi1BOAph9+6fCIebkZrZG2PY8Pf/+3beDwW1Suhvnc/iYZOzqHUx6yFQyRa X-Received: by 2002:a17:906:d928:: with SMTP id rn8mr10679530ejb.143.1571437182082; Fri, 18 Oct 2019 15:19:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571437182; cv=none; d=google.com; s=arc-20160816; b=P3AQ2vdcR0cyd1xbTkHr698JlT6tWqa7W1cfJ9jYtP7oSMJ+wY6gnAqNLMj48CDNYj U1CC0obXXTAXZupJAUr0gIyhQ66kePm5Zrl1+XmCxyY2lfbClvtBEe+W3oA2m3PxhomV BtCeOeDG9iVEB29c+WUJQJkH5PBS0JpE0z2z9OQnlfqgvPHZdmrM0+M93MQmrD0L98Jb Vn2SfqzzR1JCiNIc4ZwoKau9MTPovZiPpsHXw7tWrlLiP5J9WiWPO3A9PVh1xVRjCFfB WiizK62oY1kTRrjE9yo+XrtqOKEsR8IYBfI2T73Uxkd1qvMR5DoN7hpoBl+eB7EisVuN La2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=QMU67ashdr6NIXSp5sxb1ow30I7YwBEELAlQYgNywC8=; b=0/O6RmAGYTlPr+QqKBG8uqDjRttc0ng4hdMLNL0/GQtr91aR4zhF1jkmpBwyuJFh0P I3NT4w5HEjOpftcBI0teY9XUZqTg6XueZjt/u9SPx7h60s9k9UZx+txuV9KestiulCd0 /fOylG4HF2U1WaMVFGptbn90vzmYzFVY7WGKFCuz9XuYnRZiue1TVR3n2aRRNFTMQPlb DbevZCfHDjNevqlCAgEw0Dreqs0scteMPZer0fSCiin8y+s0uKo+59emNTioSl9PZUqt 09uyDD7s8revwVsSfHzU8UgiQ4KyMMxYHJYVLBuXj4EG4pt/IeWrpFOWyQedqp3HXxC4 5LkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nnuCi8Mv; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y49si5022261edb.138.2019.10.18.15.19.19; Fri, 18 Oct 2019 15:19:42 -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=pass header.i=@gmail.com header.s=20161025 header.b=nnuCi8Mv; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437606AbfJQUwa (ORCPT + 99 others); Thu, 17 Oct 2019 16:52:30 -0400 Received: from mail-qk1-f196.google.com ([209.85.222.196]:44395 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728420AbfJQUwa (ORCPT ); Thu, 17 Oct 2019 16:52:30 -0400 Received: by mail-qk1-f196.google.com with SMTP id u22so3202435qkk.11; Thu, 17 Oct 2019 13:52:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=QMU67ashdr6NIXSp5sxb1ow30I7YwBEELAlQYgNywC8=; b=nnuCi8MvIN5FvTlFJcLWAsFvANcNYqrJPttO3XVqBHrrL69Gu2F8yE7+WQRHAk8rod PvQs3YROR8NvmAoVxhO+8idIM5Clyk/tHRc1nVqLP29U+yGPkY9zcKqZhzpdvQYaKUNs xj5cDts6e1s5SfkrPZV+xtoV+inF3KSjhta23PmmVRJr8OfHHwbWH+O75h//rHKABOJC +xC7K3z/W7FrK5arxzfX1AzC52uE1eG/9FEArV1SG0uNel5/w57wZV3f1czHKX4pONBX rHGo2V+YRHQJRhaHqogzvdQcSHB/awWpP+2MgngHMA3q46emzr1yV8LZm2qaVkaU1kgS /mpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=QMU67ashdr6NIXSp5sxb1ow30I7YwBEELAlQYgNywC8=; b=aKVH1dpfU1n1IkXXQObEIgW4Ouzu5fmNQ8/RsCVbPDuaZD6RuQWUHpVKMxr5Tn5vr3 cQZWFlFlwr+4eIarwHBNMhUb/G0MvH/7X6u7Qe3kdV8+WitcAq4koKccYCOCpqdFw4ib WSJMhhH3cuHkkjP0hMlnfUxTYppvsT3EgfgAXx3mWfJgQA3NzEtlRfDh9Mv5i+4grOkh MA/t0zHX6PEW5Hnwai1ExGWZ8o0LrqQTAoXzYMF6o4sf5yTsopTE7JnK9lu5kil1/MnX w9BCfIWBTuncVYn0mCZSCQgRlLLC6O5Bao0WjlzaFr/0725AnyPqCtNyxXpGE7Mn9uK9 4A4g== X-Gm-Message-State: APjAAAX3i2MOTVs4R7fQLTvfspNKw54BxKiLaWkdDxUCzyA/tktpAz27 7UtOBPFttusKVsmABG6AsIkXlQ4f X-Received: by 2002:a37:7b44:: with SMTP id w65mr5312578qkc.403.1571345547902; Thu, 17 Oct 2019 13:52:27 -0700 (PDT) Received: from eaf ([181.47.179.0]) by smtp.gmail.com with ESMTPSA id e15sm24666qkm.130.2019.10.17.13.52.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2019 13:52:27 -0700 (PDT) Date: Thu, 17 Oct 2019 17:52:22 -0300 From: Ernesto =?utf-8?Q?A=2E_Fern=C3=A1ndez?= To: Chuhong Yuan Cc: linux-fsdevel@vger.kernel.org, LKML Subject: Re: [PATCH 2/2] hfsplus: add a check for hfs_bnode_find Message-ID: <20191017205222.GA2662@eaf> References: <20191016120621.304-1-hslester96@gmail.com> <20191017000703.GA4271@eaf> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 17, 2019 at 09:30:20AM +0800, Chuhong Yuan wrote: > On Thu, Oct 17, 2019 at 8:07 AM Ernesto A. Fernández > wrote: > > > > Hi, > > > > On Wed, Oct 16, 2019 at 08:06:20PM +0800, Chuhong Yuan wrote: > > > hfs_brec_update_parent misses a check for hfs_bnode_find and may miss > > > the failure. > > > Add a check for it like what is done in again. > > > > > > Signed-off-by: Chuhong Yuan > > > --- > > > fs/hfsplus/brec.c | 2 ++ > > > 1 file changed, 2 insertions(+) > > > > > > diff --git a/fs/hfsplus/brec.c b/fs/hfsplus/brec.c > > > index 1918544a7871..22bada8288c4 100644 > > > --- a/fs/hfsplus/brec.c > > > +++ b/fs/hfsplus/brec.c > > > @@ -434,6 +434,8 @@ static int hfs_brec_update_parent(struct hfs_find_data *fd) > > > new_node->parent = tree->root; > > > } > > > fd->bnode = hfs_bnode_find(tree, new_node->parent); > > > + if (IS_ERR(fd->bnode)) > > > + return PTR_ERR(fd->bnode); > > > > You shouldn't just return here, you still hold a reference to new_node. > > The call to hfs_bnode_find() after the again label seems to be making a > > similar mistake. > > > > I don't think either one can actually fail though, because the parent > > nodes have all been read and hashed before, haven't they? > > > > I find that after hfs_bnode_findhash in hfs_bnode_find, there is a test for > HFS_BNODE_ERROR and may return an error. I'm not sure whether it > can happen here. That would require a race between hfs_bnode_find() and hfs_bnode_create(), but the node has already been created. > > > > /* create index key and entry */ > > > hfs_bnode_read_key(new_node, fd->search_key, 14); > > > cnid = cpu_to_be32(new_node->this); > > > -- > > > 2.20.1 > > >