linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Drivers: hv: vmbus: incorrect device name is printed when child device is unregistered
@ 2013-06-14  0:10 Fernando Soto
  2013-06-14  2:13 ` KY Srinivasan
  0 siblings, 1 reply; 4+ messages in thread
From: Fernando Soto @ 2013-06-14  0:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: KY Srinivasan, Haiyang Zhang

From: Fernando Soto <fsoto@bluecatnetworks.com>
Please CC me, I am not subscribed to the list.

Whenever a device is unregistered in vmbus_device_unregister (drivers/hv/vmbus_drv.c), the device name in the log message may contain garbage as the memory has already been freed by the time pr_info is called. Log example:
 [ 3149.170475] hv_vmbus: child device àõsèè0_5 unregistered

By logging the message just before calling device_unregister, the correct device name is printed:
[ 3145.034652] hv_vmbus: child device vmbus_0_5 unregistered

Signed-off-by: Fernando M Soto <fsoto@bluecatnetworks.com>
--- linux-3.10-rc5/drivers/hv/vmbus_drv.c.orig	2013-06-13 19:20:55.359511352 -0400
+++ linux-3.10-rc5/drivers/hv/vmbus_drv.c	2013-06-13 19:21:39.299511695 -0400
@@ -698,14 +698,14 @@ int vmbus_device_register(struct hv_devi
  */
 void vmbus_device_unregister(struct hv_device *device_obj)
 {
+	pr_info("child device %s unregistered\n",
+		dev_name(&device_obj->device));
+
 	/*
 	 * Kick off the process of unregistering the device.
 	 * This will call vmbus_remove() and eventually vmbus_device_release()
 	 */
 	device_unregister(&device_obj->device);
-
-	pr_info("child device %s unregistered\n",
-		dev_name(&device_obj->device));
 }
 
 
--


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

* RE: [PATCH] Drivers: hv: vmbus: incorrect device name is printed when child device is unregistered
  2013-06-14  0:10 [PATCH] Drivers: hv: vmbus: incorrect device name is printed when child device is unregistered Fernando Soto
@ 2013-06-14  2:13 ` KY Srinivasan
  2013-06-14 16:22   ` Greg KH (gregkh@linuxfoundation.org)
  0 siblings, 1 reply; 4+ messages in thread
From: KY Srinivasan @ 2013-06-14  2:13 UTC (permalink / raw)
  To: Fernando Soto, linux-kernel, Greg KH (gregkh@linuxfoundation.org)
  Cc: Haiyang Zhang



> -----Original Message-----
> From: Fernando Soto [mailto:fsoto@bluecatnetworks.com]
> Sent: Thursday, June 13, 2013 8:11 PM
> To: linux-kernel@vger.kernel.org
> Cc: KY Srinivasan; Haiyang Zhang
> Subject: [PATCH] Drivers: hv: vmbus: incorrect device name is printed when child
> device is unregistered
> 
> From: Fernando Soto <fsoto@bluecatnetworks.com>
> Please CC me, I am not subscribed to the list.
> 
> Whenever a device is unregistered in vmbus_device_unregister
> (drivers/hv/vmbus_drv.c), the device name in the log message may contain
> garbage as the memory has already been freed by the time pr_info is called. Log
> example:
>  [ 3149.170475] hv_vmbus: child device àõsèè0_5 unregistered
> 
> By logging the message just before calling device_unregister, the correct device
> name is printed:
> [ 3145.034652] hv_vmbus: child device vmbus_0_5 unregistered
> 
> Signed-off-by: Fernando M Soto <fsoto@bluecatnetworks.com>
Acked-by: K. Y. Srinivasan <kys@microsoft.com>

> --- linux-3.10-rc5/drivers/hv/vmbus_drv.c.orig	2013-06-13 19:20:55.359511352 -
> 0400
> +++ linux-3.10-rc5/drivers/hv/vmbus_drv.c	2013-06-13 19:21:39.299511695 -
> 0400
> @@ -698,14 +698,14 @@ int vmbus_device_register(struct hv_devi
>   */
>  void vmbus_device_unregister(struct hv_device *device_obj)
>  {
> +	pr_info("child device %s unregistered\n",
> +		dev_name(&device_obj->device));
> +
>  	/*
>  	 * Kick off the process of unregistering the device.
>  	 * This will call vmbus_remove() and eventually vmbus_device_release()
>  	 */
>  	device_unregister(&device_obj->device);
> -
> -	pr_info("child device %s unregistered\n",
> -		dev_name(&device_obj->device));
>  }
> 
> 
> --
> 
> 



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

* Re: [PATCH] Drivers: hv: vmbus: incorrect device name is printed when child device is unregistered
  2013-06-14  2:13 ` KY Srinivasan
@ 2013-06-14 16:22   ` Greg KH (gregkh@linuxfoundation.org)
  2013-06-14 21:36     ` KY Srinivasan
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH (gregkh@linuxfoundation.org) @ 2013-06-14 16:22 UTC (permalink / raw)
  To: KY Srinivasan; +Cc: Fernando Soto, linux-kernel, Haiyang Zhang

On Fri, Jun 14, 2013 at 02:13:44AM +0000, KY Srinivasan wrote:
> 
> 
> > -----Original Message-----
> > From: Fernando Soto [mailto:fsoto@bluecatnetworks.com]
> > Sent: Thursday, June 13, 2013 8:11 PM
> > To: linux-kernel@vger.kernel.org
> > Cc: KY Srinivasan; Haiyang Zhang
> > Subject: [PATCH] Drivers: hv: vmbus: incorrect device name is printed when child
> > device is unregistered
> > 
> > From: Fernando Soto <fsoto@bluecatnetworks.com>
> > Please CC me, I am not subscribed to the list.
> > 
> > Whenever a device is unregistered in vmbus_device_unregister
> > (drivers/hv/vmbus_drv.c), the device name in the log message may contain
> > garbage as the memory has already been freed by the time pr_info is called. Log
> > example:
> >  [ 3149.170475] hv_vmbus: child device àõsèè0_5 unregistered
> > 
> > By logging the message just before calling device_unregister, the correct device
> > name is printed:
> > [ 3145.034652] hv_vmbus: child device vmbus_0_5 unregistered
> > 
> > Signed-off-by: Fernando M Soto <fsoto@bluecatnetworks.com>
> Acked-by: K. Y. Srinivasan <kys@microsoft.com>
> 
> > --- linux-3.10-rc5/drivers/hv/vmbus_drv.c.orig	2013-06-13 19:20:55.359511352 -
> > 0400
> > +++ linux-3.10-rc5/drivers/hv/vmbus_drv.c	2013-06-13 19:21:39.299511695 -
> > 0400
> > @@ -698,14 +698,14 @@ int vmbus_device_register(struct hv_devi
> >   */
> >  void vmbus_device_unregister(struct hv_device *device_obj)
> >  {
> > +	pr_info("child device %s unregistered\n",
> > +		dev_name(&device_obj->device));
> > +
> >  	/*
> >  	 * Kick off the process of unregistering the device.
> >  	 * This will call vmbus_remove() and eventually vmbus_device_release()
> >  	 */
> >  	device_unregister(&device_obj->device);
> > -
> > -	pr_info("child device %s unregistered\n",
> > -		dev_name(&device_obj->device));

No, please just remove these entirely, or make them pr_debug(), you
shouldn't clutter up the kernel log for stuff like this.

thanks,

greg k-h

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

* RE: [PATCH] Drivers: hv: vmbus: incorrect device name is printed when child device is unregistered
  2013-06-14 16:22   ` Greg KH (gregkh@linuxfoundation.org)
@ 2013-06-14 21:36     ` KY Srinivasan
  0 siblings, 0 replies; 4+ messages in thread
From: KY Srinivasan @ 2013-06-14 21:36 UTC (permalink / raw)
  To: Greg KH (gregkh@linuxfoundation.org)
  Cc: Fernando Soto, linux-kernel, Haiyang Zhang



> -----Original Message-----
> From: Greg KH (gregkh@linuxfoundation.org)
> [mailto:gregkh@linuxfoundation.org]
> Sent: Friday, June 14, 2013 12:23 PM
> To: KY Srinivasan
> Cc: Fernando Soto; linux-kernel@vger.kernel.org; Haiyang Zhang
> Subject: Re: [PATCH] Drivers: hv: vmbus: incorrect device name is printed when
> child device is unregistered
> 
> On Fri, Jun 14, 2013 at 02:13:44AM +0000, KY Srinivasan wrote:
> >
> >
> > > -----Original Message-----
> > > From: Fernando Soto [mailto:fsoto@bluecatnetworks.com]
> > > Sent: Thursday, June 13, 2013 8:11 PM
> > > To: linux-kernel@vger.kernel.org
> > > Cc: KY Srinivasan; Haiyang Zhang
> > > Subject: [PATCH] Drivers: hv: vmbus: incorrect device name is printed when
> child
> > > device is unregistered
> > >
> > > From: Fernando Soto <fsoto@bluecatnetworks.com>
> > > Please CC me, I am not subscribed to the list.
> > >
> > > Whenever a device is unregistered in vmbus_device_unregister
> > > (drivers/hv/vmbus_drv.c), the device name in the log message may contain
> > > garbage as the memory has already been freed by the time pr_info is called.
> Log
> > > example:
> > >  [ 3149.170475] hv_vmbus: child device àõsèè0_5 unregistered
> > >
> > > By logging the message just before calling device_unregister, the correct
> device
> > > name is printed:
> > > [ 3145.034652] hv_vmbus: child device vmbus_0_5 unregistered
> > >
> > > Signed-off-by: Fernando M Soto <fsoto@bluecatnetworks.com>
> > Acked-by: K. Y. Srinivasan <kys@microsoft.com>
> >
> > > --- linux-3.10-rc5/drivers/hv/vmbus_drv.c.orig	2013-06-13
> 19:20:55.359511352 -
> > > 0400
> > > +++ linux-3.10-rc5/drivers/hv/vmbus_drv.c	2013-06-13 19:21:39.299511695 -
> > > 0400
> > > @@ -698,14 +698,14 @@ int vmbus_device_register(struct hv_devi
> > >   */
> > >  void vmbus_device_unregister(struct hv_device *device_obj)
> > >  {
> > > +	pr_info("child device %s unregistered\n",
> > > +		dev_name(&device_obj->device));
> > > +
> > >  	/*
> > >  	 * Kick off the process of unregistering the device.
> > >  	 * This will call vmbus_remove() and eventually vmbus_device_release()
> > >  	 */
> > >  	device_unregister(&device_obj->device);
> > > -
> > > -	pr_info("child device %s unregistered\n",
> > > -		dev_name(&device_obj->device));
> 
> No, please just remove these entirely, or make them pr_debug(), you
> shouldn't clutter up the kernel log for stuff like this.

Agreed. Fernando, do you want to submit a patch as suggested by Greg.

K. Y
> 
> thanks,
> 
> greg k-h
> 



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

end of thread, other threads:[~2013-06-14 21:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-14  0:10 [PATCH] Drivers: hv: vmbus: incorrect device name is printed when child device is unregistered Fernando Soto
2013-06-14  2:13 ` KY Srinivasan
2013-06-14 16:22   ` Greg KH (gregkh@linuxfoundation.org)
2013-06-14 21:36     ` KY Srinivasan

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