sctp: loading sctp when load sctp_probe
Subsystems (3)
PATCH 1/1 sctp: loading sctp when load sctp_probe
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.
--- net/sctp/probe.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
net/sctp/probe.c +12 -1
@@ -182,6 +182,17 @@ 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) { +request_module ("sctp" ); + ret =register_jprobe (&sctp_recv_probe); + } +return ret; +} +static __init int sctpprobe_init (void ) {int ret = -ENOMEM ;
@@ -202,7 +213,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;
Signature · 1 line
1.7.12
Quoted 46 lines · Wang Weidong
when I modprobe
sctp_probe, it failed with "FATAL: ". I found that sctp should load beforesctp_proberegister jprobe. So I add asctp_setup_jprobefor loading 'sctp' when first failed to register jprobe, just do this similar todccp_probe.Signed-off-by Wang Weidong <[email protected]>--- net/sctp/probe.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)net/sctp/probe.c +12
-1@@ -182,6 +182,17 @@ 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) { +request_module ("sctp" ); + ret =register_jprobe (&sctp_recv_probe); + } +return ret; +} +static __init int sctpprobe_init (void ) {int ret = -ENOMEM ;@@ -202,7 +213,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;Signature · 1 line
1.7.12
You need to check the return code of request_module. if sctp.ko doesn't exist, you'll hit exactly the same problem.
You might consider also adding a MODULE_SOFTDEP macro in to the patch, so that the dependency is clearly visible in userspace to modprobe.
Neil
From: Wang Weidong <[email protected]>
Quoted 50 lines · Neil Horman
Quoted 42 lines · Wang Weidong
when I modprobe
sctp_probe, it failed with "FATAL: ". I found that sctp should load beforesctp_proberegister jprobe. So I add asctp_setup_jprobefor loading 'sctp' when first failed to register jprobe, just do this similar todccp_probe.Signed-off-by Wang Weidong <[email protected]>--- net/sctp/probe.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)net/sctp/probe.c +12
-2@@ -182,6 +182,17 @@ 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) { +request_module ("sctp" ); + ret =register_jprobe (&sctp_recv_probe); + } +return ret; +} +static __init int sctpprobe_init (void ) {int ret = -ENOMEM ;@@ -202,7 +213,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; --Quoted 4 lines
1.7.12
You need to check the return code of
request_module. if sctp.ko doesn't exist, you'll hit exactly the same problem.
Quoted 5 lines
You might consider also adding a
MODULE_SOFTDEPmacro in to the patch, so that the dependency is clearly visible in userspace to modprobe.Neil
Thanks for your suggestions. I will fix it.
Regards.
Wang
Quoted 5 lines
--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html