Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2DFDC4332F for ; Sun, 2 Jan 2022 18:06:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230297AbiABSGl (ORCPT ); Sun, 2 Jan 2022 13:06:41 -0500 Received: from isilmar-4.linta.de ([136.243.71.142]:39758 "EHLO isilmar-4.linta.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229634AbiABSGb (ORCPT ); Sun, 2 Jan 2022 13:06:31 -0500 X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES Received: from owl.dominikbrodowski.net (owl.brodo.linta [10.2.0.111]) by isilmar-4.linta.de (Postfix) with ESMTPSA id 9E42220140C; Sun, 2 Jan 2022 18:06:30 +0000 (UTC) Received: by owl.dominikbrodowski.net (Postfix, from userid 1000) id 266AB80660; Sun, 2 Jan 2022 18:47:27 +0100 (CET) Date: Sun, 2 Jan 2022 18:47:27 +0100 From: Dominik Brodowski To: Zhou Qingyang Cc: kjlu@umn.edu, Lee Jones , linux-kernel@vger.kernel.org Subject: Re: [PATCH] pcmcia: rsrc_nonstatic: Fix a NULL pointer dereference in nonstatic_find_mem_region() Message-ID: References: <20211130181142.220254-1-zhou1615@umn.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211130181142.220254-1-zhou1615@umn.edu> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Wed, Dec 01, 2021 at 02:11:40AM +0800 schrieb Zhou Qingyang: > In nonstatic_find_mem_region(), pcmcia_make_resource() is assigned to > res and used in pci_bus_alloc_resource(). There a dereference of res > in pci_bus_alloc_resource(), which could lead to a NULL pointer > dereference on failure of pcmcia_make_resource(). > > Fix this bug by adding a check of res. > > This bug was found by a static analyzer. The analysis employs > differential checking to identify inconsistent security operations > (e.g., checks or kfrees) between two code paths and confirms that the > inconsistent operations are not recovered in the current function or > the callers, so they constitute bugs. > > Note that, as a bug found by static analysis, it can be a false > positive or hard to trigger. Multiple researchers have cross-reviewed > the bug. > > Builds with CONFIG_PCCARD_NONSTATIC=y show no new warnings, > and our static analyzer no longer warns about this code. > > Fixes: 49b1153adfe1 ("pcmcia: move all pcmcia_resource_ops providers into one module") > Signed-off-by: Zhou Qingyang Same caveat as before, but applied nonetheless. Thanks, Dominik