Skip to content

Commit d8cdeda

Browse files
Daniel Borkmanndavem330
authored andcommitted
net: tcp_probe: kprobes: adapt jtcp_rcv_established signature
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>
1 parent b4c1c1d commit d8cdeda

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

net/ipv4/tcp_probe.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ static inline int tcp_probe_avail(void)
9292
* Note: arguments must match tcp_rcv_established()!
9393
*/
9494
static int jtcp_rcv_established(struct sock *sk, struct sk_buff *skb,
95-
struct tcphdr *th, unsigned int len)
95+
const struct tcphdr *th, unsigned int len)
9696
{
9797
const struct tcp_sock *tp = tcp_sk(sk);
9898
const struct inet_sock *inet = inet_sk(sk);
@@ -225,6 +225,13 @@ static __init int tcpprobe_init(void)
225225
{
226226
int ret = -ENOMEM;
227227

228+
/* Warning: if the function signature of tcp_rcv_established,
229+
* has been changed, you also have to change the signature of
230+
* jtcp_rcv_established, otherwise you end up right here!
231+
*/
232+
BUILD_BUG_ON(__same_type(tcp_rcv_established,
233+
jtcp_rcv_established) == 0);
234+
228235
init_waitqueue_head(&tcp_probe.wait);
229236
spin_lock_init(&tcp_probe.lock);
230237

0 commit comments

Comments
 (0)