linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH]video:uvesafb: Fix dereference NULL pointer code path
@ 2013-01-27  6:13 Wang YanQing
  0 siblings, 0 replies; 3+ messages in thread
From: Wang YanQing @ 2013-01-27  6:13 UTC (permalink / raw)
  To: FlorianSchandinat; +Cc: spock, linux-fbdev, linux-kernel

platform_device_alloc could failed and return NULL,
we should check this before call platform_device_put.

Signed-off-by: Wang YanQing <udknight@gmail.com>
---
 drivers/video/uvesafb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c
index 2f8f82d..230bd45 100644
--- a/drivers/video/uvesafb.c
+++ b/drivers/video/uvesafb.c
@@ -1975,7 +1975,8 @@ static int __devinit uvesafb_init(void)
 			err = -ENOMEM;
 
 		if (err) {
-			platform_device_put(uvesafb_device);
+			if (uvesafb_device)
+				platform_device_put(uvesafb_device);
 			platform_driver_unregister(&uvesafb_driver);
 			cn_del_callback(&uvesafb_cn_id);
 			return err;
-- 
1.7.11.1.116.g8228a23

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

* Re: [PATCH]video:uvesafb: Fix dereference NULL pointer code path
  2013-03-30  2:53 Wang YanQing
@ 2013-04-02 10:34 ` Tomi Valkeinen
  0 siblings, 0 replies; 3+ messages in thread
From: Tomi Valkeinen @ 2013-04-02 10:34 UTC (permalink / raw)
  To: Wang YanQing, spock, linux-fbdev, FlorianSchandinat, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 860 bytes --]

On 2013-03-30 04:53, Wang YanQing wrote:
> platform_device_alloc could failed and return NULL,
> we should check this before call platform_device_put.
> 
> Signed-off-by: Wang YanQing <udknight@gmail.com>
> ---
>  drivers/video/uvesafb.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c
> index 2f8f82d..230bd45 100644
> --- a/drivers/video/uvesafb.c
> +++ b/drivers/video/uvesafb.c
> @@ -1975,7 +1975,8 @@ static int __devinit uvesafb_init(void)
>  			err = -ENOMEM;
>  
>  		if (err) {
> -			platform_device_put(uvesafb_device);
> +			if (uvesafb_device)
> +				platform_device_put(uvesafb_device);
>  			platform_driver_unregister(&uvesafb_driver);
>  			cn_del_callback(&uvesafb_cn_id);
>  			return err;
> 

Thanks, queued to fbdev fixes.

 Tomi



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 899 bytes --]

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

* [PATCH]video:uvesafb: Fix dereference NULL pointer code path
@ 2013-03-30  2:53 Wang YanQing
  2013-04-02 10:34 ` Tomi Valkeinen
  0 siblings, 1 reply; 3+ messages in thread
From: Wang YanQing @ 2013-03-30  2:53 UTC (permalink / raw)
  To: tomi.valkeinen; +Cc: spock, linux-fbdev, FlorianSchandinat, linux-kernel

platform_device_alloc could failed and return NULL,
we should check this before call platform_device_put.

Signed-off-by: Wang YanQing <udknight@gmail.com>
---
 drivers/video/uvesafb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c
index 2f8f82d..230bd45 100644
--- a/drivers/video/uvesafb.c
+++ b/drivers/video/uvesafb.c
@@ -1975,7 +1975,8 @@ static int __devinit uvesafb_init(void)
 			err = -ENOMEM;
 
 		if (err) {
-			platform_device_put(uvesafb_device);
+			if (uvesafb_device)
+				platform_device_put(uvesafb_device);
 			platform_driver_unregister(&uvesafb_driver);
 			cn_del_callback(&uvesafb_cn_id);
 			return err;
-- 
1.7.11.1.116.g8228a23

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

end of thread, other threads:[~2013-04-02 10:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-27  6:13 [PATCH]video:uvesafb: Fix dereference NULL pointer code path Wang YanQing
2013-03-30  2:53 Wang YanQing
2013-04-02 10:34 ` Tomi Valkeinen

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