From: Colin Ian King <colin.king@canonical.com>
To: Dave Jiang <dave.jiang@intel.com>
Cc: Vinod Koul <vkoul@kernel.org>,
dmaengine@vger.kernel.org,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: re: dmaengine: idxd: fix submission race window
Date: Thu, 22 Jul 2021 19:56:53 +0100 [thread overview]
Message-ID: <92a5510c-f426-1001-5311-6c615df2e7de@canonical.com> (raw)
Hi,
Static analysis with Coverity on Linux-next has found an issue with the
following commit:
commit 6b4b87f2c31ac1af4f244990a7cbfb50d3f3e33f
Author: Dave Jiang <dave.jiang@intel.com>
Date: Wed Jul 14 11:50:06 2021 -0700
dmaengine: idxd: fix submission race window
The analysis is as follows:
180static int irq_process_pending_llist(struct idxd_irq_entry *irq_entry,
181 int *processed, u64 data)
182{
183 struct idxd_desc *desc, *t;
184 struct llist_node *head;
185 int queued = 0;
186 unsigned long flags;
187
188 *processed = 0;
189 head = llist_del_all(&irq_entry->pending_llist);
190 if (!head)
191 goto out;
192
193 llist_for_each_entry_safe(desc, t, head, llnode) {
assignment: Assigning: status = (*desc).completion->status & 0x7f.
194 u8 status = desc->completion->status &
DSA_COMP_STATUS_MASK;
195
cond_between: Condition status, taking true branch. Now the value of
status is between 1 and 127.
cond_cannot_single: Condition status, taking true branch. Now the
value of status cannot be equal to 0.
196 if (status) {
between: At condition status == IDXD_COMP_DESC_ABORT, the value of
status must be between 1 and 127.
cond_cannot_set: Condition status == IDXD_COMP_DESC_ABORT, taking
false branch. Now the value of status cannot be equal to any of {0, 255}.
cannot_single: At condition status == IDXD_COMP_DESC_ABORT, the value
of status cannot be equal to 0.
dead_error_condition: The condition !!(status ==
IDXD_COMP_DESC_ABORT) cannot be true.
197 if (unlikely(status == IDXD_COMP_DESC_ABORT)) {
Logically dead code (DEADCODE)
dead_error_begin: Execution cannot reach this statement:
complete_desc(desc, IDXD_CO....
198 complete_desc(desc, IDXD_COMPLETE_ABORT);
199 (*processed)++;
200 continue;
201 }
202
203 complete_desc(desc, IDXD_COMPLETE_NORMAL);
204 (*processed)++;
The check (status == IDXD_COMP_DESC_ABORT) is always false since status
was previously masked with 0x7f and IDXD_COMP_DESC_ABORT is 0xff
Colin.
reply other threads:[~2021-07-22 18:56 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=92a5510c-f426-1001-5311-6c615df2e7de@canonical.com \
--to=colin.king@canonical.com \
--cc=dave.jiang@intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=vkoul@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;
as well as URLs for NNTP newsgroup(s).