All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [video/fbdev] mbxfb_remove: fix null pointer dereference
@ 2020-07-26  5:20 ` Gaurav Singh
  0 siblings, 0 replies; 6+ messages in thread
From: Gaurav Singh @ 2020-07-26  5:20 UTC (permalink / raw)
  To: gaurav1086, Bartlomiej Zolnierkiewicz, Arnd Bergmann,
	Daniel Vetter, Jani Nikula, open list:FRAMEBUFFER LAYER,
	open list:FRAMEBUFFER LAYER, open list

Function mbxfb_debugfs_remove() accesses fbi->par without NULL check,
hence do the NULL check in the caller mbxfb_remove().

Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
---
 drivers/video/fbdev/mbx/mbxfb.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/video/fbdev/mbx/mbxfb.c b/drivers/video/fbdev/mbx/mbxfb.c
index 6dc287c819cb..515c0cda1994 100644
--- a/drivers/video/fbdev/mbx/mbxfb.c
+++ b/drivers/video/fbdev/mbx/mbxfb.c
@@ -1012,11 +1012,10 @@ static int mbxfb_remove(struct platform_device *dev)
 
 	write_reg_dly(SYSRST_RST, SYSRST);
 
-	mbxfb_debugfs_remove(fbi);
-
 	if (fbi) {
 		struct mbxfb_info *mfbi = fbi->par;
 
+		mbxfb_debugfs_remove(fbi);
 		unregister_framebuffer(fbi);
 		if (mfbi) {
 			if (mfbi->platform_remove)
-- 
2.17.1


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

* [PATCH] [video/fbdev] mbxfb_remove: fix null pointer dereference
@ 2020-07-26  5:20 ` Gaurav Singh
  0 siblings, 0 replies; 6+ messages in thread
From: Gaurav Singh @ 2020-07-26  5:20 UTC (permalink / raw)
  To: gaurav1086, Bartlomiej Zolnierkiewicz, Arnd Bergmann,
	Daniel Vetter, Jani Nikula, open list:FRAMEBUFFER LAYER,
	open list:FRAMEBUFFER LAYER, open list

Function mbxfb_debugfs_remove() accesses fbi->par without NULL check,
hence do the NULL check in the caller mbxfb_remove().

Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
---
 drivers/video/fbdev/mbx/mbxfb.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/video/fbdev/mbx/mbxfb.c b/drivers/video/fbdev/mbx/mbxfb.c
index 6dc287c819cb..515c0cda1994 100644
--- a/drivers/video/fbdev/mbx/mbxfb.c
+++ b/drivers/video/fbdev/mbx/mbxfb.c
@@ -1012,11 +1012,10 @@ static int mbxfb_remove(struct platform_device *dev)
 
 	write_reg_dly(SYSRST_RST, SYSRST);
 
-	mbxfb_debugfs_remove(fbi);
-
 	if (fbi) {
 		struct mbxfb_info *mfbi = fbi->par;
 
+		mbxfb_debugfs_remove(fbi);
 		unregister_framebuffer(fbi);
 		if (mfbi) {
 			if (mfbi->platform_remove)
-- 
2.17.1

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

* [PATCH] [video/fbdev] mbxfb_remove: fix null pointer dereference
@ 2020-07-26  5:20 ` Gaurav Singh
  0 siblings, 0 replies; 6+ messages in thread
From: Gaurav Singh @ 2020-07-26  5:20 UTC (permalink / raw)
  To: gaurav1086, Bartlomiej Zolnierkiewicz, Arnd Bergmann,
	Daniel Vetter, Jani Nikula, open list:FRAMEBUFFER LAYER,
	open list:FRAMEBUFFER LAYER, open list

Function mbxfb_debugfs_remove() accesses fbi->par without NULL check,
hence do the NULL check in the caller mbxfb_remove().

Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
---
 drivers/video/fbdev/mbx/mbxfb.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/video/fbdev/mbx/mbxfb.c b/drivers/video/fbdev/mbx/mbxfb.c
index 6dc287c819cb..515c0cda1994 100644
--- a/drivers/video/fbdev/mbx/mbxfb.c
+++ b/drivers/video/fbdev/mbx/mbxfb.c
@@ -1012,11 +1012,10 @@ static int mbxfb_remove(struct platform_device *dev)
 
 	write_reg_dly(SYSRST_RST, SYSRST);
 
-	mbxfb_debugfs_remove(fbi);
-
 	if (fbi) {
 		struct mbxfb_info *mfbi = fbi->par;
 
+		mbxfb_debugfs_remove(fbi);
 		unregister_framebuffer(fbi);
 		if (mfbi) {
 			if (mfbi->platform_remove)
-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] [video/fbdev] mbxfb_remove: fix null pointer dereference
  2020-07-26  5:20 ` Gaurav Singh
  (?)
@ 2020-07-26  8:57   ` Andy Shevchenko
  -1 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2020-07-26  8:57 UTC (permalink / raw)
  To: Gaurav Singh
  Cc: Bartlomiej Zolnierkiewicz, Arnd Bergmann, Daniel Vetter,
	Jani Nikula, open list:FRAMEBUFFER LAYER,
	open list:FRAMEBUFFER LAYER, open list

On Sun, Jul 26, 2020 at 8:26 AM Gaurav Singh <gaurav1086@gmail.com> wrote:
>
> Function mbxfb_debugfs_remove() accesses fbi->par without NULL check,
> hence do the NULL check in the caller mbxfb_remove().

...

> @@ -1012,11 +1012,10 @@ static int mbxfb_remove(struct platform_device *dev)
>
>         write_reg_dly(SYSRST_RST, SYSRST);
>
> -       mbxfb_debugfs_remove(fbi);
> -

>         if (fbi) {

Can you explain how this is NULL on ->remove()?

I bet this check is simply redundant. But you have to check and update
commit message accordingly.

>                 struct mbxfb_info *mfbi = fbi->par;
>
> +               mbxfb_debugfs_remove(fbi);
>                 unregister_framebuffer(fbi);
>                 if (mfbi) {
>                         if (mfbi->platform_remove)


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH] [video/fbdev] mbxfb_remove: fix null pointer dereference
@ 2020-07-26  8:57   ` Andy Shevchenko
  0 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2020-07-26  8:57 UTC (permalink / raw)
  To: Gaurav Singh
  Cc: open list:FRAMEBUFFER LAYER, Arnd Bergmann,
	Bartlomiej Zolnierkiewicz, Jani Nikula, Daniel Vetter, open list,
	open list:FRAMEBUFFER LAYER

On Sun, Jul 26, 2020 at 8:26 AM Gaurav Singh <gaurav1086@gmail.com> wrote:
>
> Function mbxfb_debugfs_remove() accesses fbi->par without NULL check,
> hence do the NULL check in the caller mbxfb_remove().

...

> @@ -1012,11 +1012,10 @@ static int mbxfb_remove(struct platform_device *dev)
>
>         write_reg_dly(SYSRST_RST, SYSRST);
>
> -       mbxfb_debugfs_remove(fbi);
> -

>         if (fbi) {

Can you explain how this is NULL on ->remove()?

I bet this check is simply redundant. But you have to check and update
commit message accordingly.

>                 struct mbxfb_info *mfbi = fbi->par;
>
> +               mbxfb_debugfs_remove(fbi);
>                 unregister_framebuffer(fbi);
>                 if (mfbi) {
>                         if (mfbi->platform_remove)


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH] [video/fbdev] mbxfb_remove: fix null pointer dereference
@ 2020-07-26  8:57   ` Andy Shevchenko
  0 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2020-07-26  8:57 UTC (permalink / raw)
  To: Gaurav Singh
  Cc: open list:FRAMEBUFFER LAYER, Arnd Bergmann,
	Bartlomiej Zolnierkiewicz, Jani Nikula, Daniel Vetter, open list,
	open list:FRAMEBUFFER LAYER

On Sun, Jul 26, 2020 at 8:26 AM Gaurav Singh <gaurav1086@gmail.com> wrote:
>
> Function mbxfb_debugfs_remove() accesses fbi->par without NULL check,
> hence do the NULL check in the caller mbxfb_remove().

...

> @@ -1012,11 +1012,10 @@ static int mbxfb_remove(struct platform_device *dev)
>
>         write_reg_dly(SYSRST_RST, SYSRST);
>
> -       mbxfb_debugfs_remove(fbi);
> -

>         if (fbi) {

Can you explain how this is NULL on ->remove()?

I bet this check is simply redundant. But you have to check and update
commit message accordingly.

>                 struct mbxfb_info *mfbi = fbi->par;
>
> +               mbxfb_debugfs_remove(fbi);
>                 unregister_framebuffer(fbi);
>                 if (mfbi) {
>                         if (mfbi->platform_remove)


-- 
With Best Regards,
Andy Shevchenko
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2020-07-26 15:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-26  5:20 [PATCH] [video/fbdev] mbxfb_remove: fix null pointer dereference Gaurav Singh
2020-07-26  5:20 ` Gaurav Singh
2020-07-26  5:20 ` Gaurav Singh
2020-07-26  8:57 ` Andy Shevchenko
2020-07-26  8:57   ` Andy Shevchenko
2020-07-26  8:57   ` Andy Shevchenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.