[Devel,RHEL7,COMMIT] ve/autofs: drop fix double pid put in error path and leaked pid on error path in autofs4_fill_super

Submitted by Konstantin Khorenko on Sept. 5, 2017, 12:18 p.m.

Details

Message ID 201709051218.v85CIQ8l006036@finist_ce7.work
State New
Series "autofs: fix leaked pid on error path in autofs4_fill_super"
Headers show

Commit Message

Konstantin Khorenko Sept. 5, 2017, 12:18 p.m.
The commit is pushed to "branch-rh7-3.10.0-514.26.1.vz7.35.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.26.1.vz7.35.6
------>
commit e851cc10aa14e1ca311187fda9a3a53a5e3dee25
Author: Konstantin Khorenko <khorenko@virtuozzo.com>
Date:   Tue Sep 5 15:13:26 2017 +0300

    ve/autofs: drop fix double pid put in error path and leaked pid on error path in autofs4_fill_super
    
    Drop redundant hunks of 078889e ("VE/AUTOFS: port 71-diff-autofs-combined"),
    they lead to unbalanced pid get/put in autofs4_fill_super().
    
    Fixes: 078889e ("VE/AUTOFS: port 71-diff-autofs-combined")
    
    Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
 fs/autofs4/autofs_i.h | 1 -
 fs/autofs4/inode.c    | 6 ++----
 2 files changed, 2 insertions(+), 5 deletions(-)

Patch hide | download patch | download mbox

diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h
index c957d14..39f197c 100644
--- a/fs/autofs4/autofs_i.h
+++ b/fs/autofs4/autofs_i.h
@@ -123,7 +123,6 @@  struct autofs_sb_info {
 	struct list_head active_list;
 	struct list_head expiring_list;
 	struct rcu_head rcu;
-	unsigned is32bit:1;
 };
 
 static inline struct autofs_sb_info *autofs4_sbi(struct super_block *sb)
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
index b23cf2a..af7506c 100644
--- a/fs/autofs4/inode.c
+++ b/fs/autofs4/inode.c
@@ -127,7 +127,7 @@  static const match_table_t tokens = {
 	{Opt_indirect, "indirect"},
 	{Opt_direct, "direct"},
 	{Opt_offset, "offset"},
-{Opt_err, NULL}
+	{Opt_err, NULL}
 };
 
 static int parse_options(char *options, int *pipefd, kuid_t *uid, kgid_t *gid,
@@ -313,7 +313,7 @@  int autofs4_fill_super(struct super_block *s, void *data, int silent)
 
 	if (!pipe) {
 		printk("autofs: could not open pipe file descriptor\n");
-		goto fail_put_pid;
+		goto fail_dput;
 	}
 	ret = autofs_prepare_pipe(pipe);
 	if (ret < 0)
@@ -335,8 +335,6 @@  int autofs4_fill_super(struct super_block *s, void *data, int silent)
 	printk("autofs: pipe file descriptor does not contain proper ops\n");
 	fput(pipe);
 	/* fall through */
-fail_put_pid:
-	put_pid(sbi->oz_pgrp);
 fail_dput:
 	dput(root);
 	goto fail_free;

Comments

Konstantin Khorenko Sept. 5, 2017, 12:47 p.m.
Please consider to prepare a ReadyKernel patch for it.

This is needed for all kernels prior to 3.10.0-693.x

https://readykernel.com/

--
Best regards,

Konstantin Khorenko,
Virtuozzo Linux Kernel Team

On 09/05/2017 03:18 PM, Konstantin Khorenko wrote:
> The commit is pushed to "branch-rh7-3.10.0-514.26.1.vz7.35.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
> after rh7-3.10.0-514.26.1.vz7.35.6
> ------>
> commit e851cc10aa14e1ca311187fda9a3a53a5e3dee25
> Author: Konstantin Khorenko <khorenko@virtuozzo.com>
> Date:   Tue Sep 5 15:13:26 2017 +0300
>
>     ve/autofs: drop fix double pid put in error path and leaked pid on error path in autofs4_fill_super
>
>     Drop redundant hunks of 078889e ("VE/AUTOFS: port 71-diff-autofs-combined"),
>     they lead to unbalanced pid get/put in autofs4_fill_super().
>
>     Fixes: 078889e ("VE/AUTOFS: port 71-diff-autofs-combined")
>
>     Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
> ---
>  fs/autofs4/autofs_i.h | 1 -
>  fs/autofs4/inode.c    | 6 ++----
>  2 files changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h
> index c957d14..39f197c 100644
> --- a/fs/autofs4/autofs_i.h
> +++ b/fs/autofs4/autofs_i.h
> @@ -123,7 +123,6 @@ struct autofs_sb_info {
>  	struct list_head active_list;
>  	struct list_head expiring_list;
>  	struct rcu_head rcu;
> -	unsigned is32bit:1;
>  };
>
>  static inline struct autofs_sb_info *autofs4_sbi(struct super_block *sb)
> diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
> index b23cf2a..af7506c 100644
> --- a/fs/autofs4/inode.c
> +++ b/fs/autofs4/inode.c
> @@ -127,7 +127,7 @@ static const match_table_t tokens = {
>  	{Opt_indirect, "indirect"},
>  	{Opt_direct, "direct"},
>  	{Opt_offset, "offset"},
> -{Opt_err, NULL}
> +	{Opt_err, NULL}
>  };
>
>  static int parse_options(char *options, int *pipefd, kuid_t *uid, kgid_t *gid,
> @@ -313,7 +313,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
>
>  	if (!pipe) {
>  		printk("autofs: could not open pipe file descriptor\n");
> -		goto fail_put_pid;
> +		goto fail_dput;
>  	}
>  	ret = autofs_prepare_pipe(pipe);
>  	if (ret < 0)
> @@ -335,8 +335,6 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
>  	printk("autofs: pipe file descriptor does not contain proper ops\n");
>  	fput(pipe);
>  	/* fall through */
> -fail_put_pid:
> -	put_pid(sbi->oz_pgrp);
>  fail_dput:
>  	dput(root);
>  	goto fail_free;
> .
>
Vasily Averin Sept. 5, 2017, 1:26 p.m.
Kostja,
why it changes autofs_sb_info?
this hook looks unrelated to the problem
and first hook in fs/autofs4/inode.c too.

On 2017-09-05 15:47, Konstantin Khorenko wrote:
> Please consider to prepare a ReadyKernel patch for it.
> 
> This is needed for all kernels prior to 3.10.0-693.x
> 
> https://readykernel.com/
> 
> -- 
> Best regards,
> 
> Konstantin Khorenko,
> Virtuozzo Linux Kernel Team
> 
> On 09/05/2017 03:18 PM, Konstantin Khorenko wrote:
>> The commit is pushed to "branch-rh7-3.10.0-514.26.1.vz7.35.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
>> after rh7-3.10.0-514.26.1.vz7.35.6
>> ------>
>> commit e851cc10aa14e1ca311187fda9a3a53a5e3dee25
>> Author: Konstantin Khorenko <khorenko@virtuozzo.com>
>> Date:   Tue Sep 5 15:13:26 2017 +0300
>>
>>     ve/autofs: drop fix double pid put in error path and leaked pid on error path in autofs4_fill_super
>>
>>     Drop redundant hunks of 078889e ("VE/AUTOFS: port 71-diff-autofs-combined"),
>>     they lead to unbalanced pid get/put in autofs4_fill_super().
>>
>>     Fixes: 078889e ("VE/AUTOFS: port 71-diff-autofs-combined")
>>
>>     Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
>> ---
>>  fs/autofs4/autofs_i.h | 1 -
>>  fs/autofs4/inode.c    | 6 ++----
>>  2 files changed, 2 insertions(+), 5 deletions(-)
>>
>> diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h
>> index c957d14..39f197c 100644
>> --- a/fs/autofs4/autofs_i.h
>> +++ b/fs/autofs4/autofs_i.h
>> @@ -123,7 +123,6 @@ struct autofs_sb_info {
>>      struct list_head active_list;
>>      struct list_head expiring_list;
>>      struct rcu_head rcu;
>> -    unsigned is32bit:1;
>>  };
>>
>>  static inline struct autofs_sb_info *autofs4_sbi(struct super_block *sb)
>> diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
>> index b23cf2a..af7506c 100644
>> --- a/fs/autofs4/inode.c
>> +++ b/fs/autofs4/inode.c
>> @@ -127,7 +127,7 @@ static const match_table_t tokens = {
>>      {Opt_indirect, "indirect"},
>>      {Opt_direct, "direct"},
>>      {Opt_offset, "offset"},
>> -{Opt_err, NULL}
>> +    {Opt_err, NULL}
>>  };
>>
>>  static int parse_options(char *options, int *pipefd, kuid_t *uid, kgid_t *gid,
>> @@ -313,7 +313,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
>>
>>      if (!pipe) {
>>          printk("autofs: could not open pipe file descriptor\n");
>> -        goto fail_put_pid;
>> +        goto fail_dput;
>>      }
>>      ret = autofs_prepare_pipe(pipe);
>>      if (ret < 0)
>> @@ -335,8 +335,6 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
>>      printk("autofs: pipe file descriptor does not contain proper ops\n");
>>      fput(pipe);
>>      /* fall through */
>> -fail_put_pid:
>> -    put_pid(sbi->oz_pgrp);
>>  fail_dput:
>>      dput(root);
>>      goto fail_free;
>> .
>>
>
Konstantin Khorenko Sept. 5, 2017, 2:06 p.m.
On 09/05/2017 04:26 PM, Vasily Averin wrote:
> Kostja,
> why it changes autofs_sb_info?
> this hook looks unrelated to the problem
> and first hook in fs/autofs4/inode.c too.

The patch rolls back hunks of our patch,
all those hunks are not needed now.

Bug is fixed by only 2 last hunks, agree, i wrote that in the bug.

>
> On 2017-09-05 15:47, Konstantin Khorenko wrote:
>> Please consider to prepare a ReadyKernel patch for it.
>>
>> This is needed for all kernels prior to 3.10.0-693.x
>>
>> https://readykernel.com/
>>
>> --
>> Best regards,
>>
>> Konstantin Khorenko,
>> Virtuozzo Linux Kernel Team
>>
>> On 09/05/2017 03:18 PM, Konstantin Khorenko wrote:
>>> The commit is pushed to "branch-rh7-3.10.0-514.26.1.vz7.35.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
>>> after rh7-3.10.0-514.26.1.vz7.35.6
>>> ------>
>>> commit e851cc10aa14e1ca311187fda9a3a53a5e3dee25
>>> Author: Konstantin Khorenko <khorenko@virtuozzo.com>
>>> Date:   Tue Sep 5 15:13:26 2017 +0300
>>>
>>>     ve/autofs: drop fix double pid put in error path and leaked pid on error path in autofs4_fill_super
>>>
>>>     Drop redundant hunks of 078889e ("VE/AUTOFS: port 71-diff-autofs-combined"),
>>>     they lead to unbalanced pid get/put in autofs4_fill_super().
>>>
>>>     Fixes: 078889e ("VE/AUTOFS: port 71-diff-autofs-combined")
>>>
>>>     Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
>>> ---
>>>  fs/autofs4/autofs_i.h | 1 -
>>>  fs/autofs4/inode.c    | 6 ++----
>>>  2 files changed, 2 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h
>>> index c957d14..39f197c 100644
>>> --- a/fs/autofs4/autofs_i.h
>>> +++ b/fs/autofs4/autofs_i.h
>>> @@ -123,7 +123,6 @@ struct autofs_sb_info {
>>>      struct list_head active_list;
>>>      struct list_head expiring_list;
>>>      struct rcu_head rcu;
>>> -    unsigned is32bit:1;
>>>  };
>>>
>>>  static inline struct autofs_sb_info *autofs4_sbi(struct super_block *sb)
>>> diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
>>> index b23cf2a..af7506c 100644
>>> --- a/fs/autofs4/inode.c
>>> +++ b/fs/autofs4/inode.c
>>> @@ -127,7 +127,7 @@ static const match_table_t tokens = {
>>>      {Opt_indirect, "indirect"},
>>>      {Opt_direct, "direct"},
>>>      {Opt_offset, "offset"},
>>> -{Opt_err, NULL}
>>> +    {Opt_err, NULL}
>>>  };
>>>
>>>  static int parse_options(char *options, int *pipefd, kuid_t *uid, kgid_t *gid,
>>> @@ -313,7 +313,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
>>>
>>>      if (!pipe) {
>>>          printk("autofs: could not open pipe file descriptor\n");
>>> -        goto fail_put_pid;
>>> +        goto fail_dput;
>>>      }
>>>      ret = autofs_prepare_pipe(pipe);
>>>      if (ret < 0)
>>> @@ -335,8 +335,6 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
>>>      printk("autofs: pipe file descriptor does not contain proper ops\n");
>>>      fput(pipe);
>>>      /* fall through */
>>> -fail_put_pid:
>>> -    put_pid(sbi->oz_pgrp);
>>>  fail_dput:
>>>      dput(root);
>>>      goto fail_free;
>>> .
>>>
>>
> .
>