diff mbox

[1/4] fs_pin: Fix uninitialized value in fs_pin

Message ID 554A14DB.1020504@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kinglong Mee May 6, 2015, 1:19 p.m. UTC
Without initialized, done in fs_pin at stack space may
contains strange value.

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
 include/linux/fs_pin.h | 1 +
 1 file changed, 1 insertion(+)

Comments

J. Bruce Fields May 7, 2015, 7:43 p.m. UTC | #1
On Wed, May 06, 2015 at 09:19:23PM +0800, Kinglong Mee wrote:
> Without initialized, done in fs_pin at stack space may
> contains strange value.

Looks like both init_fs_pin callers use some variation on kzalloc(), so
I don't think there's any actual bug here.

Maybe there's some other reason for the belt-and-suspenders approach,
that's Al's call, I think.

--b.

> 
> Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
> ---
>  include/linux/fs_pin.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/include/linux/fs_pin.h b/include/linux/fs_pin.h
> index 3886b3b..18fad53 100644
> --- a/include/linux/fs_pin.h
> +++ b/include/linux/fs_pin.h
> @@ -16,6 +16,7 @@ static inline void init_fs_pin(struct fs_pin *p, void (*kill)(struct fs_pin *))
>  	INIT_HLIST_NODE(&p->s_list);
>  	INIT_HLIST_NODE(&p->m_list);
>  	p->kill = kill;
> +	p->done = 0;
>  }
>  
>  void pin_remove(struct fs_pin *);
> -- 
> 2.4.0
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kinglong Mee May 8, 2015, 12:36 a.m. UTC | #2
On 5/8/2015 3:43 AM, J. Bruce Fields wrote:
> On Wed, May 06, 2015 at 09:19:23PM +0800, Kinglong Mee wrote:
>> Without initialized, done in fs_pin at stack space may
>> contains strange value.
> 
> Looks like both init_fs_pin callers use some variation on kzalloc(), so
> I don't think there's any actual bug here.

Yes, you are right.

But nfsd's export cache using kmalloc for memory allocating,
if I insert a fs_pin into svc_export{}, the value of done maybe
strange value.

Maybe I should update using kzalloc in nfsd?
But I'd like this one.

thanks,
Kinglong Mee

> 
> Maybe there's some other reason for the belt-and-suspenders approach,
> that's Al's call, I think.
> 
> --b.
> 
>>
>> Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
>> ---
>>  include/linux/fs_pin.h | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/include/linux/fs_pin.h b/include/linux/fs_pin.h
>> index 3886b3b..18fad53 100644
>> --- a/include/linux/fs_pin.h
>> +++ b/include/linux/fs_pin.h
>> @@ -16,6 +16,7 @@ static inline void init_fs_pin(struct fs_pin *p, void (*kill)(struct fs_pin *))
>>  	INIT_HLIST_NODE(&p->s_list);
>>  	INIT_HLIST_NODE(&p->m_list);
>>  	p->kill = kill;
>> +	p->done = 0;
>>  }
>>  
>>  void pin_remove(struct fs_pin *);
>> -- 
>> 2.4.0
>>
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" 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

diff --git a/include/linux/fs_pin.h b/include/linux/fs_pin.h
index 3886b3b..18fad53 100644
--- a/include/linux/fs_pin.h
+++ b/include/linux/fs_pin.h
@@ -16,6 +16,7 @@  static inline void init_fs_pin(struct fs_pin *p, void (*kill)(struct fs_pin *))
 	INIT_HLIST_NODE(&p->s_list);
 	INIT_HLIST_NODE(&p->m_list);
 	p->kill = kill;
+	p->done = 0;
 }
 
 void pin_remove(struct fs_pin *);