2.6.36.2-stable review
Subsystems (103)
PATCH 171/289 latencytop: fix per task accumulator
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Ken Chen <[email protected]>
commit 38715258aa2e8cd94bd4aafadc544e5104efd551 upstream.
Per task latencytop accumulator prematurely terminates due to erroneous placement of latency_record_count. It should be incremented whenever a new record is allocated instead of increment on every latencytop event.
Also fix search iterator to only search known record events instead of blindly searching all pre-allocated space.
--- kernel/latencytop.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
kernel/latencytop.c +8 -9
@@ -194,14 +194,7 @@ __account_scheduler_latency(struct task_account_global_scheduler_latency (tsk, &lat); -/* -* short term hack; if we're > 32 we stop; future we recycle: -*/ - tsk->latency_record_count++; -if (tsk->latency_record_count >=LT_SAVECOUNT ) - goto out_unlock; - -for (i =0 ; i <LT_SAVECOUNT ; i++) { +for (i =0 ; i < tsk->latency_record_count; i++) {struct latency_record *mylat;int same =1 ;
@@ -227,8 +220,14 @@ __account_scheduler_latency(struct task_ } } +/* +* short term hack; if we're > 32 we stop; future we recycle: +*/ +if (tsk->latency_record_count >=LT_SAVECOUNT ) + goto out_unlock; +/* Allocated a new one: */ - i = tsk->latency_record_count; + i = tsk->latency_record_count++;memcpy (&tsk->latency_record[i], &lat,sizeof (struct latency_record )); out_unlock:
PATCH 172/289 mm/vfs: revalidate page->mapping in do_generic_file_read()
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Dave Hansen <[email protected]>
commit 8d056cb965b8fb7c53c564abf28b1962d1061cd3 upstream.
70 hours into some stress tests of a 2.6.32-based enterprise kernel, we ran into a NULL dereference in here:
int block_is_partially_uptodate(struct page *page, read_descriptor_t *desc,
unsigned long from)
{
----> struct inode *inode = page->mapping->host;
It looks like page->mapping was the culprit. (xmon trace is below). After closer examination, I realized that do_generic_file_read() does a find_get_page(), and eventually locks the page before calling block_is_partially_uptodate(). However, it doesn't revalidate the page->mapping after the page is locked. So, there's a small window between the find_get_page() and ->is_partially_uptodate() where the page could get truncated and page->mapping cleared.
We _have_ a reference, so it can't get reclaimed, but it certainly can be truncated.
I think the correct thing is to check page->mapping after the trylock_page(), and jump out if it got truncated. This patch has been running in the test environment for a month or so now, and we have not seen this bug pop up again.
xmon info:
1f:mon> e
cpu 0x1f: Vector: 300 (Data Access) at [c0000002ae36f770]
pc: c0000000001e7a6c: .block_is_partially_uptodate+0xc/0x100
lr: c000000000142944: .generic_file_aio_read+0x1e4/0x770
sp: c0000002ae36f9f0
msr: 8000000000009032
dar: 0
dsisr: 40000000
current = 0xc000000378f99e30
paca = 0xc000000000f66300
pid = 21946, comm = bash
1f:mon> r
R00 = 0025c0500000006d R16 = 0000000000000000
R01 = c0000002ae36f9f0 R17 = c000000362cd3af0
R02 = c000000000e8cd80 R18 = ffffffffffffffff
R03 = c0000000031d0f88 R19 = 0000000000000001
R04 = c0000002ae36fa68 R20 = c0000003bb97b8a0
R05 = 0000000000000000 R21 = c0000002ae36fa68
R06 = 0000000000000000 R22 = 0000000000000000
R07 = 0000000000000001 R23 = c0000002ae36fbb0
R08 = 0000000000000002 R24 = 0000000000000000
R09 = 0000000000000000 R25 = c000000362cd3a80
R10 = 0000000000000000 R26 = 0000000000000002
R11 = c0000000001e7b60 R27 = 0000000000000000
R12 = 0000000042000484 R28 = 0000000000000001
R13 = c000000000f66300 R29 = c0000003bb97b9b8
R14 = 0000000000000001 R30 = c000000000e28a08
R15 = 000000000000ffff R31 = c0000000031d0f88
pc = c0000000001e7a6c .block_is_partially_uptodate+0xc/0x100
lr = c000000000142944 .generic_file_aio_read+0x1e4/0x770
msr = 8000000000009032 cr = 22000488
ctr = c0000000001e7a60 xer = 0000000020000000 trap = 300
dar = 0000000000000000 dsisr = 40000000
1f:mon> t
[link register ] c000000000142944 .generic_file_aio_read+0x1e4/0x770
[c0000002ae36f9f0] c000000000142a14 .generic_file_aio_read+0x2b4/0x770 (unreliable)
[c0000002ae36fb40] c0000000001b03e4 .do_sync_read+0xd4/0x160
[c0000002ae36fce0] c0000000001b153c .vfs_read+0xec/0x1f0
[c0000002ae36fd80] c0000000001b1768 .SyS_read+0x58/0xb0
[c0000002ae36fe30] c00000000000852c syscall_exit+0x0/0x40
--- Exception: c00 (System Call) at 00000080a840bc54
SP (fffca15df30) is in userspace
1f:mon> di c0000000001e7a6c
c0000000001e7a6c e9290000 ld r9,0(r9)
c0000000001e7a70 418200c0 beq c0000000001e7b30 # .block_is_partially_uptodate+0xd0/0x100
c0000000001e7a74 e9440008 ld r10,8(r4)
c0000000001e7a78 78a80020 clrldi r8,r5,32
c0000000001e7a7c 3c000001 lis r0,1
c0000000001e7a80 812900a8 lwz r9,168(r9)
c0000000001e7a84 39600001 li r11,1
c0000000001e7a88 7c080050 subf r0,r8,r0
c0000000001e7a8c 7f805040 cmplw cr7,r0,r10
c0000000001e7a90 7d6b4830 slw r11,r11,r9
c0000000001e7a94 796b0020 clrldi r11,r11,32
c0000000001e7a98 419d00a8 bgt cr7,c0000000001e7b40 # .block_is_partially_uptodate+0xe0/0x100
c0000000001e7a9c 7fa55840 cmpld cr7,r5,r11
c0000000001e7aa0 7d004214 add r8,r0,r8
c0000000001e7aa4 79080020 clrldi r8,r8,32
c0000000001e7aa8 419c0078 blt cr7,c0000000001e7b20 # .block_is_partially_uptodate+0xc0/0x100--- mm/filemap.c | 3 +++ 1 file changed, 3 insertions(+)
mm/filemap.c +3 -0
@@ -1010,6 +1010,9 @@ find_page: goto page_not_up_to_date;if (!trylock_page (page)) goto page_not_up_to_date; +/* Did it get truncated before we got the lock? */ +if (!page->mapping) + goto page_not_up_to_date_locked;if (!mapping->a_ops->is_partially_uptodate (page, desc, offset)) goto page_not_up_to_date_locked;
PATCH 173/289 bio: take care not overflow page count when mapping/copying user data
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jens Axboe <[email protected]>
commit cb4644cac4a2797afc847e6c92736664d4b0ea34 upstream.
If the iovec is being set up in a way that causes uaddr + PAGE_SIZE to overflow, we could end up attempting to map a huge number of pages. Check for this invalid input type.
--- fs/bio.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
fs/bio.c +13 -1
@@ -834,6 +834,12 @@ struct bio *bio_copy_user_iov(struct req end = (uaddr + iov[i].iov_len +PAGE_SIZE -1 ) >>PAGE_SHIFT ; start = uaddr >>PAGE_SHIFT ; +/* +* Overflow, abort +*/ +if (end < start) +return ERR_PTR (-EINVAL ); + nr_pages += end - start; len += iov[i].iov_len; }
@@ -962,6 +968,12 @@ static struct bio *__bio_map_user_iov(stunsigned long end = (uaddr + len +PAGE_SIZE -1 ) >>PAGE_SHIFT ;unsigned long start = uaddr >>PAGE_SHIFT ; +/* +* Overflow, abort +*/ +if (end < start) +return ERR_PTR (-EINVAL ); + nr_pages += end - start;/* * buffer must be aligned to at least hardsector size for now
@@ -989,7 +1001,7 @@ static struct bio *__bio_map_user_iov(stunsigned long start = uaddr >>PAGE_SHIFT ;const int local_nr_pages = end - start;const int page_limit = cur_page + local_nr_pages; - + ret =get_user_pages_fast (uaddr, local_nr_pages, write_to_vm, &pages[cur_page]);if (ret < local_nr_pages) {
PATCH 174/289 drm/radeon/kms/atom: set sane defaults in atombios_get_encoder_mode()
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alex Deucher <[email protected]>
commit c7a71fc761551dc8be8543f14a90d08cda4e77f9 upstream.
If there was no connector mapped to the encoder, atombios_get_encoder_mode() returned 0 which is the id for DP. Return something sane instead based on the encoder id. This avoids hitting the DP paths on non-DP encoders.
--- drivers/gpu/drm/radeon/radeon_encoders.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/gpu/drm/radeon/radeon_encoders.c +15 -3
@@ -595,6 +595,7 @@ atombios_digital_setup(struct drm_encodeint atombios_get_encoder_mode (struct drm_encoder *encoder) { +struct radeon_encoder *radeon_encoder =to_radeon_encoder (encoder);struct drm_device *dev = encoder->dev;struct radeon_device *rdev = dev->dev_private;struct drm_connector *connector;
@@ -602,9 +603,20 @@ atombios_get_encoder_mode(struct drm_encstruct radeon_connector_atom_dig *dig_connector; connector =radeon_get_connector_for_encoder (encoder); -if (!connector) -return 0 ; - +if (!connector) { +switch (radeon_encoder->encoder_id) { +case ENCODER_OBJECT_ID_INTERNAL_UNIPHY : +case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1 : +case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2 : +case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA : +case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1 : +return ATOM_ENCODER_MODE_DVI ; +case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1 : +case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2 : +default : +return ATOM_ENCODER_MODE_CRT ; + } + } radeon_connector =to_radeon_connector (connector);switch (connector->connector_type) {
PATCH 175/289 drm/radeon/kms: fix typos in disabled vbios code
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alex Deucher <[email protected]>
commit 0ec80d645661dda50acd417bdfcb33df2e5dd31e upstream.
6xx/7xx was hitting the wrong BUS_CNTL reg and bits.
--- drivers/gpu/drm/radeon/r600_reg.h | 1 + drivers/gpu/drm/radeon/radeon_bios.c | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-)
drivers/gpu/drm/radeon/r600_reg.h +1 -0
@@ -86,6 +86,7 @@#define R600_HDP_NONSURFACE_BASE 0x2c04#define R600_BUS_CNTL 0x5420 +# define R600_BIOS_ROM_DIS (1 << 1)#define R600_CONFIG_CNTL 0x5424#define R600_CONFIG_MEMSIZE 0x5428#define R600_CONFIG_F0_BASE 0x542C
drivers/gpu/drm/radeon/radeon_bios.c +7 -6
@@ -130,6 +130,7 @@ static bool radeon_atrm_get_bios(struct }return true; } +static bool r700_read_disabled_bios (struct radeon_device *rdev) {uint32_t viph_control;
@@ -143,7 +144,7 @@ static bool r700_read_disabled_bios(strubool r; viph_control =RREG32 (RADEON_VIPH_CONTROL ); - bus_cntl =RREG32 (RADEON_BUS_CNTL ); + bus_cntl =RREG32 (R600_BUS_CNTL ); d1vga_control =RREG32 (AVIVO_D1VGA_CONTROL ); d2vga_control =RREG32 (AVIVO_D2VGA_CONTROL ); vga_render_control =RREG32 (AVIVO_VGA_RENDER_CONTROL );
@@ -152,7 +153,7 @@ static bool r700_read_disabled_bios(stru/* disable VIP */ WREG32 (RADEON_VIPH_CONTROL , (viph_control & ~RADEON_VIPH_EN ));/* enable the rom */ -WREG32 (RADEON_BUS_CNTL , (bus_cntl & ~RADEON_BUS_BIOS_DIS_ROM )); +WREG32 (R600_BUS_CNTL , (bus_cntl & ~R600_BIOS_ROM_DIS ));/* Disable VGA mode */ WREG32(AVIVO_D1VGA_CONTROL, (d1vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE |
@@ -191,7 +192,7 @@ static bool r700_read_disabled_bios(stru cg_spll_status =RREG32 (R600_CG_SPLL_STATUS ); }WREG32 (RADEON_VIPH_CONTROL , viph_control); -WREG32 (RADEON_BUS_CNTL , bus_cntl); +WREG32 (R600_BUS_CNTL , bus_cntl);WREG32 (AVIVO_D1VGA_CONTROL , d1vga_control);WREG32 (AVIVO_D2VGA_CONTROL , d2vga_control);WREG32 (AVIVO_VGA_RENDER_CONTROL , vga_render_control);
@@ -216,7 +217,7 @@ static bool r600_read_disabled_bios(strubool r; viph_control =RREG32 (RADEON_VIPH_CONTROL ); - bus_cntl =RREG32 (RADEON_BUS_CNTL ); + bus_cntl =RREG32 (R600_BUS_CNTL ); d1vga_control =RREG32 (AVIVO_D1VGA_CONTROL ); d2vga_control =RREG32 (AVIVO_D2VGA_CONTROL ); vga_render_control =RREG32 (AVIVO_VGA_RENDER_CONTROL );
@@ -231,7 +232,7 @@ static bool r600_read_disabled_bios(stru/* disable VIP */ WREG32 (RADEON_VIPH_CONTROL , (viph_control & ~RADEON_VIPH_EN ));/* enable the rom */ -WREG32 (RADEON_BUS_CNTL , (bus_cntl & ~RADEON_BUS_BIOS_DIS_ROM )); +WREG32 (R600_BUS_CNTL , (bus_cntl & ~R600_BIOS_ROM_DIS ));/* Disable VGA mode */ WREG32(AVIVO_D1VGA_CONTROL, (d1vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE |
@@ -262,7 +263,7 @@ static bool r600_read_disabled_bios(stru/* restore regs */ WREG32 (RADEON_VIPH_CONTROL , viph_control); -WREG32 (RADEON_BUS_CNTL , bus_cntl); +WREG32 (R600_BUS_CNTL , bus_cntl);WREG32 (AVIVO_D1VGA_CONTROL , d1vga_control);WREG32 (AVIVO_D2VGA_CONTROL , d2vga_control);WREG32 (AVIVO_VGA_RENDER_CONTROL , vga_render_control);
PATCH 176/289 drm/radeon/kms: add workaround for dce3 ddc line vbios bug
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alex Deucher <[email protected]>
commit 3074adc8b6d9bf28b574a58241b958057a69a7a0 upstream.
fixes:
https://bugzilla.kernel.org/show_bug.cgi?id=23752
--- drivers/gpu/drm/radeon/radeon_atombios.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/gpu/drm/radeon/radeon_atombios.c +16 -0
@@ -98,6 +98,14 @@ static inline struct radeon_i2c_bus_rec } } +/* some DCE3 boards have bad data for this entry */ +if (ASIC_IS_DCE3 (rdev)) { +if ((i ==4 ) && + (gpio->usClkMaskRegisterIndex ==0x1fda ) && + (gpio->sucI2cId.ucAccess ==0x94 )) + gpio->sucI2cId.ucAccess =0x14 ; + } +if (gpio->sucI2cId.ucAccess == id) { i2c.mask_clk_reg =le16_to_cpu (gpio->usClkMaskRegisterIndex) *4 ; i2c.mask_data_reg =le16_to_cpu (gpio->usDataMaskRegisterIndex) *4 ;
@@ -174,6 +182,14 @@ void radeon_atombios_i2c_init(struct rad } } +/* some DCE3 boards have bad data for this entry */ +if (ASIC_IS_DCE3 (rdev)) { +if ((i ==4 ) && + (gpio->usClkMaskRegisterIndex ==0x1fda ) && + (gpio->sucI2cId.ucAccess ==0x94 )) + gpio->sucI2cId.ucAccess =0x14 ; + } + i2c.mask_clk_reg =le16_to_cpu (gpio->usClkMaskRegisterIndex) *4 ; i2c.mask_data_reg =le16_to_cpu (gpio->usDataMaskRegisterIndex) *4 ; i2c.en_clk_reg =le16_to_cpu (gpio->usClkEnRegisterIndex) *4 ;
PATCH 177/289 drm/radeon/kms: Fix retrying ttm_bo_init() after it failed once.
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <[email protected]>
commit 2b66b50b12cabc05f05543e792d4c9c2465d5702 upstream.
If ttm_bo_init() returns failure, it already destroyed the BO, so we need to retry from scratch.
--- drivers/gpu/drm/radeon/radeon_object.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_object.c +2 -2
@@ -102,6 +102,8 @@ int radeon_bo_create(struct radeon_devic type = ttm_bo_type_device; } *bo_ptr =NULL ; + +retry: bo =kzalloc (sizeof (struct radeon_bo ),GFP_KERNEL );if (bo ==NULL )return -ENOMEM ;
@@ -109,8 +111,6 @@ int radeon_bo_create(struct radeon_devic bo->gobj = gobj; bo->surface_reg =-1 ;INIT_LIST_HEAD (&bo->list); - -retry:radeon_ttm_placement_from_domain (bo, domain);/* Kernel allocation are uninterruptible */ mutex_lock (&rdev->vram_mutex);
PATCH 178/289 drm/radeon/kms: fix thermal sensor reporting on rv6xx
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alex Deucher <[email protected]>
commit b2298fd27127f872881048fd37cb9217a648ae06 upstream.
Temperature is not shifted as on newer asics.
--- drivers/gpu/drm/radeon/r600.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/gpu/drm/radeon/r600.c +1 -7
@@ -97,14 +97,8 @@ u32 rv6xx_get_temp(struct radeon_device {u32 temp = (RREG32 (CG_THERMAL_STATUS ) &ASIC_T_MASK ) >>ASIC_T_SHIFT ; -u32 actual_temp =0 ; -if ((temp >>7 ) &1 ) - actual_temp =0 ; -else - actual_temp = (temp >>1 ) &0xff ; - -return actual_temp *1000 ; +return temp *1000 ; }void r600_pm_get_dynpm_state (struct radeon_device *rdev)
PATCH 179/289 drm/radeon/kms: fix i2c pad masks on rs4xx
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alex Deucher <[email protected]>
commit be66305718bee9927e6acc6b75618ce3cd745718 upstream.
These got lost in the last i2c cleanup. Fixes:
https://bugzilla.kernel.org/show_bug.cgi?id=23222
--- drivers/gpu/drm/radeon/radeon_combios.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/gpu/drm/radeon/radeon_combios.c +13 -0
@@ -571,6 +571,7 @@ static struct radeon_i2c_bus_rec combios }if (clk_mask && data_mask) { +/* system specific masks */ i2c.mask_clk_mask = clk_mask; i2c.mask_data_mask = data_mask; i2c.a_clk_mask = clk_mask;
@@ -579,7 +580,19 @@ static struct radeon_i2c_bus_rec combios i2c.en_data_mask = data_mask; i2c.y_clk_mask = clk_mask; i2c.y_data_mask = data_mask; + }else if ((ddc_line ==RADEON_GPIOPAD_MASK ) || + (ddc_line ==RADEON_MDGPIO_MASK )) { +/* default gpiopad masks */ + i2c.mask_clk_mask = (0x20 <<8 ); + i2c.mask_data_mask =0x80 ; + i2c.a_clk_mask = (0x20 <<8 ); + i2c.a_data_mask =0x80 ; + i2c.en_clk_mask = (0x20 <<8 ); + i2c.en_data_mask =0x80 ; + i2c.y_clk_mask = (0x20 <<8 ); + i2c.y_data_mask =0x80 ; }else { +/* default masks for ddc pads */ i2c.mask_clk_mask =RADEON_GPIO_EN_1 ; i2c.mask_data_mask =RADEON_GPIO_EN_0 ; i2c.a_clk_mask =RADEON_GPIO_A_1 ;
PATCH 180/289 drm/radeon/kms: fix resume regression for some r5xx laptops
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alex Deucher <[email protected]>
commit f24d86f1a49505cdea56728b853a5d0a3f8e3d11 upstream.
I had removed this when I switched the atom indirect io methods to use the io bar rather than the mmio bar, but it appears it's still needed.
--- drivers/gpu/drm/radeon/atom.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/radeon/atom.c +1 -0
@@ -112,6 +112,7 @@ static uint32_t atom_iio_execute(struct base +=3 ;break ;case ATOM_IIO_WRITE : + (void )ctx->card->ioreg_read (ctx->card,CU16 (base +1 )); ctx->card->ioreg_write (ctx->card,CU16 (base +1 ), temp); base +=3 ;break ;
PATCH 181/289 drm/radeon/kms: fix regression in rs4xx i2c setup
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alex Deucher <[email protected]>
commit 791cfe2684a74ed7155254816ff9e89e6064277c upstream.
typo in my last i2c rework.
Fixes:
https://bugzilla.kernel.org/show_bug.cgi?id=23222
--- drivers/gpu/drm/radeon/radeon_combios.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/radeon_combios.c +1 -1
@@ -729,7 +729,7 @@ void radeon_combios_i2c_init(struct rade clk =RBIOS8 (offset +3 + (i *5 ) +3 ); data =RBIOS8 (offset +3 + (i *5 ) +4 ); i2c =combios_setup_i2c_bus (rdev,DDC_MONID , - clk, data); + (1 << clk), (1 << data)); rdev->i2c_bus[4 ] =radeon_i2c_create (dev, &i2c,"GPIOPAD_MASK" );break ; }
PATCH 182/289 drm/radeon/kms: fix interlaced and doublescan handling
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alex Deucher <[email protected]>
commit c49948f4bd39e27dd06a1cdb0c3743ca2a734f5e upstream.
--- drivers/gpu/drm/radeon/radeon_connectors.c | 34 +++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
drivers/gpu/drm/radeon/radeon_connectors.c +34 -0
@@ -1119,6 +1119,8 @@ radeon_add_atom_connector(struct drm_dev/* no HPD on analog connectors */ radeon_connector->hpd.hpd =RADEON_HPD_NONE ; connector->polled =DRM_CONNECTOR_POLL_CONNECT ; + connector->interlace_allowed = true; + connector->doublescan_allowed = true;break ;case DRM_MODE_CONNECTOR_DVIA :drm_connector_init (dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type);
@@ -1134,6 +1136,8 @@ radeon_add_atom_connector(struct drm_dev 1);/* no HPD on analog connectors */ radeon_connector->hpd.hpd =RADEON_HPD_NONE ; + connector->interlace_allowed = true; + connector->doublescan_allowed = true;break ;case DRM_MODE_CONNECTOR_DVII :case DRM_MODE_CONNECTOR_DVID :
@@ -1163,6 +1167,11 @@ radeon_add_atom_connector(struct drm_dev rdev->mode_info.load_detect_property, 1); } + connector->interlace_allowed = true; +if (connector_type ==DRM_MODE_CONNECTOR_DVII ) + connector->doublescan_allowed = true; +else + connector->doublescan_allowed = false;break ;case DRM_MODE_CONNECTOR_HDMIA :case DRM_MODE_CONNECTOR_HDMIB :
@@ -1186,6 +1195,11 @@ radeon_add_atom_connector(struct drm_dev rdev->mode_info.underscan_property, UNDERSCAN_AUTO); subpixel_order = SubPixelHorizontalRGB; + connector->interlace_allowed = true; +if (connector_type ==DRM_MODE_CONNECTOR_HDMIB ) + connector->doublescan_allowed = true; +else + connector->doublescan_allowed = false;break ;case DRM_MODE_CONNECTOR_DisplayPort:case DRM_MODE_CONNECTOR_eDP:
@@ -1216,6 +1230,9 @@ radeon_add_atom_connector(struct drm_devdrm_connector_attach_property (&radeon_connector->base, rdev->mode_info.underscan_property,UNDERSCAN_AUTO ); + connector->interlace_allowed = true; +/* in theory with a DP to VGA converter... */ + connector->doublescan_allowed = false;break ;case DRM_MODE_CONNECTOR_SVIDEO :case DRM_MODE_CONNECTOR_Composite:
@@ -1231,6 +1248,8 @@ radeon_add_atom_connector(struct drm_dev radeon_atombios_get_tv_info(rdev));/* no HPD on analog connectors */ radeon_connector->hpd.hpd =RADEON_HPD_NONE ; + connector->interlace_allowed = false; + connector->doublescan_allowed = false;break ;case DRM_MODE_CONNECTOR_LVDS : radeon_dig_connector =kzalloc (sizeof (struct radeon_connector_atom_dig ),GFP_KERNEL );
@@ -1249,6 +1268,8 @@ radeon_add_atom_connector(struct drm_dev dev->mode_config.scaling_mode_property, DRM_MODE_SCALE_FULLSCREEN); subpixel_order = SubPixelHorizontalRGB; + connector->interlace_allowed = false; + connector->doublescan_allowed = false;break ; }
@@ -1326,6 +1347,8 @@ radeon_add_legacy_connector(struct drm_d/* no HPD on analog connectors */ radeon_connector->hpd.hpd =RADEON_HPD_NONE ; connector->polled =DRM_CONNECTOR_POLL_CONNECT ; + connector->interlace_allowed = true; + connector->doublescan_allowed = true;break ;case DRM_MODE_CONNECTOR_DVIA :drm_connector_init (dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type);
@@ -1341,6 +1364,8 @@ radeon_add_legacy_connector(struct drm_d 1);/* no HPD on analog connectors */ radeon_connector->hpd.hpd =RADEON_HPD_NONE ; + connector->interlace_allowed = true; + connector->doublescan_allowed = true;break ;case DRM_MODE_CONNECTOR_DVII :case DRM_MODE_CONNECTOR_DVID :
@@ -1358,6 +1383,11 @@ radeon_add_legacy_connector(struct drm_d 1); } subpixel_order = SubPixelHorizontalRGB; + connector->interlace_allowed = true; +if (connector_type ==DRM_MODE_CONNECTOR_DVII ) + connector->doublescan_allowed = true; +else + connector->doublescan_allowed = false;break ;case DRM_MODE_CONNECTOR_SVIDEO :case DRM_MODE_CONNECTOR_Composite:
@@ -1380,6 +1410,8 @@ radeon_add_legacy_connector(struct drm_d radeon_combios_get_tv_info(rdev));/* no HPD on analog connectors */ radeon_connector->hpd.hpd =RADEON_HPD_NONE ; + connector->interlace_allowed = false; + connector->doublescan_allowed = false;break ;case DRM_MODE_CONNECTOR_LVDS :drm_connector_init (dev, &radeon_connector->base, &radeon_lvds_connector_funcs, connector_type);
@@ -1393,6 +1425,8 @@ radeon_add_legacy_connector(struct drm_d dev->mode_config.scaling_mode_property, DRM_MODE_SCALE_FULLSCREEN); subpixel_order = SubPixelHorizontalRGB; + connector->interlace_allowed = false; + connector->doublescan_allowed = false;break ; }
PATCH 183/289 exec: make argv/envp memory visible to oom-killer
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Oleg Nesterov <[email protected]>
commit 3c77f845722158206a7209c45ccddc264d19319c upstream.
Brad Spengler published a local memory-allocation DoS that evades the OOM-killer (though not the virtual memory RLIMIT):
http://www.grsecurity.net/~spender/64bit_dos.c
execve()->copy_strings() can allocate a lot of memory, but this is not visible to oom-killer, nobody can see the nascent bprm->mm and take it into account.
With this patch get_arg_page() increments current's MM_ANONPAGES counter every time we allocate the new page for argv/envp. When do_execve() succeds or fails, we change this counter back.
Technically this is not 100% correct, we can't know if the new page is swapped out and turn MM_ANONPAGES into MM_SWAPENTS, but I don't think this really matters and everything becomes correct once exec changes ->mm or fails.
--- fs/exec.c | 32 ++++++++++++++++++++++++++++++-- include/linux/binfmts.h | 1 + 2 files changed, 31 insertions(+), 2 deletions(-)
fs/exec.c +30 -2
@@ -157,6 +157,25 @@ out:#ifdef CONFIG_MMU +static void acct_arg_size (struct linux_binprm *bprm,unsigned long pages) +{ +struct mm_struct *mm = current->mm; +long diff = (long )(pages - bprm->vma_pages); + +if (!mm || !diff) +return ; + + bprm->vma_pages = pages; + +#ifdef SPLIT_RSS_COUNTING +add_mm_counter (mm,MM_ANONPAGES , diff); +#else +spin_lock (&mm->page_table_lock); +add_mm_counter (mm,MM_ANONPAGES , diff); +spin_unlock (&mm->page_table_lock); +#endif +} +static struct page *get_arg_page (struct linux_binprm *bprm,unsigned long pos,int write) {
@@ -179,6 +198,8 @@ static struct page *get_arg_page(structunsigned long size = bprm->vma->vm_end - bprm->vma->vm_start;struct rlimit *rlim; +acct_arg_size (bprm, size /PAGE_SIZE ); +/* * We've historically supported up to 32 pages (ARG_MAX) * of argument strings even with small stacks
@@ -269,6 +290,10 @@ static bool valid_arg_len(struct linux_b#else +static inline void acct_arg_size (struct linux_binprm *bprm,unsigned long pages) +{ +} +static struct page *get_arg_page (struct linux_binprm *bprm,unsigned long pos,int write) {
@@ -992,6 +1017,7 @@ int flush_old_exec(struct linux_binprm */* * Release all of the old mmap stuff */ +acct_arg_size (bprm,0 ); retval =exec_mmap (bprm->mm);if (retval) goto out;
@@ -1416,8 +1442,10 @@ int do_execve(const char * filename,return retval; out: -if (bprm->mm) -mmput (bprm->mm); +if (bprm->mm) { +acct_arg_size (bprm,0 ); +mmput (bprm->mm); + } out_file:if (bprm->file) {
include/linux/binfmts.h +1 -0
@@ -29,6 +29,7 @@ struct linux_binprm{char buf[BINPRM_BUF_SIZE ];#ifdef CONFIG_MMU struct vm_area_struct *vma; +unsigned long vma_pages;#else # define MAX_ARG_PAGES 32struct page *page[MAX_ARG_PAGES ];
PATCH 184/289 exec: copy-and-paste the fixes into compat_do_execve() paths
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Oleg Nesterov <[email protected]>
commit 114279be2120a916e8a04feeb2ac976a10016f2f upstream.
Note: this patch targets 2.6.37 and tries to be as simple as possible. That is why it adds more copy-and-paste horror into fs/compat.c and uglifies fs/exec.c, this will be cleanuped later.
compat_copy_strings() plays with bprm->vma/mm directly and thus has two problems: it lacks the RLIMIT_STACK check and argv/envp memory is not visible to oom killer.
Export acct_arg_size() and get_arg_page(), change compat_copy_strings() to use get_arg_page(), change compat_do_execve() to do acct_arg_size(0) as do_execve() does.
Add the fatal_signal_pending/cond_resched checks into compat_count() and compat_copy_strings(), this matches the code in fs/exec.c and certainly makes sense.
--- fs/compat.c | 28 +++++++++++++++------------- fs/exec.c | 8 ++++---- include/linux/binfmts.h | 4 ++++ 3 files changed, 23 insertions(+), 17 deletions(-)
fs/compat.c +15 -13
@@ -1378,6 +1378,10 @@ static int compat_count(compat_uptr_t __ argv++;if (i++ >= max)return -E2BIG ; + +if (fatal_signal_pending (current)) +return -ERESTARTNOHAND ; +cond_resched (); } }return i;
@@ -1419,6 +1423,12 @@ static int compat_copy_strings(int argc,while (len >0 ) {int offset, bytes_to_copy; +if (fatal_signal_pending (current)) { + ret = -ERESTARTNOHAND ; + goto out; + } +cond_resched (); + offset = pos %PAGE_SIZE ;if (offset ==0 ) offset =PAGE_SIZE ;
@@ -1435,18 +1445,8 @@ static int compat_copy_strings(int argc,if (!kmapped_page || kpos != (pos &PAGE_MASK )) {struct page *page; -#ifdef CONFIG_STACK_GROWSUP - ret =expand_stack_downwards (bprm->vma, pos); -if (ret <0 ) { -/* We've exceed the stack rlimit. */ - ret = -E2BIG ; - goto out; - } -#endif - ret =get_user_pages (current, bprm->mm, pos, -1 ,1 ,1 , &page,NULL ); -if (ret <=0 ) { -/* We've exceed the stack rlimit. */ + page =get_arg_page (bprm, pos,1 ); +if (!page) { ret = -E2BIG ; goto out; }
@@ -1567,8 +1567,10 @@ int compat_do_execve(char * filename,return retval; out: -if (bprm->mm) +if (bprm->mm) { +acct_arg_size (bprm,0 );mmput (bprm->mm); + } out_file:if (bprm->file) {
fs/exec.c +4 -4
@@ -157,7 +157,7 @@ out:#ifdef CONFIG_MMU -static void acct_arg_size (struct linux_binprm *bprm,unsigned long pages) +void acct_arg_size (struct linux_binprm *bprm,unsigned long pages) {struct mm_struct *mm = current->mm;long diff = (long )(pages - bprm->vma_pages);
@@ -176,7 +176,7 @@ static void acct_arg_size(struct linux_b#endif } -static struct page *get_arg_page (struct linux_binprm *bprm,unsigned long pos, +struct page *get_arg_page (struct linux_binprm *bprm,unsigned long pos,int write) {struct page *page;
@@ -290,11 +290,11 @@ static bool valid_arg_len(struct linux_b#else -static inline void acct_arg_size (struct linux_binprm *bprm,unsigned long pages) +void acct_arg_size (struct linux_binprm *bprm,unsigned long pages) { } -static struct page *get_arg_page (struct linux_binprm *bprm,unsigned long pos, +struct page *get_arg_page (struct linux_binprm *bprm,unsigned long pos,int write) {struct page *page;
include/linux/binfmts.h +4 -0
@@ -60,6 +60,10 @@ struct linux_binprm{unsigned long loader, exec; }; +extern void acct_arg_size (struct linux_binprm *bprm,unsigned long pages); +extern struct page *get_arg_page (struct linux_binprm *bprm,unsigned long pos, +int write); +#define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0#define BINPRM_FLAGS_ENFORCE_NONDUMP (1 << BINPRM_FLAGS_ENFORCE_NONDUMP_BIT)
PATCH 185/289 drm/i915/sdvo: Always add a 30ms delay to make SDVO TV detection reliable
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Chris Wilson <[email protected]>
commit ba84cd1f2b5dd49bda9300c5a11373f7e14c3c66 upstream.
Commit d09c23de intended to add a 30ms delay to give the ADD time to detect any TVs connected. However, it used the sdvo->is_tv flag to do so which is dependent upon the previous detection result and not whether the output supports TVs.
--- drivers/gpu/drm/i915/intel_sdvo.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_sdvo.c +5 -3
@@ -1498,10 +1498,12 @@ intel_sdvo_detect(struct drm_connector *if (!intel_sdvo_write_cmd (intel_sdvo,SDVO_CMD_GET_ATTACHED_DISPLAYS ,NULL ,0 ))return connector_status_unknown; -if (intel_sdvo->is_tv) { -/* add 30ms delay when the output type is SDVO-TV */ + +/* add 30ms delay when the output type might be TV */ +if (intel_sdvo->caps.output_flags & + (SDVO_OUTPUT_SVID0 |SDVO_OUTPUT_CVBS0 ))mdelay (30 ); - } +if (!intel_sdvo_read_response (intel_sdvo, &response,2 ))return connector_status_unknown;
PATCH 186/289 i915: reprogram power monitoring registers on resume
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Kyle McMartin <[email protected]>
commit 48fcfc888b48ad49dd83faa107264bbfb0089cad upstream.
Fixes issue where i915_gfx_val was reporting values several orders of magnitude higher than physically possible (without leaving scorch marks on my thighs at least.)
--- drivers/gpu/drm/i915/i915_suspend.c | 4 +++- drivers/gpu/drm/i915/intel_drv.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_suspend.c +3 -1
@@ -862,8 +862,10 @@ int i915_restore_state(struct drm_device/* Clock gating state */ intel_init_clock_gating (dev); -if (HAS_PCH_SPLIT (dev)) +if (HAS_PCH_SPLIT (dev)) {ironlake_enable_drps (dev); +intel_init_emon (dev); + }/* Cache mode state */ I915_WRITE (CACHE_MODE_0 , dev_priv->saveCACHE_MODE_0 |0xffff0000 );
drivers/gpu/drm/i915/intel_drv.h +1 -0
@@ -250,6 +250,7 @@ extern void intel_crtc_fb_gamma_get(struextern void intel_init_clock_gating (struct drm_device *dev);extern void ironlake_enable_drps (struct drm_device *dev);extern void ironlake_disable_drps (struct drm_device *dev); +extern void intel_init_emon (struct drm_device *dev);extern int intel_pin_and_fence_fb_obj (struct drm_device *dev,struct drm_gem_object *obj);
PATCH 187/289 intel-gtt: fix gtt_total_entries detection
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Daniel Vetter <[email protected]>
commit e5e408fc94595aab897f613b6f4e2f5b36870a6f upstream.
In commit f1befe71 Chris Wilson added some code to clear the full gtt on g33/pineview instead of just the mappable part. The code looks like it was copy-pasted from agp/intel-gtt.c, at least an identical piece of code is still there (in intel_i830_init_gtt_entries). This lead to a regression in 2.6.35 which was supposedly fixed in commit e7b96f28
Now this commit makes absolutely no sense to me. It seems to be slightly confused about chipset generations - it references docs for 4th gen but the regression concerns 3rd gen g33. Luckily the the g33 gmch docs are available with the GMCH Graphics Control pci config register definitions. The other (bigger problem) is that the new check in there uses the i830 stolen mem bits (.5M, 1M or 8M of stolen mem). They are different since the i855GM.
The most likely case is that it hits the 512M fallback, which was probably the right thing for the boxes this was tested on.
So the original approach by Chris Wilson seems to be wrong and the current code is definitely wrong. There is a third approach by Jesse Barnes from his RFC patch "Who wants a bigger GTT mapping range?" where he simply shoves g33 in the same clause like later chipset generations.
I've asked him and Jesse confirmed that this should work. So implement it.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=16891$
--- drivers/char/agp/intel-gtt.c | 63 ++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 36 deletions(-)
drivers/char/agp/intel-gtt.c +27 -36
@@ -534,7 +534,7 @@ static void intel_i830_init_gtt_entries(pci_read_config_word (agp_bridge->dev,I830_GMCH_CTRL , &gmch_ctrl); -if (IS_I965 ) { +if (IS_G33 ||IS_I965 ) {u32 pgetbl_ctl; pgetbl_ctl =readl (intel_private.registers+I810_PGETBL_CTL );
@@ -567,22 +567,6 @@ static void intel_i830_init_gtt_entries( size =512 ; } size +=4 ;/* add in BIOS popup space */ - }else if (IS_G33 && !IS_PINEVIEW ) { -/* G33's GTT size defined in gmch_ctrl */ -switch (gmch_ctrl &G33_PGETBL_SIZE_MASK ) { -case G33_PGETBL_SIZE_1M : - size =1024 ; -break ; -case G33_PGETBL_SIZE_2M : - size =2048 ; -break ; -default : -dev_info (&agp_bridge->dev->dev, -"unknown page table size 0x%x, assuming 512KB\n" , - (gmch_ctrl &G33_PGETBL_SIZE_MASK )); - size =512 ; - } - size +=4 ; }else if (IS_G4X ||IS_PINEVIEW ) {/* On 4 series hardware, GTT stolen is separate from graphics * stolen, ignore it in stolen gtt entries counting. However,
@@ -1257,24 +1241,31 @@ static int intel_i915_get_gtt_size(void)int size;if (IS_G33 ) { -u16 gmch_ctrl; +u32 pgetbl_ctl; + pgetbl_ctl =readl (intel_private.registers+I810_PGETBL_CTL ); -/* G33's GTT size defined in gmch_ctrl */ -pci_read_config_word (agp_bridge->dev,I830_GMCH_CTRL , &gmch_ctrl); -switch (gmch_ctrl &I830_GMCH_GMS_MASK ) { -case I830_GMCH_GMS_STOLEN_512 : +switch (pgetbl_ctl &I965_PGETBL_SIZE_MASK ) { +case I965_PGETBL_SIZE_128KB : + size =128 ; +break ; +case I965_PGETBL_SIZE_256KB : + size =256 ; +break ; +case I965_PGETBL_SIZE_512KB : size =512 ;break ; -case I830_GMCH_GMS_STOLEN_1024 : +case I965_PGETBL_SIZE_1MB : size =1024 ;break ; -case I830_GMCH_GMS_STOLEN_8192 : - size =8 *1024 ; +case I965_PGETBL_SIZE_2MB : + size =2048 ; +break ; +case I965_PGETBL_SIZE_1_5MB : + size =1024 +512 ;break ;default : -dev_info (&agp_bridge->dev->dev, -"unknown page table size 0x%x, assuming 512KB\n" , - (gmch_ctrl &I830_GMCH_GMS_MASK )); +dev_info (&intel_private.pcidev->dev, +"unknown page table size, assuming 512KB\n" ); size =512 ; } }else {
@@ -1306,14 +1297,6 @@ static int intel_i915_create_gatt_table(pci_read_config_dword (intel_private.pcidev,I915_MMADDR , &temp);pci_read_config_dword (intel_private.pcidev,I915_PTEADDR , &temp2); - gtt_map_size =intel_i915_get_gtt_size (); - - intel_private.gtt =ioremap (temp2, gtt_map_size); -if (!intel_private.gtt) -return -ENOMEM ; - - intel_private.gtt_total_size = gtt_map_size /4 ; - temp &=0xfff80000 ; intel_private.registers =ioremap (temp,128 *4096 );
@@ -1322,6 +1305,14 @@ static int intel_i915_create_gatt_table(return -ENOMEM ; } + gtt_map_size =intel_i915_get_gtt_size (); + + intel_private.gtt =ioremap (temp2, gtt_map_size); +if (!intel_private.gtt) +return -ENOMEM ; + + intel_private.gtt_total_size = gtt_map_size /4 ; + temp =readl (intel_private.registers+I810_PGETBL_CTL ) &0xfffff000 ;global_cache_flush ();/* FIXME: ? */
PATCH 188/289 sched: fix RCU lockdep splat from task_group()
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Peter Zijlstra <[email protected]>
commit 6506cf6ce68d78a5470a8360c965dafe8e4b78e3 upstream.
This addresses the following RCU lockdep splat:
[0.051203] CPU0: AMD QEMU Virtual CPU version 0.12.4 stepping 03
[0.052999] lockdep: fixing up alternatives.
[0.054105]
[0.054106] ===================================================
[0.054999] [ INFO: suspicious rcu_dereference_check() usage. ]
[0.054999] ---------------------------------------------------
[0.054999] kernel/sched.c:616 invoked rcu_dereference_check() without protection!
[0.054999]
[0.054999] other info that might help us debug this:
[0.054999]
[0.054999]
[0.054999] rcu_scheduler_active = 1, debug_locks = 1
[0.054999] 3 locks held by swapper/1:
[0.054999] #0: (cpu_add_remove_lock){+.+.+.}, at: [<ffffffff814be933>] cpu_up+0x42/0x6a
[0.054999] #1: (cpu_hotplug.lock){+.+.+.}, at: [<ffffffff810400d8>] cpu_hotplug_begin+0x2a/0x51
[0.054999] #2: (&rq->lock){-.-...}, at: [<ffffffff814be2f7>] init_idle+0x2f/0x113
[0.054999]
[0.054999] stack backtrace:
[0.054999] Pid: 1, comm: swapper Not tainted 2.6.35 #1
[0.054999] Call Trace:
[0.054999] [<ffffffff81068054>] lockdep_rcu_dereference+0x9b/0xa3
[0.054999] [<ffffffff810325c3>] task_group+0x7b/0x8a
[0.054999] [<ffffffff810325e5>] set_task_rq+0x13/0x40
[0.054999] [<ffffffff814be39a>] init_idle+0xd2/0x113
[0.054999] [<ffffffff814be78a>] fork_idle+0xb8/0xc7
[0.054999] [<ffffffff81068717>] ? mark_held_locks+0x4d/0x6b
[0.054999] [<ffffffff814bcebd>] do_fork_idle+0x17/0x2b
[0.054999] [<ffffffff814bc89b>] native_cpu_up+0x1c1/0x724
[0.054999] [<ffffffff814bcea6>] ? do_fork_idle+0x0/0x2b
[0.054999] [<ffffffff814be876>] _cpu_up+0xac/0x127
[0.054999] [<ffffffff814be946>] cpu_up+0x55/0x6a
[0.054999] [<ffffffff81ab562a>] kernel_init+0xe1/0x1ff
[0.054999] [<ffffffff81003854>] kernel_thread_helper+0x4/0x10
[0.054999] [<ffffffff814c353c>] ? restore_args+0x0/0x30
[0.054999] [<ffffffff81ab5549>] ? kernel_init+0x0/0x1ff
[0.054999] [<ffffffff81003850>] ? kernel_thread_helper+0x0/0x10
[0.056074] Booting Node 0, Processors #1lockdep: fixing up alternatives.
[0.130045] #2lockdep: fixing up alternatives.
[0.203089] #3 Ok.
[0.275286] Brought up 4 CPUs
[0.276005] Total of 4 processors activated (16017.17 BogoMIPS).The cgroup_subsys_state structures referenced by idle tasks are never freed, because the idle tasks should be part of the root cgroup, which is not removable.
The problem is that while we do in-fact hold rq->lock, the newly spawned idle thread's cpu is not yet set to the correct cpu so the lockdep check in task_group():
lockdep_is_held(&task_rq(p)->lock)
will fail.
But this is a chicken and egg problem. Setting the CPU's runqueue requires that the CPU's runqueue already be set. ;-)
So insert an RCU read-side critical section to avoid the complaint.
--- kernel/sched.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
kernel/sched.c +12 -0
@@ -5330,7 +5330,19 @@ void __cpuinit init_idle(struct task_str idle->se.exec_start =sched_clock ();cpumask_copy (&idle->cpus_allowed,cpumask_of (cpu)); +/* +* We're having a chicken and egg problem, even though we are +* holding rq->lock, the cpu isn't yet set to this cpu so the +* lockdep check in task_group() will fail. +* +* Similar case to sched_fork(). / Alternatively we could +* use task_rq_lock() here and obtain the other rq->lock. +* +* Silence PROVE_RCU +*/ +rcu_read_lock ();__set_task_cpu (idle, cpu); +rcu_read_unlock (); rq->curr = rq->idle = idle;#if defined(CONFIG_SMP ) && defined(__ARCH_WANT_UNLOCKED_CTXSW)
PATCH 189/289 libata: fix NULL sdev dereference race in atapi_qc_complete()
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Tejun Heo <[email protected]>
commit 2a5f07b5ec098edc69e05fdd2f35d3fbb1235723 upstream.
SCSI commands may be issued between __scsi_add_device() and dev->sdev assignment, so it's unsafe for ata_qc_complete() to dereference dev->sdev->locked without checking whether it's NULL or not. Fix it.
--- drivers/ata/libata-scsi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/ata/libata-scsi.c +4 -1
@@ -2577,8 +2577,11 @@ static void atapi_qc_complete(struct ata* * If door lock fails, always clear sdev->locked to * avoid this infinite loop. +* +* This may happen before SCSI scan is complete. Make +* sure qc->dev->sdev isn't NULL before dereferencing. */ -if (qc->cdb[0 ] ==ALLOW_MEDIUM_REMOVAL ) +if (qc->cdb[0 ] ==ALLOW_MEDIUM_REMOVAL && qc->dev->sdev) qc->dev->sdev->locked =0 ; qc->scsicmd->result =SAM_STAT_CHECK_CONDITION ;
PATCH 190/289 PCI: fix size checks for mmap() on /proc/bus/pci files
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Martin Wilck <[email protected]>
commit 3b519e4ea618b6943a82931630872907f9ac2c2b upstream.
The checks for valid mmaps of PCI resources made through /proc/bus/pci files that were introduced in 9eff02e2042f96fb2aedd02e032eca1c5333d767 have several problems:
1. mmap() calls on /proc/bus/pci files are made with real file offsets > 0, whereas under /sys/bus/pci/devices, the start of the resource corresponds to offset 0. This may lead to false negatives in pci_mmap_fits(), which implicitly assumes the /sys/bus/pci/devices layout.
2. The loop in proc_bus_pci_mmap doesn't skip empty resouces. This leads to false positives, because pci_mmap_fits() doesn't treat empty resources correctly (the calculated size is 1 << (8*sizeof(resource_size_t)-PAGE_SHIFT) in this case!).
3. If a user maps resources with BAR > 0, pci_mmap_fits will emit bogus WARNINGS for the first resources that don't fit until the correct one is found.
On many controllers the first 2-4 BARs are used, and the others are empty. In this case, an mmap attempt will first fail on the non-empty BARs (including the "right" BAR because of 1.) and emit bogus WARNINGS because of 3., and finally succeed on the first empty BAR because of 2. This is certainly not the intended behaviour.
This patch addresses all 3 issues.
Updated with an enum type for the additional parameter for pci_mmap_fits().
--- drivers/pci/pci-sysfs.c | 22 ++++++++++++++++------ drivers/pci/pci.h | 7 ++++++- drivers/pci/proc.c | 2 +- 3 files changed, 23 insertions(+), 8 deletions(-)
drivers/pci/pci-sysfs.c +16 -6
@@ -705,17 +705,21 @@ void pci_remove_legacy_files(struct pci_#ifdef HAVE_PCI_MMAP -int pci_mmap_fits (struct pci_dev *pdev,int resno,struct vm_area_struct *vma) +int pci_mmap_fits (struct pci_dev *pdev,int resno,struct vm_area_struct *vma, +enum pci_mmap_api mmap_api) { -unsigned long nr, start, size; +unsigned long nr, start, size, pci_start; +if (pci_resource_len (pdev, resno) ==0 ) +return 0 ; nr = (vma->vm_end - vma->vm_start) >>PAGE_SHIFT ; start = vma->vm_pgoff; size = ((pci_resource_len (pdev, resno) -1 ) >>PAGE_SHIFT ) +1 ; -if (start < size && size - start >= nr) + pci_start = (mmap_api ==PCI_MMAP_SYSFS ) ? +pci_resource_start (pdev, resno) >>PAGE_SHIFT :0 ; +if (start >= pci_start && start < pci_start + size && + start + nr <= pci_start + size)return 1 ; -WARN (1 ,"process \"%s\" tried to map 0x%08lx-0x%08lx on %s BAR %d (size 0x%08lx)\n" , - current->comm, start, start+nr,pci_name (pdev), resno, size);return 0 ; }
@@ -745,8 +749,14 @@ pci_mmap_resource(struct kobject *kobj,if (i >=PCI_ROM_RESOURCE )return -ENODEV ; -if (!pci_mmap_fits (pdev, i, vma)) +if (!pci_mmap_fits (pdev, i, vma,PCI_MMAP_SYSFS )) { +WARN (1 ,"process \"%s\" tried to map 0x%08lx bytes " +"at page 0x%08lx on %s BAR %d (start 0x%16Lx, size 0x%16Lx)\n" , + current->comm, vma->vm_end-vma->vm_start, vma->vm_pgoff, +pci_name (pdev), i, +pci_resource_start (pdev, i),pci_resource_len (pdev, i));return -EINVAL ; + }/* pci_mmap_page_range() expects the same kind of entry as coming * from /proc/bus/pci/ which is a "user visible" value. If this is
drivers/pci/pci.h +6 -1
@@ -22,8 +22,13 @@ extern void pci_remove_firmware_label_fi#endif extern void pci_cleanup_rom (struct pci_dev *dev);#ifdef HAVE_PCI_MMAP +enum pci_mmap_api { +PCI_MMAP_SYSFS ,/* mmap on /sys/bus/pci/devices/<BDF>/resource<N> */ +PCI_MMAP_PROCFS /* mmap on /proc/bus/pci/<BDF> */ +};extern int pci_mmap_fits (struct pci_dev *pdev,int resno, -struct vm_area_struct *vma); +struct vm_area_struct *vmai, +enum pci_mmap_api mmap_api);#endif int pci_probe_reset_function (struct pci_dev *dev);
drivers/pci/proc.c +1 -1
@@ -260,7 +260,7 @@ static int proc_bus_pci_mmap(struct file/* Make sure the caller is mapping a real resource for this device */ for (i =0 ; i <PCI_ROM_RESOURCE ; i++) { -if (pci_mmap_fits (dev, i, vma)) +if (pci_mmap_fits (dev, i, vma,PCI_MMAP_PROCFS ))break ; }
PATCH 191/289 PCI: fix offset check for sysfs mmapped files
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Darrick J. Wong <[email protected]>
commit 8c05cd08a7504b855c265263e84af61aabafa329 upstream.
I just loaded 2.6.37-rc2 on my machines, and I noticed that X no longer starts. Running an strace of the X server shows that it's doing this:
open("/sys/bus/pci/devices/0000:07:00.0/resource0", O_RDWR) = 10mmap(NULL, 16777216, PROT_READ|PROT_WRITE, MAP_SHARED, 10, 0) = -1 EINVAL (Invalid argument)
This code seems to be asking for a shared read/write mapping of 16MB worth of BAR0 starting at file offset 0, and letting the kernel assign a starting address. Unfortunately, this -EINVAL causes X not to start. Looking into dmesg, there's a complaint like so:
process "Xorg" tried to map 0x01000000 bytes at page 0x00000000 on 0000:07:00.0 BAR 0 (start 0x 96000000, size 0x 1000000)
...with the following code in pci_mmap_fits:
pci_start = (mmap_api == PCI_MMAP_SYSFS) ?
pci_resource_start(pdev, resno) >> PAGE_SHIFT : 0;
if (start >= pci_start && start < pci_start + size &&
start + nr <= pci_start + size)It looks like the logic here is set up such that when the mmap call comes via sysfs, the check in pci_mmap_fits wants vma->vm_pgoff to be between the resource's start and end address, and the end of the vma to be no farther than the end. However, the sysfs PCI resource files always start at offset zero, which means that this test always fails for programs that mmap the sysfs files. Given the comment in the original commit 3b519e4ea618b6943a82931630872907f9ac2c2b, I _think_ the old procfs files require that the file offset be equal to the resource's base address when mmapping.
I think what we want here is for pci_start to be 0 when mmap_api == PCI_MMAP_PROCFS. The following patch makes that change, after which the Matrox and Mach64 X drivers work again.
--- drivers/pci/pci-sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pci-sysfs.c +1 -1
@@ -715,7 +715,7 @@ int pci_mmap_fits(struct pci_dev *pdev, nr = (vma->vm_end - vma->vm_start) >>PAGE_SHIFT ; start = vma->vm_pgoff; size = ((pci_resource_len (pdev, resno) -1 ) >>PAGE_SHIFT ) +1 ; - pci_start = (mmap_api ==PCI_MMAP_SYSFS ) ? + pci_start = (mmap_api ==PCI_MMAP_PROCFS ) ?pci_resource_start (pdev, resno) >>PAGE_SHIFT :0 ;if (start >= pci_start && start < pci_start + size && start + nr <= pci_start + size)
PATCH 192/289 xhci: Remove excessive printks with shared IRQs.
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Sarah Sharp <[email protected]>
commit 241b652f1995de138106afd2f2e4eda9f8a3c240 upstream.
If the xHCI host controller shares an interrupt line with another device, the xHCI driver needs to check if the interrupt was generated by its hardware. Unfortunately, the user will see a ton of "Spurious interrupt." lines if the other hardware interrupts often. Lawrence found his dmesg output cluttered with this output when the xHCI host shared an interrupt with his i915 hardware.
Remove the warning, as sharing an interrupt is a normal thing.
This should be applied to the 2.6.36 stable tree.
--- drivers/usb/host/xhci-ring.c | 1 - 1 file changed, 1 deletion(-)
drivers/usb/host/xhci-ring.c +0 -1
@@ -2028,7 +2028,6 @@ irqreturn_t xhci_irq(struct usb_hcd *hcdif (!(status &STS_EINT )) {spin_unlock (&xhci->lock); -xhci_warn (xhci,"Spurious interrupt.\n" );return IRQ_NONE ; }xhci_dbg (xhci,"op reg status = %08x\n" , status);
PATCH 193/289 xHCI: fix wMaxPacketSize mask
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Andiry Xu <[email protected]>
commit dc07c91b9b4067022210e68d914a6890a4d70622 upstream.
USB2.0 spec 9.6.6 says: For all endpoints, bit 10..0 specify the maximum packet size(in bytes).
So the wMaxPacketSize mask should be 0x7ff rather than 0x3ff.
This patch should be queued for the stable tree. The bug in xhci_endpoint_init() was present as far back as 2.6.31, and the bug in xhci_get_max_esit_payload() was present when the function was introduced in 2.6.34.
--- drivers/usb/host/xhci-mem.c | 4 ++-- drivers/usb/host/xhci.h | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-)
drivers/usb/host/xhci-mem.c +2 -2
@@ -1043,7 +1043,7 @@ static inline u32 xhci_get_max_esit_paylif (udev->speed ==USB_SPEED_SUPER )return ep->ss_ep_comp.wBytesPerInterval; - max_packet = ep->desc.wMaxPacketSize &0x3ff ; + max_packet =GET_MAX_PACKET (ep->desc.wMaxPacketSize); max_burst = (ep->desc.wMaxPacketSize &0x1800 ) >>11 ;/* A 0 in max burst means 1 transfer per ESIT */ return max_packet * (max_burst +1 );
@@ -1133,7 +1133,7 @@ int xhci_endpoint_init(struct xhci_hcd */* Fall through */ case USB_SPEED_FULL :case USB_SPEED_LOW : - max_packet = ep->desc.wMaxPacketSize &0x3ff ; + max_packet =GET_MAX_PACKET (ep->desc.wMaxPacketSize); ep_ctx->ep_info2 |=MAX_PACKET (max_packet);break ;default :
drivers/usb/host/xhci.h +5 -0
@@ -614,6 +614,11 @@ struct xhci_ep_ctx {#define MAX_PACKET_MASK (0xffff << 16)#define MAX_PACKET_DECODED (p) (((p) >> 16) & 0xffff) +/* Get max packet size from ep desc. Bit 10..0 specify the max packet size. +* USB2.0 spec 9.6.6. +*/ +#define GET_MAX_PACKET (p) ((p) & 0x7ff) +/* tx_info bitmasks */ #define AVG_TRB_LENGTH_FOR_EP (p) ((p) & 0xffff)#define MAX_ESIT_PAYLOAD_FOR_EP (p) (((p) & 0xffff) << 16)
PATCH 194/289 xhci: Fix reset-device and configure-endpoint commands
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Paul Zimmerman <[email protected]>
commit 7a3783efffc7bc2e702d774e47fad5b8e37e9ad1 upstream.
We have been having problems with the USB-IF Gold Tree tests when plugging and unplugging devices from the tree. I have seen that the reset-device and configure-endpoint commands, which are invoked from xhci_discover_or_reset_device() and xhci_configure_endpoint(), will sometimes time out.
After much debugging, I determined that the commands themselves do not actually time out, but rather their completion events do not get delivered to the right place.
This happens when the command ring has just wrapped around, and it's enqueue pointer is left pointing to the link TRB. xhci_discover_or_reset_device() and xhci_configure_endpoint() use the enqueue pointer directly as their command TRB pointer, without checking whether it's pointing to the link TRB.
When the completion event arrives, if the command TRB is pointing to the link TRB, the check against the command ring dequeue pointer in handle_cmd_in_cmd_wait_list() fails, so the completion inside the command does not get signaled.
The patch below fixes the timeout problem for me.
This should be queued for the 2.6.35 and 2.6.36 stable trees.
--- drivers/usb/host/xhci.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/usb/host/xhci.c +18 -0
@@ -1284,6 +1284,15 @@ static int xhci_configure_endpoint(struc cmd_completion = command->completion; cmd_status = &command->status; command->command_trb = xhci->cmd_ring->enqueue; + +/* Enqueue pointer can be left pointing to the link TRB, +* we must handle that +*/ +if ((command->command_trb->link.control &TRB_TYPE_BITMASK ) + ==TRB_TYPE (TRB_LINK )) + command->command_trb = + xhci->cmd_ring->enq_seg->next->trbs; +list_add_tail (&command->cmd_list, &virt_dev->cmd_list); }else { in_ctx = virt_dev->in_ctx;
@@ -1993,6 +2002,15 @@ int xhci_reset_device(struct usb_hcd *hc/* Attempt to submit the Reset Device command to the command ring */ spin_lock_irqsave (&xhci->lock, flags); reset_device_cmd->command_trb = xhci->cmd_ring->enqueue; + +/* Enqueue pointer can be left pointing to the link TRB, +* we must handle that +*/ +if ((reset_device_cmd->command_trb->link.control &TRB_TYPE_BITMASK ) + ==TRB_TYPE (TRB_LINK )) + reset_device_cmd->command_trb = + xhci->cmd_ring->enq_seg->next->trbs; +list_add_tail (&reset_device_cmd->cmd_list, &virt_dev->cmd_list); ret =xhci_queue_reset_device (xhci, slot_id);if (ret) {
PATCH 195/289 xhci: Setup array of USB 2.0 and USB 3.0 ports.
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Sarah Sharp <[email protected]>
commit da6699ce4a889c3795624ccdcfe7181cc89f18e8 upstream.
An xHCI host controller contains USB 2.0 and USB 3.0 ports, which can occur in any order in the PORTSC registers. We cannot read the port speed bits in the PORTSC registers at init time to determine the port speed, since those bits are only valid when a USB device is plugged into the port.
Instead, we read the "Supported Protocol Capability" registers in the xHC Extended Capabilities space. Those describe the protocol, port offset in the PORTSC registers, and port count. We use those registers to create two arrays of pointers to the PORTSC registers, one for USB 3.0 ports, and another for USB 2.0 ports. A third array keeps track of the port protocol major revision, and is indexed with the internal xHCI port number.
This commit is a bit big, but it should be queued for stable because the "Don't let the USB core disable SuperSpeed ports" patch depends on it. There is no other way to determine which ports are SuperSpeed ports without this patch.
--- drivers/usb/host/xhci-mem.c | 164 ++++++++++++++++++++++++++++++++++++++++++++ drivers/usb/host/xhci.h | 27 +++++++ 2 files changed, 191 insertions(+)
drivers/usb/host/xhci-mem.c +164 -0
@@ -1441,6 +1441,13 @@ void xhci_mem_cleanup(struct xhci_hcd *x xhci->dcbaa =NULL ;scratchpad_free (xhci); + + xhci->num_usb2_ports =0 ; + xhci->num_usb3_ports =0 ; +kfree (xhci->usb2_ports); +kfree (xhci->usb3_ports); +kfree (xhci->port_array); + xhci->page_size =0 ; xhci->page_shift =0 ; }
@@ -1624,6 +1631,161 @@ static void xhci_set_hc_event_deq(struct &xhci->ir_set->erst_dequeue); } +static void xhci_add_in_port (struct xhci_hcd *xhci,unsigned int num_ports, +u32 __iomem *addr,u8 major_revision) +{ +u32 temp, port_offset, port_count; +int i; + +if (major_revision >0x03 ) { +xhci_warn (xhci,"Ignoring unknown port speed, " +"Ext Cap %p, revision = 0x%x\n" , + addr, major_revision); +/* Ignoring port protocol we can't understand. FIXME */ +return ; + } + +/* Port offset and count in the third dword, see section 7.2 */ + temp =xhci_readl (xhci, addr +2 ); + port_offset =XHCI_EXT_PORT_OFF (temp); + port_count =XHCI_EXT_PORT_COUNT (temp); +xhci_dbg (xhci,"Ext Cap %p, port offset = %u, " +"count = %u, revision = 0x%x\n" , + addr, port_offset, port_count, major_revision); +/* Port count includes the current port offset */ +if (port_offset ==0 || (port_offset + port_count -1 ) > num_ports) +/* WTF? "Valid values are ‘1’ to MaxPorts" */ +return ; + port_offset--; +for (i = port_offset; i < (port_offset + port_count); i++) { +/* Duplicate entry. Ignore the port if the revisions differ. */ +if (xhci->port_array[i] !=0 ) { +xhci_warn (xhci,"Duplicate port entry, Ext Cap %p," +" port %u\n" , addr, i); +xhci_warn (xhci,"Port was marked as USB %u, " +"duplicated as USB %u\n" , + xhci->port_array[i], major_revision); +/* Only adjust the roothub port counts if we haven't +* found a similar duplicate. +*/ +if (xhci->port_array[i] != major_revision && + xhci->port_array[i] != (u8) -1 ) { +if (xhci->port_array[i] ==0x03 ) + xhci->num_usb3_ports--; +else + xhci->num_usb2_ports--; + xhci->port_array[i] = (u8) -1 ; + } +/* FIXME: Should we disable the port? */ + } + xhci->port_array[i] = major_revision; +if (major_revision ==0x03 ) + xhci->num_usb3_ports++; +else + xhci->num_usb2_ports++; + } +/* FIXME: Should we disable ports not in the Extended Capabilities? */ +} + +/* +* Scan the Extended Capabilities for the "Supported Protocol Capabilities" that +* specify what speeds each port is supposed to be. We can't count on the port +* speed bits in the PORTSC register being correct until a device is connected, +* but we need to set up the two fake roothubs with the correct number of USB +* 3.0 and USB 2.0 ports at host controller initialization time. +*/ +static int xhci_setup_port_arrays (struct xhci_hcd *xhci,gfp_t flags) +{ +u32 __iomem *addr; +u32 offset; +unsigned int num_ports; +int i, port_index; + + addr = &xhci->cap_regs->hcc_params; + offset =XHCI_HCC_EXT_CAPS (xhci_readl (xhci, addr)); +if (offset ==0 ) { +xhci_err (xhci,"No Extended Capability registers, " +"unable to set up roothub.\n" ); +return -ENODEV ; + } + + num_ports =HCS_MAX_PORTS (xhci->hcs_params1); + xhci->port_array =kzalloc (sizeof (*xhci->port_array)*num_ports, flags); +if (!xhci->port_array) +return -ENOMEM ; + +/* +* For whatever reason, the first capability offset is from the +* capability register base, not from the HCCPARAMS register. +* See section 5.3.6 for offset calculation. +*/ + addr = &xhci->cap_regs->hc_capbase + offset; +while (1 ) { +u32 cap_id; + + cap_id =xhci_readl (xhci, addr); +if (XHCI_EXT_CAPS_ID (cap_id) ==XHCI_EXT_CAPS_PROTOCOL ) +xhci_add_in_port (xhci, num_ports, addr, + (u8 )XHCI_EXT_PORT_MAJOR (cap_id)); + offset =XHCI_EXT_CAPS_NEXT (cap_id); +if (!offset || (xhci->num_usb2_ports + xhci->num_usb3_ports) + == num_ports) +break ; +/* +* Once you're into the Extended Capabilities, the offset is +* always relative to the register holding the offset. +*/ + addr += offset; + } + +if (xhci->num_usb2_ports ==0 && xhci->num_usb3_ports ==0 ) { +xhci_warn (xhci,"No ports on the roothubs?\n" ); +return -ENODEV ; + } +xhci_dbg (xhci,"Found %u USB 2.0 ports and %u USB 3.0 ports.\n" , + xhci->num_usb2_ports, xhci->num_usb3_ports); +/* +* Note we could have all USB 3.0 ports, or all USB 2.0 ports. +* Not sure how the USB core will handle a hub with no ports... +*/ +if (xhci->num_usb2_ports) { + xhci->usb2_ports =kmalloc (sizeof (*xhci->usb2_ports)* + xhci->num_usb2_ports, flags); +if (!xhci->usb2_ports) +return -ENOMEM ; + + port_index =0 ; +for (i =0 ; i < num_ports; i++) +if (xhci->port_array[i] !=0x03 ) { + xhci->usb2_ports[port_index] = + &xhci->op_regs->port_status_base + +NUM_PORT_REGS *i; +xhci_dbg (xhci,"USB 2.0 port at index %u, " +"addr = %p\n" , i, + xhci->usb2_ports[port_index]); + port_index++; + } + } +if (xhci->num_usb3_ports) { + xhci->usb3_ports =kmalloc (sizeof (*xhci->usb3_ports)* + xhci->num_usb3_ports, flags); +if (!xhci->usb3_ports) +return -ENOMEM ; + + port_index =0 ; +for (i =0 ; i < num_ports; i++) +if (xhci->port_array[i] ==0x03 ) { + xhci->usb3_ports[port_index] = + &xhci->op_regs->port_status_base + +NUM_PORT_REGS *i; +xhci_dbg (xhci,"USB 3.0 port at index %u, " +"addr = %p\n" , i, + xhci->usb3_ports[port_index]); + port_index++; + } + } +return 0 ; +}int xhci_mem_init (struct xhci_hcd *xhci,gfp_t flags) {
@@ -1804,6 +1966,8 @@ int xhci_mem_init(struct xhci_hcd *xhci,if (scratchpad_alloc (xhci, flags)) goto fail; +if (xhci_setup_port_arrays (xhci, flags)) + goto fail;return 0 ;
drivers/usb/host/xhci.h +27 -0
@@ -448,6 +448,24 @@ struct xhci_doorbell_array {/** +* struct xhci_protocol_caps +* @revision: major revision, minor revision, capability ID, +* and next capability pointer. +* @name_string: Four ASCII characters to say which spec this xHC +* follows, typically "USB ". +* @port_info: Port offset, count, and protocol-defined information. +*/ +struct xhci_protocol_caps { +u32 revision; +u32 name_string; +u32 port_info; +}; + +#define XHCI_EXT_PORT_MAJOR (x) (((x) >> 24) & 0xff) +#define XHCI_EXT_PORT_OFF (x) ((x) & 0xff) +#define XHCI_EXT_PORT_COUNT (x) (((x) >> 8) & 0xff) + +/** * struct xhci_container_ctx * @type: Type of context. Used to calculated offsets to contained contexts. * @size: Size of the context data
@@ -1204,6 +1222,15 @@ struct xhci_hcd {#define XHCI_LINK_TRB_QUIRK (1 << 0)#define XHCI_RESET_EP_QUIRK (1 << 1)#define XHCI_NEC_HOST (1 << 2) + +/* Is each xHCI roothub port a USB 3.0, USB 2.0, or USB 1.1 port? */ +u8 *port_array; +/* Array of pointers to USB 3.0 PORTSC registers */ +u32 __iomem **usb3_ports; +unsigned int num_usb3_ports; +/* Array of pointers to USB 2.0 PORTSC registers */ +u32 __iomem **usb2_ports; +unsigned int num_usb2_ports; };/* For testing purposes */
PATCH 196/289 xhci: Dont let the USB core disable SuperSpeed ports.
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Sarah Sharp <[email protected]>
commit 6dd0a3a7e0793dbeae1b951f091025d8cf896cb4 upstream.
Disabling SuperSpeed ports is a Very Bad Thing (TM). It disables SuperSpeed terminations, which means that devices will never connect at SuperSpeed on that port. For USB 2.0/1.1 ports, disabling the port meant that the USB core could always get a connect status change later. That's not true with USB 3.0 ports.
Do not let the USB core disable SuperSpeed ports. We can't rely on the device speed in the port status registers, since that isn't valid until there's a USB device connected to the port. Instead, we use the port speed array that's created from the Extended Capabilities registers.
--- drivers/usb/host/xhci-hub.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/usb/host/xhci-hub.c +7 -0
@@ -132,6 +132,13 @@ static u32 xhci_port_state_to_neutral(u3static void xhci_disable_port (struct xhci_hcd *xhci,u16 wIndex,u32 __iomem *addr,u32 port_status) { +/* Don't allow the USB core to disable SuperSpeed ports. */ +if (xhci->port_array[wIndex] ==0x03 ) { +xhci_dbg (xhci,"Ignoring request to disable " +"SuperSpeed port.\n" ); +return ; + } +/* Write 1 to disable the port */ xhci_writel (xhci, port_status |PORT_PE , addr); port_status =xhci_readl (xhci, addr);
PATCH 197/289 USB: gadget: AT91: fix typo in atmel_usba_udc driver
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Josh Wu <[email protected]>
commit b48809518631880207796b4aab0fc39c2f036754 upstream.
compile fix for bug introduced by 969affff547027)
--- drivers/usb/gadget/atmel_usba_udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/atmel_usba_udc.c +1 -1
@@ -2016,7 +2016,7 @@ static int __init usba_udc_probe(struct } }else {/* gpio_request fail so use -EINVAL for gpio_is_valid */ - ubc->vbus_pin = -EINVAL ; + udc->vbus_pin = -EINVAL ; } }
PATCH 198/289 usb: musb: fix kernel oops when loading musb_hdrc module for the 2nd time
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Ming Lei <[email protected]>
commit b212091474a5f967979e62c5c24687ee4d0342d9 upstream.
musb driver still may write MUSB_DEVCTL register after clock is disabled in musb_platform_exit, which may cause the kernel oops[1] when musb_hdrc module is loaded for the 2nd time.
The patch fixes the kernel oops in this case.
[1] kernel oops when loading musb_hdrc module for the 2nd time
[ 93.380279] musb_hdrc: version 6.0, musb-dma, otg (peripheral+host), debug=5 [ 93.387847] bus: 'platform': add driver musb_hdrc [ 93.388153] bus: 'platform': driver_probe_device: matched device musb_hdrc with driver musb_hdrc [ 93.388183] bus: 'platform': really_probe: probing driver musb_hdrc with device musb_hdrc [ 93.405090] HS USB OTG: revision 0x33, sysconfig 0x2010, sysstatus 0x1, intrfsel 0x1, simenable 0x0 [ 93.405364] musb_hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, bulk combine, bulk split, HB-ISO Rx, HB-ISO Tx, SoftConn) [ 93.405395] musb_hdrc: MHDRC RTL version 1.400 [ 93.405426] musb_hdrc: setup fifo_mode 3 [ 93.405456] musb_hdrc: 7/31 max ep, 3648/16384 memory [ 93.405487] musb_core_init 1524: musb_hdrc: hw_ep 0shared, max 64 [ 93.405487] musb_core_init 1524: musb_hdrc: hw_ep 1tx, doublebuffer, max 512 [ 93.405517] musb_core_init 1533: musb_hdrc: hw_ep 1rx, doublebuffer, max 512 [ 93.405548] musb_core_init 1524: musb_hdrc: hw_ep 2tx, max 512 [ 93.405578] musb_core_init 1533: musb_hdrc: hw_ep 2rx, max 512 [ 93.405578] musb_core_init 1524: musb_hdrc: hw_ep 3shared, max 256 [ 93.405609] musb_core_init 1524: musb_hdrc: hw_ep 4shared, max 256 [ 93.405853] musb_platform_try_idle 133: b_idle inactive, for idle timer for 7 ms [ 93.405944] device: 'gadget': device_add [ 93.406921] PM: Adding info for No Bus:gadget [ 93.406951] musb_init_controller 2136: OTG mode, status 0, dev80 [ 93.407379] musb_do_idle 51: musb_do_idle: state=1 [ 93.408233] musb_hdrc musb_hdrc: USB OTG mode controller at fa0ab000 using DMA, IRQ 92 [ 93.416656] driver: 'musb_hdrc': driver_bound: bound to device 'musb_hdrc' [ 93.416687] bus: 'platform': really_probe: bound device musb_hdrc to driver musb_hdrc [ 124.486938] bus: 'platform': remove driver musb_hdrc [ 124.490509] twl4030_usb twl4030_usb: twl4030_phy_suspend [ 124.491424] device: 'gadget': device_unregister [ 124.491424] PM: Removing info for No Bus:gadget [ 124.495269] gadget: musb_gadget_release [ 124.498992] driver: 'musb_hdrc': driver_release [ 129.569366] musb_hdrc: version 6.0, musb-dma, otg (peripheral+host), debug=5 [ 129.576934] bus: 'platform': add driver musb_hdrc [ 129.577209] bus: 'platform': driver_probe_device: matched device musb_hdrc with driver musb_hdrc [ 129.577239] bus: 'platform': really_probe: probing driver musb_hdrc with device musb_hdrc [ 129.592651] twl4030_usb twl4030_usb: twl4030_phy_resume [ 129.592681] Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa0ab404 [ 129.600830] Internal error: : 1028 [#1] [ 129.604858] last sysfs file: /sys/devices/platform/i2c_omap.3/i2c-3/i2c-dev/i2c-3/dev [ 129.613067] Modules linked in: musb_hdrc(+) [last unloaded: musb_hdrc] [ 129.619964] CPU: 0 Not tainted (2.6.36-next-20101021+ #372) [ 129.626281] PC is at musb_platform_init+0xb0/0x1c8 [musb_hdrc] [ 129.632415] LR is at mark_held_locks+0x64/0x94 [ 129.637084] pc : [<bf032198>] lr : [<c00ad7c4>] psr: 20000013 [ 129.637084] sp : c6d5fcb0 ip : c6d5fc38 fp : c6d5fcd4 [ 129.649139] r10: c6e72180 r9 : fa0ab000 r8 : c05612e8 [ 129.654602] r7 : 0000005c r6 : c0559cc8 r5 : c6e72180 r4 : c0561548 [ 129.661468] r3 : 04d60047 r2 : fa0ab000 r1 : c07169d8 r0 : 00000000 [ 129.668304] Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user [ 129.675811] Control: 10c5387d Table: 86e4c019 DAC: 00000015 [ 129.681823] Process insmod (pid: 554, stack limit = 0xc6d5e2f0) [ 129.688049] Stack: (0xc6d5fcb0 to 0xc6d60000) [ 129.692626] fca0: fa0ab000 c0555c54 c6d5fcd4 c0561548 [ 129.701202] fcc0: 00000003 c05612e0 c6d5fe04 c6d5fcd8 bf03140c bf0320f4 c6d5fd9c c6d5fce8 [ 129.709808] fce0: c015cb94 c041448c c06d9d10 ffffffff c6d5fd14 c6d5fd00 c00adbec c6d5fd40 [ 129.718383] fd00: c015d478 c6d5fdb0 c6d5fd24 c00a9d18 c6d5e000 60000013 bf02a4ac c05612bc [ 129.726989] fd20: c0414fb4 c00a9cf0 c6d5fd54 c6d5fd38 c015bbdc c0244280 c6e8b7b0 c7929330 [ 129.735565] fd40: c6d5fdb0 c6d5fdb0 c6d5fd7c c6e7227c c015c010 c015bb90 c015c2ac c6d5fdb0 [ 129.744171] fd60: c7929330 c6d5fdb0 c7929330 c6e8b7b0 c6d5fd9c 00000000 c7929330 c6e8b7b0 [ 129.752746] fd80: c6d5fdb0 00000000 00000001 00000000 c6d5fde4 c6d5fda0 c015d478 c015cb74 [ 129.761322] fda0: c056138c 00000000 c6d5fdcc c6d5fdb8 c7929330 00000000 c056138c c05612e8 [ 129.769927] fdc0: 00000000 c05612f0 c0c5d62c c06f6e00 c73217c0 00000000 c6d5fdf4 c05612e8 [ 129.778503] fde0: c05612e8 bf02a2e4 c0c5d62c c06f6e00 c73217c0 00000000 c6d5fe14 c6d5fe08 [ 129.787109] fe00: c029a398 bf0311c8 c6d5fe4c c6d5fe18 c0299120 c029a384 c7919140 22222222 [ 129.795684] fe20: c6d5fe4c c05612e8 c056131c bf02a2e4 c0299278 c06f6e00 c73217c0 00000000 [ 129.804290] fe40: c6d5fe6c c6d5fe50 c0299314 c0299020 00000000 c6d5fe70 bf02a2e4 c0299278 [ 129.812866] fe60: c6d5fe94 c6d5fe70 c02987d4 c0299284 c7825060 c78c6618 00000000 bf02a2e4 [ 129.821441] fe80: c06e4c98 00000000 c6d5fea4 c6d5fe98 c0298ea4 c0298778 c6d5fedc c6d5fea8 [ 129.830047] fea0: c0297f84 c0298e8c bf02716c 000b9008 bf02a2e4 bf02a2d0 000b9008 bf02a2e4 [ 129.838623] fec0: 00000000 c06f6e00 bf031000 00000000 c6d5fefc c6d5fee0 c0299614 c0297ec0 [ 129.847229] fee0: bf02a2d0 000b9008 bf02a388 00000000 c6d5ff0c c6d5ff00 c029a868 c02995a8 [ 129.855804] ff00: c6d5ff24 c6d5ff10 c029a88c c029a818 0010281c 000b9008 c6d5ff34 c6d5ff28 [ 129.864410] ff20: bf03104c c029a878 c6d5ff7c c6d5ff38 c00463dc bf03100c 00000000 00000000 [ 129.872985] ff40: 00000000 0010281c 000b9008 bf02a388 00000000 0010281c 000b9008 bf02a388 [ 129.881591] ff60: 00000000 c00521c8 c6d5e000 00000000 c6d5ffa4 c6d5ff80 c00bb9b8 c00463ac [ 129.890167] ff80: c00adc88 c00ada68 00097e8e bebbfcf4 0010281c 00000080 00000000 c6d5ffa8 [ 129.898742] ffa0: c0052000 c00bb908 00097e8e bebbfcf4 402c9008 0010281c 000b9008 bebbfe5a [ 129.907348] ffc0: 00097e8e bebbfcf4 0010281c 00000080 00000014 bebbfcf4 bebbfe06 0000005b [ 129.915924] ffe0: bebbf9a0 bebbf990 0001a108 40263ec0 60000010 402c9008 011b0000 0000007c [ 129.924499] Backtrace: [ 129.927185] [<bf0320e8>] (musb_platform_init+0x0/0x1c8 [musb_hdrc]) from [<bf03140c>] (musb_probe+0x250/0xf2c [musb_hdrc]) [ 129.938781] r6:c05612e0 r5:00000003 r4:c0561548 [ 129.943695] [<bf0311bc>] (musb_probe+0x0/0xf2c [musb_hdrc]) from [<c029a398>] (platform_drv_probe+0x20/0x24) [ 129.954040] [<c029a378>] (platform_drv_probe+0x0/0x24) from [<c0299120>] (driver_probe_device+0x10c/0x264) [ 129.964172] [<c0299014>] (driver_probe_device+0x0/0x264) from [<c0299314>] (__driver_attach+0x9c/0xa0) [ 129.973968] [<c0299278>] (__driver_attach+0x0/0xa0) from [<c02987d4>] (bus_for_each_dev+0x68/0x94) [ 129.983367] r7:c0299278 r6:bf02a2e4 r5:c6d5fe70 r4:00000000 [ 129.989349] [<c029876c>] (bus_for_each_dev+0x0/0x94) from [<c0298ea4>] (driver_attach+0x24/0x28) [ 129.998565] r7:00000000 r6:c06e4c98 r5:bf02a2e4 r4:00000000 [ 130.004547] [<c0298e80>] (driver_attach+0x0/0x28) from [<c0297f84>] (bus_add_driver+0xd0/0x274) [ 130.013671] [<c0297eb4>] (bus_add_driver+0x0/0x274) from [<c0299614>] (driver_register+0x78/0x158) [ 130.023101] [<c029959c>] (driver_register+0x0/0x158) from [<c029a868>] (platform_driver_register+0x5c/0x60) [ 130.033325] r7:00000000 r6:bf02a388 r5:000b9008 r4:bf02a2d0 [ 130.039276] [<c029a80c>] (platform_driver_register+0x0/0x60) from [<c029a88c>] (platform_driver_probe+0x20/0xa8) [ 130.050018] [<c029a86c>] (platform_driver_probe+0x0/0xa8) from [<bf03104c>] (musb_init+0x4c/0x54 [musb_hdrc]) [ 130.060424] r5:000b9008 r4:0010281c [ 130.064239] [<bf031000>] (musb_init+0x0/0x54 [musb_hdrc]) from [<c00463dc>] (do_one_initcall+0x3c/0x1c0) [ 130.074218] [<c00463a0>] (do_one_initcall+0x0/0x1c0) from [<c00bb9b8>] (sys_init_module+0xbc/0x1d0) [ 130.083709] [<c00bb8fc>] (sys_init_module+0x0/0x1d0) from [<c0052000>] (ret_fast_syscall+0x0/0x3c) [ 130.093109] r7:00000080 r6:0010281c r5:bebbfcf4 r4:00097e8e [ 130.099090] Code: 0a000046 e3a01001 e12fff33 e59520e4 (e5923404) [ 130.105621] ---[ end trace 1d0bd69deb79164d ]---
--- drivers/usb/musb/musb_core.c | 1 - 1 file changed, 1 deletion(-)
drivers/usb/musb/musb_core.c +0 -1
@@ -2243,7 +2243,6 @@ static int __exit musb_remove(struct pla#endif musb_writeb (musb->mregs,MUSB_DEVCTL ,0 );musb_platform_exit (musb); -musb_writeb (musb->mregs,MUSB_DEVCTL ,0 );musb_free (musb);iounmap (ctrl_base);
PATCH 199/289 USB: ftdi_sio: add device IDs for Milkymist One JTAG/serial
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Sebastien Bourdeauducq <[email protected]>
commit 7fea0f714ffb3f303d4b66933af2df2f5584c9bf upstream.
Add the USB IDs for the Milkymist One FTDI-based JTAG/serial adapter
(http://projects.qi-hardware.com/index.php/p/mmone-jtag-serial-cable/)
to the ftdi_sio driver and disable the first serial channel (used as JTAG from userspace).
--- drivers/usb/serial/ftdi_sio.c | 2 ++ drivers/usb/serial/ftdi_sio_ids.h | 7 +++++++ 2 files changed, 9 insertions(+)
drivers/usb/serial/ftdi_sio.c +2 -0
@@ -794,6 +794,8 @@ static struct usb_device_id id_table_com { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LOGBOOKML_PID) }, { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LS_LOGBOOK_PID) }, { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_HS_LOGBOOK_PID) }, + { USB_DEVICE(QIHARDWARE_VID, MILKYMISTONE_JTAGSERIAL_PID), + .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, { }, /* Optional parameter entry */ { } /* Terminating entry */ };
drivers/usb/serial/ftdi_sio_ids.h +7 -0
@@ -1100,3 +1100,10 @@#define FTDI_SCIENCESCOPE_LOGBOOKML_PID 0xFF18#define FTDI_SCIENCESCOPE_LS_LOGBOOK_PID 0xFF1C#define FTDI_SCIENCESCOPE_HS_LOGBOOK_PID 0xFF1D + +/* +* Milkymist One JTAG/Serial +*/ +#define QIHARDWARE_VID 0x20B7 +#define MILKYMISTONE_JTAGSERIAL_PID 0x0713 +
PATCH 200/289 USB: option: fix when the driver is loaded incorrectly for some Huawei devices.
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: ma rui <[email protected]>
commit 58c0d9d70109bd7e82bdb9517007311a48499960 upstream.
When huawei datacard with PID 0x14AC is insterted into Linux system, the present kernel will load the "option" driver to all the interfaces. But actually, some interfaces run as other function and do not need "option" driver.
In this path, we modify the id_tables, when the PID is 0x14ac ,VID is 0x12d1, Only when the interface's Class is 0xff,Subclass is 0xff, Pro is 0xff, it does need "option" driver.
--- drivers/usb/serial/option.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/serial/option.c +1 -1
@@ -512,7 +512,7 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4505, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_ETS1220, 0xff, 0xff, 0xff) }, - { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E14AC) }, + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E14AC, 0xff, 0xff, 0xff) }, { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) }, { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) }, { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V740) },
PATCH 201/289 usb: misc: sisusbvga: fix information leak to userland
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Vasiliy Kulikov <[email protected]>
commit 5dc92cf1d0b4b0debbd2e333b83f9746c103533d upstream.
Structure sisusb_info is copied to userland with "sisusb_reserved" field uninitialized. It leads to leaking of contents of kernel stack memory.
--- drivers/usb/misc/sisusbvga/sisusb.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/misc/sisusbvga/sisusb.c +1 -0
@@ -3008,6 +3008,7 @@ sisusb_ioctl(struct file *file, unsigned#else x.sisusb_conactive =0 ;#endif +memset (x.sisusb_reserved,0 ,sizeof (x.sisusb_reserved));if (copy_to_user ((void __user *)arg, &x,sizeof (x))) retval = -EFAULT ;
PATCH 202/289 usb: misc: iowarrior: fix information leak to userland
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Vasiliy Kulikov <[email protected]>
commit eca67aaeebd6e5d22b0d991af1dd0424dc703bfb upstream.
Structure iowarrior_info is copied to userland with padding byted between "serial" and "revision" fields uninitialized. It leads to leaking of contents of kernel stack memory.
--- drivers/usb/misc/iowarrior.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/misc/iowarrior.c +1 -0
@@ -553,6 +553,7 @@ static long iowarrior_ioctl(struct file/* needed for power consumption */ struct usb_config_descriptor *cfg_descriptor = &dev->udev->actconfig->desc; +memset (&info,0 ,sizeof (info));/* directly from the descriptor */ info.vendor =le16_to_cpu (dev->udev->descriptor.idVendor); info.product = dev->product_id;
PATCH 203/289 usb: core: fix information leak to userland
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Vasiliy Kulikov <[email protected]>
commit 886ccd4520064408ce5876cfe00554ce52ecf4a7 upstream.
Structure usbdevfs_connectinfo is copied to userland with padding byted after "slow" field uninitialized. It leads to leaking of contents of kernel stack memory.
--- drivers/usb/core/devio.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/usb/core/devio.c +4 -3
@@ -965,10 +965,11 @@ static int proc_getdriver(struct dev_stastatic int proc_connectinfo (struct dev_state *ps,void __user *arg) { -struct usbdevfs_connectinfo ci; +struct usbdevfs_connectinfo ci = { + .devnum = ps->dev->devnum, + .slow = ps->dev->speed ==USB_SPEED_LOW + }; - ci.devnum = ps->dev->devnum; - ci.slow = ps->dev->speed ==USB_SPEED_LOW ;if (copy_to_user (arg, &ci,sizeof (ci)))return -EFAULT ;return 0 ;
PATCH 204/289 USB: ohci-jz4740: Fix spelling in MODULE_ALIAS
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Stefan Weil <[email protected]>
commit 1c0a38038e8fcfaa6b5a81d53a4898f3f939f582 upstream.
platfrom -> platform
--- drivers/usb/host/ohci-jz4740.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/ohci-jz4740.c +1 -1
@@ -273,4 +273,4 @@ static struct platform_driver ohci_hcd_j }, }; -MODULE_ALIAS ("platfrom:jz4740-ohci" ); +MODULE_ALIAS ("platform:jz4740-ohci" );
PATCH 205/289 Staging: rt2870: Add USB ID for Buffalo Airstation WLI-UC-GN
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: John Tapsell <[email protected]>
commit 251d380034c6c34efe75ffb89d863558ba68ec6a upstream.
This was tested to successfully enable the hardware.
--- drivers/staging/rt2860/usb_main_dev.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/rt2860/usb_main_dev.c +1 -0
@@ -182,6 +182,7 @@ struct usb_device_id rtusb_usb_id[] = { {USB_DEVICE(0x2001, 0x3C09)}, /* D-Link */ {USB_DEVICE(0x2001, 0x3C0A)}, /* D-Link 3072 */ {USB_DEVICE(0x2019, 0xED14)}, /* Planex Communications, Inc. */ + {USB_DEVICE(0x0411, 0x015D)}, /* Buffalo Airstation WLI-UC-GN */ {} /* Terminating entry */ };
PATCH 206/289 USB: ehci: fix debugfs lpm permissions
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 723b991a62d94f74c9f19abd3da6e937288eb969 upstream.
The permissions for the lpm debugfs file is incorrect, this fixes it.
--- drivers/usb/host/ehci-dbg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/ehci-dbg.c +1 -1
@@ -1063,7 +1063,7 @@ static inline void create_debug_files (s &debug_registers_fops)) goto file_error; -if (!debugfs_create_file ("lpm" ,S_IRUGO |S_IWUGO , ehci->debug_dir, bus, +if (!debugfs_create_file ("lpm" ,S_IRUGO |S_IWUSR , ehci->debug_dir, bus, &debug_lpm_fops)) goto file_error;
PATCH 207/289 USB: EHCI: fix obscure race in ehci_endpoint_disable
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alan Stern <[email protected]>
commit 02e2c51ba3e80acde600721ea784c3ef84da5ea1 upstream.
This patch (as1435) fixes an obscure and unlikely race in ehci-hcd. When an async URB is unlinked, the corresponding QH is removed from the async list. If the QH's endpoint is then disabled while the URB is being given back, ehci_endpoint_disable() won't find the QH on the async list, causing it to believe that the QH has been lost. This will lead to a memory leak at best and quite possibly to an oops.
The solution is to trust usbcore not to lose track of endpoints. If the QH isn't on the async list then it doesn't need to be taken off the list, but the driver should still wait for the QH to become IDLE before disabling it.
In theory this fixes Bugzilla #20182. In fact the race is so rare that it's not possible to tell whether the bug is still present. However, adding delays and making other changes to force the race seems to show that the patch works.
--- drivers/usb/host/ehci-hcd.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/usb/host/ehci-hcd.c +5 -5
@@ -1048,10 +1048,11 @@ rescan: tmp && tmp != qh; tmp = tmp->qh_next.qh)continue ; -/* periodic qh self-unlinks on empty */ -if (!tmp) - goto nogood; -unlink_async (ehci, qh); +/* periodic qh self-unlinks on empty, and a COMPLETING qh +* may already be unlinked. +*/ +if (tmp) +unlink_async (ehci, qh);/* FALL THROUGH */ case QH_STATE_UNLINK :/* wait for hw to finish? */ case QH_STATE_UNLINK_WAIT :
@@ -1068,7 +1069,6 @@ idle_timeout: }/* else FALL THROUGH */ default : -nogood:/* caller was supposed to have unlinked any requests; * that's not our job. just leak this memory. */
PATCH 208/289 USB: ehci: disable LPM and PPCD for nVidia MCP89 chips
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Brian J. Tarricone <[email protected]>
commit a85b4e7f4481c5a1ca89fa63c9c871151965075e upstream.
Tested on MacBookAir3,1. Without this, we get EPROTO errors when fetching device config descriptors.
--- drivers/usb/host/ehci-pci.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/usb/host/ehci-pci.c +12 -0
@@ -148,6 +148,18 @@ static int ehci_pci_setup(struct usb_hcdif (pdev->revision <0xa4 ) ehci->no_selective_suspend =1 ;break ; + +/* MCP89 chips on the MacBookAir3,1 give EPROTO when +* fetching device descriptors unless LPM is disabled. +* There are also intermittent problems enumerating +* devices with PPCD enabled. +*/ +case 0x0d9d : +ehci_info (ehci,"disable lpm/ppcd for nvidia mcp89" ); + ehci->has_lpm =0 ; + ehci->has_ppcd =0 ; + ehci->command &= ~CMD_PPCEE ; +break ; }break ;case PCI_VENDOR_ID_VIA :
PATCH 209/289 USB: storage: sierra_ms: fix sysfs file attribute
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit d9624e75f6ad94d8a0718c1fafa89186d271a78c upstream.
A non-writable sysfs file shouldn't have writable attributes.
--- drivers/usb/storage/sierra_ms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/storage/sierra_ms.c +1 -1
@@ -121,7 +121,7 @@ static ssize_t show_truinst(struct devic }return result; } -static DEVICE_ATTR(truinst, S_IWUGO | S_IRUGO, show_truinst, NULL); +static DEVICE_ATTR(truinst, S_IRUGO, show_truinst, NULL);int sierra_ms_init (struct us_data *us) {
PATCH 210/289 USB: atm: ueagle-atm: fix up some permissions on the sysfs files
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit e502ac5e1eca99d7dc3f12b2a6780ccbca674858 upstream.
Some of the sysfs files had the incorrect permissions. Some didn't make sense at all (writable for a file that you could not write to?)
--- drivers/usb/atm/ueagle-atm.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/usb/atm/ueagle-atm.c +3 -4
@@ -2301,7 +2301,7 @@ out:return ret; } -static DEVICE_ATTR(stat_status, S_IWUGO | S_IRUGO, read_status, reboot); +static DEVICE_ATTR(stat_status, S_IWUSR | S_IRUGO, read_status, reboot);static ssize_t read_human_status (struct device *dev,struct device_attribute *attr,char *buf)
@@ -2364,8 +2364,7 @@ out:return ret; } -static DEVICE_ATTR(stat_human_status, S_IWUGO | S_IRUGO, - read_human_status, NULL); +static DEVICE_ATTR(stat_human_status, S_IRUGO, read_human_status, NULL);static ssize_t read_delin (struct device *dev,struct device_attribute *attr,char *buf)
@@ -2397,7 +2396,7 @@ out:return ret; } -static DEVICE_ATTR(stat_delin, S_IWUGO | S_IRUGO, read_delin, NULL); +static DEVICE_ATTR(stat_delin, S_IRUGO, read_delin, NULL);#define UEA_ATTR (name, reset) \ \
PATCH 211/289 USB: misc: cypress_cy7c63: fix up some sysfs attribute permissions
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 212/289 USB: misc: usbled: fix up some sysfs attribute permissions
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 213/289 USB: misc: trancevibrator: fix up a sysfs attribute permission
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 214/289 USB: misc: usbsevseg: fix up some sysfs attribute permissions
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 215/289 USB: ftdi_sio: Add ID for RT Systems USB-29B radio cable
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 216/289 USB: serial: ftdi_sio: Vardaan USB RS422/485 converter PID added
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 217/289 USB: fix autosuspend bug in usb-serial
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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
@@ -1331,6 +1332,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 218/289 e1000: fix screaming IRQ
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 219/289 ACPI: install ACPI table handler before any dynamic tables being loaded
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Zhang Rui <[email protected]>
commit b1d248d96c71665c79befb81207f38f894c7c082 upstream.
ACPI table sysfs I/F is broken by commit
78f1699659963fff97975df44db6d5dbe7218e55
Author: Alex Chiang <[email protected]> Date: Sun Dec 20 12:19:09 2009 -0700
ACPI: processor: call _PDC early
because dynamic SSDT tables may be loaded in _PDC, before installing the ACPI table handler.
As a result, the sysfs I/F of these dynamic tables are located at /sys/firmware/acpi/tables instead of /sys/firmware/acpi/tables/dynamic, which is not true.
Invoke acpi_sysfs_init() before acpi_early_processor_set_pdc(), so that the table handler is installed before any dynamic tables loaded.
https://bugzilla.kernel.org/show_bug.cgi?id=21142
--- drivers/acpi/bus.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/acpi/bus.c +6 -1
@@ -935,6 +935,12 @@ static int __init acpi_bus_init(void) goto error1; } +/* +* _PDC control method may load dynamic SSDT tables, +* and we need to install the table handler before that. +*/ +acpi_sysfs_init (); +acpi_early_processor_set_pdc ();/*
@@ -1026,7 +1032,6 @@ static int __init acpi_init(void)acpi_scan_init ();acpi_ec_init ();acpi_power_init (); -acpi_sysfs_init ();acpi_debugfs_init ();acpi_sleep_proc_init ();acpi_wakeup_device_init ();
PATCH 220/289 ACPI battery: support percentage battery remaining capacity
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 {
@@ -412,6 +413,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; }
@@ -448,6 +451,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; }
@@ -561,6 +568,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);
@@ -586,7 +620,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 221/289 acpi-cpufreq: fix a memleak when unloading driver
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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
@@ -701,6 +701,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 222/289 ACPI: debugfs custom_method open to non-root
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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/debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/debugfs.c +1 -1
@@ -79,7 +79,7 @@ int __init 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;
PATCH 223/289 PNPACPI: cope with invalid device IDs
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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
@@ -180,11 +180,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;/*
@@ -192,11 +205,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 ;
@@ -227,7 +246,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 224/289 saa7134: Fix autodetect for Behold A7 and H7 TV cards
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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
@@ -6661,6 +6661,18 @@ struct pci_device_id saa7134_pci_tbl[] = .subdevice = 0x2804, .driver_data = SAA7134_BOARD_TECHNOTREND_BUDGET_T3000, }, { + .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,
@@ -6698,18 +6710,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 225/289 fuse: fix attributes after open(O_TRUNC)
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 226/289 cs5535-gpio: apply CS5536 errata workaround for GPIOs
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 227/289 do_exit(): make sure that we run with get_fs() == USER_DS
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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
@@ -903,6 +903,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 228/289 mm/hugetlb.c: avoid double unlock_page() in hugetlb_fault()
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Dean Nelson <[email protected]>
commit 1f64d69c7ad2e48e697493e45590679f7a69b7b2 upstream.
Have hugetlb_fault() call unlock_page(page) only if it had previously called lock_page(page).
Setting CONFIG_DEBUG_VM=y and then running the libhugetlbfs test suite, resulted in the tripping of VM_BUG_ON(!PageLocked(page)) in unlock_page() having been called by hugetlb_fault() when page == pagecache_page. This patch remedied the problem.
--- mm/hugetlb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
mm/hugetlb.c +2 -1
@@ -2668,7 +2668,8 @@ out_page_table_lock:unlock_page (pagecache_page);put_page (pagecache_page); } -unlock_page (page); +if (page != pagecache_page) +unlock_page (page); out_mutex:mutex_unlock (&hugetlb_instantiation_mutex);
PATCH 229/289 cifs: fix another memleak, in cifs_root_iget
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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
@@ -835,8 +835,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 (rc); +if (!inode) { + inode =ERR_PTR (rc); + goto out; + }#ifdef CONFIG_CIFS_FSCACHE /* populate tcon->resource_id */
@@ -852,13 +854,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 230/289 cifs: fix parsing of hostname in dfs referrals
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jeff Layton <[email protected]>
commit ba03864872691c0bb580a7fb47388da337ef4aa2 upstream.
The DFS referral parsing code does a memchr() call to find the '\\' delimiter that separates the hostname in the referral UNC from the sharename. It then uses that value to set the length of the hostname via pointer subtraction. Instead of subtracting the start of the hostname however, it subtracts the start of the UNC, which causes the code to pass in a hostname length that is 2 bytes too long.
Regression introduced in commit 1a4240f4.
--- fs/cifs/dns_resolve.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/dns_resolve.c +1 -1
@@ -66,7 +66,7 @@ dns_resolve_server_name_to_ip(const char/* Search for server name delimiter */ sep =memchr (hostname,'\\' , len);if (sep) - len = sep - unc; + len = sep - hostname;else cFYI (1 ,"%s: probably server name is whole unc: %s" , __func__, unc);
PATCH 231/289 ath9k: fix timeout on stopping rx dma
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Felix Fietkau <[email protected]>
commit d47844a014fada1a788719f6426bc7044f2a0fd8 upstream.
It seems that using ath9k_hw_stoppcurecv to stop rx dma is not enough. When it's time to stop DMA, the PCU is still busy, so the rx enable bit never clears.
Using ath9k_hw_abortpcurecv helps with getting rx stopped much faster, with this change, I cannot reproduce the rx stop related WARN_ON anymore.
--- drivers/net/wireless/ath/ath9k/recv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/recv.c +1 -1
@@ -508,7 +508,7 @@ bool ath_stoprecv(struct ath_softc *sc)bool stopped;spin_lock_bh (&sc->rx.rxbuflock); -ath9k_hw_stoppcurecv (ah); +ath9k_hw_abortpcurecv (ah);ath9k_hw_setrxfilter (ah,0 ); stopped =ath9k_hw_stopdmarecv (ah);
PATCH 232/289 uml: disable winch irq before freeing handler data
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 233/289 backlight: grab ops_lock before testing bd->ops
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 234/289 nommu: yield CPU while disposing VM
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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
@@ -1668,6 +1668,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 235/289 PM / PM QoS: Fix reversed min and max
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Colin Cross <[email protected]>
commit 00fafcda1773245a5292f953321ec3f0668c8c28 upstream.
pm_qos_get_value had min and max reversed, causing all pm_qos requests to have no effect.
--- kernel/pm_qos_params.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/pm_qos_params.c +2 -2
@@ -120,10 +120,10 @@ static inline int pm_qos_get_value(strucswitch (o->type) {case PM_QOS_MIN : -return plist_last (&o->requests)->prio; +return plist_first (&o->requests)->prio;case PM_QOS_MAX : -return plist_first (&o->requests)->prio; +return plist_last (&o->requests)->prio;default :/* runtime check for not using enum */
PATCH 236/289 x86: Ignore trap bits on single step exceptions
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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
@@ -433,6 +433,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 237/289 mmc: fix rmmod race for hosts using card-detection polling
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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
@@ -1514,7 +1514,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 238/289 DECnet: dont leak uninitialized stack byte
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 239/289 perf_events: Fix perf_counter_mmap() hook in mprotect()
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 240/289 ARM: 6464/2: fix spinlock recursion in adjust_pte()
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 241/289 ARM: 6489/1: thumb2: fix incorrect optimisation in usracc
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 242/289 ARM: 6482/2: Fix find_next_zero_bit and related assembly
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 243/289 leds: fix bug with reading NAS SS4200 dmi code
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 244/289 serial: mfd: adjust the baud rate setting
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Feng Tang <[email protected]>
commit a5880a9e5bb40fbae55de60051d69a29091053c3 upstream.
Previous baud rate setting code only has been tested with 3.5M/9600/ 115200/230400/460800 bps, and recently we got a 3M bps device to test, which needs to modify current MUL register setting, and with this patch 2.5M/2M/1.5M/1M/0.5M should also work as they just use a MUL value scale down from 3M's.
Also got some reference register setting from silicon guys for different baud rates, which tries to keep the pre-scalar register value to 16.
--- drivers/serial/mfd.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-)
drivers/serial/mfd.c +8 -10
@@ -892,8 +892,7 @@ serial_hsu_set_termios(struct uart_portunsigned char cval, fcr =0 ;unsigned long flags;unsigned int baud, quot; -u32 mul =0x3600 ; -u32 ps =0x10 ; +u32 ps, mul;switch (termios->c_cflag &CSIZE ) {case CS5 :
@@ -937,20 +936,19 @@ serial_hsu_set_termios(struct uart_port ps =0xC ; quot =1 ;break ; -case 2500000 : - mul =0x2710 ; - ps =0x10 ; - quot =1 ; -break ;case 18432000 : mul =0x2400 ; ps =0x10 ; quot =1 ;break ; +case 3000000 : +case 2500000 : +case 2000000 :case 1500000 : - mul =0x1D4C ; - ps =0xc ; - quot =1 ; +case 1000000 : +case 500000 : +/* mul/ps/quot = 0x9C4/0x10/0x1 will make a 500000 bps */ + mul = baud /500000 *0x9C4 ;break ;default : ;
PATCH 245/289 memcg: avoid deadlock between move charge and try_charge()
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Daisuke Nishimura <[email protected]>
commit b1dd693e5b9348bd68a80e679e03cf9c0973b01b upstream.
__mem_cgroup_try_charge() can be called under down_write(&mmap_sem)(e.g. mlock does it). This means it can cause deadlock if it races with move charge:
Ex.1)
move charge | try charge
--------------------------------------+------------------------------
mem_cgroup_can_attach() | down_write(&mmap_sem)
mc.moving_task = current | ..
mem_cgroup_precharge_mc() | __mem_cgroup_try_charge()
mem_cgroup_count_precharge() | prepare_to_wait()
down_read(&mmap_sem) | if (mc.moving_task)
-> cannot aquire the lock | -> true
| schedule()Ex.2)
move charge | try charge
--------------------------------------+------------------------------
mem_cgroup_can_attach() |
mc.moving_task = current |
mem_cgroup_precharge_mc() |
mem_cgroup_count_precharge() |
down_read(&mmap_sem) |
.. |
up_read(&mmap_sem) |
| down_write(&mmap_sem)
mem_cgroup_move_task() | ..
mem_cgroup_move_charge() | __mem_cgroup_try_charge()
down_read(&mmap_sem) | prepare_to_wait()
-> cannot aquire the lock | if (mc.moving_task)
| -> true
| schedule()To avoid this deadlock, we do all the move charge works (both can_attach() and attach()) under one mmap_sem section.
And after this patch, we set/clear mc.moving_task outside mc.lock, because we use the lock only to check mc.from/to.
--- mm/memcontrol.c | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-)
mm/memcontrol.c +26 -17
@@ -269,13 +269,14 @@ enum move_type {/* "mc" and its members are protected by cgroup_mutex */ static struct move_charge_struct { -spinlock_t lock;/* for from, to, moving_task */ +spinlock_t lock;/* for from, to */ struct mem_cgroup *from;struct mem_cgroup *to;unsigned long precharge;unsigned long moved_charge;unsigned long moved_swap;struct task_struct *moving_task;/* a task moving charges */ +struct mm_struct *mm;wait_queue_head_t waitq;/* a waitq for other context */ } mc = { .lock =__SPIN_LOCK_UNLOCKED (mc.lock),
@@ -4445,7 +4446,7 @@ static unsigned long mem_cgroup_count_prunsigned long precharge;struct vm_area_struct *vma; -down_read (&mm->mmap_sem); +/* We've already held the mmap_sem */ for (vma = mm->mmap; vma; vma = vma->vm_next) {struct mm_walk mem_cgroup_count_precharge_walk = { .pmd_entry = mem_cgroup_count_precharge_pte_range,
@@ -4457,7 +4458,6 @@ static unsigned long mem_cgroup_count_prwalk_page_range (vma->vm_start, vma->vm_end, &mem_cgroup_count_precharge_walk); } -up_read (&mm->mmap_sem); precharge = mc.precharge; mc.precharge =0 ;
@@ -4508,11 +4508,16 @@ static void mem_cgroup_clear_mc(void) mc.moved_swap =0 ; } +if (mc.mm) { +up_read (&mc.mm->mmap_sem); +mmput (mc.mm); + }spin_lock (&mc.lock); mc.from =NULL ; mc.to =NULL ; - mc.moving_task =NULL ;spin_unlock (&mc.lock); + mc.moving_task =NULL ; + mc.mm =NULL ;memcg_oom_recover (from);memcg_oom_recover (to);wake_up_all (&mc.waitq);
@@ -4537,26 +4542,37 @@ static int mem_cgroup_can_attach(structreturn 0 ;/* We move charges only when we move a owner of the mm */ if (mm->owner == p) { +/* +* We do all the move charge works under one mmap_sem to +* avoid deadlock with down_write(&mmap_sem) +* -> try_charge() -> if (mc.moving_task) -> sleep. +*/ +down_read (&mm->mmap_sem); +VM_BUG_ON (mc.from);VM_BUG_ON (mc.to);VM_BUG_ON (mc.precharge);VM_BUG_ON (mc.moved_charge);VM_BUG_ON (mc.moved_swap);VM_BUG_ON (mc.moving_task); +VM_BUG_ON (mc.mm); +spin_lock (&mc.lock); mc.from = from; mc.to = mem; mc.precharge =0 ; mc.moved_charge =0 ; mc.moved_swap =0 ; - mc.moving_task = current;spin_unlock (&mc.lock); + mc.moving_task = current; + mc.mm = mm; ret =mem_cgroup_precharge_mc (mm);if (ret)mem_cgroup_clear_mc (); - } -mmput (mm); +/* We call up_read() and mmput() in clear_mc(). */ + }else +mmput (mm); }return ret; }
@@ -4644,7 +4660,7 @@ static void mem_cgroup_move_charge(strucstruct vm_area_struct *vma;lru_add_drain_all (); -down_read (&mm->mmap_sem); +/* We've already held the mmap_sem */ for (vma = mm->mmap; vma; vma = vma->vm_next) {int ret;struct mm_walk mem_cgroup_move_charge_walk = {
@@ -4663,7 +4679,6 @@ static void mem_cgroup_move_charge(struc*/ break ; } -up_read (&mm->mmap_sem); } static void mem_cgroup_move_task(struct cgroup_subsys *ss,
@@ -4672,17 +4687,11 @@ static void mem_cgroup_move_task(struct struct task_struct *p, bool threadgroup) { -struct mm_struct *mm; - -if (!mc.to) +if (!mc.mm)/* no need to move charge */ return ; - mm =get_task_mm (p); -if (mm) { -mem_cgroup_move_charge (mm); -mmput (mm); - } +mem_cgroup_move_charge (mc.mm);mem_cgroup_clear_mc (); }#else /* !CONFIG_MMU */
PATCH 246/289 Revert "vfs: show unreachable paths in getcwd and proc"
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Eric W. Biederman <[email protected]>
commit 7b2a69ba7055da9a04eb96aa7b38c8e3280aaaa5 upstream.
Because it caused a chroot ttyname regression in 2.6.36.
As of 2.6.36 ttyname does not work in a chroot. It has already been reported that screen breaks, and for me this breaks an automated distribution testsuite, that I need to preserve the ability to run the existing binaries on for several more years. glibc 2.11.3 which has a fix for this is not an option.
The root cause of this breakage is:
commit 8df9d1a4142311c084ffeeacb67cd34d190eff74
Author: Miklos Szeredi <[email protected]>
Date: Tue Aug 10 11:41:41 2010 +0200
vfs: show unreachable paths in getcwd and proc
Prepend "(unreachable)" to path strings if the path is not reachable from the current root.
Two places updated are
- the return string from getcwd()
- and symlinks under /proc/$PID.
Other uses of d_path() are left unchanged (we know that some old software crashes if /proc/mounts is changed).
So remove the nice sounding, but ultimately ill advised change to how /proc/fd symlinks work.
--- fs/proc/base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/proc/base.c +1 -1
@@ -1526,7 +1526,7 @@ static int do_proc_readlink(struct pathif (!tmp)return -ENOMEM ; - pathname =d_path_with_unreachable (path, tmp,PAGE_SIZE ); + pathname =d_path (path, tmp,PAGE_SIZE ); len =PTR_ERR (pathname);if (IS_ERR (pathname)) goto out;
PATCH 247/289 Staging: udlfb: fix up some sysfs attribute permissions
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 248/289 Staging: iio: adis16220: fix up some sysfs attribute permissions
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 249/289 Staging: iio: adis16220: fix up my fixup for some sysfs attribute permissions
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 250/289 Staging: samsung-laptop: fix up some sysfs attribute permissions
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 251/289 Staging: samsung-laptop: fix up my fixup for some sysfs attribute permissions
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 252/289 Staging: frontier: fix up some sysfs attribute permissions
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 253/289 staging: rtl8187se: Change panic to warn when RF switch turned off
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 254/289 Staging: batman-adv: ensure that eth_type_trans gets linear memory
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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
@@ -246,6 +246,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 255/289 perf: Fix inherit vs. context rotation bug
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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
@@ -788,6 +788,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
@@ -1620,8 +1620,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); }
@@ -5622,6 +5626,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 ;
@@ -5662,6 +5667,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);
@@ -5669,6 +5683,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 256/289 ARM: 6456/1: Fix for building DEBUG with sa11xx_base.c as a module.
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 257/289 ARM: cns3xxx: Fix build with CONFIG_PCI=y
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Anton Vorontsov <[email protected]>
commit 44266416f786514ec43a0d15ad951c34566b99c9 upstream.
commit 6338a6aa7c082f11d55712251e14178c68bf5869 ("ARM: 6269/1: Add 'code' parameter for hook_fault_code()") breaks CNS3xxx build:
CC arch/arm/mach-cns3xxx/pcie.opcie.c: In function 'cns3xxx_pcie_init':
pcie.c:373: warning: passing argument 4 of 'hook_fault_code' makes integer from pointer without a cast pcie.c:373: error: too few arguments to function 'hook_fault_code'
This commit fixes the small issue.
--- arch/arm/mach-cns3xxx/pcie.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-cns3xxx/pcie.c +1 -1
@@ -369,7 +369,7 @@ static int __init cns3xxx_pcie_init(void {int i; -hook_fault_code (16 +6 , cns3xxx_pcie_abort_handler,SIGBUS , +hook_fault_code (16 +6 , cns3xxx_pcie_abort_handler,SIGBUS ,0 ,"imprecise external abort" );for (i =0 ; i <ARRAY_SIZE (cns3xxx_pcie); i++) {
PATCH 258/289 PM / Hibernate: Fix memory corruption related to swap
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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
@@ -326,7 +326,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)
@@ -338,7 +337,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;
@@ -347,7 +346,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. */
@@ -356,7 +358,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);
@@ -451,17 +456,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;
@@ -475,7 +479,6 @@ int hibernation_restore(int platform_modint hibernation_platform_enter (void ) {int error; -gfp_t saved_mask;if (!hibernation_ops)return -ENOSYS ;
@@ -491,7 +494,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)
@@ -535,7 +537,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:
@@ -643,6 +644,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
@@ -197,7 +197,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 ;
@@ -208,7 +207,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) {
@@ -225,7 +224,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 259/289 wmi: use memcmp instead of strncmp to compare GUIDs
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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
@@ -801,7 +801,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 260/289 nohz/s390: fix arch_needs_cpu() return value on offline cpus
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 261/289 genirq: Fix incorrect proc spurious output
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 262/289 net: Truncate recvfrom and sendto length to INT_MAX.
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Linus Torvalds <[email protected]>
commit 253eacc070b114c2ec1f81b067d2fed7305467b0 upstream.
--- net/socket.c | 4 ++++ 1 file changed, 4 insertions(+)
net/socket.c +4 -0
@@ -1651,6 +1651,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;
@@ -1708,6 +1710,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 263/289 net: Limit socket I/O iovec total length to INT_MAX.
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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.
--- include/linux/socket.h | 2 +- net/compat.c | 10 ++++++---- net/core/iovec.c | 20 +++++++++----------- 3 files changed, 16 insertions(+), 16 deletions(-)
include/linux/socket.h +1 -1
@@ -322,7 +322,7 @@ extern int csum_partial_copy_fromiovecenint offset, unsigned int len, __wsum *csump); -extern long verify_iovec (struct msghdr *m,struct iovec *iov,struct sockaddr *address,int mode); +extern int verify_iovec (struct msghdr *m,struct iovec *iov,struct sockaddr *address,int mode);extern int memcpy_toiovec (struct iovec *v,unsigned char *kdata,int len);extern int memcpy_toiovecend (const struct iovec *v,unsigned char *kdata,int offset,int len);
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 +9 -11
@@ -35,10 +35,9 @@* in any case. */ -long verify_iovec (struct msghdr *m,struct iovec *iov,struct sockaddr *address,int mode) +int verify_iovec (struct msghdr *m,struct iovec *iov,struct sockaddr *address,int mode) { -int size, ct; -long err; +int size, ct, err;if (m->msg_namelen) {if (mode ==VERIFY_READ ) {
@@ -60,14 +59,13 @@ long verify_iovec(struct msghdr *m, stru 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 264/289 Input: i8042 - add Sony VAIO VPCZ122GX to nomux list
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 265/289 omap: dma: Fix buffering disable bit setting for omap24xx
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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
@@ -996,11 +996,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 266/289 OMAP3: DMA: Errata i541: sDMA FIFO draining does not finish
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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>
@@ -1024,8 +1025,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 267/289 memory corruption in X.25 facilities parsing
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 268/289 vlan: Avoid hwaccel vlan packets when vid not used.
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jesse Gross <[email protected]>
[This patch applies only to 2.6.36 stable. The problem was introduced in that release and is already fixed by larger changes to the vlan code in 2.6.37.]
Normally hardware accelerated vlan packets are quickly dropped if there is no corresponding vlan device configured. The one exception is promiscuous mode, where we allow all of these packets through so they can be picked up by tcpdump. However, this behavior causes a crash if we actually try to receive these packets. This fixes that crash by ignoring packets with vids not corresponding to a configured device in the vlan hwaccel routines and then dropping them before they get to consumers in the network stack.
--- net/8021q/vlan_core.c | 3 +++ net/core/dev.c | 13 +++++++++++++ 2 files changed, 16 insertions(+)
net/8021q/vlan_core.c +3 -0
@@ -43,6 +43,9 @@ int vlan_hwaccel_do_receive(struct sk_bustruct net_device *dev = skb->dev;struct vlan_rx_stats *rx_stats; +if (unlikely (!is_vlan_dev (dev))) +return 0 ; + skb->dev =vlan_dev_info (dev)->real_dev;netif_nit_deliver (skb);
net/core/dev.c +13 -0
@@ -2891,6 +2891,19 @@ static int __netif_receive_skb(struct sk ncls:#endif +/* If we got this far with a hardware accelerated VLAN tag, it means +* that we were put in promiscuous mode but nobody is interested in +* this vid. Drop the packet now to prevent it from getting propagated +* to other parts of the stack that won't know how to deal with packets +* tagged in this manner. +*/ +if (unlikely (vlan_tx_tag_present (skb))) { +if (pt_prev) + ret = pt_prev->func (skb, skb->dev, pt_prev, orig_dev); +kfree_skb (skb); + goto out; + } +/* Handle special case of bridge or macvlan */ rx_handler =rcu_dereference (skb->dev->rx_handler);if (rx_handler) {
PATCH 269/289 kbuild: use getopt_long(), not its _only() variant
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Arnaud Lacombe <[email protected]>
commit c94d3fb01fb6db1899cdf53ea4eb9d38e08a08fe upstream.
NetBSD lacks getopt_long_only() whereas getopt_long() works just fine.
--- scripts/kconfig/conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kconfig/conf.c +1 -1
@@ -466,7 +466,7 @@ int main(int ac, char **av)bindtextdomain (PACKAGE ,LOCALEDIR );textdomain (PACKAGE ); -while ((opt =getopt_long_only (ac, av,"" , long_opts,NULL )) !=-1 ) { +while ((opt =getopt_long (ac, av,"" , long_opts,NULL )) !=-1 ) { input_mode = (enum input_mode )opt;switch (opt) {case silentoldconfig:
PATCH 270/289 filter: make sure filters dont read uninitialized memory
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 271/289 can-bcm: fix minor heap overflow
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 272/289 x25: Prevent crashing when parsing bad X.25 facilities
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 273/289 crypto: padlock - Fix AES-CBC handling on odd-block-sized input
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 274/289 ext4: fix NULL pointer dereference in print_daily_error_info()
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Sergey Senozhatsky <[email protected]>
commit a1c6c5698d53db4c47a25c3a8d11731a4d7b8370 upstream.
Fix NULL pointer dereference in print_daily_error_info, when called on unmounted fs (EXT4_SB(sb) returns NULL), by removing error reporting timer in ext4_put_super.
Google-Bug-Id: 3017663
--- fs/ext4/super.c | 1 + 1 file changed, 1 insertion(+)
fs/ext4/super.c +1 -0
@@ -719,6 +719,7 @@ static void ext4_put_super(struct super_ext4_abort (sb,"Couldn't clean up the journal" ); } +del_timer (&sbi->s_err_report);ext4_release_system_zone (sb);ext4_mb_release (sb);ext4_ext_release (sb);
PATCH 275/289 econet: disallow NULL remote addr for sendmsg(), fixes CVE-2010-3849
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 276/289 econet: fix CVE-2010-3850
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 277/289 econet: fix CVE-2010-3848
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 278/289 rds: Integer overflow in RDS cmsg handling
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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 279/289 cfg80211: fix extension channel checks to initiate communication
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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
@@ -44,6 +44,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)
@@ -68,6 +98,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 280/289 qla2xxx: Add module parameter to enable/disable GFF_ID device type check.
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Chad Dupuis <[email protected]>
commit 4da26e162b69d89c3186a35a052c05e61a555637 upstream.
Add the module parameter ql2xgffidenable to disable/enable the use of the GFF_ID name server command to prevent non FCP SCSI devices from being added to the driver's internal fc_port database.
--- drivers/scsi/qla2xxx/qla_gbl.h | 1 + drivers/scsi/qla2xxx/qla_init.c | 5 +++-- drivers/scsi/qla2xxx/qla_os.c | 5 +++++ 3 files changed, 9 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_gbl.h +1 -0
@@ -92,6 +92,7 @@ extern int ql2xshiftctondsd;extern int ql2xdbwr;extern int ql2xdontresethba;extern int ql2xasynctmfenable; +extern int ql2xgffidenable;extern int ql2xenabledif;extern int ql2xenablehba_err_chk;extern int ql2xtargetreset;
drivers/scsi/qla2xxx/qla_init.c +3 -2
@@ -3258,8 +3258,9 @@ qla2x00_find_all_fabric_devs(scsi_qla_hocontinue ;/* Bypass ports whose FCP-4 type is not FCP_SCSI */ -if (new_fcport->fc4_type !=FC4_TYPE_FCP_SCSI && - new_fcport->fc4_type !=FC4_TYPE_UNKNOWN ) +if (ql2xgffidenable && + (new_fcport->fc4_type !=FC4_TYPE_FCP_SCSI && + new_fcport->fc4_type !=FC4_TYPE_UNKNOWN ))continue ;/* Locate matching device in database. */
drivers/scsi/qla2xxx/qla_os.c +5 -0
@@ -160,6 +160,11 @@ MODULE_PARM_DESC(ql2xtargetreset,"Enable target reset." "Default is 1 - use hw defaults."); +int ql2xgffidenable; +module_param (ql2xgffidenable, int,S_IRUGO |S_IRUSR ); +MODULE_PARM_DESC (ql2xgffidenable, +"Enables GFF_ID checks of port type. " +"Default is 0 - Do not use GFF_ID information." );int ql2xasynctmfenable;module_param (ql2xasynctmfenable, int,S_IRUGO |S_IRUSR );
PATCH 281/289 msp3400: fix mute audio regression
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: Hans Verkuil <[email protected]>
commit 0310871d8f71da4ad8643687fbc40f219a0dac4d upstream.
The switch to the new control framework caused a regression where the audio was no longer unmuted after the carrier scan finished.
The original code attempted to set the volume control to its current value in order to have the set-volume control code to be called that handles the volume and muting. However, the framework will not call that code unless the new volume value is different from the old.
Instead we now call msp_s_ctrl directly.
It is a bit of a hack: we really need a v4l2_ctrl_refresh_ctrl function for this (or something along those lines).
Thanks to Andy Walls for bisecting this and to Shane Shrybman for reporting it!
Thanks-to: Andy Walls <[email protected]>
--- drivers/media/video/msp3400-driver.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/media/video/msp3400-driver.c +6 -1
@@ -382,7 +382,12 @@ static int msp_s_ctrl(struct v4l2_ctrl *void msp_update_volume (struct msp_state *state) { -v4l2_ctrl_s_ctrl (state->volume,v4l2_ctrl_g_ctrl (state->volume)); +/* Force an update of the volume/mute cluster */ +v4l2_ctrl_lock (state->volume); + state->volume->val = state->volume->cur.val; + state->muted->val = state->muted->cur.val; +msp_s_ctrl (state->volume); +v4l2_ctrl_unlock (state->volume); }/* --- v4l2 ioctls --- */
PATCH 282/289 r8169: fix rx checksum offload
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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
@@ -4455,9 +4455,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)) ||
@@ -4551,8 +4550,6 @@ static int rtl8169_rx_interrupt(struct ncontinue ; } -rtl8169_rx_csum (skb, desc); -if (rtl8169_try_rx_copy (&skb, tp, pkt_size, addr)) {dma_sync_single_for_device (&pdev->dev, addr, pkt_size,PCI_DMA_FROMDEVICE );
@@ -4563,6 +4560,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 283/289 r8169: (re)init phy on resume
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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
@@ -4889,6 +4889,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);
@@ -4929,6 +4932,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 284/289 r8169: revert "Handle rxfifo errors on 8168 chips"
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us know.
------------------
From: =?UTF-8?q?fran=C3=A7ois=20romieu?= <[email protected]>
commit 53f57357ff0afc37804f4e82ee3123e0c0a2cad6 upstream.
The original patch helps under obscure conditions (no pun) but some 8168 do not like it. The change needs to be tightened with a specific 8168 version.
This reverts commit 801e147cde02f04b5c2f42764cd43a89fc7400a2 ("r8169: Handle rxfifo errors on 8168 chips").
Regression at https://bugzilla.kernel.org/show_bug.cgi?id=20882
--- drivers/net/r8169.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/r8169.c +3 -2
@@ -2936,7 +2936,7 @@ static const struct rtl_cfg_info { .hw_start = rtl_hw_start_8168, .region = 2, .align = 8, - .intr_event = SYSErr | RxFIFOOver | LinkChg | RxOverflow | + .intr_event = SYSErr | LinkChg | RxOverflow | TxErr | TxOK | RxOK | RxErr, .napi_event = TxErr | TxOK | RxOK | RxOverflow, .features = RTL_FEATURE_GMII | RTL_FEATURE_MSI,
@@ -4628,7 +4628,8 @@ static irqreturn_t rtl8169_interrupt(int }/* Work around for rx fifo overflow */ -if (unlikely (status & RxFIFOOver)) { +if (unlikely (status & RxFIFOOver) && + (tp->mac_version ==RTL_GIGA_MAC_VER_11 )) {netif_stop_queue (dev);rtl8169_tx_timeout (dev);break ;
PATCH 285/289 r8169: fix checksum broken
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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
@@ -4460,8 +4460,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 286/289 nmi: fix clock comparator revalidation
In reply to Greg KH2.6.36-stable review patch. If anyone has any objections, please let us 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);