+ lcd-fix-oops-if-driver-only-interested-in-set_power.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     lcd: fix oops if driver only interested in .set_power
has been added to the -mm tree.  Its filename is
     lcd-fix-oops-if-driver-only-interested-in-set_power.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find
out what to do about this

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: lcd: fix oops if driver only interested in .set_power
From: Ben Dooks <ben-linux@xxxxxxxxx>

The LCD driver core calls LCD drivers when either the blanking state or
the display mode has changed, but does not make any check to see if the
called driver has a .set_mode method.

This means if a driver only has a .set_power method then the system will
OOPS on changing mode (and with the console semaphore held so you cannot
easily see the problem).

Fix the problem by ensuring that either callback is valid before use.

Signed-off-by: Ben Dooks <ben-linux@xxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 drivers/video/backlight/lcd.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff -puN drivers/video/backlight/lcd.c~lcd-fix-oops-if-driver-only-interested-in-set_power drivers/video/backlight/lcd.c
--- a/drivers/video/backlight/lcd.c~lcd-fix-oops-if-driver-only-interested-in-set_power
+++ a/drivers/video/backlight/lcd.c
@@ -42,10 +42,13 @@ static int fb_notifier_callback(struct n
 
 	mutex_lock(&ld->ops_lock);
 	if (!ld->ops->check_fb || ld->ops->check_fb(ld, evdata->info)) {
-		if (event == FB_EVENT_BLANK)
-			ld->ops->set_power(ld, *(int *)evdata->data);
-		else
-			ld->ops->set_mode(ld, evdata->data);
+		if (event == FB_EVENT_BLANK) {
+			if (ld->ops->set_power)
+				ld->ops->set_power(ld, *(int *)evdata->data);
+		} else {
+			if (ld->ops->set_mode)
+				ld->ops->set_mode(ld, evdata->data);
+		}
 	}
 	mutex_unlock(&ld->ops_lock);
 	return 0;
_

Patches currently in -mm which might be from ben-linux@xxxxxxxxx are

lcd-fix-oops-if-driver-only-interested-in-set_power.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux