diff mbox

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

Message ID 20131217192433.168b39ef@liptov.cs.ualberta.ca
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Gerrit Renker Dec. 18, 2013, 2:24 a.m. UTC
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.

>>>>>>>>>>>>>>>>>>>>>>> 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.

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
---
 net/dccp/probe.c |   19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

wangweidong Dec. 18, 2013, 2:38 a.m. UTC | #1
On 2013/12/18 10:24, Gerrit Renker wrote:
> 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.
> 
>>>>>>>>>>>>>>>>>>>>>>>> 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.
> 
> Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
> ---
>  net/dccp/probe.c |   19 +++++++------------
>  1 file changed, 7 insertions(+), 12 deletions(-)
> 
> --- a/net/dccp/probe.c
> +++ b/net/dccp/probe.c
> @@ -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;
>  
> 
> 

It is OK.
Thanks.

Signed-off-by: Wang Weidong <wangweidong1@huawei.com>



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Dec. 20, 2013, 12:26 a.m. UTC | #2
From: Wang Weidong <wangweidong1@huawei.com>
Date: Wed, 18 Dec 2013 10:38:36 +0800

> On 2013/12/18 10:24, Gerrit Renker wrote:
>> 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.
>> 
>>>>>>>>>>>>>>>>>>>>>>>>> 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.
>> 
>> Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
 ...
> Signed-off-by: Wang Weidong <wangweidong1@huawei.com>

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

--- a/net/dccp/probe.c
+++ b/net/dccp/probe.c
@@ -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;