linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUGFIX PATCH] USB: chipidea: fix use after free bug
@ 2012-11-22  9:11 Lothar Waßmann
  2012-11-22  9:29 ` Alexander Shishkin
  0 siblings, 1 reply; 2+ messages in thread
From: Lothar Waßmann @ 2012-11-22  9:11 UTC (permalink / raw)
  To: Alexander Shishkin
  Cc: Greg Kroah-Hartman, linux-kernel, linux-usb, Lothar Waßmann

The pointer to a platform_device struct must not be dereferenced after
the device has been unregistered.

This bug produces a crash when unloading the ci13xxx kernel module
compiled with CONFIG_PAGE_POISONING enabled.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
---
 drivers/usb/chipidea/core.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index f69d029..b726c49 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -385,8 +385,9 @@ EXPORT_SYMBOL_GPL(ci13xxx_add_device);
 
 void ci13xxx_remove_device(struct platform_device *pdev)
 {
+	int id = pdev->id;
 	platform_device_unregister(pdev);
-	ida_simple_remove(&ci_ida, pdev->id);
+	ida_simple_remove(&ci_ida, id);
 }
 EXPORT_SYMBOL_GPL(ci13xxx_remove_device);
 
-- 
1.7.2.5


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

* Re: [BUGFIX PATCH] USB: chipidea: fix use after free bug
  2012-11-22  9:11 [BUGFIX PATCH] USB: chipidea: fix use after free bug Lothar Waßmann
@ 2012-11-22  9:29 ` Alexander Shishkin
  0 siblings, 0 replies; 2+ messages in thread
From: Alexander Shishkin @ 2012-11-22  9:29 UTC (permalink / raw)
  To: Lothar Waßmann
  Cc: Greg Kroah-Hartman, linux-kernel, linux-usb, Lothar Waßmann

Lothar Waßmann <LW@KARO-electronics.de> writes:

> The pointer to a platform_device struct must not be dereferenced after
> the device has been unregistered.
>
> This bug produces a crash when unloading the ci13xxx kernel module
> compiled with CONFIG_PAGE_POISONING enabled.
>
> Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

Good one, thanks.

Acked-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>

Greg, this is -stable material, applicable starting from v3.6.

> ---
>  drivers/usb/chipidea/core.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> index f69d029..b726c49 100644
> --- a/drivers/usb/chipidea/core.c
> +++ b/drivers/usb/chipidea/core.c
> @@ -385,8 +385,9 @@ EXPORT_SYMBOL_GPL(ci13xxx_add_device);
>  
>  void ci13xxx_remove_device(struct platform_device *pdev)
>  {
> +	int id = pdev->id;
>  	platform_device_unregister(pdev);
> -	ida_simple_remove(&ci_ida, pdev->id);
> +	ida_simple_remove(&ci_ida, id);
>  }
>  EXPORT_SYMBOL_GPL(ci13xxx_remove_device);
>  
> -- 
> 1.7.2.5

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

end of thread, other threads:[~2012-11-23  5:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-22  9:11 [BUGFIX PATCH] USB: chipidea: fix use after free bug Lothar Waßmann
2012-11-22  9:29 ` Alexander Shishkin

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