Skip to contentSkip to conversation

dccp: add check request_moduls in setup_jprobe

PATCH New Wang Weidong 3 participants 4 messages Dec 17, 2013 – Dec 20, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dccp: add check request_moduls in setup_jprobe

when register_jprobe failed, we will try request_module. But some time request_module will failed such as the dccp is not exist. so check the request_module for avoiding do register_jprobe again.

---
 net/dccp/probe.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
net/dccp/probe.c +4 -1
index 4c6bdf9..53158d2 100644
@@ -157,9 +157,12 @@ static __init int setup_jprobe(void)
 	int ret = register_jprobe(&dccp_send_probe);
 
 	if (ret) {
-		request_module("dccp");
+		if (request_module("dccp"))
+			goto out;
 		ret = register_jprobe(&dccp_send_probe);
 	}
+
+out:
 	return ret;
 }
 
Signature · 1 line
1.7.12
#1 lore raw

PATCH 1/1 dccp: catch failed request_module call in dccp_probe init (was: [PATCH net-next] dccp: add check request_moduls in setup_jprobe)

Hi Wang,

thank you for the patch, please find refactored version below, changes are
(a) if request_module fails, return its error code instead of the previous ret,
(b) refactor code -- setup_jprobe becomes superfluous.

Please add your signed off if ok, since it is essentially your patch.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Wang's patch revised <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

dccp: catch failed request_module call in dccp_probe init

Check the return value of request_module during dccp_probe initialisation, bail out if that call fails.

---
 net/dccp/probe.c |   19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)
net/dccp/probe.c +7 -12
@@ -152,17 +152,6 @@ static const struct file_operations dccp
 	.llseek  = noop_llseek,
 };
 
-static __init int setup_jprobe(void)
-{
-	int ret = register_jprobe(&dccp_send_probe);
-
-	if (ret) {
-		request_module("dccp");
-		ret = register_jprobe(&dccp_send_probe);
-	}
-	return ret;
-}
-
 static __init int dccpprobe_init(void)
 {
 	int ret = -ENOMEM;
@@ -174,7 +163,13 @@ static __init int dccpprobe_init(void)
 	if (!proc_create(procname, S_IRUSR, init_net.proc_net, &dccpprobe_fops))
 		goto err0;
 
-	ret = setup_jprobe();
+	ret = register_jprobe(&dccp_send_probe);
+	if (ret) {
+		ret = request_module("dccp");
+		if (!ret)
+			ret = register_jprobe(&dccp_send_probe);
+	}
+
 	if (ret)
 		goto err1;
 
#2 lore raw

Re: [PATCH 1/1][net-next] dccp: catch failed request_module call in dccp_probe init

Quoted 46 lines · Gerrit Renker

Hi Wang,

thank you for the patch, please find refactored version below, changes are
(a) if request_module fails, return its error code instead of the previous ret,
(b) refactor code -- setup_jprobe becomes superfluous.

Please add your signed off if ok, since it is essentially your patch.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Wang's patch revised <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

dccp: catch failed request_module call in dccp_probe init

Check the return value of request_module during dccp_probe initialisation, bail out if that call fails.

---
 net/dccp/probe.c |   19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)
net/dccp/probe.c +0 -12
@@ -152,17 +152,6 @@ static const struct file_operations dccp
 	.llseek  = noop_llseek,
 };
 
-static __init int setup_jprobe(void)
-{
-	int ret = register_jprobe(&dccp_send_probe);
-
-	if (ret) {
-		request_module("dccp");
-		ret = register_jprobe(&dccp_send_probe);
-	}
-	return ret;
-}
-
 static __init int dccpprobe_init(void)
 {
 	int ret = -ENOMEM;
@@ -174,7 +163,13 @@ static __init int dccpprobe_init(void)
 	if (!proc_create(procname, S_IRUSR, init_net.proc_net, &dccpprobe_fops))
 		goto err0;
 
-	ret = setup_jprobe();

net/dccp/probe.c static __init int dccpprobe_init(void) · line 175

Quoted 10 lines
net/dccp/probe.c +7 -0
+	ret = register_jprobe(&dccp_send_probe);
+	if (ret) {
+		ret = request_module("dccp");
+		if (!ret)
+			ret = register_jprobe(&dccp_send_probe);
+	}
+
 	if (ret)
 		goto err1;
 

It is OK.
Thanks.

maintainer Applied
#3 lore raw

Re: [PATCH 1/1][net-next] dccp: catch failed request_module call in dccp_probe init

From: Wang Weidong <[email protected]>
Date: Wed, 18 Dec 2013 10:38:36 +0800

Quoted 16 lines · Gerrit Renker
Quoted 15 lines

Hi Wang,

thank you for the patch, please find refactored version below, changes are
(a) if request_module fails, return its error code instead of the previous ret,
(b) refactor code -- setup_jprobe becomes superfluous.

Please add your signed off if ok, since it is essentially your patch.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Wang's patch revised <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

dccp: catch failed request_module call in dccp_probe init

Check the return value of request_module during dccp_probe initialisation, bail out if that call fails.

...

Quoted 1 line

Applied, thanks.