Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9323485ybi; Wed, 24 Jul 2019 02:06:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqwyOO4uJbwstSzr15DKsqiVljtFqO/xZVfjFK9sEPHaypfFqinXybBGeRcVn1U5/KChgsew X-Received: by 2002:a63:d555:: with SMTP id v21mr58159564pgi.179.1563959179388; Wed, 24 Jul 2019 02:06:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563959179; cv=none; d=google.com; s=arc-20160816; b=ly1cw/TqViyOQgBLPQIlpu2l5kskojxIVE/nQOxOemK8rgKdGWAw2J3EdHqvhGU6ur 7UIWa5qc2CMLwn9zBxyFbpGKRD4alx61gJz1EDQRBkapWjtmllVR7OcXK2F5wRlze+aI p66aDMxVvGBKqATRlxyUHQ70MNX71n9BX6stLhrAXfYBhygmM2peubzK/b+Bfx+DY8sM 7RS7Dp5KywM1/0y6Vz5szVi0r7estGn4ElqOpr0rtM2Ecuf5mCEjL40tCDv2vatV1z5z /8cRNsrG0C3vz6pBsns0pwNRInZBrWs5EJOH4ggVLO+ZJ1Ppgqe/AomauqAdeUWEJDpc 3M9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=6vHK56wqMRi9Gt/H+eSy3G1JxqGweQC0HYoGrsgQtMg=; b=DcNbJcxWSTn3He3U26qqVaRS9wYvbu2IPsdMVfjJG9waNEmpxnOJCp2YcVwjl+SFxV AxzLhcBs52QePinQ6OWSGxRkkuR9LGsHb0BN2lJnUF4uL6/s+I6SBj8xleogZbYWqDco Qo9/2Ez5X+asN9Omb3wV1L++zaI2boVgoPxCM1sQmvW4goGdtBBzFjzDISTSzd/wPnpr zpX0sp/TmRIEdr7TDFA2HfkEhmG1fF7Py0E2jGwywTA98i6NESaAlElMienmeekFuBr1 8X22LfOZ4OQggrmLAoKZ2IIXrYilqrdmU0HAgh/b3ACrZWOro3j0jS9kd/GYIDupe0Ib CKYQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o12si13595431pgn.390.2019.07.24.02.06.03; Wed, 24 Jul 2019 02:06:19 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726824AbfGXJFB convert rfc822-to-8bit (ORCPT + 99 others); Wed, 24 Jul 2019 05:05:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55676 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726766AbfGXJFA (ORCPT ); Wed, 24 Jul 2019 05:05:00 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9442830C75C0; Wed, 24 Jul 2019 09:05:00 +0000 (UTC) Received: from fogou.chygwyn.com (unknown [10.33.36.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D2F4D1001B28; Wed, 24 Jul 2019 09:04:56 +0000 (UTC) Subject: Re: [Cluster-devel] [BUG] fs: gfs2: possible null-pointer dereferences in gfs2_rgrp_bh_get() To: Jia-Ju Bai , rpeterso@redhat.com, agruenba@redhat.com Cc: cluster-devel@redhat.com, linux-kernel@vger.kernel.org References: <8d270882-54da-365e-1be7-a291a5178b1e@gmail.com> From: Steven Whitehouse Message-ID: Date: Wed, 24 Jul 2019 10:04:55 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <8d270882-54da-365e-1be7-a291a5178b1e@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8BIT Content-Language: en-US X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Wed, 24 Jul 2019 09:05:00 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 24/07/2019 09:50, Jia-Ju Bai wrote: > In gfs2_rgrp_bh_get, there is an if statement on line 1191 to check > whether "rgd->rd_bits[0].bi_bh" is NULL. That is how we detect whether the rgrp has already been read in, so the function is skipped in the case that we've already read in the rgrp. > When "rgd->rd_bits[0].bi_bh" is NULL, it is used on line 1216: >     gfs2_rgrp_in(rgd, (rgd->rd_bits[0].bi_bh)->b_data); No it isn't. See line 1196 where bi_bh is set, and where we also bail out (line 1198) in case it has not been set. > and on line 1225: >     gfs2_rgrp_ondisk2lvb(..., rgd->rd_bits[0].bi_bh->b_data); > and on line 1228: >     if (!gfs2_rgrp_lvb_valid(rgd)) > > Note that in gfs2_rgrp_lvb_valid(rgd), there is a statement on line 1114: >     struct gfs2_rgrp *str = (struct gfs2_rgrp > *)rgd->rd_bits[0].bi_bh->b_data; > > Thus, possible null-pointer dereferences may occur. > > These bugs are found by a static analysis tool STCheck written by us. > I do not know how to correctly fix these bugs, so I only report bugs. > > > Best wishes, > Jia-Ju Bai > So I'm not seeing how there can be a NULL deref in those later lines. I think this is another false positive, Steve.