public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] audit: destroy filename correctly
@ 2013-04-01  7:00 Dmitry Monakhov
  2013-04-10 17:07 ` Jeff Layton
  2013-04-22  8:08 ` [PATCH] audit: destroy filename correctly PING Dmitry Monakhov
  0 siblings, 2 replies; 4+ messages in thread
From: Dmitry Monakhov @ 2013-04-01  7:00 UTC (permalink / raw)
  To: linux-kernel; +Cc: viro, eparis, Dmitry Monakhov

filename should be destroyed via final_putname() instead of __putname()
Otherwise this result in following BUGON() in case of long names:
  kernel BUG at mm/slab.c:3006!
  Call Trace:
  kmem_cache_free+0x1c1/0x850
  audit_putname+0x88/0x90
  putname+0x73/0x80
  sys_symlinkat+0x120/0x150
  sys_symlink+0x16/0x20
  system_call_fastpath+0x16/0x1b

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
 kernel/auditsc.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index a371f85..bfe7ca6 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -1010,7 +1010,7 @@ static inline void audit_free_names(struct audit_context *context)
 	list_for_each_entry_safe(n, next, &context->names_list, list) {
 		list_del(&n->list);
 		if (n->name && n->name_put)
-			__putname(n->name);
+			final_putname(n->name);
 		if (n->should_free)
 			kfree(n);
 	}
@@ -2036,7 +2036,7 @@ void audit_putname(struct filename *name)
 	BUG_ON(!context);
 	if (!context->in_syscall) {
 #if AUDIT_DEBUG == 2
-		printk(KERN_ERR "%s:%d(:%d): __putname(%p)\n",
+		printk(KERN_ERR "%s:%d(:%d): final_putname(%p)\n",
 		       __FILE__, __LINE__, context->serial, name);
 		if (context->name_count) {
 			struct audit_names *n;
@@ -2047,7 +2047,7 @@ void audit_putname(struct filename *name)
 				       n->name, n->name->name ?: "(null)");
 			}
 #endif
-		__putname(name);
+		final_putname(name);
 	}
 #if AUDIT_DEBUG
 	else {
-- 
1.7.1


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

* Re: [PATCH] audit: destroy filename correctly
  2013-04-01  7:00 [PATCH] audit: destroy filename correctly Dmitry Monakhov
@ 2013-04-10 17:07 ` Jeff Layton
  2013-04-22  8:08 ` [PATCH] audit: destroy filename correctly PING Dmitry Monakhov
  1 sibling, 0 replies; 4+ messages in thread
From: Jeff Layton @ 2013-04-10 17:07 UTC (permalink / raw)
  To: Dmitry Monakhov; +Cc: linux-kernel

On Mon,  1 Apr 2013 11:00:00 +0400
Dmitry Monakhov <dmonakhov@openvz.org> wrote:

> filename should be destroyed via final_putname() instead of __putname()
> Otherwise this result in following BUGON() in case of long names:
>   kernel BUG at mm/slab.c:3006!
>   Call Trace:
>   kmem_cache_free+0x1c1/0x850
>   audit_putname+0x88/0x90
>   putname+0x73/0x80
>   sys_symlinkat+0x120/0x150
>   sys_symlink+0x16/0x20
>   system_call_fastpath+0x16/0x1b
> 
> Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
> ---
>  kernel/auditsc.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/kernel/auditsc.c b/kernel/auditsc.c
> index a371f85..bfe7ca6 100644
> --- a/kernel/auditsc.c
> +++ b/kernel/auditsc.c
> @@ -1010,7 +1010,7 @@ static inline void audit_free_names(struct audit_context *context)
>  	list_for_each_entry_safe(n, next, &context->names_list, list) {
>  		list_del(&n->list);
>  		if (n->name && n->name_put)
> -			__putname(n->name);
> +			final_putname(n->name);
>  		if (n->should_free)
>  			kfree(n);
>  	}
> @@ -2036,7 +2036,7 @@ void audit_putname(struct filename *name)
>  	BUG_ON(!context);
>  	if (!context->in_syscall) {
>  #if AUDIT_DEBUG == 2
> -		printk(KERN_ERR "%s:%d(:%d): __putname(%p)\n",
> +		printk(KERN_ERR "%s:%d(:%d): final_putname(%p)\n",
>  		       __FILE__, __LINE__, context->serial, name);
>  		if (context->name_count) {
>  			struct audit_names *n;
> @@ -2047,7 +2047,7 @@ void audit_putname(struct filename *name)
>  				       n->name, n->name->name ?: "(null)");
>  			}
>  #endif
> -		__putname(name);
> +		final_putname(name);
>  	}
>  #if AUDIT_DEBUG
>  	else {

Looks correct to me...

Reviewed-by: Jeff Layton <jlayton@redhat.com>

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

* Re: [PATCH] audit: destroy filename correctly PING.
  2013-04-01  7:00 [PATCH] audit: destroy filename correctly Dmitry Monakhov
  2013-04-10 17:07 ` Jeff Layton
@ 2013-04-22  8:08 ` Dmitry Monakhov
  2013-04-23 14:24   ` Eric Paris
  1 sibling, 1 reply; 4+ messages in thread
From: Dmitry Monakhov @ 2013-04-22  8:08 UTC (permalink / raw)
  To: linux-kernel; +Cc: viro, eparis, linux-audit

On Mon,  1 Apr 2013 11:00:00 +0400, Dmitry Monakhov <dmonakhov@openvz.org> wrote:
Ping. Patch (https://lkml.org/lkml/2013/4/1/65) was not a 1'st April's joke. 
Add CC:linux-audit@redhat.com
> filename should be destroyed via final_putname() instead of __putname()
> Otherwise this result in following BUGON() in case of long names:
>   kernel BUG at mm/slab.c:3006!
>   Call Trace:
>   kmem_cache_free+0x1c1/0x850
>   audit_putname+0x88/0x90
>   putname+0x73/0x80
>   sys_symlinkat+0x120/0x150
>   sys_symlink+0x16/0x20
>   system_call_fastpath+0x16/0x1b
> 
> Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
> ---
>  kernel/auditsc.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/kernel/auditsc.c b/kernel/auditsc.c
> index a371f85..bfe7ca6 100644
> --- a/kernel/auditsc.c
> +++ b/kernel/auditsc.c
> @@ -1010,7 +1010,7 @@ static inline void audit_free_names(struct audit_context *context)
>  	list_for_each_entry_safe(n, next, &context->names_list, list) {
>  		list_del(&n->list);
>  		if (n->name && n->name_put)
> -			__putname(n->name);
> +			final_putname(n->name);
>  		if (n->should_free)
>  			kfree(n);
>  	}
> @@ -2036,7 +2036,7 @@ void audit_putname(struct filename *name)
>  	BUG_ON(!context);
>  	if (!context->in_syscall) {
>  #if AUDIT_DEBUG == 2
> -		printk(KERN_ERR "%s:%d(:%d): __putname(%p)\n",
> +		printk(KERN_ERR "%s:%d(:%d): final_putname(%p)\n",
>  		       __FILE__, __LINE__, context->serial, name);
>  		if (context->name_count) {
>  			struct audit_names *n;
> @@ -2047,7 +2047,7 @@ void audit_putname(struct filename *name)
>  				       n->name, n->name->name ?: "(null)");
>  			}
>  #endif
> -		__putname(name);
> +		final_putname(name);
>  	}
>  #if AUDIT_DEBUG
>  	else {
> -- 
> 1.7.1
> 

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

* Re: [PATCH] audit: destroy filename correctly PING.
  2013-04-22  8:08 ` [PATCH] audit: destroy filename correctly PING Dmitry Monakhov
@ 2013-04-23 14:24   ` Eric Paris
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Paris @ 2013-04-23 14:24 UTC (permalink / raw)
  To: Dmitry Monakhov; +Cc: linux-kernel, viro, linux-audit

I picked it up for 3.10.  Sorry, should have said something.  Thanks!

-Eric

----- Original Message -----
> On Mon,  1 Apr 2013 11:00:00 +0400, Dmitry Monakhov <dmonakhov@openvz.org>
> wrote:
> Ping. Patch (https://lkml.org/lkml/2013/4/1/65) was not a 1'st April's joke.
> Add CC:linux-audit@redhat.com
> > filename should be destroyed via final_putname() instead of __putname()
> > Otherwise this result in following BUGON() in case of long names:
> >   kernel BUG at mm/slab.c:3006!
> >   Call Trace:
> >   kmem_cache_free+0x1c1/0x850
> >   audit_putname+0x88/0x90
> >   putname+0x73/0x80
> >   sys_symlinkat+0x120/0x150
> >   sys_symlink+0x16/0x20
> >   system_call_fastpath+0x16/0x1b
> > 
> > Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
> > ---
> >  kernel/auditsc.c |    6 +++---
> >  1 files changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/kernel/auditsc.c b/kernel/auditsc.c
> > index a371f85..bfe7ca6 100644
> > --- a/kernel/auditsc.c
> > +++ b/kernel/auditsc.c
> > @@ -1010,7 +1010,7 @@ static inline void audit_free_names(struct
> > audit_context *context)
> >  	list_for_each_entry_safe(n, next, &context->names_list, list) {
> >  		list_del(&n->list);
> >  		if (n->name && n->name_put)
> > -			__putname(n->name);
> > +			final_putname(n->name);
> >  		if (n->should_free)
> >  			kfree(n);
> >  	}
> > @@ -2036,7 +2036,7 @@ void audit_putname(struct filename *name)
> >  	BUG_ON(!context);
> >  	if (!context->in_syscall) {
> >  #if AUDIT_DEBUG == 2
> > -		printk(KERN_ERR "%s:%d(:%d): __putname(%p)\n",
> > +		printk(KERN_ERR "%s:%d(:%d): final_putname(%p)\n",
> >  		       __FILE__, __LINE__, context->serial, name);
> >  		if (context->name_count) {
> >  			struct audit_names *n;
> > @@ -2047,7 +2047,7 @@ void audit_putname(struct filename *name)
> >  				       n->name, n->name->name ?: "(null)");
> >  			}
> >  #endif
> > -		__putname(name);
> > +		final_putname(name);
> >  	}
> >  #if AUDIT_DEBUG
> >  	else {
> > --
> > 1.7.1
> > 
> 

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

end of thread, other threads:[~2013-04-23 14:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-01  7:00 [PATCH] audit: destroy filename correctly Dmitry Monakhov
2013-04-10 17:07 ` Jeff Layton
2013-04-22  8:08 ` [PATCH] audit: destroy filename correctly PING Dmitry Monakhov
2013-04-23 14:24   ` Eric Paris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox