Skip to content

Commit

Permalink
sctp: loading sctp when load sctp_probe
Browse files Browse the repository at this point in the history
when I modprobe sctp_probe, it failed with "FATAL: ". I found that
sctp should load before sctp_probe register jprobe. So I add a
sctp_setup_jprobe for loading 'sctp' when first failed to register
jprobe, just do this similar to dccp_probe.

v2: add MODULE_SOFTDEP and check of request_module, as suggested by Neil

Signed-off-by: Wang Weidong <wangweidong1@huawei.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
wangweidong authored and David S. Miller committed Dec 17, 2013
1 parent 319e2e3 commit 9bd7d20
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion net/sctp/probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include <net/sctp/sctp.h>
#include <net/sctp/sm.h>

MODULE_SOFTDEP("pre: sctp");
MODULE_AUTHOR("Wei Yongjun <yjwei@cn.fujitsu.com>");
MODULE_DESCRIPTION("SCTP snooper");
MODULE_LICENSE("GPL");
Expand Down Expand Up @@ -182,6 +183,20 @@ static struct jprobe sctp_recv_probe = {
.entry = jsctp_sf_eat_sack,
};

static __init int sctp_setup_jprobe(void)
{
int ret = register_jprobe(&sctp_recv_probe);

if (ret) {
if (request_module("sctp"))
goto out;
ret = register_jprobe(&sctp_recv_probe);
}

out:
return ret;
}

static __init int sctpprobe_init(void)
{
int ret = -ENOMEM;
Expand All @@ -202,7 +217,7 @@ static __init int sctpprobe_init(void)
&sctpprobe_fops))
goto free_kfifo;

ret = register_jprobe(&sctp_recv_probe);
ret = sctp_setup_jprobe();
if (ret)
goto remove_proc;

Expand Down

0 comments on commit 9bd7d20

Please sign in to comment.