]> git.pld-linux.org Git - packages/kernel.git/blame - kernel-small_fixes.patch
- vs up to patch-3.13.6-vs2.3.6.11.diff
[packages/kernel.git] / kernel-small_fixes.patch
CommitLineData
08aa9d92 1--- linux-2.6.33/scripts/mod/modpost.c~ 2010-02-24 19:52:17.000000000 +0100
2+++ linux-2.6.33/scripts/mod/modpost.c 2010-03-07 14:26:47.242168558 +0100
3@@ -15,7 +15,8 @@
4 #include <stdio.h>
5 #include <ctype.h>
6 #include "modpost.h"
7-#include "../../include/generated/autoconf.h"
8+// PLD architectures don't use CONFIG_SYMBOL_PREFIX
9+//#include "../../include/generated/autoconf.h"
10 #include "../../include/linux/license.h"
11
12 /* Some toolchains use a `_' prefix for all user symbols. */
13
2136e199
AM
14--- linux-3.0/scripts/kconfig/lxdialog/check-lxdialog.sh~ 2011-07-22 04:17:23.000000000 +0200
15+++ linux-3.0/scripts/kconfig/lxdialog/check-lxdialog.sh 2011-08-25 21:26:04.799150642 +0200
16@@ -9,6 +9,12 @@
17 $cc -print-file-name=lib${lib}.${ext} | grep -q /
18 if [ $? -eq 0 ]; then
19 echo "-l${lib}"
20+ for libt in tinfow tinfo ; do
21+ $cc -print-file-name=lib${libt}.${ext} | grep -q /
22+ if [ $? -eq 0 ]; then
23+ echo "-l${libt}"
24+ fi
25+ done
26 exit
27 fi
28 done
44c0f99c 29
59e60efc
AM
30diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
31index 7a0c800..ec5ebbb 100644
32--- a/drivers/net/ethernet/realtek/r8169.c
33+++ b/drivers/net/ethernet/realtek/r8169.c
514e5dae 34@@ -6927,6 +6927,14 @@ rtl_init_one(struct pci_dev *pdev, const
59e60efc
AM
35 for (i = 0; i < ETH_ALEN; i++)
36 dev->dev_addr[i] = RTL_R8(MAC0 + i);
514e5dae 37
59e60efc
AM
38+ if (!is_valid_ether_addr(dev->dev_addr)) {
39+ /* Report it and use a random ethernet address instead */
40+ netdev_err(dev, "Invalid MAC address: %pM\n", dev->dev_addr);
41+ random_ether_addr(dev->dev_addr);
42+ netdev_info(dev, "Using random MAC address: %pM\n",
514e5dae 43+ dev->dev_addr);
59e60efc 44+ }
514e5dae 45+
59e60efc 46 SET_ETHTOOL_OPS(dev, &rtl8169_ethtool_ops);
514e5dae
AM
47 dev->watchdog_timeo = RTL8169_TX_TIMEOUT;
48
20e3bfd4
KK
49[PATCH] SCSI: Don't attempt to send extended INQUIRY command if skip_vpd_pages is set
50
51If a device has the skip_vpd_pages flag set we should simply fail the
52scsi_get_vpd_page() call.
53
54Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
55Acked-by: Alan Stern <stern@rowland.harvard.edu>
56Tested-by: Stuart Foster <smf.linux@ntlworld.com>
57Cc: stable@vger.kernel.org
58
59diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
60index 3b1ea34..eaa808e 100644
61--- a/drivers/scsi/scsi.c
62+++ b/drivers/scsi/scsi.c
63@@ -1031,6 +1031,9 @@
64 {
65 int i, result;
66
67+ if (sdev->skip_vpd_pages)
68+ goto fail;
69+
70 /* Ask for all the pages supported by this device */
71 result = scsi_vpd_inquiry(sdev, buf, 0, buf_len);
72 if (result)
bf059aeb
AM
73commit 4d0ed18277cc6f07513ee0b04475f19cd69e75ef
74Author: Peter Hurley <peter@hurleysoftware.com>
75Date: Tue Dec 10 17:12:02 2013 -0500
76
77 n_tty: Fix buffer overruns with larger-than-4k pastes
78
79 readline() inadvertently triggers an error recovery path when
80 pastes larger than 4k overrun the line discipline buffer. The
81 error recovery path discards input when the line discipline buffer
82 is full and operating in canonical mode and no newline has been
83 received. Because readline() changes the termios to non-canonical
84 mode to read the line char-by-char, the line discipline buffer
85 can become full, and then when readline() restores termios back
86 to canonical mode for the caller, the now-full line discipline
87 buffer triggers the error recovery.
88
89 When changing termios from non-canon to canon mode and the read
90 buffer contains data, simulate an EOF push _without_ the
91 DISABLED_CHAR in the read buffer.
92
93 Importantly for the readline() problem, the termios can be
94 changed back to non-canonical mode without changes to the read
95 buffer occurring; ie., as if the previous termios change had not
96 happened (as long as no intervening read took place).
97
98 Preserve existing userspace behavior which allows '\0's already
99 received in non-canon mode to be read as '\0's in canon mode
100 (rather than trigger add'l EOF pushes or an actual EOF).
101
102 Patch based on original proposal and discussion here
103 https://bugzilla.kernel.org/show_bug.cgi?id=55991
104 by Stas Sergeev <stsp@users.sourceforge.net>
105
106 Reported-by: Margarita Manterola <margamanterola@gmail.com>
107 Cc: Maximiliano Curia <maxy@gnuservers.com.ar>
108 Cc: Pavel Machek <pavel@ucw.cz>
109 Cc: Arkadiusz Miskiewicz <a.miskiewicz@gmail.com>
110 Acked-by: Stas Sergeev <stsp@users.sourceforge.net>
111 Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
112 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
113
114diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
115index fdc2ecd..961e6a9 100644
116--- a/drivers/tty/n_tty.c
117+++ b/drivers/tty/n_tty.c
118@@ -104,6 +104,7 @@ struct n_tty_data {
119
120 /* must hold exclusive termios_rwsem to reset these */
121 unsigned char lnext:1, erasing:1, raw:1, real_raw:1, icanon:1;
122+ unsigned char push:1;
123
124 /* shared by producer and consumer */
125 char read_buf[N_TTY_BUF_SIZE];
126@@ -341,6 +342,7 @@ static void reset_buffer_flags(struct n_tty_data *ldata)
127
128 ldata->erasing = 0;
129 bitmap_zero(ldata->read_flags, N_TTY_BUF_SIZE);
130+ ldata->push = 0;
131 }
132
133 static void n_tty_packet_mode_flush(struct tty_struct *tty)
134@@ -1745,7 +1747,16 @@ static void n_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
135
136 if (!old || (old->c_lflag ^ tty->termios.c_lflag) & ICANON) {
137 bitmap_zero(ldata->read_flags, N_TTY_BUF_SIZE);
138- ldata->line_start = ldata->canon_head = ldata->read_tail;
139+ ldata->line_start = ldata->read_tail;
140+ if (!L_ICANON(tty) || !read_cnt(ldata)) {
141+ ldata->canon_head = ldata->read_tail;
142+ ldata->push = 0;
143+ } else {
144+ set_bit((ldata->read_head - 1) & (N_TTY_BUF_SIZE - 1),
145+ ldata->read_flags);
146+ ldata->canon_head = ldata->read_head;
147+ ldata->push = 1;
148+ }
149 ldata->erasing = 0;
150 ldata->lnext = 0;
151 }
152@@ -1951,6 +1962,12 @@ static int copy_from_read_buf(struct tty_struct *tty,
153 * it copies one line of input up to and including the line-delimiting
154 * character into the user-space buffer.
155 *
156+ * NB: When termios is changed from non-canonical to canonical mode and
157+ * the read buffer contains data, n_tty_set_termios() simulates an EOF
158+ * push (as if C-d were input) _without_ the DISABLED_CHAR in the buffer.
159+ * This causes data already processed as input to be immediately available
160+ * as input although a newline has not been received.
161+ *
162 * Called under the atomic_read_lock mutex
163 *
164 * n_tty_read()/consumer path:
165@@ -1997,7 +2014,7 @@ static int canon_copy_from_read_buf(struct tty_struct *tty,
166 n += found;
167 c = n;
168
169- if (found && read_buf(ldata, eol) == __DISABLED_CHAR) {
170+ if (found && !ldata->push && read_buf(ldata, eol) == __DISABLED_CHAR) {
171 n--;
172 eof_push = !n && ldata->read_tail != ldata->line_start;
173 }
174@@ -2024,7 +2041,10 @@ static int canon_copy_from_read_buf(struct tty_struct *tty,
175 ldata->read_tail += c;
176
177 if (found) {
178- ldata->line_start = ldata->read_tail;
179+ if (!ldata->push)
180+ ldata->line_start = ldata->read_tail;
181+ else
182+ ldata->push = 0;
183 tty_audit_push(tty);
184 }
185 return eof_push ? -EAGAIN : 0;
0cde89ea
AM
186From 27095111cbafd3212c7e9a4a8cef1099b7520ca8 Mon Sep 17 00:00:00 2001
187From: Kieran Clancy <clancy.kieran@gmail.com>
188Date: Fri, 28 Feb 2014 14:12:28 +0000
189Subject: ACPI / EC: Clear stale EC events on Samsung systems
190
191A number of Samsung notebooks (530Uxx/535Uxx/540Uxx/550Pxx/900Xxx/etc)
192continue to log events during sleep (lid open/close, AC plug/unplug,
193battery level change), which accumulate in the EC until a buffer fills.
194After the buffer is full (tests suggest it holds 8 events), GPEs stop
195being triggered for new events. This state persists on wake or even on
196power cycle, and prevents new events from being registered until the EC
197is manually polled.
198
199This is the root cause of a number of bugs, including AC not being
200detected properly, lid close not triggering suspend, and low ambient
201light not triggering the keyboard backlight. The bug also seemed to be
202responsible for performance issues on at least one user's machine.
203
204Juan Manuel Cabo found the cause of bug and the workaround of polling
205the EC manually on wake.
206
207The loop which clears the stale events is based on an earlier patch by
208Lan Tianyu (see referenced attachment).
209
210This patch:
211 - Adds a function acpi_ec_clear() which polls the EC for stale _Q
212 events at most ACPI_EC_CLEAR_MAX (currently 100) times. A warning is
213 logged if this limit is reached.
214 - Adds a flag EC_FLAGS_CLEAR_ON_RESUME which is set to 1 if the DMI
215 system vendor is Samsung. This check could be replaced by several
216 more specific DMI vendor/product pairs, but it's likely that the bug
217 affects more Samsung products than just the five series mentioned
218 above. Further, it should not be harmful to run acpi_ec_clear() on
219 systems without the bug; it will return immediately after finding no
220 data waiting.
221 - Runs acpi_ec_clear() on initialisation (boot), from acpi_ec_add()
222 - Runs acpi_ec_clear() on wake, from acpi_ec_unblock_transactions()
223
224References: https://bugzilla.kernel.org/show_bug.cgi?id=44161
225References: https://bugzilla.kernel.org/show_bug.cgi?id=45461
226References: https://bugzilla.kernel.org/show_bug.cgi?id=57271
227References: https://bugzilla.kernel.org/attachment.cgi?id=126801
228Suggested-by: Juan Manuel Cabo <juanmanuel.cabo@gmail.com>
229Signed-off-by: Kieran Clancy <clancy.kieran@gmail.com>
230Reviewed-by: Lan Tianyu <tianyu.lan@intel.com>
231Reviewed-by: Dennis Jansen <dennis.jansen@web.de>
232Tested-by: Kieran Clancy <clancy.kieran@gmail.com>
233Tested-by: Juan Manuel Cabo <juanmanuel.cabo@gmail.com>
234Tested-by: Dennis Jansen <dennis.jansen@web.de>
235Tested-by: Maurizio D'Addona <mauritiusdadd@gmail.com>
236Tested-by: San Zamoyski <san@plusnet.pl>
237Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
238---
239diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
240index 959d41a..d7d32c2 100644
241--- a/drivers/acpi/ec.c
242+++ b/drivers/acpi/ec.c
243@@ -67,6 +67,8 @@ enum ec_command {
244 #define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */
245 #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */
246 #define ACPI_EC_MSI_UDELAY 550 /* Wait 550us for MSI EC */
247+#define ACPI_EC_CLEAR_MAX 100 /* Maximum number of events to query
248+ * when trying to clear the EC */
249
250 enum {
251 EC_FLAGS_QUERY_PENDING, /* Query is pending */
252@@ -116,6 +118,7 @@ EXPORT_SYMBOL(first_ec);
253 static int EC_FLAGS_MSI; /* Out-of-spec MSI controller */
254 static int EC_FLAGS_VALIDATE_ECDT; /* ASUStec ECDTs need to be validated */
255 static int EC_FLAGS_SKIP_DSDT_SCAN; /* Not all BIOS survive early DSDT scan */
256+static int EC_FLAGS_CLEAR_ON_RESUME; /* Needs acpi_ec_clear() on boot/resume */
257
258 /* --------------------------------------------------------------------------
259 Transaction Management
260@@ -440,6 +443,29 @@ acpi_handle ec_get_handle(void)
261
262 EXPORT_SYMBOL(ec_get_handle);
263
264+static int acpi_ec_query_unlocked(struct acpi_ec *ec, u8 *data);
265+
266+/*
267+ * Clears stale _Q events that might have accumulated in the EC.
268+ * Run with locked ec mutex.
269+ */
270+static void acpi_ec_clear(struct acpi_ec *ec)
271+{
272+ int i, status;
273+ u8 value = 0;
274+
275+ for (i = 0; i < ACPI_EC_CLEAR_MAX; i++) {
276+ status = acpi_ec_query_unlocked(ec, &value);
277+ if (status || !value)
278+ break;
279+ }
280+
281+ if (unlikely(i == ACPI_EC_CLEAR_MAX))
282+ pr_warn("Warning: Maximum of %d stale EC events cleared\n", i);
283+ else
284+ pr_info("%d stale EC events cleared\n", i);
285+}
286+
287 void acpi_ec_block_transactions(void)
288 {
289 struct acpi_ec *ec = first_ec;
290@@ -463,6 +489,10 @@ void acpi_ec_unblock_transactions(void)
291 mutex_lock(&ec->mutex);
292 /* Allow transactions to be carried out again */
293 clear_bit(EC_FLAGS_BLOCKED, &ec->flags);
294+
295+ if (EC_FLAGS_CLEAR_ON_RESUME)
296+ acpi_ec_clear(ec);
297+
298 mutex_unlock(&ec->mutex);
299 }
300
301@@ -821,6 +851,13 @@ static int acpi_ec_add(struct acpi_device *device)
302
303 /* EC is fully operational, allow queries */
304 clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags);
305+
306+ /* Clear stale _Q events if hardware might require that */
307+ if (EC_FLAGS_CLEAR_ON_RESUME) {
308+ mutex_lock(&ec->mutex);
309+ acpi_ec_clear(ec);
310+ mutex_unlock(&ec->mutex);
311+ }
312 return ret;
313 }
314
315@@ -922,6 +959,30 @@ static int ec_enlarge_storm_threshold(const struct dmi_system_id *id)
316 return 0;
317 }
318
319+/*
320+ * On some hardware it is necessary to clear events accumulated by the EC during
321+ * sleep. These ECs stop reporting GPEs until they are manually polled, if too
322+ * many events are accumulated. (e.g. Samsung Series 5/9 notebooks)
323+ *
324+ * https://bugzilla.kernel.org/show_bug.cgi?id=44161
325+ *
326+ * Ideally, the EC should also be instructed NOT to accumulate events during
327+ * sleep (which Windows seems to do somehow), but the interface to control this
328+ * behaviour is not known at this time.
329+ *
330+ * Models known to be affected are Samsung 530Uxx/535Uxx/540Uxx/550Pxx/900Xxx,
331+ * however it is very likely that other Samsung models are affected.
332+ *
333+ * On systems which don't accumulate _Q events during sleep, this extra check
334+ * should be harmless.
335+ */
336+static int ec_clear_on_resume(const struct dmi_system_id *id)
337+{
338+ pr_debug("Detected system needing EC poll on resume.\n");
339+ EC_FLAGS_CLEAR_ON_RESUME = 1;
340+ return 0;
341+}
342+
343 static struct dmi_system_id ec_dmi_table[] __initdata = {
344 {
345 ec_skip_dsdt_scan, "Compal JFL92", {
346@@ -965,6 +1026,9 @@ static struct dmi_system_id ec_dmi_table[] __initdata = {
347 ec_validate_ecdt, "ASUS hardware", {
348 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTek Computer Inc."),
349 DMI_MATCH(DMI_PRODUCT_NAME, "L4R"),}, NULL},
350+ {
351+ ec_clear_on_resume, "Samsung hardware", {
352+ DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD.")}, NULL},
353 {},
354 };
355
356--
357cgit v0.9.2
This page took 0.091116 seconds and 4 git commands to generate.