Skip to content

Commit

Permalink
net: sctp: add build check for sctp_sf_eat_sack_6_2/jsctp_sf_eat_sack
Browse files Browse the repository at this point in the history
In order to avoid any future surprises of kernel panics due to jprobes
function mismatches (as e.g. fixed in 4cb9d6e: sctp: jsctp_sf_eat_sack:
fix jprobes function signature mismatch), we should check both function
types during build and scream loudly if they do not match. __same_type
resolves to __builtin_types_compatible_p, which is 1 in case both types
are the same and 0 otherwise, qualifiers are ignored. Tested by myself.

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 Feb 13, 2013
1 parent 1e55817 commit 2222299
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions net/sctp/probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,13 @@ static __init int sctpprobe_init(void)
{
int ret = -ENOMEM;

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

init_waitqueue_head(&sctpw.wait);
spin_lock_init(&sctpw.lock);
if (kfifo_alloc(&sctpw.fifo, bufsize, GFP_KERNEL))
Expand Down

0 comments on commit 2222299

Please sign in to comment.