Skip to content

Commit

Permalink
SUNRPC: Fix sockaddr handling in svcsock_accept_class trace points
Browse files Browse the repository at this point in the history
Avoid potentially hazardous memory copying and the needless use of
"%pIS" -- in the kernel, an RPC service listener is always bound to
ANYADDR. Having the network namespace is helpful when recording
errors, though.

Fixes: a0469f4 ("SUNRPC: Replace dprintk call sites in TCP state change callouts")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
  • Loading branch information
Chuck Lever committed Jan 10, 2022
1 parent dc6c6fb commit 1672086
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions include/trace/events/sunrpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -2125,17 +2125,17 @@ DECLARE_EVENT_CLASS(svcsock_accept_class,
TP_STRUCT__entry(
__field(long, status)
__string(service, service)
__array(unsigned char, addr, sizeof(struct sockaddr_in6))
__field(unsigned int, netns_ino)
),

TP_fast_assign(
__entry->status = status;
__assign_str(service, service);
memcpy(__entry->addr, &xprt->xpt_local, sizeof(__entry->addr));
__entry->netns_ino = xprt->xpt_net->ns.inum;
),

TP_printk("listener=%pISpc service=%s status=%ld",
__entry->addr, __get_str(service), __entry->status
TP_printk("addr=listener service=%s status=%ld",
__get_str(service), __entry->status
)
);

Expand Down

0 comments on commit 1672086

Please sign in to comment.