linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] proc/proc_sysctl: Modify the order of scheduling function calls
@ 2022-09-05  1:29 Li zeming
  2022-09-05  3:12 ` Matthew Wilcox
  0 siblings, 1 reply; 2+ messages in thread
From: Li zeming @ 2022-09-05  1:29 UTC (permalink / raw)
  To: mcgrof, keescook, yzaikin; +Cc: linux-kernel, linux-fsdevel, Li zeming

When the ctl_table_header object is judged to be valid, the scheduling
check is performed again.

Signed-off-by: Li zeming <zeming@nfschina.com>
---
 fs/proc/proc_sysctl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 50ba9e4fb284..36921e2ebeb0 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -1729,11 +1729,10 @@ static void drop_sysctl_table(struct ctl_table_header *header)
 void unregister_sysctl_table(struct ctl_table_header * header)
 {
 	int nr_subheaders;
-	might_sleep();
-
 	if (header == NULL)
 		return;
 
+	might_sleep();
 	nr_subheaders = count_subheaders(header->ctl_table_arg);
 	if (unlikely(nr_subheaders > 1)) {
 		struct ctl_table_header **subheaders;
-- 
2.18.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] proc/proc_sysctl: Modify the order of scheduling function calls
  2022-09-05  1:29 [PATCH] proc/proc_sysctl: Modify the order of scheduling function calls Li zeming
@ 2022-09-05  3:12 ` Matthew Wilcox
  0 siblings, 0 replies; 2+ messages in thread
From: Matthew Wilcox @ 2022-09-05  3:12 UTC (permalink / raw)
  To: Li zeming; +Cc: mcgrof, keescook, yzaikin, linux-kernel, linux-fsdevel

On Mon, Sep 05, 2022 at 09:29:25AM +0800, Li zeming wrote:
> When the ctl_table_header object is judged to be valid, the scheduling
> check is performed again.

No, we want the check in all cases, even if the header is NULL.

> Signed-off-by: Li zeming <zeming@nfschina.com>
> ---
>  fs/proc/proc_sysctl.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
> index 50ba9e4fb284..36921e2ebeb0 100644
> --- a/fs/proc/proc_sysctl.c
> +++ b/fs/proc/proc_sysctl.c
> @@ -1729,11 +1729,10 @@ static void drop_sysctl_table(struct ctl_table_header *header)
>  void unregister_sysctl_table(struct ctl_table_header * header)
>  {
>  	int nr_subheaders;
> -	might_sleep();
> -
>  	if (header == NULL)
>  		return;
>  
> +	might_sleep();
>  	nr_subheaders = count_subheaders(header->ctl_table_arg);
>  	if (unlikely(nr_subheaders > 1)) {
>  		struct ctl_table_header **subheaders;
> -- 
> 2.18.2
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-05  3:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-05  1:29 [PATCH] proc/proc_sysctl: Modify the order of scheduling function calls Li zeming
2022-09-05  3:12 ` Matthew Wilcox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).