Skip to content

Commit

Permalink
xsk: fix to reject invalid options in Tx descriptor
Browse files Browse the repository at this point in the history
Passing a non-existing option in the options member of struct
xdp_desc was, incorrectly, silently ignored. This patch addresses
that behavior, and drops any Tx descriptor with non-existing options.

We have examined existing user space code, and to our best knowledge,
no one is relying on the current incorrect behavior. AF_XDP is still
in its infancy, so from our perspective, the risk of breakage is very
low, and addressing this problem now is important.

Fixes: 35fcde7 ("xsk: support for Tx")
Signed-off-by: Björn Töpel <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
  • Loading branch information
Björn Töpel authored and borkmann committed Mar 8, 2019
1 parent f54ba39 commit c57b557
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/xdp/xsk_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ static inline bool xskq_is_valid_desc(struct xsk_queue *q, struct xdp_desc *d)
if (!xskq_is_valid_addr(q, d->addr))
return false;

if (((d->addr + d->len) & q->chunk_mask) !=
(d->addr & q->chunk_mask)) {
if (((d->addr + d->len) & q->chunk_mask) != (d->addr & q->chunk_mask) ||
d->options) {
q->invalid_descs++;
return false;
}
Expand Down

0 comments on commit c57b557

Please sign in to comment.