Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3711253ybi; Mon, 29 Jul 2019 11:13:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqw8wekRe2rkirD0k0mAwQzReFU2LG8R0W4xUGWu5ADYaawBToGrZR3KTR+lw9syQPkyjUWO X-Received: by 2002:a63:a346:: with SMTP id v6mr59283661pgn.57.1564423985848; Mon, 29 Jul 2019 11:13:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564423985; cv=none; d=google.com; s=arc-20160816; b=haB+k0wVq6jIsULOMxU8c+3WChnvTJBmRMTCemCQ6SLu8X8ObLc/fQJN4+eJLxVRtD eqtSloFxlPOL25/NVci0uB51Q4m0ARdNpO1PhgoIFnjsA8gbni7uDxGzgjBvkjBHvCK4 0ji9Fh96ckbRfndocJE0+WkZNUJaoCM463qH2nGSLgVuxTfj1qkOdexZwS1jiknWljRn qSb8xbdyoiVm1uq9JQMsiULOo7ej/IxM2j2tam1bu6H3+fs1u/SA2O2Y9SQaFLB2ZOnd TcgUtlP1I08rYpGCVybjsE4ffJmvQ6zA+BTLppurADN4ttxAncuBYsS4s7QQ5bU4VFf2 oSvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature:dkim-signature; bh=OaTK1xULZ3rZnh5gtz+9UPvnH9ji807q7n5daRateWE=; b=GHoykjeBFwXfwowhqXUFMQHXTkfPXkZKrCV50oZ0o0vAZUEPkRk439GeEhawmteALL vQnfPJT/yzRUt040T81yagEBZQ05a+YqGFvY4U45d6zz0h9cORWUZAx/BDE/wNrxHAtG s3xtJ7HkBqfXdGPqpjeTtBUqp4Sqk0Gy1ueA8uoumcDuaMkHSJ1emLrmGWN4fgOzkzhK yPCr0zEH7SFkJZRP7cQYEqMcY69Mm8t1WtlL98Z1UcdYAcdSYCREm+EipaRTavCjA1iT LYkTuLo9djk8rsECbQ4+ZZxePHxcsH0OQfG6KdsQt9ChUgjXlSfggXmkRBJ088LJlUy9 Eq5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=EprW1r+E; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=EprW1r+E; 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=hansenpartnership.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g8si26672146pjp.57.2019.07.29.11.12.50; Mon, 29 Jul 2019 11:13:05 -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=fail header.i=@hansenpartnership.com header.s=20151216 header.b=EprW1r+E; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=EprW1r+E; 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=hansenpartnership.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728705AbfG2PCp (ORCPT + 99 others); Mon, 29 Jul 2019 11:02:45 -0400 Received: from bedivere.hansenpartnership.com ([66.63.167.143]:36088 "EHLO bedivere.hansenpartnership.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727168AbfG2PCo (ORCPT ); Mon, 29 Jul 2019 11:02:44 -0400 Received: from localhost (localhost [127.0.0.1]) by bedivere.hansenpartnership.com (Postfix) with ESMTP id 3D4EF8EE128; Mon, 29 Jul 2019 08:02:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=hansenpartnership.com; s=20151216; t=1564412564; bh=AXFFEJd9Z+18E4ObOxvkjLDLsngNOvQy6aoRiwcys2A=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=EprW1r+EW/YWTOUw/uvCXRsE7c7By6UIgumC4MaW1eJu2fXPEecjGfFRQfkdy0U2I B8HdedUX5X0f0fbVa0MDGNpR6c/0Wl600FHmM+Z5t1Yj7ayetkPnygB+bcqiLnCkvs r+9sqS+4sCpGDEZjL2W4X6Hl2wEe45cRXMEkmnWA= Received: from bedivere.hansenpartnership.com ([127.0.0.1]) by localhost (bedivere.hansenpartnership.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ql8M7lsLqgpc; Mon, 29 Jul 2019 08:02:44 -0700 (PDT) Received: from jarvis.lan (unknown [50.35.71.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bedivere.hansenpartnership.com (Postfix) with ESMTPSA id 943F48EE116; Mon, 29 Jul 2019 08:02:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=hansenpartnership.com; s=20151216; t=1564412564; bh=AXFFEJd9Z+18E4ObOxvkjLDLsngNOvQy6aoRiwcys2A=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=EprW1r+EW/YWTOUw/uvCXRsE7c7By6UIgumC4MaW1eJu2fXPEecjGfFRQfkdy0U2I B8HdedUX5X0f0fbVa0MDGNpR6c/0Wl600FHmM+Z5t1Yj7ayetkPnygB+bcqiLnCkvs r+9sqS+4sCpGDEZjL2W4X6Hl2wEe45cRXMEkmnWA= Message-ID: <1564412562.3501.9.camel@HansenPartnership.com> Subject: Re: [PATCH] target: iscsi: iscsi_target_tpg: Fix a possible null-pointer dereference in iscsit_tpg_add_network_portal() From: James Bottomley To: Jia-Ju Bai , martin.petersen@oracle.com, kstewart@linuxfoundation.org, allison@lohutok.net, rfontana@redhat.com, tglx@linutronix.de, gregkh@linuxfoundation.org Cc: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-kernel@vger.kernel.org Date: Mon, 29 Jul 2019 08:02:42 -0700 In-Reply-To: <20190729022956.18192-1-baijiaju1990@gmail.com> References: <20190729022956.18192-1-baijiaju1990@gmail.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.6 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2019-07-29 at 10:29 +0800, Jia-Ju Bai wrote: > In iscsit_tpg_add_network_portal(), there is an if statement on line > 496 > to check whether tpg->tpg_tiqn is NULL: > if (tpg->tpg_tiqn) > > When tpg->tpg_tiqn is NULL, it is used on line 508: > pr_debug(..., tpg->tpg_tiqn->tiqn, ...); > > Thus, a possible null-pointer dereference may occur. > > To fix this bug, tpg->tpg_tiqn is checked before being used. > > This bug is found by a static analysis tool STCheck written by us. I don't really think this is helpful. The first question is, is the implied might be NULL check correct? The tpg_tiqn is always set by a non-dummy driver and I think network configuration is only done for the non dummy driver, so I suspect the NULL check is wrong. Secondly even if the NULL check were correct, I think there's still a need for some debugging output, so the proposed patch also looks wrong. James