From: "Marciniszyn, Mike" <mike.marciniszyn@cornelisnetworks.com>
To: Tuo Li <islituo@gmail.com>,
"Dalessandro, Dennis" <dennis.dalessandro@cornelisnetworks.com>,
"dledford@redhat.com" <dledford@redhat.com>,
"jgg@ziepe.ca" <jgg@ziepe.ca>
Cc: "linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
Linux Kernel <linux-kernel@vger.kernel.org>,
"baijiaju1990@gmail.com" <baijiaju1990@gmail.com>
Subject: RE: [BUG] RDMA/hw/qib/qib_iba6120: possible buffer underflow in rcvctrl_6120_mod()
Date: Tue, 17 Aug 2021 18:37:25 +0000 [thread overview]
Message-ID: <CH0PR01MB71533F43952BA6C56AC21C4EF2FE9@CH0PR01MB7153.prod.exchangelabs.com> (raw)
In-Reply-To: <9c03a5f4-865b-000e-0206-9e01f876261a@gmail.com>
> Subject: [BUG] RDMA/hw/qib/qib_iba6120: possible buffer underflow in
> rcvctrl_6120_mod()
>
> Hello,
>
> Our static analysis tool reports a possible buffer underflow in qib_iba6120.c in
> Linux 5.14.0-rc3:
>
> The variable ctxt is checked in:
> 2110: if (ctxt < 0)
>
> This indicates that ctxt can be negative.
> If so, possible buffer underflows will occur:
> 2120: qib_write_kreg_ctxt(dd, kr_rcvhdrtailaddr, ctxt,
> dd->rcd[ctxt]->rcvhdrqtailaddr_phys);
> 2122: qib_write_kreg_ctxt(dd, kr_rcvhdraddr, ctxt,
> dd->rcd[ctxt]->rcvhdrq_phys);
>
> However, I am not sure whether ctxt < 0 and op & QIB_RCVCTRL_CTXT_ENB
> can be true at the same time.
>
> Any feedback would be appreciated, thanks!
>
Look at the assignment to f_rcvctrl and the calls using that variable:
5 qib_iba6120.c qib_init_iba6120_funcs 3463 dd->f_rcvctrl = rcvctrl_6120_mod;
6 qib_iba7220.c qib_init_iba7220_funcs 4508 dd->f_rcvctrl = rcvctrl_7220_mod;
7 qib_iba7322.c qib_init_iba7322_funcs 7198 dd->f_rcvctrl = rcvctrl_7322_mod;
All these functions have the same "issue". The -1 parameter implies all contexts and the -1 ctxt happens from init_after_reset() and qib_shutdown_device() and by code inspection, they only or in operations that lack QIB_RCVCTRL_CTXT_ENB, thus avoiding the code path that writes a per context CSR using the ctxt as an index.
I don't think this is an issue.
Mike
next prev parent reply other threads:[~2021-08-17 18:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-12 7:35 Tuo Li
2021-08-17 18:37 ` Marciniszyn, Mike [this message]
2021-08-17 18:46 ` Marciniszyn, Mike
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=CH0PR01MB71533F43952BA6C56AC21C4EF2FE9@CH0PR01MB7153.prod.exchangelabs.com \
--to=mike.marciniszyn@cornelisnetworks.com \
--cc=baijiaju1990@gmail.com \
--cc=dennis.dalessandro@cornelisnetworks.com \
--cc=dledford@redhat.com \
--cc=islituo@gmail.com \
--cc=jgg@ziepe.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
/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
all inboxes | Powered by JetHome®