]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
more .26 patches
authorGreg Kroah-Hartman <gregkh@suse.de>
Wed, 3 Sep 2008 15:28:33 +0000 (08:28 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 3 Sep 2008 15:28:33 +0000 (08:28 -0700)
queue-2.6.26/8250-improve-workaround-for-uarts-that-don-t-re-assert-thre-correctly.patch [new file with mode: 0644]
queue-2.6.26/drivers-char-random.c-fix-a-race-which-can-lead-to-a-bogus-bug.patch [new file with mode: 0644]
queue-2.6.26/mm-make-setup_zone_migrate_reserve-aware-of-overlapping-nodes.patch [new file with mode: 0644]
queue-2.6.26/rtc_time_to_tm-fix-signed-unsigned-arithmetic.patch [new file with mode: 0644]
queue-2.6.26/series

diff --git a/queue-2.6.26/8250-improve-workaround-for-uarts-that-don-t-re-assert-thre-correctly.patch b/queue-2.6.26/8250-improve-workaround-for-uarts-that-don-t-re-assert-thre-correctly.patch
new file mode 100644 (file)
index 0000000..4432707
--- /dev/null
@@ -0,0 +1,81 @@
+From jejb@kernel.org  Wed Sep  3 08:25:08 2008
+From: Will Newton <will.newton@gmail.com>
+Date: Wed, 3 Sep 2008 02:35:06 GMT
+Subject: 8250: improve workaround for UARTs that don't re-assert THRE correctly
+To: jejb@kernel.org, stable@kernel.org
+Message-ID: <200809030235.m832Z6tq015405@hera.kernel.org>
+
+From: Will Newton <will.newton@gmail.com>
+
+commit 363f66fe06c75270b669c88e321e6b354ba0201e upstream
+
+Recent changes to tighten the check for UARTs that don't correctly
+re-assert THRE (01c194d9278efc15d4785ff205643e9c0bdcef53: "serial 8250:
+tighten test for using backup timer") caused problems when such a UART was
+opened for the second time - the bug could only successfully be detected
+at first initialization.  For users of this version of this particular
+UART IP it is fatal.
+
+This patch stores the information about the bug in the bugs field of the
+port structure when the port is first started up so subsequent opens can
+check this bit even if the test for the bug fails.
+
+David Brownell: "My own exposure to this is that the UART on DaVinci
+hardware, which TI allegedly derived from its original 16550 logic, has
+periodically gone from working to unusable with the mainline 8250.c ...
+and back and forth a bunch.  Currently it's "unusable", a regression from
+some previous versions.  With this patch from Will, it's usable."
+
+Signed-off-by: Will Newton <will.newton@gmail.com>
+Acked-by: Alex Williamson <alex.williamson@hp.com>
+Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
+Cc: David Brownell <david-b@pacbell.net>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/serial/8250.c |   16 ++++++++++++----
+ drivers/serial/8250.h |    1 +
+ 2 files changed, 13 insertions(+), 4 deletions(-)
+
+--- a/drivers/serial/8250.c
++++ b/drivers/serial/8250.c
+@@ -1895,15 +1895,23 @@ static int serial8250_startup(struct uar
+                * kick the UART on a regular basis.
+                */
+               if (!(iir1 & UART_IIR_NO_INT) && (iir & UART_IIR_NO_INT)) {
++                      up->bugs |= UART_BUG_THRE;
+                       pr_debug("ttyS%d - using backup timer\n", port->line);
+-                      up->timer.function = serial8250_backup_timeout;
+-                      up->timer.data = (unsigned long)up;
+-                      mod_timer(&up->timer, jiffies +
+-                              poll_timeout(up->port.timeout) + HZ / 5);
+               }
+       }
+       /*
++       * The above check will only give an accurate result the first time
++       * the port is opened so this value needs to be preserved.
++       */
++      if (up->bugs & UART_BUG_THRE) {
++              up->timer.function = serial8250_backup_timeout;
++              up->timer.data = (unsigned long)up;
++              mod_timer(&up->timer, jiffies +
++                        poll_timeout(up->port.timeout) + HZ / 5);
++      }
++
++      /*
+        * If the "interrupt" for this port doesn't correspond with any
+        * hardware interrupt, we use a timer-based system.  The original
+        * driver used to do this with IRQ0.
+--- a/drivers/serial/8250.h
++++ b/drivers/serial/8250.h
+@@ -49,6 +49,7 @@ struct serial8250_config {
+ #define UART_BUG_QUOT (1 << 0)        /* UART has buggy quot LSB */
+ #define UART_BUG_TXEN (1 << 1)        /* UART has buggy TX IIR status */
+ #define UART_BUG_NOMSR        (1 << 2)        /* UART has buggy MSR status bits (Au1x00) */
++#define UART_BUG_THRE (1 << 3)        /* UART has buggy THRE reassertion */
+ #define PROBE_RSA     (1 << 0)
+ #define PROBE_ANY     (~0)
diff --git a/queue-2.6.26/drivers-char-random.c-fix-a-race-which-can-lead-to-a-bogus-bug.patch b/queue-2.6.26/drivers-char-random.c-fix-a-race-which-can-lead-to-a-bogus-bug.patch
new file mode 100644 (file)
index 0000000..51d93d9
--- /dev/null
@@ -0,0 +1,106 @@
+From jejb@kernel.org  Wed Sep  3 08:23:47 2008
+From: Andrew Morton <akpm@linux-foundation.org>
+Date: Wed, 3 Sep 2008 02:35:02 GMT
+Subject: drivers/char/random.c: fix a race which can lead to a bogus BUG()
+To: jejb@kernel.org, stable@kernel.org
+Message-ID: <200809030235.m832Z2Yo015325@hera.kernel.org>
+
+From: Andrew Morton <akpm@linux-foundation.org>
+
+commit 8b76f46a2db29407fed66cf4aca19d61b3dcb3e1 upstream
+
+Fix a bug reported by and diagnosed by Aaron Straus.
+
+This is a regression intruduced into 2.6.26 by
+
+    commit adc782dae6c4c0f6fb679a48a544cfbcd79ae3dc
+    Author: Matt Mackall <mpm@selenic.com>
+    Date:   Tue Apr 29 01:03:07 2008 -0700
+
+        random: simplify and rename credit_entropy_store
+
+credit_entropy_bits() does:
+
+       spin_lock_irqsave(&r->lock, flags);
+       ...
+       if (r->entropy_count > r->poolinfo->POOLBITS)
+               r->entropy_count = r->poolinfo->POOLBITS;
+
+so there is a time window in which this BUG_ON():
+
+static size_t account(struct entropy_store *r, size_t nbytes, int min,
+                     int reserved)
+{
+       unsigned long flags;
+
+       BUG_ON(r->entropy_count > r->poolinfo->POOLBITS);
+
+       /* Hold lock while accounting */
+       spin_lock_irqsave(&r->lock, flags);
+
+can trigger.
+
+We could fix this by moving the assertion inside the lock, but it seems
+safer and saner to revert to the old behaviour wherein
+entropy_store.entropy_count at no time exceeds
+entropy_store.poolinfo->POOLBITS.
+
+Reported-by: Aaron Straus <aaron@merfinllc.com>
+Cc: Matt Mackall <mpm@selenic.com>
+Cc: Theodore Ts'o <tytso@mit.edu>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/char/random.c |   19 ++++++++++---------
+ 1 file changed, 10 insertions(+), 9 deletions(-)
+
+--- a/drivers/char/random.c
++++ b/drivers/char/random.c
+@@ -406,7 +406,7 @@ struct entropy_store {
+       /* read-write data: */
+       spinlock_t lock;
+       unsigned add_ptr;
+-      int entropy_count;
++      int entropy_count;      /* Must at no time exceed ->POOLBITS! */
+       int input_rotate;
+ };
+@@ -519,6 +519,7 @@ static void mix_pool_bytes(struct entrop
+ static void credit_entropy_bits(struct entropy_store *r, int nbits)
+ {
+       unsigned long flags;
++      int entropy_count;
+       if (!nbits)
+               return;
+@@ -526,20 +527,20 @@ static void credit_entropy_bits(struct e
+       spin_lock_irqsave(&r->lock, flags);
+       DEBUG_ENT("added %d entropy credits to %s\n", nbits, r->name);
+-      r->entropy_count += nbits;
+-      if (r->entropy_count < 0) {
++      entropy_count = r->entropy_count;
++      entropy_count += nbits;
++      if (entropy_count < 0) {
+               DEBUG_ENT("negative entropy/overflow\n");
+-              r->entropy_count = 0;
+-      } else if (r->entropy_count > r->poolinfo->POOLBITS)
+-              r->entropy_count = r->poolinfo->POOLBITS;
++              entropy_count = 0;
++      } else if (entropy_count > r->poolinfo->POOLBITS)
++              entropy_count = r->poolinfo->POOLBITS;
++      r->entropy_count = entropy_count;
+       /* should we wake readers? */
+-      if (r == &input_pool &&
+-          r->entropy_count >= random_read_wakeup_thresh) {
++      if (r == &input_pool && entropy_count >= random_read_wakeup_thresh) {
+               wake_up_interruptible(&random_read_wait);
+               kill_fasync(&fasync, SIGIO, POLL_IN);
+       }
+-
+       spin_unlock_irqrestore(&r->lock, flags);
+ }
diff --git a/queue-2.6.26/mm-make-setup_zone_migrate_reserve-aware-of-overlapping-nodes.patch b/queue-2.6.26/mm-make-setup_zone_migrate_reserve-aware-of-overlapping-nodes.patch
new file mode 100644 (file)
index 0000000..ad65397
--- /dev/null
@@ -0,0 +1,62 @@
+From jejb@kernel.org  Wed Sep  3 08:25:42 2008
+From: Adam Litke <agl@us.ibm.com>
+Date: Wed, 3 Sep 2008 02:35:08 GMT
+Subject: mm: make setup_zone_migrate_reserve() aware of overlapping nodes
+To: jejb@kernel.org, stable@kernel.org
+Message-ID: <200809030235.m832Z8Wn015432@hera.kernel.org>
+
+From: Adam Litke <agl@us.ibm.com>
+
+commit 344c790e3821dac37eb742ddd0b611a300f78b9a upstream
+
+I have gotten to the root cause of the hugetlb badness I reported back on
+August 15th.  My system has the following memory topology (note the
+overlapping node):
+
+            Node 0 Memory: 0x8000000-0x44000000
+            Node 1 Memory: 0x0-0x8000000 0x44000000-0x80000000
+
+setup_zone_migrate_reserve() scans the address range 0x0-0x8000000 looking
+for a pageblock to move onto the MIGRATE_RESERVE list.  Finding no
+candidates, it happily continues the scan into 0x8000000-0x44000000.  When
+a pageblock is found, the pages are moved to the MIGRATE_RESERVE list on
+the wrong zone.  Oops.
+
+setup_zone_migrate_reserve() should skip pageblocks in overlapping nodes.
+
+Signed-off-by: Adam Litke <agl@us.ibm.com>
+Acked-by: Mel Gorman <mel@csn.ul.ie>
+Cc: Dave Hansen <dave@linux.vnet.ibm.com>
+Cc: Nishanth Aravamudan <nacc@us.ibm.com>
+Cc: Andy Whitcroft <apw@shadowen.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ mm/page_alloc.c |    7 +++++++
+ 1 file changed, 7 insertions(+)
+
+--- a/mm/page_alloc.c
++++ b/mm/page_alloc.c
+@@ -693,6 +693,9 @@ int move_freepages(struct zone *zone,
+ #endif
+       for (page = start_page; page <= end_page;) {
++              /* Make sure we are not inadvertently changing nodes */
++              VM_BUG_ON(page_to_nid(page) != zone_to_nid(zone));
++
+               if (!pfn_valid_within(page_to_pfn(page))) {
+                       page++;
+                       continue;
+@@ -2475,6 +2478,10 @@ static void setup_zone_migrate_reserve(s
+                       continue;
+               page = pfn_to_page(pfn);
++              /* Watch out for overlapping nodes */
++              if (page_to_nid(page) != zone_to_nid(zone))
++                      continue;
++
+               /* Blocks with reserved pages will never free, skip them. */
+               if (PageReserved(page))
+                       continue;
diff --git a/queue-2.6.26/rtc_time_to_tm-fix-signed-unsigned-arithmetic.patch b/queue-2.6.26/rtc_time_to_tm-fix-signed-unsigned-arithmetic.patch
new file mode 100644 (file)
index 0000000..52e183f
--- /dev/null
@@ -0,0 +1,60 @@
+From jejb@kernel.org  Wed Sep  3 08:24:25 2008
+From: Jan Altenberg <jan.altenberg@linutronix.de>
+Date: Wed, 3 Sep 2008 02:35:04 GMT
+Subject: rtc_time_to_tm: fix signed/unsigned arithmetic
+To: jejb@kernel.org, stable@kernel.org
+Message-ID: <200809030235.m832Z4VM015365@hera.kernel.org>
+
+From: Jan Altenberg <jan.altenberg@linutronix.de>
+
+commit 73442daf2ea85e2a779396b76b1a39b10188ecb5 upstream
+
+commit 945185a69daa457c4c5e46e47f4afad7dcea734f ("rtc: rtc_time_to_tm: use
+unsigned arithmetic") changed the some types in rtc_time_to_tm() to
+unsigned:
+
+ void rtc_time_to_tm(unsigned long time, struct rtc_time *tm)
+ {
+-       register int days, month, year;
++       unsigned int days, month, year;
+
+This doesn't work for all cases, because days is checked for < 0 later
+on:
+
+if (days < 0) {
+       year -= 1;
+       days += 365 + LEAP_YEAR(year);
+}
+
+I think the correct fix would be to keep days signed and do an appropriate
+cast later on.
+
+Signed-off-by: Jan Altenberg <jan.altenberg@linutronix.de>
+Cc: Maciej W. Rozycki <macro@linux-mips.org>
+Cc: Alessandro Zummo <a.zummo@towertech.it>
+Cc: David Brownell <david-b@pacbell.net>
+Cc: Dmitri Vorobiev <dmitri.vorobiev@gmail.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/rtc/rtc-lib.c |    5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/drivers/rtc/rtc-lib.c
++++ b/drivers/rtc/rtc-lib.c
+@@ -51,10 +51,11 @@ EXPORT_SYMBOL(rtc_year_days);
+  */
+ void rtc_time_to_tm(unsigned long time, struct rtc_time *tm)
+ {
+-      unsigned int days, month, year;
++      unsigned int month, year;
++      int days;
+       days = time / 86400;
+-      time -= days * 86400;
++      time -= (unsigned int) days * 86400;
+       /* day of the week, 1970-01-01 was a Thursday */
+       tm->tm_wday = (days + 4) % 7;
index b01cba14fa8ad0b2fbe21cfae8ca3857fb097fc2..ea787a885b397b0f05d572f8b2b12f9da00f825a 100644 (file)
@@ -13,3 +13,7 @@ bio-fix-bio_copy_kern-handling-of-bio-bv_len.patch
 forcedeth-fix-checksum-flag.patch
 atl1-disable-tso-by-default.patch
 cifs-fix-o_append-on-directio-mounts.patch
+drivers-char-random.c-fix-a-race-which-can-lead-to-a-bogus-bug.patch
+rtc_time_to_tm-fix-signed-unsigned-arithmetic.patch
+8250-improve-workaround-for-uarts-that-don-t-re-assert-thre-correctly.patch
+mm-make-setup_zone_migrate_reserve-aware-of-overlapping-nodes.patch