Daniel Borkmann says:

====================
pull-request: bpf 2021-01-20

1) Fix wrong bpf_map_peek_elem_proto helper callback, from Mircea Cirjaliu.

2) Fix signed_{sub,add32}_overflows type truncation, from Daniel Borkmann.

3) Fix AF_XDP to also clear pools for inactive queues, from Maxim Mikityanskiy.

* https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf:
  bpf: Fix signed_{sub,add32}_overflows type handling
  xsk: Clear pool even for inactive queues
  bpf: Fix helper bpf_map_peek_elem_proto pointing to wrong callback
====================

Link: https://lore.kernel.org/r/20210120163439.8160-1-daniel@iogearbox.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Jakub Kicinski 2021-01-20 08:47:34 -08:00
commit b3741b4388
3 changed files with 6 additions and 6 deletions

View File

@ -108,7 +108,7 @@ BPF_CALL_2(bpf_map_peek_elem, struct bpf_map *, map, void *, value)
} }
const struct bpf_func_proto bpf_map_peek_elem_proto = { const struct bpf_func_proto bpf_map_peek_elem_proto = {
.func = bpf_map_pop_elem, .func = bpf_map_peek_elem,
.gpl_only = false, .gpl_only = false,
.ret_type = RET_INTEGER, .ret_type = RET_INTEGER,
.arg1_type = ARG_CONST_MAP_PTR, .arg1_type = ARG_CONST_MAP_PTR,

View File

@ -5313,7 +5313,7 @@ static bool signed_add_overflows(s64 a, s64 b)
return res < a; return res < a;
} }
static bool signed_add32_overflows(s64 a, s64 b) static bool signed_add32_overflows(s32 a, s32 b)
{ {
/* Do the add in u32, where overflow is well-defined */ /* Do the add in u32, where overflow is well-defined */
s32 res = (s32)((u32)a + (u32)b); s32 res = (s32)((u32)a + (u32)b);
@ -5323,7 +5323,7 @@ static bool signed_add32_overflows(s64 a, s64 b)
return res < a; return res < a;
} }
static bool signed_sub_overflows(s32 a, s32 b) static bool signed_sub_overflows(s64 a, s64 b)
{ {
/* Do the sub in u64, where overflow is well-defined */ /* Do the sub in u64, where overflow is well-defined */
s64 res = (s64)((u64)a - (u64)b); s64 res = (s64)((u64)a - (u64)b);
@ -5335,7 +5335,7 @@ static bool signed_sub_overflows(s32 a, s32 b)
static bool signed_sub32_overflows(s32 a, s32 b) static bool signed_sub32_overflows(s32 a, s32 b)
{ {
/* Do the sub in u64, where overflow is well-defined */ /* Do the sub in u32, where overflow is well-defined */
s32 res = (s32)((u32)a - (u32)b); s32 res = (s32)((u32)a - (u32)b);
if (b < 0) if (b < 0)

View File

@ -108,9 +108,9 @@ EXPORT_SYMBOL(xsk_get_pool_from_qid);
void xsk_clear_pool_at_qid(struct net_device *dev, u16 queue_id) void xsk_clear_pool_at_qid(struct net_device *dev, u16 queue_id)
{ {
if (queue_id < dev->real_num_rx_queues) if (queue_id < dev->num_rx_queues)
dev->_rx[queue_id].pool = NULL; dev->_rx[queue_id].pool = NULL;
if (queue_id < dev->real_num_tx_queues) if (queue_id < dev->num_tx_queues)
dev->_tx[queue_id].pool = NULL; dev->_tx[queue_id].pool = NULL;
} }