Skip to content

Commit

Permalink
net: tcp_probe: kprobes: adapt jtcp_rcv_established signature
Browse files Browse the repository at this point in the history
This patches fixes a rather unproblematic function signature mismatch
as the const specifier was missing for the th variable; and next to
that it adds a build-time assertion so that future function signature
mismatches for kprobes will not end badly, similarly as commit 2222299
("net: sctp: add build check for sctp_sf_eat_sack_6_2/jsctp_sf_eat_sack")
did it for SCTP.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Daniel Borkmann authored and David S. Miller committed Aug 22, 2013
1 parent b4c1c1d commit d8cdeda
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion net/ipv4/tcp_probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ static inline int tcp_probe_avail(void)
* Note: arguments must match tcp_rcv_established()!
*/
static int jtcp_rcv_established(struct sock *sk, struct sk_buff *skb,
struct tcphdr *th, unsigned int len)
const struct tcphdr *th, unsigned int len)
{
const struct tcp_sock *tp = tcp_sk(sk);
const struct inet_sock *inet = inet_sk(sk);
Expand Down Expand Up @@ -225,6 +225,13 @@ static __init int tcpprobe_init(void)
{
int ret = -ENOMEM;

/* Warning: if the function signature of tcp_rcv_established,
* has been changed, you also have to change the signature of
* jtcp_rcv_established, otherwise you end up right here!
*/
BUILD_BUG_ON(__same_type(tcp_rcv_established,
jtcp_rcv_established) == 0);

init_waitqueue_head(&tcp_probe.wait);
spin_lock_init(&tcp_probe.lock);

Expand Down

0 comments on commit d8cdeda

Please sign in to comment.