Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp163107pxb; Wed, 27 Oct 2021 00:08:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjO+Q62wgQtlTkRMefLKpnW7fkq4BB04BHBB7FcIkf5YLFX3hvWayWgNjZNZrytG2Ah4Oq X-Received: by 2002:a05:6402:713:: with SMTP id w19mr1222378edx.37.1635318491492; Wed, 27 Oct 2021 00:08:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635318491; cv=none; d=google.com; s=arc-20160816; b=0cfm3hJ4TTXUnaLKPDDq/MZQXb6TBPOsPgA3rYKrCL1TCp6ILm48Y23xJ73RParPkx MSVrx0EbzFCfv3iQvX6KzzHwE3Mkq9WRML0zxtvBdkE7bcElQqu+rK73Mhzqw8o62gzs bi6ElYHGrgHSEBO9RqqmRdLeWy0/VdFdNs8xjDD8S5aA6IRNGZyZKEWyJYQLNhFEwzLe xICziCFrUpl70oKA+0Vs8K7oSKUwA/7N0fSFi2FZ8HsM30Kkm4ICtrUpBPanKGOzUMdk 0sgReK83WFOSQz4VT5fYfcCkYUpdOPDkCXQGc/mAwfJP+hevtwRvgxgLx2rOQ/GOroTp /JGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=HatkSwwWXAPS+QA7K6+ZH1dx+GegwY193wnTxtpGRUI=; b=GLM8SGtxRnv06McOzmMR8DDiFuHq4VtKzn4cRPpawFOwNwegfsS4k1BFMfC3xdtR1o jcgouH1NdJ8WlGc9Eml97tg8oOR53k+2NbZ6EBT6jp87em5Ce203RX7OiqEAyS21jJPQ v6GpnmxY6nlV1cUWo+9YjmkH8us6wQhwXddLf+xwJTbmGt79zw2P+Zj2BNMP3IYVkiGJ e6H/zbmc/vu/UrjoKrhd1zOTJljcv5JAlQN23Db544WEGNWLv16nfP2ioq3hmGmDzJtq 6s5hTAfcASilhaTNvijOVn2kRD+tbtFrIPqe5bWM9nyU69FV92LosIWIIIy/QYgb4OsI SDyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=g30x3pZv; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h5si19764356ejj.144.2021.10.27.00.07.46; Wed, 27 Oct 2021 00:08:11 -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=@kernel.org header.s=k20201202 header.b=g30x3pZv; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236533AbhJZSjd (ORCPT + 99 others); Tue, 26 Oct 2021 14:39:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:37576 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230225AbhJZSjc (ORCPT ); Tue, 26 Oct 2021 14:39:32 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D25DF60E05; Tue, 26 Oct 2021 18:37:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1635273428; bh=1xQXVhbF8/BGLuvjiPQZc83KtW2+s7akCS60PQNrPZg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=g30x3pZvp/LbCs0Ax/nHYsd74I1JEAOKbTMArMvXnNkfibGEYWkLJSFx4Zytob6Bl F1iMT7y2fiD6zrj/XCf6jOAgGtDVvBg5gxOJcaZMoMO6MCAm4MmSWUh7cNAbG0hsWp ki9rEZgjxnq43vVD/BUU2qEJX3Evz4S9ttVDkFK5xVQsAiZq/r0lA/ptW4GANCPQmO raVqRcux30VB2ahlzI9+PnTXjazdX0SySkBbWjXHYc1MDw4zw2Xo5ABQvPpKr6Afoi koSXsza+Ospt210rf7g2WHLxvkljZOkaszX1Tkkr38o4AWaSI2FRkH0Wty5/q27pIJ iGjvwPiqXqKPQ== Date: Tue, 26 Oct 2021 13:42:01 -0500 From: "Gustavo A. R. Silva" To: Tyrel Datwyler Cc: Michael Ellerman , 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 Message-ID: <20211026184201.GB1457721@embeddedor> References: <20211015050345.GA1161918@embeddedor> <97c42e43-15b9-5db6-d460-dbb16f31954d@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <97c42e43-15b9-5db6-d460-dbb16f31954d@linux.ibm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Thanks, Tyrel. -- Gustavo