2.6.35.10 longterm review
Subsystems (93)
PATCH 157/223 USB: misc: cypress_cy7c63: fix up some sysfs attribute permissions
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit c990600d340641150f7270470a64bd99a5c0b225 upstream.
They should not be writable by any user.
--- drivers/usb/misc/cypress_cy7c63.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/usb/misc/cypress_cy7c63.c +2 -4
@@ -196,11 +196,9 @@ static ssize_t get_port1_handler(structreturn read_port (dev, attr, buf,1 ,CYPRESS_READ_PORT_ID1 ); } -static DEVICE_ATTR(port0, S_IWUGO | S_IRUGO, - get_port0_handler, set_port0_handler); +static DEVICE_ATTR(port0, S_IRUGO | S_IWUSR, get_port0_handler, set_port0_handler); -static DEVICE_ATTR(port1, S_IWUGO | S_IRUGO, - get_port1_handler, set_port1_handler); +static DEVICE_ATTR(port1, S_IRUGO | S_IWUSR, get_port1_handler, set_port1_handler); static int cypress_probe(struct usb_interface *interface,
PATCH 158/223 USB: misc: usbled: fix up some sysfs attribute permissions
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 48f115470e68d443436b76b22dad63ffbffd6b97 upstream.
They should not be writable by any user.
--- drivers/usb/misc/usbled.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/misc/usbled.c +1 -1
@@ -94,7 +94,7 @@ static ssize_t set_##value(struct devicechange_color (led); \return count; \ } \ -static DEVICE_ATTR(value, S_IWUGO | S_IRUGO, show_##value, set_##value); +static DEVICE_ATTR(value, S_IRUGO | S_IWUSR, show_##value, set_##value);show_set (blue);show_set (red);show_set (green);
PATCH 159/223 USB: misc: trancevibrator: fix up a sysfs attribute permission
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit d489a4b3926bad571d404ca6508f6744b9602776 upstream.
It should not be writable by any user.
--- drivers/usb/misc/trancevibrator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/misc/trancevibrator.c +1 -1
@@ -86,7 +86,7 @@ static ssize_t set_speed(struct device *return count; } -static DEVICE_ATTR(speed, S_IWUGO | S_IRUGO, show_speed, set_speed); +static DEVICE_ATTR(speed, S_IRUGO | S_IWUSR, show_speed, set_speed);static int tv_probe (struct usb_interface *interface,const struct usb_device_id *id)
PATCH 160/223 USB: misc: usbsevseg: fix up some sysfs attribute permissions
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit e24d7ace4e822debcb78386bf279c9aba4d7fbd1 upstream.
They should not be writable by any user.
--- drivers/usb/misc/usbsevseg.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/usb/misc/usbsevseg.c +4 -6
@@ -192,7 +192,7 @@ static ssize_t set_attr_##name(struct de \return count; \ } \ -static DEVICE_ATTR(name, S_IWUGO | S_IRUGO, show_attr_##name, set_attr_##name); +static DEVICE_ATTR(name, S_IRUGO | S_IWUSR, show_attr_##name, set_attr_##name);static ssize_t show_attr_text (struct device *dev,struct device_attribute *attr,char *buf)
@@ -223,7 +223,7 @@ static ssize_t set_attr_text(struct devireturn count; } -static DEVICE_ATTR(text, S_IWUGO | S_IRUGO, show_attr_text, set_attr_text); +static DEVICE_ATTR(text, S_IRUGO | S_IWUSR, show_attr_text, set_attr_text);static ssize_t show_attr_decimals (struct device *dev,struct device_attribute *attr,char *buf)
@@ -272,8 +272,7 @@ static ssize_t set_attr_decimals(structreturn count; } -static DEVICE_ATTR(decimals, S_IWUGO | S_IRUGO, - show_attr_decimals, set_attr_decimals); +static DEVICE_ATTR(decimals, S_IRUGO | S_IWUSR, show_attr_decimals, set_attr_decimals);static ssize_t show_attr_textmode (struct device *dev,struct device_attribute *attr,char *buf)
@@ -319,8 +318,7 @@ static ssize_t set_attr_textmode(structreturn -EINVAL ; } -static DEVICE_ATTR(textmode, S_IWUGO | S_IRUGO, - show_attr_textmode, set_attr_textmode); +static DEVICE_ATTR(textmode, S_IRUGO | S_IWUSR, show_attr_textmode, set_attr_textmode);MYDEV_ATTR_SIMPLE_UNSIGNED (powered, update_display_powered);
PATCH 161/223 USB: ftdi_sio: Add ID for RT Systems USB-29B radio cable
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Michael Stuermer <[email protected]>
commit 28942bb6a9dd4e2ed793675e515cfb8297ed355b upstream.
Another variant of the RT Systems programming cable for ham radios.
--- drivers/usb/serial/ftdi_sio.c | 1 + drivers/usb/serial/ftdi_sio_ids.h | 1 + 2 files changed, 2 insertions(+)
drivers/usb/serial/ftdi_sio.c +1 -0
@@ -696,6 +696,7 @@ static struct usb_device_id id_table_com .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_SERIAL_VX7_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_CT29B_PID) }, { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) }, { USB_DEVICE(FTDI_VID, FTDI_PHI_FISCO_PID) }, { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) },
drivers/usb/serial/ftdi_sio_ids.h +1 -0
@@ -721,6 +721,7 @@*/ #define RTSYSTEMS_VID 0x2100/* Vendor ID */ #define RTSYSTEMS_SERIAL_VX7_PID 0x9e52/* Serial converter for VX-7 Radios using FT232RL */ +#define RTSYSTEMS_CT29B_PID 0x9e54/* CT29B Radio Cable */ /* * Bayer Ascensia Contour blood glucose meter USB-converter cable.
PATCH 162/223 USB: serial: ftdi_sio: Vardaan USB RS422/485 converter PID added
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Jacques Viviers <[email protected]>
commit 6fdbad8021151a9e93af8159a6232c8f26415c09 upstream.
Add the PID for the Vardaan Enterprises VEUSB422R3 USB to RS422/485 converter. It uses the same chip as the FTDI_8U232AM_PID 0x6001.
This should also work with the stable branches for:
2.6.31, 2.6.32, 2.6.33, 2.6.34, 2.6.35, 2.6.36
--- drivers/usb/serial/ftdi_sio.c | 1 + drivers/usb/serial/ftdi_sio_ids.h | 3 +++ 2 files changed, 4 insertions(+)
drivers/usb/serial/ftdi_sio.c +1 -0
@@ -201,6 +201,7 @@ static struct usb_device_id id_table_com { USB_DEVICE(FTDI_VID, FTDI_MTXORB_5_PID) }, { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) }, { USB_DEVICE(FTDI_VID, FTDI_R2000KU_TRUE_RNG) }, + { USB_DEVICE(FTDI_VID, FTDI_VARDAAN_PID) }, { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0100_PID) }, { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0101_PID) }, { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0102_PID) },
drivers/usb/serial/ftdi_sio_ids.h +3 -0
@@ -114,6 +114,9 @@/* Lenz LI-USB Computer Interface. */ #define FTDI_LENZ_LIUSB_PID 0xD780 +/* Vardaan Enterprises Serial Interface VEUSB422R3 */ +#define FTDI_VARDAAN_PID 0xF070 +/* * Xsens Technologies BV products (http://www.xsens.com). */
PATCH 163/223 USB: fix autosuspend bug in usb-serial
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit abf03184a31a3286fc0ab30f838ddee8ba9f9b7b upstream.
This patch (as1437) fixes a bug in the usb-serial autosuspend handling. Since the usb-serial core now has autosuspend support, it must set the .supports_autosuspend member in every serial driver it registers. Otherwise the usb_autopm_get_interface() call won't work.
This fixes Bugzilla #23012.
--- drivers/usb/serial/usb-serial.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/serial/usb-serial.c +3 -0
@@ -52,6 +52,7 @@ static struct usb_driver usb_serial_driv .suspend = usb_serial_suspend, .resume = usb_serial_resume, .no_dynamic_id = 1, + .supports_autosuspend = 1, };/* There is no MODULE_DEVICE_TABLE for usbserial.c. Instead
@@ -1344,6 +1345,8 @@ int usb_serial_register(struct usb_seriareturn -ENODEV ;fixup_generic (driver); +if (driver->usb_driver) + driver->usb_driver->supports_autosuspend =1 ;if (!driver->description) driver->description = driver->driver.name;
PATCH 164/223 e1000: fix screaming IRQ
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Anupam Chanda <[email protected]>
commit ab08853fab2093e5c6f5de56827a4c93dce4b055 upstream.
VMWare reports that the e1000 driver has a bug when bringing down the interface, such that interrupts are not disabled in the hardware but the driver stops reporting that it consumed the interrupt.
The fix is to set the driver's "down" flag later in the routine, after all the timers and such have exited, preventing the interrupt handler from being called and exiting early without handling the interrupt.
--- drivers/net/e1000/e1000_main.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/e1000/e1000_main.c +8 -4
@@ -31,7 +31,7 @@char e1000_driver_name[] ="e1000" ;static char e1000_driver_string[] ="Intel(R) PRO/1000 Network Driver" ; -#define DRV_VERSION "7.3.21-k6-NAPI" +#define DRV_VERSION "7.3.21-k8-NAPI"const char e1000_driver_version[] =DRV_VERSION ;static const char e1000_copyright[] ="Copyright (c) 1999-2006 Intel Corporation." ;
@@ -483,9 +483,6 @@ void e1000_down(struct e1000_adapter *adstruct net_device *netdev = adapter->netdev;u32 rctl, tctl; -/* signal that we're down so the interrupt handler does not -* reschedule our watchdog timer */ -set_bit (__E1000_DOWN, &adapter->flags);/* disable receives in the hardware */ rctl =er32 (RCTL );
@@ -506,6 +503,13 @@ void e1000_down(struct e1000_adapter *ade1000_irq_disable (adapter); +/* +* Setting DOWN must be after irq_disable to prevent +* a screaming interrupt. Setting DOWN also prevents +* timers and tasks from rescheduling. +*/ +set_bit (__E1000_DOWN, &adapter->flags); +del_timer_sync (&adapter->tx_fifo_stall_timer);del_timer_sync (&adapter->watchdog_timer);del_timer_sync (&adapter->phy_info_timer);
PATCH 165/223 ACPI battery: support percentage battery remaining capacity
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Rui <[email protected]>
commit 557d58687dcdee6bc00c1a8f1fd4e0eac8fefce9 upstream.
According to the ACPI spec, some kinds of primary battery can report percentage battery remaining capacity directly to OS.
In this case, it reports the LastFullChargedCapacity == 100, BatteryPresentRate = 0xFFFFFFFF, and BatteryRemaingCapacity a percentage value, which actually means RemainingBatteryPercentage.
Now we found some battery follows this rule even if it's a rechargeable.
https://bugzilla.kernel.org/show_bug.cgi?id=15979
Handle these batteries correctly in ACPI battery driver so that they won't break userspace.
--- drivers/acpi/battery.c | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-)
drivers/acpi/battery.c +37 -1
@@ -98,6 +98,7 @@ enum {* due to bad math. */ ACPI_BATTERY_QUIRK_SIGNED16_CURRENT , + ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, }; struct acpi_battery {
@@ -413,6 +414,8 @@ static int acpi_battery_get_info(struct result =extract_package (battery, buffer.pointer, info_offsets,ARRAY_SIZE (info_offsets));kfree (buffer.pointer); +if (test_bit (ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY , &battery->flags)) + battery->full_charge_capacity = battery->design_capacity;return result; }
@@ -449,6 +452,10 @@ static int acpi_battery_get_state(struct battery->rate_now != -1) battery->rate_now =abs ((s16 )battery->rate_now); +if (test_bit (ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY , &battery->flags) + && battery->capacity_now >=0 && battery->capacity_now <=100 ) + battery->capacity_now = (battery->capacity_now * + battery->full_charge_capacity) /100 ;return result; }
@@ -562,6 +569,33 @@ static void acpi_battery_quirks(struct a } } +/* +* According to the ACPI spec, some kinds of primary batteries can +* report percentage battery remaining capacity directly to OS. +* In this case, it reports the Last Full Charged Capacity == 100 +* and BatteryPresentRate == 0xFFFFFFFF. +* +* Now we found some battery reports percentage remaining capacity +* even if it's rechargeable. +* https://bugzilla.kernel.org/show_bug.cgi?id=15979 +* +* Handle this correctly so that they won't break userspace. +*/ +static void acpi_battery_quirks2 (struct acpi_battery *battery) +{ +if (test_bit (ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY , &battery->flags)) +return ; + +if (battery->full_charge_capacity ==100 && + battery->rate_now ==ACPI_BATTERY_VALUE_UNKNOWN && + battery->capacity_now >=0 && battery->capacity_now <=100 ) { +set_bit (ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY , &battery->flags); + battery->full_charge_capacity = battery->design_capacity; + battery->capacity_now = (battery->capacity_now * + battery->full_charge_capacity) /100 ; + } +} +static int acpi_battery_update (struct acpi_battery *battery) {int result, old_present =acpi_battery_present (battery);
@@ -587,7 +621,9 @@ static int acpi_battery_update(struct acif (!battery->bat.dev)sysfs_add_battery (battery);#endif -return acpi_battery_get_state (battery); + result =acpi_battery_get_state (battery); +acpi_battery_quirks2 (battery); +return result; }/* --------------------------------------------------------------------------
PATCH 166/223 acpi-cpufreq: fix a memleak when unloading driver
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Rui <[email protected]>
commit dab5fff14df2cd16eb1ad4c02e83915e1063fece upstream.
We didn't free per_cpu(acfreq_data, cpu)->freq_table when acpi_freq driver is unloaded.
Resulting in the following messages in /sys/kernel/debug/kmemleak:
unreferenced object 0xf6450e80 (size 64):
comm "modprobe", pid 1066, jiffies 4294677317 (age 19290.453s) hex dump (first 32 bytes):
00 00 00 00 e8 a2 24 00 01 00 00 00 00 9f 24 00 ......$.......$.
02 00 00 00 00 6a 18 00 03 00 00 00 00 35 0c 00 .....j.......5..
backtrace:
[<c123ba97>] kmemleak_alloc+0x27/0x50
[<c109f96f>] __kmalloc+0xcf/0x110
[<f9da97ee>] acpi_cpufreq_cpu_init+0x1ee/0x4e4 [acpi_cpufreq]
[<c11cd8d2>] cpufreq_add_dev+0x142/0x3a0
[<c11920b7>] sysdev_driver_register+0x97/0x110
[<c11cce56>] cpufreq_register_driver+0x86/0x140
[<f9dad080>] 0xf9dad080
[<c1001130>] do_one_initcall+0x30/0x160
[<c10626e9>] sys_init_module+0x99/0x1e0
[<c1002d97>] sysenter_do_call+0x12/0x26
[<ffffffff>] 0xffffffffhttps://bugzilla.kernel.org/show_bug.cgi?id=15807#c21
--- arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c +1 -0
@@ -704,6 +704,7 @@ static int acpi_cpufreq_cpu_exit(structper_cpu (acfreq_data, policy->cpu) =NULL ;acpi_processor_unregister_performance (data->acpi_data, policy->cpu); +kfree (data->freq_table);kfree (data); }
PATCH 167/223 ACPI: debugfs custom_method open to non-root
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Dave Jones <[email protected]>
commit ed3aada1bf34c5a9e98af167f125f8a740fc726a upstream.
Currently we have:
--w--w--w-. 1 root root 0 2010-11-11 14:56 /sys/kernel/debug/acpi/custom_method
which is just crazy. Change this to --w-------.
--- drivers/acpi/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/debug.c +1 -1
@@ -258,7 +258,7 @@ static int acpi_debugfs_init(void)if (!acpi_dir) goto err; - cm_dentry =debugfs_create_file ("custom_method" ,S_IWUGO , + cm_dentry =debugfs_create_file ("custom_method" ,S_IWUSR , acpi_dir,NULL , &cm_fops);if (!cm_dentry) goto err;
RE: [PATCH] [167/223] ACPI: debugfs custom_method open to non-root
Quoted 1 line
2.6.35-longterm review patch. If anyone has any objections, please let me know.
is -longterm something that happens after -stable runs out of gas? Note that this particular patch applies back to 2.6.33.
thanks,
-Len
Quoted 34 lines
------------------
From: Dave Jones <[email protected]>commit
ed3aada1bf34c5a9e98af167f125f8a740fc726aupstream.Currently we have:
--w--w--w-. 1 root root 0 2010-11-11 14:56
/sys/kernel/debug/acpi/custom_methodwhich is just crazy. Change this to --w-------.
Signed-off-by Dave Jones <[email protected]>Signed-off-by Len Brown <[email protected]>Signed-off-by Linus Torvalds <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>Signed-off-by Andi Kleen <[email protected]>--- drivers/acpi/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Index:
linux/drivers/acpi/debug.c
===================================================================drivers/acpi/debug.c +1
-1@@ -258,7 +258,7 @@ static int acpi_debugfs_init(void)if (!acpi_dir) goto err; - cm_dentry =debugfs_create_file ("custom_method" ,S_IWUGO , + cm_dentry =debugfs_create_file ("custom_method" ,S_IWUSR , acpi_dir,NULL , &cm_fops);if (!cm_dentry) goto err;
RE: [PATCH] [167/223] ACPI: debugfs custom_method open to non-root
Quoted 4 lines
Quoted 2 lines
2.6.35-longterm review patch. If anyone has any objections, please let me know.
is -longterm something that happens after -stable runs out of gas?
Yes (but not for all kernels)
Quoted 1 line
Note that this particular patch applies back to 2.6.33.
Paul G. could consider it for his 2.6.34 then.
-Andi
Re: [PATCH] [167/223] ACPI: debugfs custom_method open to non-root
Quoted 10 lines · Andi Kleen
Quoted 4 lines
Quoted 2 lines
2.6.35-longterm review patch. If anyone has any objections, please let me know.
is -longterm something that happens after -stable runs out of gas?
Yes (but not for all kernels)
Quoted 1 line
Note that this particular patch applies back to 2.6.33.
Paul G. could consider it for his 2.6.34 then.
Yes, thanks. If people creating/nominating patches happen to have that kind of knowledge handy (i.e. for what version(s) it makes sense) then I'd encourage everyone to try capturing that somewhere - it will be handy for all the longterm maintainers.
Paul.
Quoted 1 line
-Andi
PATCH 168/223 PNPACPI: cope with invalid device IDs
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Torokhov <[email protected]>
commit 420a0f66378c84b00b0e603e4d38210102dbe367 upstream.
If primary ID (HID) is invalid try locating first valid ID on compatible ID list before giving up.
This helps, for example, to recognize i8042 AUX port on Sony Vaio VPCZ1 which uses SNYSYN0003 as HID. Without the patch users are forced to boot with i8042.nopnp to make use of their touchpads.
--- drivers/pnp/pnpacpi/core.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-)
drivers/pnp/pnpacpi/core.c +24 -5
@@ -28,7 +28,7 @@#include "../base.h" #include "pnpacpi.h" -static int num =0 ; +static int num;/* We need only to blacklist devices that have already an acpi driver that * can't use pnp layer. We don't need to blacklist device that are directly
@@ -157,11 +157,24 @@ struct pnp_protocol pnpacpi_protocol = { };EXPORT_SYMBOL (pnpacpi_protocol); +static char *pnpacpi_get_id (struct acpi_device *device) +{ +struct acpi_hardware_id *id; + +list_for_each_entry (id, &device->pnp.ids, list) { +if (ispnpidacpi (id->id)) +return id->id; + } + +return NULL ; +} +static int __init pnpacpi_add_device (struct acpi_device *device) {acpi_handle temp =NULL ;acpi_status status;struct pnp_dev *dev; +char *pnpid;struct acpi_hardware_id *id;/*
@@ -169,11 +182,17 @@ static int __init pnpacpi_add_device(str* driver should not be loaded. */ status =acpi_get_handle (device->handle,"_CRS" , &temp); -if (ACPI_FAILURE (status) || !ispnpidacpi (acpi_device_hid (device)) || -is_exclusive_device (device) || (!device->status.present)) +if (ACPI_FAILURE (status)) +return 0 ; + + pnpid =pnpacpi_get_id (device); +if (!pnpid) +return 0 ; + +if (is_exclusive_device (device) || !device->status.present)return 0 ; - dev =pnp_alloc_dev (&pnpacpi_protocol, num,acpi_device_hid (device)); + dev =pnp_alloc_dev (&pnpacpi_protocol, num, pnpid);if (!dev)return -ENOMEM ;
@@ -204,7 +223,7 @@ static int __init pnpacpi_add_device(strpnpacpi_parse_resource_option_data (dev);list_for_each_entry (id, &device->pnp.ids, list) { -if (!strcmp (id->id,acpi_device_hid (device))) +if (!strcmp (id->id, pnpid))continue ;if (!ispnpidacpi (id->id))continue ;
PATCH 169/223 saa7134: Fix autodetect for Behold A7 and H7 TV cards
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Dmitri Belimov <[email protected]>
commit 35bbe587d0959712b69540077c9e0fd27d3e6baf upstream.
The entries for those cards are after the generic entries, so they don't work, in practice. Moving them to happen before the generic entres fix the issue.
--- drivers/media/video/saa7134/saa7134-cards.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/media/video/saa7134/saa7134-cards.c +12 -12
@@ -6631,6 +6631,18 @@ struct pci_device_id saa7134_pci_tbl[] = .subdevice = 0x6655, .driver_data = SAA7134_BOARD_LEADTEK_WINFAST_DTV1000S, }, { + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7133, + .subvendor = 0x5ace, /* Beholder Intl. Ltd. */ + .subdevice = 0x7190, + .driver_data = SAA7134_BOARD_BEHOLD_H7, + }, { + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7133, + .subvendor = 0x5ace, /* Beholder Intl. Ltd. */ + .subdevice = 0x7090, + .driver_data = SAA7134_BOARD_BEHOLD_A7, + }, { /* --- boards without eeprom + subsystem ID --- */ .vendor = PCI_VENDOR_ID_PHILIPS, .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
@@ -6668,18 +6680,6 @@ struct pci_device_id saa7134_pci_tbl[] = .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, .driver_data = SAA7134_BOARD_UNKNOWN, - }, { - .vendor = PCI_VENDOR_ID_PHILIPS, - .device = PCI_DEVICE_ID_PHILIPS_SAA7133, - .subvendor = 0x5ace, /* Beholder Intl. Ltd. */ - .subdevice = 0x7190, - .driver_data = SAA7134_BOARD_BEHOLD_H7, - }, { - .vendor = PCI_VENDOR_ID_PHILIPS, - .device = PCI_DEVICE_ID_PHILIPS_SAA7133, - .subvendor = 0x5ace, /* Beholder Intl. Ltd. */ - .subdevice = 0x7090, - .driver_data = SAA7134_BOARD_BEHOLD_A7, },{/* --- end of list --- */ }
PATCH 170/223 fuse: fix attributes after open(O_TRUNC)
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Ken Sumrall <[email protected]>
commit a0822c55779d9319939eac69f00bb729ea9d23da upstream.
The attribute cache for a file was not being cleared when a file is opened with O_TRUNC.
If the filesystem's open operation truncates the file ("atomic_o_trunc" feature flag is set) then the kernel should invalidate the cached st_mtime and st_ctime attributes.
Also i_size should be explicitly be set to zero as it is used sometimes without refreshing the cache.
--- fs/fuse/file.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
fs/fuse/file.c +10 -0
@@ -134,6 +134,7 @@ EXPORT_SYMBOL_GPL(fuse_do_open);void fuse_finish_open (struct inode *inode,struct file *file) {struct fuse_file *ff = file->private_data; +struct fuse_conn *fc =get_fuse_conn (inode);if (ff->open_flags &FOPEN_DIRECT_IO ) file->f_op = &fuse_direct_io_file_operations;
@@ -141,6 +142,15 @@ void fuse_finish_open(struct inode *inodinvalidate_inode_pages2 (inode->i_mapping);if (ff->open_flags &FOPEN_NONSEEKABLE )nonseekable_open (inode, file); +if (fc->atomic_o_trunc && (file->f_flags &O_TRUNC )) { +struct fuse_inode *fi =get_fuse_inode (inode); + +spin_lock (&fc->lock); + fi->attr_version = ++fc->attr_version; +i_size_write (inode,0 ); +spin_unlock (&fc->lock); +fuse_invalidate_attr (inode); + } }int fuse_open_common (struct inode *inode,struct file *file,bool isdir)
PATCH 171/223 cs5535-gpio: apply CS5536 errata workaround for GPIOs
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Andres Salomon <[email protected]>
commit 853ff88324a248a9f5da6e110850223db353ec07 upstream.
The AMD Geode CS5536 Companion Device Silicon Revision B1 Specification Update mentions the follow as issue #36:
"Atomic write transactions to the atomic GPIO High Bank Feature Bit
registers should only affect the bits selected [...]"
"after Suspend, an atomic write transaction [...] will clear all
non-selected bits of the accessed register."
In other words, writing to the high bank for a single GPIO bit will clear every other GPIO bit (but only sometimes after a suspend).
The workaround described is obvious and simple; do a read-modify-write. This patch does that, and documents why we're doing it.
--- drivers/gpio/cs5535-gpio.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/gpio/cs5535-gpio.c +14 -2
@@ -56,6 +56,18 @@ static struct cs5535_gpio_chip {* registers, see include/linux/cs5535.h. */ +static void errata_outl (u32 val,unsigned long addr) +{ +/* +* According to the CS5536 errata (#36), after suspend +* a write to the high bank GPIO register will clear all +* non-selected bits; the recommended workaround is a +* read-modify-write operation. +*/ + val |=inl (addr); +outl (val, addr); +} +static void __cs5535_gpio_set (struct cs5535_gpio_chip *chip,unsigned offset,unsigned int reg) {
@@ -64,7 +76,7 @@ static void __cs5535_gpio_set(struct cs5outl (1 << offset, chip->base + reg); else /* high bank register */ - outl(1 << (offset - 16), chip->base + 0x80 + reg); + errata_outl(1 << (offset - 16), chip->base + 0x80 + reg); }void cs5535_gpio_set (unsigned offset,unsigned int reg)
@@ -86,7 +98,7 @@ static void __cs5535_gpio_clear(struct coutl (1 << (offset +16 ), chip->base + reg); else/* high bank register */ - outl(1 << offset, chip->base + 0x80 + reg); + errata_outl(1 << offset, chip->base + 0x80 + reg); }void cs5535_gpio_clear (unsigned offset,unsigned int reg)
PATCH 172/223 do_exit(): make sure that we run with get_fs() == USER_DS
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Nelson Elhage <[email protected]>
commit 33dd94ae1ccbfb7bf0fb6c692bc3d1c4269e6177 upstream.
If a user manages to trigger an oops with fs set to KERNEL_DS, fs is not otherwise reset before do_exit(). do_exit may later (via mm_release in fork.c) do a put_user to a user-controlled address, potentially allowing a user to leverage an oops into a controlled write into kernel memory.
This is only triggerable in the presence of another bug, but this potentially turns a lot of DoS bugs into privilege escalations, so it's worth fixing. I have proof-of-concept code which uses this bug along with CVE-2010-3849 to write a zero to an arbitrary kernel address, so I've tested that this is not theoretical.
A more logical place to put this fix might be when we know an oops has occurred, before we call do_exit(), but that would involve changing every architecture, in multiple places.
Let's just stick it in do_exit instead.
--- kernel/exit.c | 9 +++++++++ 1 file changed, 9 insertions(+)
kernel/exit.c +9 -0
@@ -900,6 +900,15 @@ NORET_TYPE void do_exit(long code)if (unlikely (!tsk->pid))panic ("Attempted to kill the idle task!" ); +/* +* If do_exit is called because this processes oopsed, it's possible +* that get_fs() was left as KERNEL_DS, so reset it to USER_DS before +* continuing. Amongst other possible reasons, this is to prevent +* mm_release()->clear_child_tid() from writing to a user-controlled +* kernel address. +*/ +set_fs (USER_DS ); +tracehook_report_exit (&code);validate_creds_for_do_exit (tsk);
PATCH 173/223 cifs: fix another memleak, in cifs_root_iget
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Oskar Schirmer <[email protected]>
commit a7851ce73b9fdef53f251420e6883cf4f3766534 upstream.
cifs_root_iget allocates full_path through cifs_build_path_to_root, but fails to kfree it upon cifs_get_inode_info* failure.
Make all failure exit paths traverse clean up handling at the end of the function.
--- fs/cifs/inode.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
fs/cifs/inode.c +6 -6
@@ -804,8 +804,10 @@ struct inode *cifs_root_iget(struct supe rc =cifs_get_inode_info (&inode, full_path,NULL , sb, xid,NULL ); -if (!inode) -return ERR_PTR (-ENOMEM ); +if (!inode) { + inode =ERR_PTR (rc); + goto out; + }if (rc && cifs_sb->tcon->ipc) {cFYI (1 ,"ipc connection - fake read inode" );
@@ -816,13 +818,11 @@ struct inode *cifs_root_iget(struct supe inode->i_uid = cifs_sb->mnt_uid; inode->i_gid = cifs_sb->mnt_gid; }else if (rc) { -kfree (full_path); -_FreeXid (xid);iget_failed (inode); -return ERR_PTR (rc); + inode =ERR_PTR (rc); } - +out:kfree (full_path);/* can not call macro FreeXid here since in a void func * TODO: This is no longer true
PATCH 174/223 uml: disable winch irq before freeing handler data
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Will Newton <[email protected]>
commit 69e83dad5207f8f03c9699e57e1febb114383cb8 upstream.
Disable the winch irq early to make sure we don't take an interrupt part way through the freeing of the handler data, resulting in a crash on shutdown:
winch_interrupt : read failed, errno = 9
fd 13 is losing SIGWINCH support
------------[ cut here ]------------ WARNING: at lib/list_debug.c:48 list_del+0xc6/0x100() list_del corruption, next is LIST_POISON1 (00100100) 082578c8: [<081fd77f>] dump_stack+0x22/0x24 082578e0: [<0807a18a>] warn_slowpath_common+0x5a/0x80 08257908: [<0807a23e>] warn_slowpath_fmt+0x2e/0x30 08257920: [<08172196>] list_del+0xc6/0x100 08257940: [<08060244>] free_winch+0x14/0x80 08257958: [<080606fb>] winch_interrupt+0xdb/0xe0 08257978: [<080a65b5>] handle_IRQ_event+0x35/0xe0 08257998: [<080a8717>] handle_edge_irq+0xb7/0x170 082579bc: [<08059bc4>] do_IRQ+0x34/0x50 082579d4: [<08059e1b>] sigio_handler+0x5b/0x80 082579ec: [<0806a374>] sig_handler_common+0x44/0xb0 08257a68: [<0806a538>] sig_handler+0x38/0x50 08257a78: [<0806a77c>] handle_signal+0x5c/0xa0 08257a9c: [<0806be28>] hard_handler+0x18/0x20 08257aac: [<00c14400>] 0xc14400
--- arch/um/drivers/line.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/um/drivers/line.c +3 -2
@@ -727,6 +727,9 @@ struct winch {static void free_winch (struct winch *winch,int free_irq_ok) { +if (free_irq_ok) +free_irq (WINCH_IRQ , winch); +list_del (&winch->list);if (winch->pid !=-1 )
@@ -735,8 +738,6 @@ static void free_winch(struct winch *winos_close_file (winch->fd);if (winch->stack !=0 )free_stack (winch->stack,0 ); -if (free_irq_ok) -free_irq (WINCH_IRQ , winch);kfree (winch); }
PATCH 175/223 backlight: grab ops_lock before testing bd->ops
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <[email protected]>
commit d1d73578e053b981c3611e5a211534290d24a5eb upstream.
According to the comment describing ops_lock in the definition of struct backlight_device and when comparing with other functions in backlight.c the mutex must be hold when checking ops to be non-NULL.
Fixes a problem added by c835ee7f4154992e6 ("backlight: Add suspend/resume support to the backlight core") in Jan 2009.
--- drivers/video/backlight/backlight.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/video/backlight/backlight.c +6 -6
@@ -197,12 +197,12 @@ static int backlight_suspend(struct devi {struct backlight_device *bd =to_backlight_device (dev); -if (bd->ops->options &BL_CORE_SUSPENDRESUME ) { -mutex_lock (&bd->ops_lock); +mutex_lock (&bd->ops_lock); +if (bd->ops && bd->ops->options &BL_CORE_SUSPENDRESUME ) { bd->props.state |=BL_CORE_SUSPENDED ;backlight_update_status (bd); -mutex_unlock (&bd->ops_lock); } +mutex_unlock (&bd->ops_lock);return 0 ; }
@@ -211,12 +211,12 @@ static int backlight_resume(struct devic {struct backlight_device *bd =to_backlight_device (dev); -if (bd->ops->options &BL_CORE_SUSPENDRESUME ) { -mutex_lock (&bd->ops_lock); +mutex_lock (&bd->ops_lock); +if (bd->ops && bd->ops->options &BL_CORE_SUSPENDRESUME ) { bd->props.state &= ~BL_CORE_SUSPENDED ;backlight_update_status (bd); -mutex_unlock (&bd->ops_lock); } +mutex_unlock (&bd->ops_lock);return 0 ; }
PATCH 176/223 nommu: yield CPU while disposing VM
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Steven J. Magnani <[email protected]>
commit 04c3496152394d17e3bc2316f9731ee3e8a026bc upstream.
Depending on processor speed, page size, and the amount of memory a process is allowed to amass, cleanup of a large VM may freeze the system for many seconds. This can result in a watchdog timeout.
Make sure other tasks receive some service when cleaning up large VMs.
--- mm/nommu.c | 1 + 1 file changed, 1 insertion(+)
mm/nommu.c +1 -0
@@ -1673,6 +1673,7 @@ void exit_mmap(struct mm_struct *mm) mm->mmap = vma->vm_next;delete_vma_from_mm (vma);delete_vma (mm, vma); +cond_resched (); }kleave ("" );
PATCH 177/223 x86: Ignore trap bits on single step exceptions
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Frederic Weisbecker <[email protected]>
commit 6c0aca288e726405b01dacb12cac556454d34b2a upstream.
When a single step exception fires, the trap bits, used to signal hardware breakpoints, are in a random state.
These trap bits might be set if another exception will follow, like a breakpoint in the next instruction, or a watchpoint in the previous one. Or there can be any junk there.
So if we handle these trap bits during the single step exception, we are going to handle an exception twice, or we are going to handle junk.
Just ignore them in this case.
This fixes https://bugzilla.kernel.org/show_bug.cgi?id=21332
--- arch/x86/kernel/hw_breakpoint.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/x86/kernel/hw_breakpoint.c +4 -0
@@ -421,6 +421,10 @@ static int __kprobes hw_breakpoint_handl dr6_p = (unsigned long *)ERR_PTR (args->err); dr6 = *dr6_p; +/* If it's a single step, TRAP bits are random */ +if (dr6 &DR_STEP ) +return NOTIFY_DONE ; +/* Do an early return if no trap bits are set in DR6 */ if ((dr6 &DR_TRAP_BITS ) ==0 )return NOTIFY_DONE ;
PATCH 178/223 mmc: fix rmmod race for hosts using card-detection polling
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Guennadi Liakhovetski <[email protected]>
commit d9bcbf343ec63e1104b5276195888ee06b4d086f upstream.
MMC hosts that poll for card detection by defining the MMC_CAP_NEEDS_POLL flag have a race on rmmod, where the delayed work is cancelled without waiting for completed polling. To prevent this a _sync version of the work cancellation has to be used.
--- drivers/mmc/core/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/core/core.c +1 -1
@@ -1160,7 +1160,7 @@ void mmc_stop_host(struct mmc_host *hostif (host->caps &MMC_CAP_DISABLE )cancel_delayed_work (&host->disable); -cancel_delayed_work (&host->detect); +cancel_delayed_work_sync (&host->detect);mmc_flush_scheduled_work ();/* clear pm flags now and let card drivers set them as needed */
PATCH 179/223 DECnet: don't leak uninitialized stack byte
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Dan Rosenberg <[email protected]>
commit 3c6f27bf33052ea6ba9d82369fb460726fb779c0 upstream.
A single uninitialized padding byte is leaked to userspace.
--- net/decnet/af_decnet.c | 2 ++ 1 file changed, 2 insertions(+)
net/decnet/af_decnet.c +2 -0
@@ -1556,6 +1556,8 @@ static int __dn_getsockopt(struct socketif (r_len >sizeof (struct linkinfo_dn )) r_len =sizeof (struct linkinfo_dn ); +memset (&link,0 ,sizeof (link)); +switch (sock->state) {case SS_CONNECTING : link.idn_linkstate =LL_CONNECTING ;
PATCH 180/223 perf_events: Fix perf_counter_mmap() hook in mprotect()
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Pekka Enberg <[email protected]>
commit 63bfd7384b119409685a17d5c58f0b56e5dc03da upstream.
As pointed out by Linus, commit dab5855 ("perf_counter: Add mmap event hooks to mprotect()") is fundamentally wrong as mprotect_fixup() can free 'vma' due to merging. Fix the problem by moving perf_event_mmap() hook to mprotect_fixup().
Note: there's another successful return path from mprotect_fixup() if old flags equal to new flags. We don't, however, need to call perf_event_mmap() there because 'perf' already knows the VMA is executable.
--- mm/mprotect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/mprotect.c +1 -1
@@ -211,6 +211,7 @@ success:mmu_notifier_invalidate_range_end (mm, start, end);vm_stat_account (mm, oldflags, vma->vm_file, -nrpages);vm_stat_account (mm, newflags, vma->vm_file, nrpages); +perf_event_mmap (vma);return 0 ; fail:
@@ -299,7 +300,6 @@ SYSCALL_DEFINE3(mprotect, unsigned long, error =mprotect_fixup (vma, &prev, nstart, tmp, newflags);if (error) goto out; -perf_event_mmap (vma); nstart = tmp;if (nstart < prev->vm_end)
PATCH 181/223 ARM: 6464/2: fix spinlock recursion in adjust_pte()
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Mika Westerberg <[email protected]>
commit 4e54d93d3c9846ba1c2644ad06463dafa690d1b7 upstream.
When running following code in a machine which has VIVT caches and USE_SPLIT_PTLOCKS is not defined:
fd = open("/etc/passwd", O_RDONLY);
addr = mmap(NULL, 4096, PROT_READ, MAP_SHARED, fd, 0);
addr2 = mmap(NULL, 4096, PROT_READ, MAP_SHARED, fd, 0);
v = *((int *)addr);we will hang in spinlock recursion in the page fault handler:
BUG: spinlock recursion on CPU#0, mmap_test/717
lock: c5e295d8, .magic: dead4ead, .owner: mmap_test/717,
.owner_cpu: 0
[<c0026604>] (unwind_backtrace+0x0/0xec)
[<c014ee48>] (do_raw_spin_lock+0x40/0x140)
[<c0027f68>] (update_mmu_cache+0x208/0x250)
[<c0079db4>] (__do_fault+0x320/0x3ec)
[<c007af7c>] (handle_mm_fault+0x2f0/0x6d8)
[<c0027834>] (do_page_fault+0xdc/0x1cc)
[<c00202d0>] (do_DataAbort+0x34/0x94)This comes from the fact that when USE_SPLIT_PTLOCKS is not defined, the only lock protecting the page tables is mm->page_table_lock which is already locked before update_mmu_cache() is called.
--- arch/arm/mm/fault-armv.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-)
arch/arm/mm/fault-armv.c +26 -2
@@ -65,6 +65,30 @@ static int do_adjust_pte(struct vm_area_return ret; } +#if USE_SPLIT_PTLOCKS +/* +* If we are using split PTE locks, then we need to take the page +* lock here. Otherwise we are using shared mm->page_table_lock +* which is already locked, thus cannot take it. +*/ +static inline void do_pte_lock (spinlock_t *ptl) +{ +/* +* Use nested version here to indicate that we are already +* holding one similar spinlock. +*/ +spin_lock_nested (ptl,SINGLE_DEPTH_NESTING ); +} + +static inline void do_pte_unlock (spinlock_t *ptl) +{ +spin_unlock (ptl); +} +#else /* !USE_SPLIT_PTLOCKS */ +static inline void do_pte_lock (spinlock_t *ptl) {} +static inline void do_pte_unlock (spinlock_t *ptl) {} +#endif /* USE_SPLIT_PTLOCKS */ +static int adjust_pte (struct vm_area_struct *vma,unsigned long address,unsigned long pfn) {
@@ -89,11 +113,11 @@ static int adjust_pte(struct vm_area_str*/ ptl =pte_lockptr (vma->vm_mm, pmd); pte =pte_offset_map_nested (pmd, address); -spin_lock (ptl); +do_pte_lock (ptl); ret =do_adjust_pte (vma, address, pfn, pte); -spin_unlock (ptl); +do_pte_unlock (ptl);pte_unmap_nested (pte);return ret;
PATCH 182/223 ARM: 6489/1: thumb2: fix incorrect optimisation in usracc
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit 1142b71d85894dcff1466dd6c871ea3c89e0352c upstream.
Commit 8b592783 added a Thumb-2 variant of usracc which, when it is called with \rept=2, calls usraccoff once with an offset of 0 and secondly with a hard-coded offset of 4 in order to avoid incrementing the pointer again. If \inc != 4 then we will store the data to the wrong offset from \ptr. Luckily, the only caller that passes \rept=2 to this function is __clear_user so we haven't been actively corrupting user data.
This patch fixes usracc to pass \inc instead of #4 to usraccoff when it is called a second time.
--- arch/arm/include/asm/assembler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/include/asm/assembler.h +1 -1
@@ -215,7 +215,7 @@ @ Slightly optimised to avoid incrementing the pointer twice usraccoff \instr, \reg, \ptr, \inc, 0, \cond, \abort .if \rept == 2 - usraccoff \instr, \reg, \ptr, \inc, 4, \cond, \abort + usraccoff \instr, \reg, \ptr, \inc, \inc, \cond, \abort .endif add\cond \ptr, #\rept * \inc
PATCH 183/223 ARM: 6482/2: Fix find_next_zero_bit and related assembly
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: James Jones <[email protected]>
commit 0e91ec0c06d2cd15071a6021c94840a50e6671aa upstream.
The find_next_bit, find_first_bit, find_next_zero_bit and find_first_zero_bit functions were not properly clamping to the maxbit argument at the bit level. They were instead only checking maxbit at the byte level. To fix this, add a compare and a conditional move instruction to the end of the common bit-within-the- byte code used by all the functions and be sure not to clobber the maxbit argument before it is used.
--- arch/arm/lib/findbit.S | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/arm/lib/findbit.S +4 -2
@@ -174,8 +174,8 @@ ENDPROC(_find_next_bit_be) */ .L_found: #if __LINUX_ARM_ARCH__ >= 5 - rsb r1, r3, #0 - and r3, r3, r1 + rsb r0, r3, #0 + and r3, r3, r0 clz r3, r3 rsb r3, r3, #31 add r0, r2, r3
@@ -190,5 +190,7 @@ ENDPROC(_find_next_bit_be) addeq r2, r2, #1 mov r0, r2 #endif + cmp r1, r0 @ Clamp to maxbit + movlo r0, r1 mov pc, lr
PATCH 184/223 leds: fix bug with reading NAS SS4200 dmi code
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <[email protected]>
commit 50d431e8a15701b599c98afe2b464eb33c952477 upstream.
While running randconfg with ktest.pl I stumbled upon this bug:
BUG: unable to handle kernel NULL pointer dereference at 0000000000000003 IP: [<ffffffff815fe44f>] strstr+0x39/0x86 PGD 0 Oops: 0000 [#1] SMP last sysfs file: CPU 0 Modules linked in:
Pid: 1, comm: swapper Not tainted 2.6.37-rc1-test+ #6 DG965MQ/
RIP: 0010:[<ffffffff815fe44f>] [<ffffffff815fe44f>] strstr+0x39/0x86 RSP: 0018:ffff8800797cbd80 EFLAGS: 00010213 RAX: 0000000000000000 RBX: 0000000000000003 RCX: ffffffffffffffff RDX: 0000000000000000 RSI: ffffffff82eb7ac9 RDI: 0000000000000003 RBP: ffff8800797cbda0 R08: ffff880000000003 R09: 0000000000030725 R10: ffff88007d294c00 R11: 0000000000014c00 R12: 0000000000000020 R13: ffffffff82eb7ac9 R14: ffffffffffffffff R15: ffffffff82eb7b08 FS: 0000000000000000(0000) GS:ffff88007d200000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b CR2: 0000000000000003 CR3: 0000000002a1d000 CR4: 00000000000006f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Process swapper (pid: 1, threadinfo ffff8800797ca000, task ffff8800797d0000) Stack: 00000000000000ba ffffffff82eb7ac9 ffffffff82eb7ab8 00000000000000ba ffff8800797cbdf0 ffffffff81e2050f ffff8800797cbdc0 00000000815f913b ffff8800797cbe00 ffffffff82eb7ab8 0000000000000000 0000000000000000 Call Trace: [<ffffffff81e2050f>] dmi_matches+0x117/0x154 [<ffffffff81e205d7>] dmi_check_system+0x3d/0x8d [<ffffffff82e1ad25>] ? nas_gpio_init+0x0/0x2c8 [<ffffffff82e1ad49>] nas_gpio_init+0x24/0x2c8 [<ffffffff820d750d>] ? wm8350_led_init+0x0/0x20 [<ffffffff82e1ad25>] ? nas_gpio_init+0x0/0x2c8 [<ffffffff810022f7>] do_one_initcall+0xab/0x1b2 [<ffffffff82da749c>] kernel_init+0x248/0x331 [<ffffffff8100e624>] kernel_thread_helper+0x4/0x10 [<ffffffff82da7254>] ? kernel_init+0x0/0x331
Found that the nas_led_whitelist dmi_system_id structure array had no NULL end delimiter, causing the dmi_check_system() loop to read an undefined entry.
--- drivers/leds/leds-ss4200.c | 1 + 1 file changed, 1 insertion(+)
drivers/leds/leds-ss4200.c +1 -0
@@ -102,6 +102,7 @@ static struct dmi_system_id __initdata n DMI_MATCH(DMI_PRODUCT_VERSION, "1.00.00") } }, + {} };/*
PATCH 185/223 Staging: udlfb: fix up some sysfs attribute permissions
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit cc9ca9dfddda46b1802d325891a69d7efdbe1f1e and cc9ca9dfddda46b1802d325891a69d7efdbe1f1e upstream merged together.
They should not be writable by any user
--- drivers/staging/udlfb/udlfb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/udlfb/udlfb.c +1 -1
@@ -1143,7 +1143,7 @@ static struct device_attribute fb_device__ATTR_RO (metrics_bytes_sent),__ATTR_RO (metrics_cpu_kcycles_used),__ATTR_RO (metrics_misc), -__ATTR (metrics_reset,S_IWUGO ,NULL , metrics_reset_store), +__ATTR (metrics_reset,S_IWUSR ,NULL , metrics_reset_store), __ATTR_RW(use_defio), };
PATCH 186/223 Staging: iio: adis16220: fix up some sysfs attribute permissions
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 1d904e8950c86e670ace237eaea1d48cd81e94df upstream.
They should not be writable by any user
--- drivers/staging/iio/accel/adis16220_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/iio/accel/adis16220_core.c +1 -1
@@ -506,7 +506,7 @@ static IIO_DEVICE_ATTR(reset, S_IWUSR, N adis16220_write_reset, 0);#define IIO_DEV_ATTR_CAPTURE (_store) \ - IIO_DEVICE_ATTR(capture, S_IWUGO, NULL, _store, 0) + IIO_DEVICE_ATTR(capture, S_IRUSR, NULL, _store, 0)static IIO_DEV_ATTR_CAPTURE (adis16220_write_capture);
PATCH 187/223 Staging: iio: adis16220: fix up my fixup for some sysfs attribute permissions
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit c9e51d9e4bee3da47623622884f4828e079a0581 upstream.
They should be writable by root, not readable. Doh, stupid me with the wrong flags.
--- drivers/staging/iio/accel/adis16220_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/iio/accel/adis16220_core.c +1 -1
@@ -506,7 +506,7 @@ static IIO_DEVICE_ATTR(reset, S_IWUSR, N adis16220_write_reset, 0);#define IIO_DEV_ATTR_CAPTURE (_store) \ - IIO_DEVICE_ATTR(capture, S_IRUSR, NULL, _store, 0) + IIO_DEVICE_ATTR(capture, S_IWUSR, NULL, _store, 0)static IIO_DEV_ATTR_CAPTURE (adis16220_write_capture);
PATCH 188/223 Staging: samsung-laptop: fix up some sysfs attribute permissions
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 90c05b97fdec8d2196e420d98f774bab731af7aa upstream.
They should not be writable by any user
--- drivers/staging/samsung-laptop/samsung-laptop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/samsung-laptop/samsung-laptop.c +1 -1
@@ -356,7 +356,7 @@ static ssize_t set_silent_state(struct d }return count; } -static DEVICE_ATTR(silent, S_IWUGO | S_IRUGO, +static DEVICE_ATTR(silent, S_IRUSR | S_IRUGO, get_silent_state, set_silent_state);
PATCH 189/223 Staging: samsung-laptop: fix up my fixup for some sysfs attribute permissions
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 4d7bc388b44e42a1feafa35e50eef4f24d6ca59d upstream.
They should be writable by root, not readable. Doh, stupid me with the wrong flags.
--- drivers/staging/samsung-laptop/samsung-laptop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/samsung-laptop/samsung-laptop.c +1 -1
@@ -356,7 +356,7 @@ static ssize_t set_silent_state(struct d }return count; } -static DEVICE_ATTR(silent, S_IRUSR | S_IRUGO, +static DEVICE_ATTR(silent, S_IWUSR | S_IRUGO, get_silent_state, set_silent_state);
PATCH 190/223 Staging: frontier: fix up some sysfs attribute permissions
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 3bad28ec006ad6ab2bca4e5103860b75391e3c9d and 2a767fda5d0d8dcff465724dfad6ee131489b3f2 upstream merged together.
They should not be writable by any user
--- drivers/staging/frontier/tranzport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/frontier/tranzport.c +1 -1
@@ -204,7 +204,7 @@ static void usb_tranzport_abort_transfer t->value = temp; \return count; \ } \ - static DEVICE_ATTR(value, S_IWUGO | S_IRUGO, show_##value, set_##value); + static DEVICE_ATTR(value, S_IWUSR | S_IRUGO, show_##value, set_##value);show_int (enable);show_int (offline);
PATCH 191/223 staging: rtl8187se: Change panic to warn when RF switch turned off
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit f36d83a8cb7224f45fdfa1129a616dff56479a09 upstream.
This driver issues a kernel panic over conditions that do not justify such drastic action. Change these to log entries with a stack dump.
This patch fixes the system crash reported in
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/674285.
--- drivers/staging/rtl8187se/r8185b_init.c | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-)
drivers/staging/rtl8187se/r8185b_init.c +23 -9
@@ -268,8 +268,12 @@ HwHSSIThreeWire( }udelay (10 ); } -if (TryCnt ==TC_3W_POLL_MAX_TRY_CNT ) -panic ("HwThreeWire(): CmdReg: %#X RE|WE bits are not clear!!\n" , u1bTmp); +if (TryCnt ==TC_3W_POLL_MAX_TRY_CNT ) { +printk (KERN_ERR "rtl8187se: HwThreeWire(): CmdReg:" +" %#X RE|WE bits are not clear!!\n" , u1bTmp); +dump_stack (); +return 0 ; + }// RTL8187S HSSI Read/Write Function u1bTmp =read_nic_byte (dev,RF_SW_CONFIG );
@@ -309,13 +313,23 @@ HwHSSIThreeWire(int idx;int ByteCnt = nDataBufBitCnt /8 ;//printk("%d\n",nDataBufBitCnt); -if ((nDataBufBitCnt %8 ) !=0 ) -panic ("HwThreeWire(): nDataBufBitCnt(%d) should be multiple of 8!!!\n" , - nDataBufBitCnt); - -if (nDataBufBitCnt >64 ) -panic ("HwThreeWire(): nDataBufBitCnt(%d) should <= 64!!!\n" , - nDataBufBitCnt); +if ((nDataBufBitCnt %8 ) !=0 ) { +printk (KERN_ERR "rtl8187se: " +"HwThreeWire(): nDataBufBitCnt(%d)" +" should be multiple of 8!!!\n" , + nDataBufBitCnt); +dump_stack (); + nDataBufBitCnt +=8 ; + nDataBufBitCnt &= ~7 ; + } + +if (nDataBufBitCnt >64 ) { +printk (KERN_ERR "rtl8187se: HwThreeWire():" +" nDataBufBitCnt(%d) should <= 64!!!\n" , + nDataBufBitCnt); +dump_stack (); + nDataBufBitCnt =64 ; + }for (idx =0 ; idx < ByteCnt; idx++) {
PATCH 192/223 Staging: batman-adv: ensure that eth_type_trans gets linear memory
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Marek Lindner <[email protected]>
commit b6faaae1a15a352d68b3e3cd8b840e56709820bf upstream.
eth_type_trans tries to pull data with the length of the ethernet header from the skb. We only ensured that enough data for the first ethernet header and the batman header is available in non-paged memory of the skb and not for the ethernet after the batman header.
eth_type_trans would fail sometimes with drivers which don't ensure that all there data is perfectly linearised.
The failure was noticed through a kernel bug Oops generated by the skb_pull inside eth_type_trans.
--- drivers/staging/batman-adv/soft-interface.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/staging/batman-adv/soft-interface.c +4 -0
@@ -295,6 +295,10 @@ void interface_rx(struct sk_buff *skb, iskb_pull_rcsum (skb, hdr_size);/* skb_set_mac_header(skb, -sizeof(struct ethhdr));*/ +if (unlikely (!pskb_may_pull (skb,ETH_HLEN ))) { +kfree_skb (skb); +return ; + } skb->dev = dev; skb->protocol =eth_type_trans (skb, dev);
PATCH 193/223 perf: Fix inherit vs. context rotation bug
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit dddd3379a619a4cb8247bfd3c94ca9ae3797aa2e upstream.
It was found that sometimes children of tasks with inherited events had one extra event. Eventually it turned out to be due to the list rotation no being exclusive with the list iteration in the inheritance code.
Cure this by temporarily disabling the rotation while we inherit the events.
LKML-Reference: <new-submission>
--- include/linux/perf_event.h | 1 + kernel/perf_event.c | 22 ++++++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-)
include/linux/perf_event.h +1 -0
@@ -764,6 +764,7 @@ struct perf_event_context {int nr_active;int is_active;int nr_stat; +int rotate_disable;atomic_t refcount;struct task_struct *task;
kernel/perf_event.c +20 -2
@@ -1609,8 +1609,12 @@ static void rotate_ctx(struct perf_event {raw_spin_lock (&ctx->lock); -/* Rotate the first entry last of non-pinned groups */ -list_rotate_left (&ctx->flexible_groups); +/* +* Rotate the first entry last of non-pinned groups. Rotation might be +* disabled by the inheritance code. +*/ +if (!ctx->rotate_disable) +list_rotate_left (&ctx->flexible_groups);raw_spin_unlock (&ctx->lock); }
@@ -5596,6 +5600,7 @@ int perf_event_init_task(struct task_strstruct perf_event *event;struct task_struct *parent = current;int inherited_all =1 ; +unsigned long flags;int ret =0 ; child->perf_event_ctxp =NULL ;
@@ -5636,6 +5641,15 @@ int perf_event_init_task(struct task_strbreak ; } +/* +* We can't hold ctx->lock when iterating the ->flexible_group list due +* to allocations, but we need to prevent rotation because +* rotate_ctx() will change the list from interrupt context. +*/ +raw_spin_lock_irqsave (&parent_ctx->lock, flags); + parent_ctx->rotate_disable =1 ; +raw_spin_unlock_irqrestore (&parent_ctx->lock, flags); +list_for_each_entry (event, &parent_ctx->flexible_groups, group_entry) { ret =inherit_task_group (event, parent, parent_ctx, child, &inherited_all);
@@ -5643,6 +5657,10 @@ int perf_event_init_task(struct task_strbreak ; } +raw_spin_lock_irqsave (&parent_ctx->lock, flags); + parent_ctx->rotate_disable =0 ; +raw_spin_unlock_irqrestore (&parent_ctx->lock, flags); + child_ctx = child->perf_event_ctxp;if (child_ctx && inherited_all) {
PATCH 194/223 ARM: 6456/1: Fix for building DEBUG with sa11xx_base.c as a module.
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Marcelo Roberto Jimenez <[email protected]>
commit b9f515e3e3861abbaa093359f7c6f31283695228 upstream.
This patch fixes a compilation issue when compiling PCMCIA SA1100 support as a module with PCMCIA_DEBUG enabled. The symbol soc_pcmcia_debug was not beeing exported.
ARM: pcmcia: Fix for building DEBUG with sa11xx_base.c as a module.
This patch fixes a compilation issue when compiling PCMCIA SA1100 support as a module with PCMCIA_DEBUG enabled. The symbol soc_pcmcia_debug was not beeing exported.
--- drivers/pcmcia/soc_common.c | 1 + 1 file changed, 1 insertion(+)
drivers/pcmcia/soc_common.c +1 -0
@@ -65,6 +65,7 @@ void soc_pcmcia_debug(struct soc_pcmcia_ va_end(args); } } +EXPORT_SYMBOL (soc_pcmcia_debug);#endif
PATCH 195/223 PM / Hibernate: Fix memory corruption related to swap
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <[email protected]>
commit c9e664f1fdf34aa8cede047b206deaa8f1945af0 upstream.
There is a problem that swap pages allocated before the creation of a hibernation image can be released and used for storing the contents of different memory pages while the image is being saved. Since the kernel stored in the image doesn't know of that, it causes memory corruption to occur after resume from hibernation, especially on systems with relatively small RAM that need to swap often.
This issue can be addressed by keeping the GFP_IOFS bits clear in gfp_allowed_mask during the entire hibernation, including the saving of the image, until the system is finally turned off or the hibernation is aborted. Unfortunately, for this purpose it's necessary to rework the way in which the hibernate and suspend code manipulates gfp_allowed_mask.
This change is based on an earlier patch from Hugh Dickins.
--- include/linux/gfp.h | 4 ++-- kernel/power/hibernate.c | 22 ++++++++++++---------- kernel/power/suspend.c | 5 ++--- kernel/power/user.c | 2 ++ mm/page_alloc.c | 19 ++++++++++++------- 5 files changed, 30 insertions(+), 22 deletions(-)
include/linux/gfp.h +2 -2
@@ -339,7 +339,7 @@ void drain_local_pages(void *dummy);extern gfp_t gfp_allowed_mask; -extern void set_gfp_allowed_mask (gfp_t mask); -extern gfp_t clear_gfp_allowed_mask (gfp_t mask); +extern void pm_restrict_gfp_mask (void ); +extern void pm_restore_gfp_mask (void );#endif /* __LINUX_GFP_H */
kernel/power/hibernate.c +12 -10
@@ -324,7 +324,6 @@ static int create_image(int platform_modint hibernation_snapshot (int platform_mode) {int error; -gfp_t saved_mask; error =platform_begin (platform_mode);if (error)
@@ -336,7 +335,7 @@ int hibernation_snapshot(int platform_mo goto Close;suspend_console (); - saved_mask =clear_gfp_allowed_mask (GFP_IOFS ); +pm_restrict_gfp_mask (); error =dpm_suspend_start (PMSG_FREEZE );if (error) goto Recover_platform;
@@ -345,7 +344,10 @@ int hibernation_snapshot(int platform_mo goto Recover_platform; error =create_image (platform_mode); -/* Control returns here after successful restore */ +/* +* Control returns here (1) after the image has been created or the +* image creation has failed and (2) after a successful restore. +*/ Resume_devices:/* We may need to release the preallocated image pages here. */
@@ -354,7 +356,10 @@ int hibernation_snapshot(int platform_modpm_resume_end (in_suspend ? (error ?PMSG_RECOVER :PMSG_THAW ) :PMSG_RESTORE ); -set_gfp_allowed_mask (saved_mask); + +if (error || !in_suspend) +pm_restore_gfp_mask (); +resume_console (); Close:platform_end (platform_mode);
@@ -449,17 +454,16 @@ static int resume_target_kernel(bool plaint hibernation_restore (int platform_mode) {int error; -gfp_t saved_mask;pm_prepare_console ();suspend_console (); - saved_mask =clear_gfp_allowed_mask (GFP_IOFS ); +pm_restrict_gfp_mask (); error =dpm_suspend_start (PMSG_QUIESCE );if (!error) { error =resume_target_kernel (platform_mode);dpm_resume_end (PMSG_RECOVER ); } -set_gfp_allowed_mask (saved_mask); +pm_restore_gfp_mask ();resume_console ();pm_restore_console ();return error;
@@ -473,7 +477,6 @@ int hibernation_restore(int platform_modint hibernation_platform_enter (void ) {int error; -gfp_t saved_mask;if (!hibernation_ops)return -ENOSYS ;
@@ -489,7 +492,6 @@ int hibernation_platform_enter(void) entering_platform_hibernation = true;suspend_console (); - saved_mask =clear_gfp_allowed_mask (GFP_IOFS ); error =dpm_suspend_start (PMSG_HIBERNATE );if (error) {if (hibernation_ops->recover)
@@ -527,7 +529,6 @@ int hibernation_platform_enter(void) Resume_devices: entering_platform_hibernation = false;dpm_resume_end (PMSG_RESTORE ); -set_gfp_allowed_mask (saved_mask);resume_console (); Close:
@@ -635,6 +636,7 @@ int hibernate(void)swsusp_free ();if (!error)power_down (); +pm_restore_gfp_mask (); }else {pr_debug ("PM: Image restored successfully.\n" ); }
kernel/power/suspend.c +2 -3
@@ -196,7 +196,6 @@ static int suspend_enter(suspend_state_tint suspend_devices_and_enter (suspend_state_t state) {int error; -gfp_t saved_mask;if (!suspend_ops)return -ENOSYS ;
@@ -207,7 +206,7 @@ int suspend_devices_and_enter(suspend_st goto Close; }suspend_console (); - saved_mask =clear_gfp_allowed_mask (GFP_IOFS ); +pm_restrict_gfp_mask ();suspend_test_start (); error =dpm_suspend_start (PMSG_SUSPEND );if (error) {
@@ -224,7 +223,7 @@ int suspend_devices_and_enter(suspend_stsuspend_test_start ();dpm_resume_end (PMSG_RESUME );suspend_test_finish ("resume devices" ); -set_gfp_allowed_mask (saved_mask); +pm_restore_gfp_mask ();resume_console (); Close:if (suspend_ops->end)
kernel/power/user.c +2 -0
@@ -263,6 +263,7 @@ static long snapshot_ioctl(struct file *case SNAPSHOT_UNFREEZE :if (!data->frozen || data->ready)break ; +pm_restore_gfp_mask ();thaw_processes ();usermodehelper_enable (); data->frozen =0 ;
@@ -275,6 +276,7 @@ static long snapshot_ioctl(struct file * error = -EPERM ;break ; } +pm_restore_gfp_mask (); error =hibernation_snapshot (data->platform_support);if (!error) error =put_user (in_suspend, (int __user *)arg);
mm/page_alloc.c +12 -7
@@ -103,19 +103,24 @@ gfp_t gfp_allowed_mask __read_mostly = G* only be modified with pm_mutex held, unless the suspend/hibernate code is * guaranteed not to run in parallel with that modification). */ -void set_gfp_allowed_mask (gfp_t mask) + +static gfp_t saved_gfp_mask; + +void pm_restore_gfp_mask (void ) {WARN_ON (!mutex_is_locked (&pm_mutex)); - gfp_allowed_mask = mask; +if (saved_gfp_mask) { + gfp_allowed_mask = saved_gfp_mask; + saved_gfp_mask =0 ; + } } -gfp_t clear_gfp_allowed_mask (gfp_t mask) +void pm_restrict_gfp_mask (void ) { -gfp_t ret = gfp_allowed_mask; -WARN_ON (!mutex_is_locked (&pm_mutex)); - gfp_allowed_mask &= ~mask; -return ret; +WARN_ON (saved_gfp_mask); + saved_gfp_mask = gfp_allowed_mask; + gfp_allowed_mask &= ~GFP_IOFS ; }#endif /* CONFIG_PM_SLEEP */
PATCH 196/223 wmi: use memcmp instead of strncmp to compare GUIDs
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Thadeu Lima de Souza Cascardo <[email protected]>
commit 8b14d7b22c61f17ccb869e0047d9df6dd9f50a9f upstream.
While looking for the duplicates in /sys/class/wmi/, I couldn't find them. The code that looks for duplicates uses strncmp in a binary GUID, which may contain zero bytes. The right function is memcmp, which is also used in another section of wmi code.
It was finding 49142400-C6A3-40FA-BADB-8A2652834100 as a duplicate of 39142400-C6A3-40FA-BADB-8A2652834100. Since the first byte is the fourth printed, they were found as equal by strncmp.
--- drivers/platform/x86/wmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/wmi.c +1 -1
@@ -795,7 +795,7 @@ static bool guid_already_parsed(const ch wblock = list_entry(p, struct wmi_block, list); gblock = &wblock->gblock; -if (strncmp (gblock->guid, guid_string,16 ) ==0 ) +if (memcmp (gblock->guid, guid_string,16 ) ==0 )return true; }return false;
PATCH 197/223 nohz/s390: fix arch_needs_cpu() return value on offline cpus
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <[email protected]>
commit 398812159e328478ae49b4bd01f0d71efea96c39 upstream.
This fixes the same problem as described in the patch "nohz: fix printk_needs_cpu() return value on offline cpus" for the arch_needs_cpu() primitive:
arch_needs_cpu() may return 1 if called on offline cpus. When a cpu gets offlined it schedules the idle process which, before killing its own cpu, will call tick_nohz_stop_sched_tick().
That function in turn will call arch_needs_cpu() in order to check if the local tick can be disabled. On offline cpus this function should naturally return 0 since regardless if the tick gets disabled or not the cpu will be dead short after. That is besides the fact that __cpu_disable() should already have made sure that no interrupts on the offlined cpu will be delivered anyway.
In this case it prevents tick_nohz_stop_sched_tick() to call select_nohz_load_balancer(). No idea if that really is a problem. However what made me debug this is that on 2.6.32 the function get_nohz_load_balancer() is used within __mod_timer() to select a cpu on which a timer gets enqueued. If arch_needs_cpu() returns 1 then the nohz_load_balancer cpu doesn't get updated when a cpu gets offlined. It may contain the cpu number of an offline cpu. In turn timers get enqueued on an offline cpu and not very surprisingly they never expire and cause system hangs.
This has been observed 2.6.32 kernels. On current kernels __mod_timer() uses get_nohz_timer_target() which doesn't have that problem. However there might be other problems because of the too early exit tick_nohz_stop_sched_tick() in case a cpu goes offline.
This specific bug was indrocuded with 3c5d92a0 "nohz: Introduce arch_needs_cpu".
In this case a cpu hotplug notifier is used to fix the issue in order to keep the normal/fast path small. All we need to do is to clear the condition that makes arch_needs_cpu() return 1 since it is just a performance improvement which is supposed to keep the local tick running for a short period if a cpu goes idle. Nothing special needs to be done except for clearing the condition.
--- arch/s390/kernel/vtime.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
arch/s390/kernel/vtime.c +19 -0
@@ -19,6 +19,7 @@#include <linux/kernel_stat.h> #include <linux/rcupdate.h> #include <linux/posix-timers.h> +#include <linux/cpu.h> #include <asm/s390_ext.h> #include <asm/timer.h>
@@ -565,6 +566,23 @@ void init_cpu_vtimer(void)__ctl_set_bit (0 ,10 ); } +static int __cpuinit s390_nohz_notify (struct notifier_block *self, +unsigned long action,void *hcpu) +{ +struct s390_idle_data *idle; +long cpu = (long ) hcpu; + + idle = &per_cpu (s390_idle, cpu); +switch (action) { +case CPU_DYING : +case CPU_DYING_FROZEN : + idle->nohz_delay =0 ; +default : +break ; + } +return NOTIFY_OK ; +} +void __init vtime_init (void ) {/* request the cpu timer external interrupt */
@@ -573,5 +591,6 @@ void __init vtime_init(void)/* Enable cpu timer interrupts on the boot cpu. */ init_cpu_vtimer (); +cpu_notifier (s390_nohz_notify,0 ); }
PATCH 198/223 genirq: Fix incorrect proc spurious output
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Kenji Kaneshige <[email protected]>
commit 25c9170ed64a6551beefe9315882f754e14486f4 upstream.
Since commit a1afb637(switch /proc/irq/*/spurious to seq_file) all /proc/irq/XX/spurious files show the information of irq 0.
Current irq_spurious_proc_open() passes on NULL as the 3rd argument, which is used as an IRQ number in irq_spurious_proc_show(), to the single_open(). Because of this, all the /proc/irq/XX/spurious file shows IRQ 0 information regardless of the IRQ number.
To fix the problem, irq_spurious_proc_open() must pass on the appropreate data (IRQ number) to single_open().
LKML-Reference: <[email protected]>
--- kernel/irq/proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/irq/proc.c +1 -1
@@ -214,7 +214,7 @@ static int irq_spurious_proc_show(structstatic int irq_spurious_proc_open (struct inode *inode,struct file *file) { -return single_open (file, irq_spurious_proc_show,NULL ); +return single_open (file, irq_spurious_proc_show,PDE (inode)->data); }static const struct file_operations irq_spurious_proc_fops = {
PATCH 199/223 net: Truncate recvfrom and sendto length to INT_MAX.
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit 253eacc070b114c2ec1f81b067d2fed7305467b0 upstream.
--- net/socket.c | 4 ++++ 1 file changed, 4 insertions(+)
net/socket.c +4 -0
@@ -1652,6 +1652,8 @@ SYSCALL_DEFINE6(sendto, int, fd, void __struct iovec iov;int fput_needed; +if (len >INT_MAX ) + len =INT_MAX ; sock =sockfd_lookup_light (fd, &err, &fput_needed);if (!sock) goto out;
@@ -1709,6 +1711,8 @@ SYSCALL_DEFINE6(recvfrom, int, fd, voidint err, err2;int fput_needed; +if (size >INT_MAX ) + size =INT_MAX ; sock =sockfd_lookup_light (fd, &err, &fput_needed);if (!sock) goto out;
PATCH 200/223 net: Limit socket I/O iovec total length to INT_MAX.
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: David S. Miller <[email protected]>
commit 8acfe468b0384e834a303f08ebc4953d72fb690a upstream.
This helps protect us from overflow issues down in the individual protocol sendmsg/recvmsg handlers. Once we hit INT_MAX we truncate out the rest of the iovec by setting the iov_len members to zero.
This works because:
1) For SOCK_STREAM and SOCK_SEQPACKET sockets, partial writes are allowed and the application will just continue with another write to send the rest of the data.
2) For datagram oriented sockets, where there must be a one-to-one correspondance between write() calls and packets on the wire, INT_MAX is going to be far larger than the packet size limit the protocol is going to check for and signal with -EMSGSIZE.
Based upon a patch by Linus Torvalds.
--- net/compat.c | 10 ++++++---- net/core/iovec.c | 15 +++++++-------- 2 files changed, 13 insertions(+), 12 deletions(-)
net/compat.c +6 -4
@@ -41,10 +41,12 @@ static inline int iov_from_user_compat_tcompat_size_t len;if (get_user (len, &uiov32->iov_len) || -get_user (buf, &uiov32->iov_base)) { - tot_len = -EFAULT ; -break ; - } +get_user (buf, &uiov32->iov_base)) +return -EFAULT ; + +if (len >INT_MAX - tot_len) + len =INT_MAX - tot_len; + tot_len += len; kiov->iov_base =compat_ptr (buf); kiov->iov_len = (__kernel_size_t ) len;
net/core/iovec.c +7 -8
@@ -59,14 +59,13 @@ int verify_iovec(struct msghdr *m, struc err =0 ;for (ct =0 ; ct < m->msg_iovlen; ct++) { - err += iov[ct].iov_len; -/* -* Goal is not to verify user data, but to prevent returning -* negative value, which is interpreted as errno. -* Overflow is still possible, but it is harmless. -*/ -if (err <0 ) -return -EMSGSIZE ; +size_t len = iov[ct].iov_len; + +if (len >INT_MAX - err) { + len =INT_MAX - err; + iov[ct].iov_len = len; + } + err += len; }return err;
PATCH 201/223 Input: i8042 - add Sony VAIO VPCZ122GX to nomux list
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Torokhov <[email protected]>
[Note that the mainline will not have this particular fix but rather will blacklist entire VAIO line based off DMI board name. For stable I am being a bit more cautious and blacklist one particular product.]
Trying to query/activate active multiplexing mode on this VAIO makes both keyboard and touchpad inoperable. Futher kernels will blacklist entire VAIO line, however here we blacklist just one particular model.
--- drivers/input/serio/i8042-x86ia64io.h | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/input/serio/i8042-x86ia64io.h +7 -0
@@ -333,6 +333,13 @@ static const struct dmi_system_id __init }, }, { +/* Sony Vaio VPCZ122GX */ + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Sony Corporation" ), + DMI_MATCH(DMI_PRODUCT_NAME, "VPCZ122GX"), + }, + }, + {/* Sony Vaio FS-115b */ .matches = { DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
PATCH 202/223 omap: dma: Fix buffering disable bit setting for omap24xx
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Jarkko Nikula <[email protected]>
commit 3e57f1626b5febe5cc99aa6870377deef3ae03cc upstream.
An errata workaround for omap24xx is not setting the buffering disable bit 25 what is the purpose but channel enable bit 7 instead.
Background for this fix is the DMA stalling issue with ASoC omap-mcbsp driver. Peter Ujfalusi <[email protected]> has found an issue in recording that the DMA stall could happen if there were a buffer overrun detected by ALSA and the DMA was stopped and restarted due that. This problem is known to occur on both OMAP2420 and OMAP3. It can recover on OMAP3 after dma free, dma request and reconfiguration cycle. However, on OMAP2420 it seems that only way to recover is a reset.
Problem was not visible before the commit c12abc0. That commit changed that the McBSP transmitter/receiver is released from reset only when needed. That is, only enabled McBSP transmitter without transmission was able to prevent this DMA stall problem in receiving side and underlying problem did not show up until now. McBSP transmitter itself seems to no be reason since DMA stall does not recover by enabling the transmission after stall.
Debugging showed that there were a DMA write active during DMA stop time and it never completed even when restarting the DMA. Experimenting showed that the DMA buffering disable bit could be used to avoid stalling when using source synchronized transfers. However that could have performance hit and OMAP3 TRM states that buffering disable is not allowed for destination synchronized transfers so subsequent patch will implement a method to complete DMA writes when stopping.
This patch is based on assumtion that complete lock-up on OMAP2420 is different but related problem. I don't have access to OMAP2420 errata but I believe this old workaround here is put for a reason but unfortunately a wrong bit was typed and problem showed up only now.
--- arch/arm/plat-omap/dma.c | 14 ++++++++++---- arch/arm/plat-omap/include/plat/dma.h | 1 + 2 files changed, 11 insertions(+), 4 deletions(-)
arch/arm/plat-omap/dma.c +10 -4
@@ -993,11 +993,17 @@ void omap_start_dma(int lch) l =dma_read (CCR (lch));/* -* Errata: On ES2.0 BUFFERING disable must be set. -* This will always fail on ES1.0 +* Errata: Inter Frame DMA buffering issue (All OMAP2420 and +* OMAP2430ES1.0): DMA will wrongly buffer elements if packing and +* bursting is enabled. This might result in data gets stalled in +* FIFO at the end of the block. +* Workaround: DMA channels must have BUFFERING_DISABLED bit set to +* guarantee no data will stay in the DMA FIFO in case inter frame +* buffering occurs. */ -if (cpu_is_omap24xx ()) - l |=OMAP_DMA_CCR_EN ; +if (cpu_is_omap2420 () || + (cpu_is_omap2430 () && (omap_type () ==OMAP2430_REV_ES1_0 ))) + l |=OMAP_DMA_CCR_BUFFERING_DISABLE ; l |=OMAP_DMA_CCR_EN ;dma_write (l,CCR (lch));
arch/arm/plat-omap/include/plat/dma.h +1 -0
@@ -335,6 +335,7 @@#define OMAP2_DMA_MISALIGNED_ERR_IRQ (1 << 11)#define OMAP_DMA_CCR_EN (1 << 7) +#define OMAP_DMA_CCR_BUFFERING_DISABLE (1 << 25)#define OMAP_DMA_DATA_TYPE_S8 0x00#define OMAP_DMA_DATA_TYPE_S16 0x01
PATCH 203/223 OMAP3: DMA: Errata i541: sDMA FIFO draining does not finish
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Peter Ujfalusi <[email protected]>
commit 0e4905c0199d683497833be60a428c784d7575b8 upstream.
Implement the suggested workaround for OMAP3 regarding to sDMA draining issue, when the channel is disabled on the fly.
This errata affects the following configuration:
sDMA transfer is source synchronized
Buffering is enabled
SmartStandby is selected.
The issue can be easily reproduced by creating overrun situation while recording audio.
Either introduce load to the CPU:
nice -19 arecord -D hw:0 -M -B 10000 -F 5000 -f dat > /dev/null & \
dd if=/dev/urandom of=/dev/null
or suspending the arecord, and resuming it:
arecord -D hw:0 -M -B 10000 -F 5000 -f dat > /dev/null CTRL+Z; fg; CTRL+Z; fg; ...
In case of overrun audio stops DMA, and restarts it (without reseting the sDMA channel). When we hit this errata in stop case (sDMA drain did not complete), at the coming start the sDMA will not going to be operational (it is still draining).
This leads to DMA stall condition.
On OMAP3 we can recover with sDMA channel reset, it has been observed that by introducing unrelated sDMA activity might also help (reading from MMC for example).
The same errata exists for OMAP2, where the suggestion is to disable the buffering to avoid this type of error.
On OMAP3 the suggestion is to set sDMA to NoStandby before disabling the channel, and wait for the drain to finish, than configure sDMA to SmartStandby again.
--- arch/arm/plat-omap/dma.c | 36 ++++++++++++++++++++++++++++++++-- arch/arm/plat-omap/include/plat/dma.h | 3 ++ 2 files changed, 37 insertions(+), 2 deletions(-)
arch/arm/plat-omap/dma.c +34 -2
@@ -30,6 +30,7 @@#include <linux/irq.h> #include <linux/io.h> #include <linux/slab.h> +#include <linux/delay.h> #include <asm/system.h> #include <mach/hardware.h>
@@ -1021,8 +1022,39 @@ void omap_stop_dma(int lch)dma_write (0 ,CICR (lch)); l =dma_read (CCR (lch)); - l &= ~OMAP_DMA_CCR_EN ; -dma_write (l,CCR (lch)); +/* OMAP3 Errata i541: sDMA FIFO draining does not finish */ +if (cpu_is_omap34xx () && (l &OMAP_DMA_CCR_SEL_SRC_DST_SYNC )) { +int i =0 ; +u32 sys_cf; + +/* Configure No-Standby */ + l =dma_read (OCP_SYSCONFIG ); + sys_cf = l; + l &= ~DMA_SYSCONFIG_MIDLEMODE_MASK ; + l |=DMA_SYSCONFIG_MIDLEMODE (DMA_IDLEMODE_NO_IDLE ); +dma_write (l ,OCP_SYSCONFIG ); + + l =dma_read (CCR (lch)); + l &= ~OMAP_DMA_CCR_EN ; +dma_write (l,CCR (lch)); + +/* Wait for sDMA FIFO drain */ + l =dma_read (CCR (lch)); +while (i <100 && (l & (OMAP_DMA_CCR_RD_ACTIVE | +OMAP_DMA_CCR_WR_ACTIVE ))) { +udelay (5 ); + i++; + l =dma_read (CCR (lch)); + } +if (i >=100 ) +printk (KERN_ERR "DMA drain did not complete on " +"lch %d\n" , lch); +/* Restore OCP_SYSCONFIG */ +dma_write (sys_cf,OCP_SYSCONFIG ); + }else { + l &= ~OMAP_DMA_CCR_EN ; +dma_write (l,CCR (lch)); + }if (!omap_dma_in_1510_mode () && dma_chan[lch].next_lch !=-1 ) {int next_lch, cur_lch = lch;
arch/arm/plat-omap/include/plat/dma.h +3 -0
@@ -335,6 +335,9 @@#define OMAP2_DMA_MISALIGNED_ERR_IRQ (1 << 11)#define OMAP_DMA_CCR_EN (1 << 7) +#define OMAP_DMA_CCR_RD_ACTIVE (1 << 9) +#define OMAP_DMA_CCR_WR_ACTIVE (1 << 10) +#define OMAP_DMA_CCR_SEL_SRC_DST_SYNC (1 << 24)#define OMAP_DMA_CCR_BUFFERING_DISABLE (1 << 25)#define OMAP_DMA_DATA_TYPE_S8 0x00
PATCH 204/223 memory corruption in X.25 facilities parsing
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: andrew hendry <[email protected]>
commit a6331d6f9a4298173b413cf99a40cc86a9d92c37 upstream.
--- net/x25/x25_facilities.c | 8 ++++---- net/x25/x25_in.c | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-)
net/x25/x25_facilities.c +4 -4
@@ -134,15 +134,15 @@ int x25_parse_facilities(struct sk_buffcase X25_FAC_CLASS_D :switch (*p) {case X25_FAC_CALLING_AE : -if (p[1 ] >X25_MAX_DTE_FACIL_LEN ) -break ; +if (p[1 ] >X25_MAX_DTE_FACIL_LEN || p[1 ] <=1 ) +return 0 ; dte_facs->calling_len = p[2 ];memcpy (dte_facs->calling_ae, &p[3 ], p[1 ] -1 ); *vc_fac_mask |=X25_MASK_CALLING_AE ;break ;case X25_FAC_CALLED_AE : -if (p[1 ] >X25_MAX_DTE_FACIL_LEN ) -break ; +if (p[1 ] >X25_MAX_DTE_FACIL_LEN || p[1 ] <=1 ) +return 0 ; dte_facs->called_len = p[2 ];memcpy (dte_facs->called_ae, &p[3 ], p[1 ] -1 ); *vc_fac_mask |=X25_MASK_CALLED_AE ;
net/x25/x25_in.c +2 -0
@@ -119,6 +119,8 @@ static int x25_state1_machine(struct soc &x25->vc_facil_mask);if (len >0 )skb_pull (skb, len); +else +return -1 ;/* * Copy any Call User Data. */
PATCH 205/223 net: optimize Berkeley Packet Filter (BPF) processing
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
Gcc is currenlty not in the ability to optimize the switch statement in sk_run_filter() because of dense case labels. This patch replace the OR'd labels with ordered sequenced case labels. The sk_chk_filter() function is modified to patch/replace the original OPCODES in a ordered but equivalent form. gcc is now in the ability to transform the switch statement in sk_run_filter into a jump table of complexity O(1).
Until this patch gcc generates a sequence of conditional branches (O(n) of 567 byte .text segment size (arch x86_64):
7ff: 8b 06 mov (%rsi),%eax 801: 66 83 f8 35 cmp $0x35,%ax 805: 0f 84 d0 02 00 00 je adb <sk_run_filter+0x31d> 80b: 0f 87 07 01 00 00 ja 918 <sk_run_filter+0x15a> 811: 66 83 f8 15 cmp $0x15,%ax 815: 0f 84 c5 02 00 00 je ae0 <sk_run_filter+0x322> 81b: 77 73 ja 890 <sk_run_filter+0xd2> 81d: 66 83 f8 04 cmp $0x4,%ax 821: 0f 84 17 02 00 00 je a3e <sk_run_filter+0x280> 827: 77 29 ja 852 <sk_run_filter+0x94> 829: 66 83 f8 01 cmp $0x1,%ax
[...]
With the modification the compiler translate the switch statement into the following jump table fragment:
7ff: 66 83 3e 2c cmpw $0x2c,(%rsi) 803: 0f 87 1f 02 00 00 ja a28 <sk_run_filter+0x26a> 809: 0f b7 06 movzwl (%rsi),%eax 80c: ff 24 c5 00 00 00 00 jmpq *0x0(,%rax,8) 813: 44 89 e3 mov %r12d,%ebx 816: e9 43 03 00 00 jmpq b5e <sk_run_filter+0x3a0> 81b: 41 89 dc mov %ebx,%r12d 81e: e9 3b 03 00 00 jmpq b5e <sk_run_filter+0x3a0>
Furthermore, I reordered the instructions to reduce cache line misses by order the most common instruction to the start.
--- include/linux/filter.h | 48 +++++++++++ net/core/filter.c | 212 +++++++++++++++++++++++++++++++++++++------------ 2 files changed, 209 insertions(+), 51 deletions(-)
include/linux/filter.h +48 -0
@@ -91,6 +91,54 @@ struct sock_fprog { /* Required for SO_A#define BPF_TAX 0x00#define BPF_TXA 0x80 +enum { +BPF_S_RET_K =0 , +BPF_S_RET_A , +BPF_S_ALU_ADD_K , +BPF_S_ALU_ADD_X , +BPF_S_ALU_SUB_K , +BPF_S_ALU_SUB_X , +BPF_S_ALU_MUL_K , +BPF_S_ALU_MUL_X , +BPF_S_ALU_DIV_X , +BPF_S_ALU_AND_K , +BPF_S_ALU_AND_X , +BPF_S_ALU_OR_K , +BPF_S_ALU_OR_X , +BPF_S_ALU_LSH_K , +BPF_S_ALU_LSH_X , +BPF_S_ALU_RSH_K , +BPF_S_ALU_RSH_X , +BPF_S_ALU_NEG , +BPF_S_LD_W_ABS , +BPF_S_LD_H_ABS , +BPF_S_LD_B_ABS , +BPF_S_LD_W_LEN , +BPF_S_LD_W_IND , +BPF_S_LD_H_IND , +BPF_S_LD_B_IND , +BPF_S_LD_IMM , +BPF_S_LDX_W_LEN , +BPF_S_LDX_B_MSH , +BPF_S_LDX_IMM , +BPF_S_MISC_TAX , +BPF_S_MISC_TXA , +BPF_S_ALU_DIV_K , +BPF_S_LD_MEM , +BPF_S_LDX_MEM , +BPF_S_ST , +BPF_S_STX , +BPF_S_JMP_JA , +BPF_S_JMP_JEQ_K , +BPF_S_JMP_JEQ_X , +BPF_S_JMP_JGE_K , +BPF_S_JMP_JGE_X , +BPF_S_JMP_JGT_K , +BPF_S_JMP_JGT_X , +BPF_S_JMP_JSET_K , +BPF_S_JMP_JSET_X , +}; +#ifndef BPF_MAXINSNS #define BPF_MAXINSNS 4096#endif
net/core/filter.c +161 -51
397 lines not on this page · raw message
PATCH 206/223 filter: make sure filters dont read uninitialized memory
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: David S. Miller <[email protected]>
commit 57fe93b374a6b8711995c2d466c502af9f3a08bb upstream.
There is a possibility malicious users can get limited information about uninitialized stack mem array. Even if sk_run_filter() result is bound to packet length (0 .. 65535), we could imagine this can be used by hostile user.
Initializing mem[] array, like Dan Rosenberg suggested in his patch is expensive since most filters dont even use this array.
Its hard to make the filter validation in sk_chk_filter(), because of the jumps. This might be done later.
In this patch, I use a bitmap (a single long var) so that only filters using mem[] loads/stores pay the price of added security checks.
For other filters, additional cost is a single instruction.
[ Since we access fentry->k a lot now, cache it in a local variable
and mark filter entry pointer as const. -DaveM ]
--- net/core/filter.c | 64 +++++++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 29 deletions(-)
net/core/filter.c +35 -29
@@ -112,39 +112,41 @@ EXPORT_SYMBOL(sk_filter);*/ unsigned int sk_run_filter (struct sk_buff *skb,struct sock_filter *filter,int flen) { -struct sock_filter *fentry;/* We walk down these */ void *ptr;u32 A =0 ;/* Accumulator */ u32 X =0 ;/* Index Register */ u32 mem[BPF_MEMWORDS ];/* Scratch Memory Store */ +unsigned long memvalid =0 ;u32 tmp;int k;int pc; +BUILD_BUG_ON (BPF_MEMWORDS >BITS_PER_LONG );/* * Process array of filter instructions. */ for (pc =0 ; pc < flen; pc++) { - fentry = &filter[pc]; +const struct sock_filter *fentry = &filter[pc]; +u32 f_k = fentry->k;switch (fentry->code) {case BPF_S_ALU_ADD_X :A +=X ;continue ;case BPF_S_ALU_ADD_K : -A += fentry->k; +A += f_k;continue ;case BPF_S_ALU_SUB_X :A -=X ;continue ;case BPF_S_ALU_SUB_K : -A -= fentry->k; +A -= f_k;continue ;case BPF_S_ALU_MUL_X :A *=X ;continue ;case BPF_S_ALU_MUL_K : -A *= fentry->k; +A *= f_k;continue ;case BPF_S_ALU_DIV_X :if (X ==0 )
@@ -152,49 +154,49 @@ unsigned int sk_run_filter(struct sk_bufA /=X ;continue ;case BPF_S_ALU_DIV_K : -A /= fentry->k; +A /= f_k;continue ;case BPF_S_ALU_AND_X :A &=X ;continue ;case BPF_S_ALU_AND_K : -A &= fentry->k; +A &= f_k;continue ;case BPF_S_ALU_OR_X :A |=X ;continue ;case BPF_S_ALU_OR_K : -A |= fentry->k; +A |= f_k;continue ;case BPF_S_ALU_LSH_X :A <<=X ;continue ;case BPF_S_ALU_LSH_K : -A <<= fentry->k; +A <<= f_k;continue ;case BPF_S_ALU_RSH_X :A >>=X ;continue ;case BPF_S_ALU_RSH_K : -A >>= fentry->k; +A >>= f_k;continue ;case BPF_S_ALU_NEG :A = -A ;continue ;case BPF_S_JMP_JA : - pc += fentry->k; + pc += f_k;continue ;case BPF_S_JMP_JGT_K : - pc += (A > fentry->k) ? fentry->jt : fentry->jf; + pc += (A > f_k) ? fentry->jt : fentry->jf;continue ;case BPF_S_JMP_JGE_K : - pc += (A >= fentry->k) ? fentry->jt : fentry->jf; + pc += (A >= f_k) ? fentry->jt : fentry->jf;continue ;case BPF_S_JMP_JEQ_K : - pc += (A == fentry->k) ? fentry->jt : fentry->jf; + pc += (A == f_k) ? fentry->jt : fentry->jf;continue ;case BPF_S_JMP_JSET_K : - pc += (A & fentry->k) ? fentry->jt : fentry->jf; + pc += (A & f_k) ? fentry->jt : fentry->jf;continue ;case BPF_S_JMP_JGT_X : pc += (A >X ) ? fentry->jt : fentry->jf;
@@ -209,7 +211,7 @@ unsigned int sk_run_filter(struct sk_buf pc += (A &X ) ? fentry->jt : fentry->jf;continue ;case BPF_S_LD_W_ABS : - k = fentry->k; + k = f_k; load_w: ptr =load_pointer (skb, k,4 , &tmp);if (ptr !=NULL ) {
@@ -218,7 +220,7 @@ load_w: }break ;case BPF_S_LD_H_ABS : - k = fentry->k; + k = f_k; load_h: ptr =load_pointer (skb, k,2 , &tmp);if (ptr !=NULL ) {
@@ -227,7 +229,7 @@ load_h: }break ;case BPF_S_LD_B_ABS : - k = fentry->k; + k = f_k; load_b: ptr =load_pointer (skb, k,1 , &tmp);if (ptr !=NULL ) {
@@ -242,32 +244,34 @@ load_b:X = skb->len;continue ;case BPF_S_LD_W_IND : - k =X + fentry->k; + k =X + f_k; goto load_w;case BPF_S_LD_H_IND : - k =X + fentry->k; + k =X + f_k; goto load_h;case BPF_S_LD_B_IND : - k =X + fentry->k; + k =X + f_k; goto load_b;case BPF_S_LDX_B_MSH : - ptr =load_pointer (skb, fentry->k,1 , &tmp); + ptr =load_pointer (skb, f_k,1 , &tmp);if (ptr !=NULL ) {X = (*(u8 *)ptr &0xf ) <<2 ;continue ; }return 0 ;case BPF_S_LD_IMM : -A = fentry->k; +A = f_k;continue ;case BPF_S_LDX_IMM : -X = fentry->k; +X = f_k;continue ;case BPF_S_LD_MEM : -A = mem[fentry->k]; +A = (memvalid & (1UL << f_k)) ? + mem[f_k] :0 ;continue ;case BPF_S_LDX_MEM : -X = mem[fentry->k]; +X = (memvalid & (1UL << f_k)) ? + mem[f_k] :0 ;continue ;case BPF_S_MISC_TAX :X =A ;
@@ -276,14 +280,16 @@ load_b:A =X ;continue ;case BPF_S_RET_K : -return fentry->k; +return f_k;case BPF_S_RET_A :return A ;case BPF_S_ST : - mem[fentry->k] =A ; + memvalid |=1UL << f_k; + mem[f_k] =A ;continue ;case BPF_S_STX : - mem[fentry->k] =X ; + memvalid |=1UL << f_k; + mem[f_k] =X ;continue ;default :WARN_ON (1 );
PATCH 207/223 can-bcm: fix minor heap overflow
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Hartkopp <[email protected]>
commit 0597d1b99fcfc2c0eada09a698f85ed413d4ba84 upstream.
On 64-bit platforms the ASCII representation of a pointer may be up to 17 bytes long. This patch increases the length of the buffer accordingly.
http://marc.info/?l=linux-netdev&m=128872251418192&w=2
--- net/can/bcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/can/bcm.c +1 -1
@@ -125,7 +125,7 @@ struct bcm_sock {struct list_head tx_ops;unsigned long dropped_usr_msgs;struct proc_dir_entry *bcm_proc_read; -char procname [9 ];/* pointer printed in ASCII with \0 */ +char procname [20 ];/* pointer printed in ASCII with \0 */ };static inline struct bcm_sock *bcm_sk (const struct sock *sk)
PATCH 208/223 x25: Prevent crashing when parsing bad X.25 facilities
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Dan Rosenberg <[email protected]>
commit 5ef41308f94dcbb3b7afc56cdef1c2ba53fa5d2f upstream.
Now with improved comma support.
On parsing malformed X.25 facilities, decrementing the remaining length may cause it to underflow. Since the length is an unsigned integer, this will result in the loop continuing until the kernel crashes.
This patch adds checks to ensure decrementing the remaining length does not cause it to wrap around.
--- net/x25/x25_facilities.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
net/x25/x25_facilities.c +9 -3
@@ -61,6 +61,8 @@ int x25_parse_facilities(struct sk_buffwhile (len >0 ) {switch (*p &X25_FAC_CLASS_MASK ) {case X25_FAC_CLASS_A : +if (len <2 ) +return 0 ;switch (*p) {case X25_FAC_REVERSE :if ((p[1 ] &0x81 ) ==0x81 ) {
@@ -104,6 +106,8 @@ int x25_parse_facilities(struct sk_buff len -=2 ;break ;case X25_FAC_CLASS_B : +if (len <3 ) +return 0 ;switch (*p) {case X25_FAC_PACKET_SIZE : facilities->pacsize_in = p[1 ];
@@ -125,6 +129,8 @@ int x25_parse_facilities(struct sk_buff len -=3 ;break ;case X25_FAC_CLASS_C : +if (len <4 ) +return 0 ;printk (KERN_DEBUG "X.25: unknown facility %02X, " "values %02X, %02X, %02X\n" , p[0 ], p[1 ], p[2 ], p[3 ]);
@@ -132,6 +138,8 @@ int x25_parse_facilities(struct sk_buff len -=4 ;break ;case X25_FAC_CLASS_D : +if (len < p[1 ] +2 ) +return 0 ;switch (*p) {case X25_FAC_CALLING_AE :if (p[1 ] >X25_MAX_DTE_FACIL_LEN || p[1 ] <=1 )
@@ -149,9 +157,7 @@ int x25_parse_facilities(struct sk_buffbreak ;default :printk (KERN_DEBUG "X.25: unknown facility %02X," -"length %d, values %02X, %02X, " -"%02X, %02X\n" , - p[0 ], p[1 ], p[2 ], p[3 ], p[4 ], p[5 ]); +"length %d\n" , p[0 ], p[1 ]);break ; } len -= p[1 ] +2 ;
PATCH 209/223 crypto: padlock - Fix AES-CBC handling on odd-block-sized input
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Herbert Xu <[email protected]>
commit c054a076a1bd4731820a9c4d638b13d5c9bf5935 upstream.
On certain VIA chipsets AES-CBC requires the input/output to be a multiple of 64 bytes. We had a workaround for this but it was buggy as it sent the whole input for processing when it is meant to only send the initial number of blocks which makes the rest a multiple of 64 bytes.
As expected this causes memory corruption whenever the workaround kicks in.
--- drivers/crypto/padlock-aes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/padlock-aes.c +1 -1
@@ -286,7 +286,7 @@ static inline u8 *padlock_xcrypt_cbc(conif (initial) asmvolatile (".byte 0xf3,0x0f,0xa7,0xd0" /* rep xcryptcbc */ :"+S" (input),"+D" (output),"+a" (iv) - :"d" (control_word),"b" (key),"c" (count)); + :"d" (control_word),"b" (key),"c" (initial)); asmvolatile (".byte 0xf3,0x0f,0xa7,0xd0" /* rep xcryptcbc */ : "+S" (input), "+D" (output), "+a" (iv)
PATCH 210/223 econet: disallow NULL remote addr for sendmsg(), fixes CVE-2010-3849
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Phil Blundell <[email protected]>
commit fa0e846494792e722d817b9d3d625a4ef4896c96 upstream.
Later parts of econet_sendmsg() rely on saddr != NULL, so return early with EINVAL if NULL was passed otherwise an oops may occur.
--- net/econet/af_econet.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-)
net/econet/af_econet.c +8 -18
@@ -297,23 +297,14 @@ static int econet_sendmsg(struct kiocb *mutex_lock (&econet_mutex); -if (saddr ==NULL ) { -struct econet_sock *eo =ec_sk (sk); - - addr.station = eo->station; - addr.net = eo->net; - port = eo->port; - cb = eo->cb; - }else { -if (msg->msg_namelen <sizeof (struct sockaddr_ec )) { -mutex_unlock (&econet_mutex); -return -EINVAL ; - } - addr.station = saddr->addr.station; - addr.net = saddr->addr.net; - port = saddr->port; - cb = saddr->cb; - } +if (saddr ==NULL || msg->msg_namelen <sizeof (struct sockaddr_ec )) { +mutex_unlock (&econet_mutex); +return -EINVAL ; + } + addr.station = saddr->addr.station; + addr.net = saddr->addr.net; + port = saddr->port; + cb = saddr->cb;/* Look for a device with the right network number. */ dev = net2dev_map[addr.net];
@@ -351,7 +342,6 @@ static int econet_sendmsg(struct kiocb * eb = (struct ec_cb *)&skb->cb; -/* BUG: saddr may be NULL */ eb->cookie = saddr->cookie; eb->sec = *saddr; eb->sent = ec_tx_done;
PATCH 211/223 econet: fix CVE-2010-3850
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Phil Blundell <[email protected]>
commit 16c41745c7b92a243d0874f534c1655196c64b74 upstream.
Add missing check for capable(CAP_NET_ADMIN) in SIOCSIFADDR operation.
--- net/econet/af_econet.c | 3 +++ 1 file changed, 3 insertions(+)
net/econet/af_econet.c +3 -0
@@ -661,6 +661,9 @@ static int ec_dev_ioctl(struct socket *s err =0 ;switch (cmd) {case SIOCSIFADDR : +if (!capable (CAP_NET_ADMIN )) +return -EPERM ; + edev = dev->ec_ptr;if (edev ==NULL ) {/* Magic up a new one. */
PATCH 212/223 econet: fix CVE-2010-3848
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Phil Blundell <[email protected]>
commit a27e13d370415add3487949c60810e36069a23a6 upstream.
Don't declare variable sized array of iovecs on the stack since this could cause stack overflow if msg->msgiovlen is large. Instead, coalesce the user-supplied data into a new buffer and use a single iovec for it.
--- net/econet/af_econet.c | 62 ++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 31 deletions(-)
net/econet/af_econet.c +31 -31
@@ -31,6 +31,7 @@#include <linux/skbuff.h> #include <linux/udp.h> #include <linux/slab.h> +#include <linux/vmalloc.h> #include <net/sock.h> #include <net/inet_common.h> #include <linux/stat.h>
@@ -276,12 +277,12 @@ static int econet_sendmsg(struct kiocb *#endif #ifdef CONFIG_ECONET_AUNUDP struct msghdr udpmsg; -struct iovec iov[msg->msg_iovlen+1 ]; +struct iovec iov[2 ];struct aunhdr ah;struct sockaddr_in udpdest;__kernel_size_t size; -int i;mm_segment_t oldfs; +char *userbuf;#endif /*
@@ -319,17 +320,17 @@ static int econet_sendmsg(struct kiocb * } } -if (len +15 > dev->mtu) { -mutex_unlock (&econet_mutex); -return -EMSGSIZE ; - } -if (dev->type ==ARPHRD_ECONET ) {/* Real hardware Econet. We're not worthy etc. */ #ifdef CONFIG_ECONET_NATIVE unsigned short proto =0 ;int res; +if (len +15 > dev->mtu) { +mutex_unlock (&econet_mutex); +return -EMSGSIZE ; + } +dev_hold (dev); skb = sock_alloc_send_skb(sk, len+LL_ALLOCATED_SPACE(dev),
@@ -405,6 +406,11 @@ static int econet_sendmsg(struct kiocb *return -ENETDOWN ;/* No socket - can't send */ } +if (len >32768 ) { + err = -E2BIG ; + goto error; + } +/* Make up a UDP datagram and hand it off to some higher intellect. */ memset (&udpdest,0 ,sizeof (udpdest));
@@ -436,36 +442,26 @@ static int econet_sendmsg(struct kiocb */* tack our header on the front of the iovec */ size =sizeof (struct aunhdr ); -/* -* XXX: that is b0rken. We can't mix userland and kernel pointers -* in iovec, since on a lot of platforms copy_from_user() will -* *not* work with the kernel and userland ones at the same time, -* regardless of what we do with set_fs(). And we are talking about -* econet-over-ethernet here, so "it's only ARM anyway" doesn't -* apply. Any suggestions on fixing that code? -- AV -*/ iov[0 ].iov_base = (void *)&ah; iov[0 ].iov_len = size; -for (i =0 ; i < msg->msg_iovlen; i++) { -void __user *base = msg->msg_iov[i].iov_base; -size_t iov_len = msg->msg_iov[i].iov_len; -/* Check it now since we switch to KERNEL_DS later. */ -if (!access_ok (VERIFY_READ , base, iov_len)) { -mutex_unlock (&econet_mutex); -return -EFAULT ; - } - iov[i+1 ].iov_base = base; - iov[i+1 ].iov_len = iov_len; - size += iov_len; + + userbuf =vmalloc (len); +if (userbuf ==NULL ) { + err = -ENOMEM ; + goto error; } + iov[1 ].iov_base = userbuf; + iov[1 ].iov_len = len; + err =memcpy_fromiovec (userbuf, msg->msg_iov, len); +if (err) + goto error_free_buf; +/* Get a skbuff (no data, just holds our cb information) */ if ((skb =sock_alloc_send_skb (sk,0 , msg->msg_flags &MSG_DONTWAIT , - &err)) ==NULL ) { -mutex_unlock (&econet_mutex); -return err; - } + &err)) ==NULL ) + goto error_free_buf; eb = (struct ec_cb *)&skb->cb;
@@ -481,7 +477,7 @@ static int econet_sendmsg(struct kiocb * udpmsg.msg_name = (void *)&udpdest; udpmsg.msg_namelen =sizeof (udpdest); udpmsg.msg_iov = &iov[0 ]; - udpmsg.msg_iovlen = msg->msg_iovlen +1 ; + udpmsg.msg_iovlen =2 ; udpmsg.msg_control =NULL ; udpmsg.msg_controllen =0 ; udpmsg.msg_flags=0 ;
@@ -489,9 +485,13 @@ static int econet_sendmsg(struct kiocb * oldfs =get_fs ();set_fs (KERNEL_DS );/* More privs :-) */ err =sock_sendmsg (udpsock, &udpmsg, size);set_fs (oldfs); + +error_free_buf: +vfree (userbuf);#else err = -EPROTOTYPE ;#endif + error:mutex_unlock (&econet_mutex);return err;
PATCH 213/223 rds: Integer overflow in RDS cmsg handling
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Dan Rosenberg <[email protected]>
commit 218854af84038d828a32f061858b1902ed2beec6 upstream.
In rds_cmsg_rdma_args(), the user-provided args->nr_local value is restricted to less than UINT_MAX. This seems to need a tighter upper bound, since the calculation of total iov_size can overflow, resulting in a small sock_kmalloc() allocation. This would probably just result in walking off the heap and crashing when calling rds_rdma_pages() with a high count value. If it somehow doesn't crash here, then memory corruption could occur soon after.
--- net/rds/rdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/rds/rdma.c +1 -1
@@ -474,7 +474,7 @@ static struct rds_rdma_op *rds_rdma_prep goto out; } -if (args->nr_local > (u64 )UINT_MAX ) { +if (args->nr_local >UIO_MAXIOV ) { ret = -EMSGSIZE ; goto out; }
PATCH 214/223 cfg80211: fix extension channel checks to initiate communication
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Luis R. Rodriguez <[email protected]>
commit 9236d838c920e90708570d9bbd7bb82d30a38130 upstream.
When operating in a mode that initiates communication and using HT40 we should fail if we cannot use both primary and secondary channels to initiate communication. Our current ht40 allowmap only covers STA mode of operation, for beaconing modes we need a check on the fly as the mode of operation is dynamic and there other flags other than disable which we should read to check if we can initiate communication.
Do not allow for initiating communication if our secondary HT40 channel has is either disabled, has a passive scan flag, a no-ibss flag or is a radar channel. Userspace now has similar checks but this is also needed in-kernel.
--- net/wireless/chan.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)
net/wireless/chan.c +51 -0
@@ -43,6 +43,36 @@ rdev_freq_to_chan(struct cfg80211_registreturn chan; } +static bool can_beacon_sec_chan (struct wiphy *wiphy, +struct ieee80211_channel *chan, +enum nl80211_channel_type channel_type) +{ +struct ieee80211_channel *sec_chan; +int diff; + +switch (channel_type) { +case NL80211_CHAN_HT40PLUS : + diff =20 ; +case NL80211_CHAN_HT40MINUS : + diff =-20 ; +default : +return false; + } + + sec_chan =ieee80211_get_channel (wiphy, chan->center_freq + diff); +if (!sec_chan) +return false; + +/* we'll need a DFS capability later */ +if (sec_chan->flags & (IEEE80211_CHAN_DISABLED | +IEEE80211_CHAN_PASSIVE_SCAN | +IEEE80211_CHAN_NO_IBSS | +IEEE80211_CHAN_RADAR )) +return false; + +return true; +} +int cfg80211_set_freq (struct cfg80211_registered_device *rdev,struct wireless_dev *wdev,int freq,enum nl80211_channel_type channel_type)
@@ -67,6 +97,27 @@ int cfg80211_set_freq(struct cfg80211_reif (!chan)return -EINVAL ; +/* Both channels should be able to initiate communication */ +if (wdev && (wdev->iftype ==NL80211_IFTYPE_ADHOC || + wdev->iftype ==NL80211_IFTYPE_AP || + wdev->iftype ==NL80211_IFTYPE_AP_VLAN || + wdev->iftype ==NL80211_IFTYPE_MESH_POINT )) { +switch (channel_type) { +case NL80211_CHAN_HT40PLUS : +case NL80211_CHAN_HT40MINUS : +if (!can_beacon_sec_chan (&rdev->wiphy, chan, + channel_type)) { +printk (KERN_DEBUG +"cfg80211: Secondary channel not " +"allowed to initiate communication\n" ); +return -EINVAL ; + } +break ; +default : +break ; + } + } + result = rdev->ops->set_channel (&rdev->wiphy, wdev ? wdev->netdev :NULL , chan, channel_type);
PATCH 215/223 r8169: fix rx checksum offload
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit adea1ac7effbddbe60a9de6d63462bfe79289e59 upstream.
While porting GRO to r8169, I found this driver has a bug in its rx path.
All skbs given to network stack had their ip_summed set to CHECKSUM_NONE, while hardware said they had correct TCP/UDP checksums.
The reason is driver sets skb->ip_summed on the original skb before the copy eventually done by copybreak. The fresh skb gets the ip_summed = CHECKSUM_NONE value, forcing network stack to recompute checksum, and preventing my GRO patch to work.
Fix is to make the ip_summed setting after skb copy.
Note : rx_copybreak current value is 16383, so all frames are copied...
--- drivers/net/r8169.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/r8169.c +2 -4
@@ -4458,9 +4458,8 @@ static inline int rtl8169_fragmented_frareturn (status & (FirstFrag | LastFrag)) != (FirstFrag | LastFrag); } -static inline void rtl8169_rx_csum (struct sk_buff *skb,struct RxDesc *desc) +static inline void rtl8169_rx_csum (struct sk_buff *skb,u32 opts1) { -u32 opts1 =le32_to_cpu (desc->opts1);u32 status = opts1 & RxProtoMask; if (((status == RxProtoTCP) && !(opts1 & TCPFail)) ||
@@ -4554,8 +4553,6 @@ static int rtl8169_rx_interrupt(struct ncontinue ; } -rtl8169_rx_csum (skb, desc); -if (rtl8169_try_rx_copy (&skb, tp, pkt_size, addr)) {pci_dma_sync_single_for_device (pdev, addr, pkt_size,PCI_DMA_FROMDEVICE );
@@ -4566,6 +4563,7 @@ static int rtl8169_rx_interrupt(struct n tp->Rx_skbuff[entry] =NULL ; } +rtl8169_rx_csum (skb, status);skb_put (skb, pkt_size); skb->protocol =eth_type_trans (skb, dev);
PATCH 216/223 r8169: (re)init phy on resume
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Stanislaw Gruszka <[email protected]>
commit fccec10b33503a2b1197c8e7a3abd30443bedb08 upstream.
Fix switching device to low-speed mode after resume reported in:
https://bugzilla.redhat.com/show_bug.cgi?id=502974
--- drivers/net/r8169.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/r8169.c +5 -0
@@ -4893,6 +4893,9 @@ static int rtl8169_resume(struct device {struct pci_dev *pdev =to_pci_dev (device);struct net_device *dev =pci_get_drvdata (pdev); +struct rtl8169_private *tp =netdev_priv (dev); + +rtl8169_init_phy (dev, tp);if (netif_running (dev))__rtl8169_resume (dev);
@@ -4933,6 +4936,8 @@ static int rtl8169_runtime_resume(struct tp->saved_wolopts =0 ;spin_unlock_irq (&tp->lock); +rtl8169_init_phy (dev, tp); +__rtl8169_resume (dev);return 0 ;
PATCH 217/223 r8169: fix checksum broken
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Shan Wei <[email protected]>
commit d5d3ebe3be5c5123f2d444e186717f45284151e2 upstream.
If r8196 received packets with invalid sctp/igmp(not tcp, udp) checksum, r8196 set skb->ip_summed wit CHECKSUM_UNNECESSARY. This cause that upper protocol don't check checksum field.
I am not family with r8196 driver. I try to guess the meaning of RxProtoIP and IPFail. RxProtoIP stands for received IPv4 packet that upper protocol is not tcp and udp. !(opts1 & IPFail) is true means that driver correctly to check checksum in IPv4 header.
If it's right, I think we should not set ip_summed wit CHECKSUM_UNNECESSARY for my sctp packets with invalid checksum.
If it's not right, please tell me.
--- drivers/net/r8169.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/r8169.c +1 -2
@@ -4463,8 +4463,7 @@ static inline void rtl8169_rx_csum(strucu32 status = opts1 & RxProtoMask;if (((status == RxProtoTCP) && !(opts1 & TCPFail)) || - ((status == RxProtoUDP) && !(opts1 & UDPFail)) || - ((status == RxProtoIP) && !(opts1 & IPFail))) + ((status == RxProtoUDP) && !(opts1 & UDPFail))) skb->ip_summed =CHECKSUM_UNNECESSARY ;else skb->ip_summed =CHECKSUM_NONE ;
PATCH 218/223 nmi: fix clock comparator revalidation
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <[email protected]>
commit e8129c642155616d9e2160a75f103e127c8c3708 upstream.
On each machine check all registers are revalidated. The save area for the clock comparator however only contains the upper most seven bytes of the former contents, if valid.
Therefore the machine check handler uses a store clock instruction to get the current time and writes that to the clock comparator register which in turn will generate an immediate timer interrupt. However within the lowcore the expected time of the next timer interrupt is stored. If the interrupt happens before that time the handler won't be called. In turn the clock comparator won't be reprogrammed and therefore the interrupt condition stays pending which causes an interrupt loop until the expected time is reached.
On NOHZ machines this can result in unresponsive machines since the time of the next expected interrupted can be a couple of days in the future.
To fix this just revalidate the clock comparator register with the expected value.
In addition the special handling for udelay must be changed as well.
--- arch/s390/kernel/nmi.c | 10 ++++------ arch/s390/lib/delay.c | 14 +++++++++----- 2 files changed, 13 insertions(+), 11 deletions(-)
arch/s390/kernel/nmi.c +4 -6
@@ -95,7 +95,6 @@ EXPORT_SYMBOL_GPL(s390_handle_mcck); static int notrace s390_revalidate_registers(struct mci *mci) {int kill_task; -u64 tmpclock;u64 zero;void *fpt_save_area, *fpt_creg_save_area;
@@ -214,11 +213,10 @@ static int notrace s390_revalidate_regis : "0", "cc");#endif /* Revalidate clock comparator register */ - asmvolatile ( -" stck 0(%1)\n" -" sckc 0(%1)" - :"=m" (tmpclock) :"a" (&(tmpclock)) :"cc" ,"memory" ); - +if (S390_lowcore.clock_comparator ==-1 ) +set_clock_comparator (S390_lowcore.mcck_clock); +else +set_clock_comparator (S390_lowcore.clock_comparator);/* Check if old PSW is valid */ if (!mci->wp)/*
arch/s390/lib/delay.c +9 -5
@@ -29,17 +29,21 @@ static void __udelay_disabled(unsigned l {unsigned long mask, cr0, cr0_saved;u64 clock_saved; +u64 end; + mask = psw_kernel_bits |PSW_MASK_WAIT |PSW_MASK_EXT ; + end =get_clock () + (usecs <<12 ); clock_saved =local_tick_disable (); -set_clock_comparator (get_clock () + (usecs <<12 ));__ctl_store (cr0_saved,0 ,0 ); cr0 = (cr0_saved &0xffff00e0 ) |0x00000800 ;__ctl_load (cr0 ,0 ,0 ); - mask = psw_kernel_bits |PSW_MASK_WAIT |PSW_MASK_EXT ;lockdep_off (); -trace_hardirqs_on (); -__load_psw_mask (mask); -local_irq_disable (); +do { +set_clock_comparator (end); +trace_hardirqs_on (); +__load_psw_mask (mask); +local_irq_disable (); + }while (get_clock () < end);lockdep_on ();__ctl_load (cr0_saved,0 ,0 );local_tick_enable (clock_saved);
PATCH 219/223 Rename 'pipe_info()' to 'get_pipe_info()'
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit 71993e62a47dabddf10302807d6aa260455503f4 upstream.
.. and change it to take the 'file' pointer instead of an inode, since that's what all users want anyway.
The renaming is preparatory to exporting it to other users. The old 'pipe_info()' name was too generic and is already used elsewhere, so before making the function public we need to use a more specific name.
--- fs/splice.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
fs/splice.c +9 -10
@@ -1328,12 +1328,11 @@ static int splice_pipe_to_pipe(struct pi* location, so checking ->i_pipe is not enough to verify that this is a * pipe. */ -static inline struct pipe_inode_info *pipe_info (struct inode *inode) +static inline struct pipe_inode_info *get_pipe_info (struct file *file) { -if (S_ISFIFO (inode->i_mode)) -return inode->i_pipe; +struct inode *i = file->f_path.dentry->d_inode; -return NULL ; +return S_ISFIFO (i->i_mode) ? i->i_pipe :NULL ; }/*
@@ -1348,8 +1347,8 @@ static long do_splice(struct file *in, lloff_t offset, *off;long ret; - ipipe =pipe_info (in->f_path.dentry->d_inode); - opipe =pipe_info (out->f_path.dentry->d_inode); + ipipe =get_pipe_info (in); + opipe =get_pipe_info (out);if (ipipe && opipe) {if (off_in || off_out)
@@ -1567,7 +1566,7 @@ static long vmsplice_to_user(struct fileint error;long ret; - pipe =pipe_info (file->f_path.dentry->d_inode); + pipe =get_pipe_info (file);if (!pipe)return -EBADF ;
@@ -1654,7 +1653,7 @@ static long vmsplice_to_pipe(struct file };long ret; - pipe =pipe_info (file->f_path.dentry->d_inode); + pipe =get_pipe_info (file);if (!pipe)return -EBADF ;
@@ -2034,8 +2033,8 @@ static int link_pipe(struct pipe_inode_istatic long do_tee (struct file *in,struct file *out,size_t len,unsigned int flags) { -struct pipe_inode_info *ipipe =pipe_info (in->f_path.dentry->d_inode); -struct pipe_inode_info *opipe =pipe_info (out->f_path.dentry->d_inode); +struct pipe_inode_info *ipipe =get_pipe_info (in); +struct pipe_inode_info *opipe =get_pipe_info (out);int ret = -EINVAL ;/*
PATCH 220/223 Export 'get_pipe_info()' to other users
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit c66fb347946ebdd5b10908866ecc9fa05ee2cf3d upstream.
And in particular, use it in 'pipe_fcntl()'.
The other pipe functions do not need to use the 'careful' version, since they are only ever called for things that are already known to be pipes.
The normal read/write/ioctl functions are called through the file operations structures, so if a file isn't a pipe, they'd never get called. But pipe_fcntl() is special, and called directly from the generic fcntl code, and needs to use the same careful function that the splice code is using.
--- fs/pipe.c | 2 +- fs/splice.c | 11 ----------- include/linux/pipe_fs_i.h | 12 ++++++++++++ 3 files changed, 13 insertions(+), 12 deletions(-)
fs/pipe.c +1 -1
@@ -1202,7 +1202,7 @@ long pipe_fcntl(struct file *file, unsigstruct pipe_inode_info *pipe;long ret; - pipe = file->f_path.dentry->d_inode->i_pipe; + pipe =get_pipe_info (file);if (!pipe)return -EBADF ;
fs/splice.c +0 -11
@@ -1323,17 +1323,6 @@ long do_splice_direct(struct file *in, lstatic int splice_pipe_to_pipe (struct pipe_inode_info *ipipe,struct pipe_inode_info *opipe,size_t len,unsigned int flags); -/* -* After the inode slimming patch, i_pipe/i_bdev/i_cdev share the same -* location, so checking ->i_pipe is not enough to verify that this is a -* pipe. -*/ -static inline struct pipe_inode_info *get_pipe_info (struct file *file) -{ -struct inode *i = file->f_path.dentry->d_inode; - -return S_ISFIFO (i->i_mode) ? i->i_pipe :NULL ; -}/* * Determine where to splice to/from.
include/linux/pipe_fs_i.h +12 -0
@@ -161,4 +161,16 @@ void generic_pipe_buf_release(struct pip/* for F_SETPIPE_SZ and F_GETPIPE_SZ */ long pipe_fcntl (struct file *,unsigned int ,unsigned long arg); +/* +* After the inode slimming patch, i_pipe/i_bdev/i_cdev share the same +* location, so checking ->i_pipe is not enough to verify that this is a +* pipe. +*/ +static inline struct pipe_inode_info *get_pipe_info (struct file *file) +{ +struct inode *i = file->f_path.dentry->d_inode; + +return S_ISFIFO (i->i_mode) ? i->i_pipe :NULL ; +} +#endif
PATCH 221/223 Un-inline get_pipe_info() helper function
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit 72083646528d4887b920deb71b37e09bc7d227bb upstream.
This avoids some include-file hell, and the function isn't really important enough to be inlined anyway.
--- fs/pipe.c | 12 ++++++++++++ include/linux/pipe_fs_i.h | 13 +------------ 2 files changed, 13 insertions(+), 12 deletions(-)
fs/pipe.c +12 -0
@@ -1197,6 +1197,18 @@ int pipe_proc_fn(struct ctl_table *tablereturn ret; } +/* +* After the inode slimming patch, i_pipe/i_bdev/i_cdev share the same +* location, so checking ->i_pipe is not enough to verify that this is a +* pipe. +*/ +struct pipe_inode_info *get_pipe_info (struct file *file) +{ +struct inode *i = file->f_path.dentry->d_inode; + +return S_ISFIFO (i->i_mode) ? i->i_pipe :NULL ; +} +long pipe_fcntl (struct file *file,unsigned int cmd,unsigned long arg) {struct pipe_inode_info *pipe;
include/linux/pipe_fs_i.h +1 -12
@@ -160,17 +160,6 @@ void generic_pipe_buf_release(struct pip/* for F_SETPIPE_SZ and F_GETPIPE_SZ */ long pipe_fcntl (struct file *,unsigned int ,unsigned long arg); - -/* -* After the inode slimming patch, i_pipe/i_bdev/i_cdev share the same -* location, so checking ->i_pipe is not enough to verify that this is a -* pipe. -*/ -static inline struct pipe_inode_info *get_pipe_info (struct file *file) -{ -struct inode *i = file->f_path.dentry->d_inode; - -return S_ISFIFO (i->i_mode) ? i->i_pipe :NULL ; -} +struct pipe_inode_info *get_pipe_info (struct file *file);#endif
PATCH 222/223 Fix pktcdvd ioctl dev_minor range check
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Dan Rosenberg <[email protected]>
Upstream 252a52aa4fa22a668f019e55b3aac3ff71ec1c29
The PKT_CTRL_CMD_STATUS device ioctl retrieves a pointer to a pktcdvd_device from the global pkt_devs array. The index into this array is provided directly by the user and is a signed integer, so the comparison to ensure that it falls within the bounds of this array will fail when provided with a negative index.
This can be used to read arbitrary kernel memory or cause a crash due to an invalid pointer dereference. This can be exploited by users with permission to open /dev/pktcdvd/control (on many distributions, this is readable by group "cdrom").
--- drivers/block/pktcdvd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/pktcdvd.c +1 -1
@@ -2368,7 +2368,7 @@ static void pkt_release_dev(struct pktcdpkt_shrink_pktlist (pd); } -static struct pktcdvd_device *pkt_find_dev_from_minor (int dev_minor) +static struct pktcdvd_device *pkt_find_dev_from_minor (unsigned int dev_minor) {if (dev_minor >=MAX_WRITERS )return NULL ;
PATCH 223/223 Bump release to 2.6.35.10
In reply to Andi Kleen2.6.35-longterm review patch. If anyone has any objections, please let me know.
------------------
--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
@@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 6 SUBLEVEL = 35 -EXTRAVERSION = .9 +EXTRAVERSION = .10 NAME = Yokohama # *DOCUMENTATION*
Quoted 8 lines · On Mon, 13 Dec 2010 00:44:54 +0100 (CET) Andi Kleen wrote:
This is the start of the longterm review cycle for the 2.6.35.10 release. There are a large number of patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let us know. If anyone is a maintainer of the proper subsystem, and wants to add a Signed-off-by: line to the patch, please respond with it.
Reponses should be made within 48 hours.
(oh well)
Future 2.6.35.* longterm could use this commit to fix a build error:
commit f35843ed8d17562f7c5da4b34a4a81b0cc450e9e
Author: Thadeu Lima de Souza Cascardo <[email protected]> Date: Wed May 26 12:00:10 2010 -0300
classmate-laptop: depends on RFKILL or RFKILL=n
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***