Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp416577pxb; Wed, 27 Oct 2021 05:31:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwY3rd1SNgotymQD1tQQd2ODZPjIPasl59b7DwMIPxik3KqAe3lhA7jGPWBAWQel04dyIjT X-Received: by 2002:a50:d80d:: with SMTP id o13mr42939375edj.204.1635337864923; Wed, 27 Oct 2021 05:31:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635337864; cv=none; d=google.com; s=arc-20160816; b=Wg14XcZuJnSOGr6AqMwmvfaf5ml3pUmx7gxu9MvjNOUB1uXCPaHDcv9ORy4qXG5i+f tu7+8Lc2X9MFMLaHMMjEjR2HbvyaHHSwMrZ0JTfLGj2zGgPWb/ABpppbb5rP/bVKq4+I eyju6baM8/QRidi1fQHL7vCX/wqd3xV8HPSm12fbBbbDdjyCKZTZasBjXrSz1agfkvqc G6v4Xz7BeCQ8Aa0G+nPeiPK/ajEnK5F5mXzRgRfb4eCQiNC/gL1WHrdw97iCaXEX8Mza VI6h606xcStfcxs1Ica+2QCiPVWAVbMhKOPdCeEpT3jMr2S3qKkW8SD5Vkomh11WnDu1 RRag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=XefSZASUt0Shq3/7ecZYzgnUVFy7rObUidTFXFQDrPU=; b=aJcBQTJumpVQaWq65xqXspeVLM2fpzw8Ql3u9Qy1uJ59oZPMbH3OBRuktGWd5ElEAo khxVn0G+ooKmzMxBBZ0M/AomSRNHc+k5mn1LWjzhxWxFIUDjHFPTVDAVaRYk9kQCu1VP kCxgNAyTPAykyxTIefqX7XawKOAF3tzekR4li5AD1Q6rFl3ZgkG2Pe80SH+3D9XMeVVP 07solKn7zJcXeveki6jjo+F1iAh92cqCJwip+D2OxHSSia8470a/jjMhtqP0WJjvfUL3 xjr/vzPFGO1P/F+slOjFjI4crNkJhyQ/gh4juNK7TAggGIMtX8jp8YA9M4lYqnmsWxM0 eSxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=esTDXAO9; 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 30si31532123ejl.658.2021.10.27.05.30.08; Wed, 27 Oct 2021 05:31:04 -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=pass header.i=@ellerman.id.au header.s=201909 header.b=esTDXAO9; 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 S240042AbhJZWdZ (ORCPT + 99 others); Tue, 26 Oct 2021 18:33:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230411AbhJZWdY (ORCPT ); Tue, 26 Oct 2021 18:33:24 -0400 Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee2:21ea]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DA67C061570; Tue, 26 Oct 2021 15:31:00 -0700 (PDT) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4Hf63f3HMqz4xbG; Wed, 27 Oct 2021 09:30:54 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellerman.id.au; s=201909; t=1635287454; bh=XefSZASUt0Shq3/7ecZYzgnUVFy7rObUidTFXFQDrPU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=esTDXAO9VPl+gb2NPopWhgwRcoAKMImKj95UXpm2end2j9VxyW8qWOQExKFdCD2r3 4a+mjM6PhzR1Dx7NnsaUdKC8A9h4hQH8QbVPjd0w64niF0gJtD2paXrzLs8gGsawPB 5r24B/zV9OZLLbD5DXlXDGV2qQNPcx+t4qsHIlI0w/eZSBKNSktsUqTd548ZBrjqqb T5icJ4Tw5eSz+Vn8mjFyVNqqP2DygNPnzsYuRsql1asJwyp5nXjpt5mhkHuoVqt/R5 1RGTLcyFsedb3kM/5vatFc5wmHDc+TE+SvCghW+DRTZvNfXBYMfBhO26O2selqltlS Z9O13Qfolda3g== From: Michael Ellerman To: "Gustavo A. R. Silva" , Tyrel Datwyler Cc: Benjamin Herrenschmidt , Paul Mackerras , Nicholas Piggin , Haren Myneni , linux-hardening@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH][next] powerpc/vas: Fix potential NULL pointer dereference In-Reply-To: <20211026184201.GB1457721@embeddedor> References: <20211015050345.GA1161918@embeddedor> <97c42e43-15b9-5db6-d460-dbb16f31954d@linux.ibm.com> <20211026184201.GB1457721@embeddedor> Date: Wed, 27 Oct 2021 09:30:53 +1100 Message-ID: <87h7d3beqq.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org "Gustavo A. R. Silva" writes: > On Mon, Oct 18, 2021 at 02:09:31PM -0700, Tyrel Datwyler wrote: >> On 10/14/21 10:03 PM, Gustavo A. R. Silva wrote: >> > (!ptr && !ptr->foo) strikes again. :) >> > >> > The expression (!ptr && !ptr->foo) is bogus and in case ptr is NULL, >> > it leads to a NULL pointer dereference: ptr->foo. >> > >> > Fix this by converting && to || >> > >> > This issue was detected with the help of Coccinelle, and audited and >> > fixed manually. >> > >> > Fixes: 1a0d0d5ed5e3 ("powerpc/vas: Add platform specific user window operations") >> > Cc: stable@vger.kernel.org >> > Signed-off-by: Gustavo A. R. Silva >> Looking at the usage pattern it is obvious that if we determine !ptr attempting >> to also confirm !ptr->ops is going to blow up. >> >> LGTM. >> >> Reviewed-by: Tyrel Datwyler > > I think I'll take this in my tree. I've already put it in powerpc/next: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?h=next&id=61cb9ac66b30374c7fd8a8b2a3c4f8f432c72e36 If you need to pick it up as well for some reason that's fine. cheers