Netdev List
 help / color / mirror / Atom feed
* [PATCH v2 bpf-next 0/2] sockmap: fix sg api usage
@ 2018-03-30  0:20 Prashant Bhole
  2018-03-30  0:20 ` [PATCH v2 bpf-next 1/2] lib/scatterlist: add sg_init_marker() helper Prashant Bhole
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Prashant Bhole @ 2018-03-30  0:20 UTC (permalink / raw)
  To: Daniel Borkmann, Alexei Starovoitov, David S . Miller
  Cc: Prashant Bhole, John Fastabend, netdev

These patches fix sg api usage in sockmap. Previously sockmap didn't
use sg_init_table(), which caused hitting BUG_ON in sg api, when
CONFIG_DEBUG_SG is enabled

v1: added sg_init_table() calls wherever needed.

v2:
- Patch1 adds new helper function in sg api. sg_init_marker()
- Patch2 sg_init_marker() and sg_init_table() in appropriate places

Backgroud:
While reviewing v1, John Fastabend raised a valid point about
unnecessary memset in sg_init_table() because sockmap uses sg table
which embedded in a struct. As enclosing struct is zeroed out, there
is unnecessary memset in sg_init_table.

So Daniel Borkmann suggested to define another static inline function
in scatterlist.h which only initializes sg_magic. Also this function 
will be called from sg_init_table. From this suggestion I defined a
function sg_init_marker() which sets sg_magic and calls sg_mark_end()

Prashant Bhole (2):
  lib/scatterlist: add sg_init_marker() helper
  bpf: sockmap: initialize sg table entries properly

 include/linux/scatterlist.h | 18 ++++++++++++++++++
 kernel/bpf/sockmap.c        | 13 ++++++++-----
 lib/scatterlist.c           |  9 +--------
 3 files changed, 27 insertions(+), 13 deletions(-)

-- 
2.14.3

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-03-30 20:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-30  0:20 [PATCH v2 bpf-next 0/2] sockmap: fix sg api usage Prashant Bhole
2018-03-30  0:20 ` [PATCH v2 bpf-next 1/2] lib/scatterlist: add sg_init_marker() helper Prashant Bhole
2018-03-30  3:38   ` John Fastabend
2018-03-30  0:21 ` [PATCH v2 bpf-next 2/2] bpf: sockmap: initialize sg table entries properly Prashant Bhole
2018-03-30  3:37   ` John Fastabend
2018-03-30  3:39 ` [PATCH v2 bpf-next 0/2] sockmap: fix sg api usage John Fastabend
2018-03-30 20:52   ` Daniel Borkmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox