From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Jia-Ju Bai <baijiaju1990@gmail.com>,
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
Subject: Re: [PATCH] target: iscsi: iscsi_target_tpg: Fix a possible null-pointer dereference in iscsit_tpg_add_network_portal()
Date: Mon, 29 Jul 2019 08:02:42 -0700 [thread overview]
Message-ID: <1564412562.3501.9.camel@HansenPartnership.com> (raw)
In-Reply-To: <20190729022956.18192-1-baijiaju1990@gmail.com>
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
prev parent reply other threads:[~2019-07-29 15:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-29 2:29 [PATCH] target: iscsi: iscsi_target_tpg: Fix a possible null-pointer dereference in iscsit_tpg_add_network_portal() Jia-Ju Bai
2019-07-29 15:02 ` James Bottomley [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1564412562.3501.9.camel@HansenPartnership.com \
--to=james.bottomley@hansenpartnership.com \
--cc=allison@lohutok.net \
--cc=baijiaju1990@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=kstewart@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=rfontana@redhat.com \
--cc=target-devel@vger.kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox