Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2430251imm; Sat, 9 Jun 2018 15:23:49 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKb5DZO2IuvLm9H/BGHESXbt6nhh++1pBTvwaLyNDbeq1yKNh44012BeBDBvPjOIGG//kCG X-Received: by 2002:a63:7459:: with SMTP id e25-v6mr9590423pgn.186.1528583029798; Sat, 09 Jun 2018 15:23:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528583029; cv=none; d=google.com; s=arc-20160816; b=tnP4rgR7+7Q7C68Qkw2VDudpmrCCTskE0sNgigx9DJm5z+43Gr7cdJQB+ZJ1ETnIs4 W7uIy2npWinbpfgEYAxMkjgpxVR6AfulS5qjgVG6W+RHKuoqTIeW3gGilnSPfabZlYZF yucyS6kwqIjg70cun9bv3iRKIPouqsodZ7lBflRY1hOzjaVonN3FyfN9dkQEKBXL6WIS YVtXQiVykrJcSv8Y8QojMbc7s+PXwaGV+YhiNB2qp5Qd3F4h06gCpaRen5/UKwVvDWO3 djUwoMfWtyFtM6TLX07XXpjk6Zp9xSXr0AcWOED9Kdak2Qs2sROsVg3gS6cDKt/LrDkv Cz6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=LmMFwgVn9r6VV1iIg/LsH7YUfMu8AGmbrAHi+bIsn4o=; b=aM8Xl8HIJz+RhETiamgO3r4Q1dbgGZx6sB+YEgRveygkGNPXa+E/Qgg+Bm+J/YUeE5 5AvssmXpUV3o5RXOgnYJu8aA4LAXTJ8EH9pASaQj7XAim7Cx9ieloL8lQm9tsFEA6YnZ qT3WZAlN5lkJ05joK+EOIDCdtbAsbS+tWkS21sbojj4O2pSVrpOxqv2K0eaUsYQtfj4p mmX9HiHpGg2NAX0s9sA0YuMhVyvIEHkJpFt8KiW+D/hFBAsge9c2emCG/dpqcT+8N4Nm 4dyKHID2To0gngOvZmN4HGx6vswKBddmAliW/gWYXp4wlJ68Unb05C9WryaxrIGMXbF5 QlFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=c0Ei0b8m; dkim=pass header.i=@codeaurora.org header.s=default header.b=c0Ei0b8m; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f26-v6si12093888pfn.366.2018.06.09.15.23.35; Sat, 09 Jun 2018 15:23:49 -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=@codeaurora.org header.s=default header.b=c0Ei0b8m; dkim=pass header.i=@codeaurora.org header.s=default header.b=c0Ei0b8m; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753503AbeFIWW6 (ORCPT + 99 others); Sat, 9 Jun 2018 18:22:58 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:40774 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753408AbeFIWW5 (ORCPT ); Sat, 9 Jun 2018 18:22:57 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 9835B6074D; Sat, 9 Jun 2018 22:22:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1528582976; bh=PvP1EVL2pl5QrExOD+bUp54xz3TxVXc90a10fKzWKXk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=c0Ei0b8mbso2Q26ifpRqEoTFLh1iTU3rTjQpoV9Y+RmKTBCGeBZh4N+8/tC1pUjm9 SWQbBbgw30jkYvRtGY6nWVWy7Fj0V0ifK7SABq7ziOZRi/pprao73yUZvNu9Twomrf M+BaaPT0WrPyU/3SkB+Tkj1HFWpoa3sU6CNLzZf8= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 14B72600D0; Sat, 9 Jun 2018 22:22:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1528582976; bh=PvP1EVL2pl5QrExOD+bUp54xz3TxVXc90a10fKzWKXk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=c0Ei0b8mbso2Q26ifpRqEoTFLh1iTU3rTjQpoV9Y+RmKTBCGeBZh4N+8/tC1pUjm9 SWQbBbgw30jkYvRtGY6nWVWy7Fj0V0ifK7SABq7ziOZRi/pprao73yUZvNu9Twomrf M+BaaPT0WrPyU/3SkB+Tkj1HFWpoa3sU6CNLzZf8= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Sat, 09 Jun 2018 18:22:56 -0400 From: okaya@codeaurora.org To: Andy Shevchenko Cc: Anton Vasilyev , Greg Kroah-Hartman , Johannes Thumshirn , Gaurav Pathak , Hannes Reinecke , devel@driverdev.osuosl.org, Linux Kernel Mailing List , ldv-project@linuxtesting.org Subject: Re: [PATCH] staging: rts5208: add check on NULL before dereference In-Reply-To: References: <20180609163829.30619-1-vasilyev@ispras.ru> Message-ID: <6358f10997e30da2fe91e75525d14131@codeaurora.org> X-Sender: okaya@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-06-09 15:34, Andy Shevchenko wrote: > On Sat, Jun 9, 2018 at 7:58 PM, wrote: >> On 2018-06-09 12:38, Anton Vasilyev wrote: >>> >>> If rtsx_probe fails to allocate dev->chip, then NULL pointer >>> dereference occurs at rtsx_release_resources(). >>> >>> Patch adds checks chip on NULL before its dereference at >>> rtsx_release_resources and passing with dereference inside >>> rtsx_release_chip. >>> >>> Found by Linux Driver Verification project (linuxtesting.org). > >> I think you should bail out if dev->chip is null rather than adding >> conditiinals. > > I'm wondering if it's false positive. At which circumstances that may > happen? Only if dev->chip allocation fails. Code tries to cleanup prior resources by calling clean_everything() function which ends up in rtsx_release_resources()