3.0.18-stable review
Subsystems (57)
cover 3.0.18-stable review
This is the start of the stable review cycle for the 3.0.18 release. There are 90 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let us know. If anyone is a maintainer of the proper subsystem, and wants to add a Signed-off-by: line to the patch, please respond with it.
Responses should be made by Wednesday, January 25, 2012, 20:00:00 UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.0.18-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
Makefile | 4 +- arch/ia64/kernel/acpi.c | 10 +- arch/score/kernel/entry.S | 2 +- arch/x86/include/asm/amd_nb.h | 2 + arch/x86/kernel/amd_nb.c | 31 ++++++ arch/x86/kernel/apic/x2apic_uv_x.c | 7 +- arch/x86/mm/mmap.c | 4 +- arch/x86/mm/srat.c | 4 + arch/x86/pci/Makefile | 3 +- arch/x86/pci/acpi.c | 18 +++- arch/x86/pci/amd_bus.c | 42 ++------ arch/x86/platform/uv/tlb_uv.c | 13 ++- block/scsi_ioctl.c | 52 +++++++++ drivers/acpi/acpica/dsargs.c | 24 ++++ drivers/acpi/numa.c | 6 + drivers/acpi/processor_core.c | 26 ++++- drivers/block/cciss.c | 6 +- drivers/block/ub.c | 3 +- drivers/block/virtio_blk.c | 4 +- drivers/cdrom/cdrom.c | 3 +- drivers/gpu/drm/radeon/r100.c | 5 +- drivers/gpu/drm/radeon/r600_hdmi.c | 7 ++ drivers/gpu/drm/radeon/radeon_device.c | 5 +- drivers/gpu/drm/radeon/rs600.c | 4 +- drivers/hid/hid-core.c | 14 ++- drivers/hid/hid-ids.h | 14 ++- drivers/hid/hid-multitouch.c | 32 ++++-- drivers/i2c/busses/i2c-ali1535.c | 11 ++- drivers/i2c/busses/i2c-eg20t.c | 2 +- drivers/i2c/busses/i2c-nforce2.c | 2 +- drivers/i2c/busses/i2c-omap.c | 2 +- drivers/i2c/busses/i2c-sis5595.c | 4 +- drivers/i2c/busses/i2c-sis630.c | 6 +- drivers/i2c/busses/i2c-viapro.c | 7 +- drivers/ide/ide-floppy_ioctl.c | 3 +- drivers/idle/intel_idle.c | 9 +- drivers/md/dm-flakey.c | 11 ++- drivers/md/dm-linear.c | 12 ++- drivers/md/dm-mpath.c | 6 + drivers/media/video/uvc/uvc_v4l2.c | 9 ++ drivers/media/video/uvc/uvcvideo.h | 1 + drivers/media/video/v4l2-ioctl.c | 4 + drivers/mmc/core/mmc.c | 2 +- drivers/mmc/host/sdhci.c | 6 +- drivers/mtd/mtd_blkdevs.c | 3 +- drivers/mtd/mtdoops.c | 5 +- drivers/mtd/tests/mtd_stresstest.c | 7 ++ drivers/mtd/ubi/cdev.c | 3 + drivers/mtd/ubi/debug.h | 5 +- drivers/mtd/ubi/eba.c | 6 +- drivers/mtd/ubi/ubi.h | 2 + drivers/mtd/ubi/wl.c | 12 ++- drivers/net/phy/mdio-gpio.c | 2 +- drivers/net/wireless/iwlegacy/iwl3945-base.c | 9 +- drivers/net/wireless/iwlwifi/iwl-agn-lib.c | 1 + drivers/net/wireless/iwlwifi/iwl-agn-rxon.c | 3 + drivers/net/wireless/rt2x00/rt2800pci.c | 28 ++---- drivers/net/wireless/rtlwifi/rtl8192se/fw.c | 4 + drivers/pci/msi.c | 10 ++ drivers/pnp/quirks.c | 42 ++++++++ drivers/rtc/interface.c | 4 +- drivers/scsi/mpt2sas/mpt2sas_base.c | 83 +++++---------- drivers/scsi/mpt2sas/mpt2sas_scsih.c | 11 +- drivers/scsi/sd.c | 13 ++- drivers/scsi/sym53c8xx_2/sym_glue.c | 4 + drivers/target/target_core_cdb.c | 12 ++ drivers/target/target_core_transport.c | 14 +++ drivers/xen/xenbus/xenbus_xs.c | 6 + fs/dcache.c | 14 ++- fs/ext4/super.c | 7 +- fs/nfs/callback_proc.c | 2 +- fs/nfs/objlayout/objio_osd.c | 3 +- fs/nfs/objlayout/objlayout.c | 10 ++- fs/nfs/pnfs.c | 12 ++ fs/nfs/pnfs.h | 1 + fs/nfs/super.c | 43 ++++---- fs/nfsd/export.c | 2 +- fs/notify/mark.c | 8 +- fs/proc/base.c | 145 +++++++------------------- fs/proc/task_mmu.c | 3 + fs/proc/uptime.c | 9 ++- fs/ubifs/debug.h | 17 ++-- include/acpi/acpi_numa.h | 1 + include/linux/blkdev.h | 3 + include/linux/dcache.h | 1 + include/linux/memcontrol.h | 6 + include/linux/pci_regs.h | 2 +- include/linux/sunrpc/svcsock.h | 2 +- include/linux/videodev2.h | 1 + include/target/target_core_base.h | 1 + include/xen/interface/io/xs_wire.h | 3 + init/do_mounts.c | 35 ++++++- kernel/kprobes.c | 2 +- mm/filemap.c | 18 +--- mm/memcontrol.c | 44 ++++++++ mm/page_alloc.c | 11 ++ net/ipv4/ah4.c | 6 +- net/ipv6/ah6.c | 6 +- net/mac80211/wpa.c | 2 +- net/sunrpc/svc.c | 20 +++-- net/sunrpc/svc_xprt.c | 53 +++++++--- scripts/kconfig/streamline_config.pl | 52 +++++++-- scripts/recordmcount.h | 2 +- security/integrity/ima/ima_api.c | 4 +- security/integrity/ima/ima_queue.c | 17 ++- sound/pci/hda/hda_local.h | 7 +- sound/pci/hda/hda_proc.c | 2 + sound/pci/hda/patch_sigmatel.c | 2 +- sound/pci/ice1712/amp.c | 7 +- sound/pci/oxygen/xonar_wm87x6.c | 1 + sound/usb/usx2y/usb_stream.c | 6 +- 111 files changed, 870 insertions(+), 454 deletions(-)
PATCH 1/90 mtdoops: fix the oops_page_used array size
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roman Tereshonkov <[email protected]>
commit 556f063580db2953a7e53cd46b47724246320f60 upstream.
The array of unsigned long pointed by oops_page_used is allocated by vmalloc which requires the size to be in bytes.
BITS_PER_LONG is equal to 32.
If we want to allocate memory for 32 pages with one bit per page then 32 / BITS_PER_LONG is equal to 1 byte that is 8 bits.
To fix it we need to multiply the result by sizeof(unsigned long) equal to 4.
--- drivers/mtd/mtdoops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/mtdoops.c +1 -1
@@ -369,7 +369,7 @@ static void mtdoops_notify_add(struct mt/* oops_page_used is a bit field */ cxt->oops_page_used =vmalloc (DIV_ROUND_UP (mtdoops_pages, -BITS_PER_LONG )); +BITS_PER_LONG ) *sizeof (unsigned long ));if (!cxt->oops_page_used) {printk (KERN_ERR "mtdoops: could not allocate page array\n" );return ;
PATCH 2/90 mtd: mtdoops: skip reading initially bad blocks
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roman Tereshonkov <[email protected]>
commit 3538c56329936c78f7d356889908790006d0124c upstream.
Use block_isbad to check and skip the bad blocks reading. This will allow to get rid of the read errors if bad blocks are present initially.
--- drivers/mtd/mtdoops.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/mtd/mtdoops.c +3 -0
@@ -253,6 +253,9 @@ static void find_next_position(struct mtsize_t retlen;for (page =0 ; page < cxt->oops_pages; page++) { +if (mtd->block_isbad && + mtd->block_isbad (mtd, page * record_size)) +continue ;/* Assume the page is used */ mark_page_used (cxt, page); ret = mtd->read(mtd, page * record_size, MTDOOPS_HEADER_SIZE,
PATCH 3/90 mtd: mtd_blkdevs: dont increase open count on error path
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brian Norris <[email protected]>
commit 342ff28f5a2e5aa3236617bd2bddf6c749677ef2 upstream.
Some error paths in mtd_blkdevs were fixed in the following commit:
commit 94735ec4044a6d318b83ad3c5794e931ed168d10
mtd: mtd_blkdevs: fix error path in blktrans_open
But on these error paths, the block device's `dev->open' count is already incremented before we check for errors. This meant that, while the error path was handled correctly on the first time through blktrans_open(), the device is erroneously considered already open on the second time through.
This problem can be seen, for instance, when a UBI volume is simultaneously mounted as a UBIFS partition and read through its corresponding gluebi mtdblockX device. This results in blktrans_open() passing its error checks (with `dev->open > 0') without actually having a handle on the device. Here's a summarized log of the actions and results with nandsim:
# modprobe nandsim
# modprobe mtdblock
# modprobe gluebi
# modprobe ubifs
# ubiattach /dev/ubi_ctrl -m 0
...
# ubimkvol /dev/ubi0 -N test -s 16MiB
...
# mount -t ubifs ubi0:test /mnt
# ls /dev/mtdblock*
/dev/mtdblock0 /dev/mtdblock1
# cat /dev/mtdblock1 > /dev/null
cat: can't open '/dev/mtdblock4': Device or resource busy
# cat /dev/mtdblock1 > /dev/null CPU 0 Unable to handle kernel paging request at virtual address
fffffff0, epc == 8031536c, ra == 8031f280
Oops[#1]:
...
Call Trace:
[<8031536c>] ubi_leb_read+0x14/0x164
[<8031f280>] gluebi_read+0xf0/0x148
[<802edba8>] mtdblock_readsect+0x64/0x198
[<802ecfe4>] mtd_blktrans_thread+0x330/0x3f4
[<8005be98>] kthread+0x88/0x90
[<8000bc04>] kernel_thread_helper+0x10/0x18--- drivers/mtd/mtd_blkdevs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mtd/mtd_blkdevs.c +2 -1
@@ -215,7 +215,7 @@ static int blktrans_open(struct block_demutex_lock (&dev->lock); -if (dev->open++) +if (dev->open) goto unlock;kref_get (&dev->ref);
@@ -235,6 +235,7 @@ static int blktrans_open(struct block_de goto error_release; unlock: + dev->open++;mutex_unlock (&dev->lock);blktrans_dev_put (dev);return ret;
PATCH 4/90 mtd: tests: stresstest: bail out if device has not enough eraseblocks
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wolfram Sang <[email protected]>
commit 2f4478ccff7df845dc9c0f8996a96373122c4417 upstream.
stresstest needs at least two eraseblocks. Bail out gracefully if that condition is not met. Fixes the following 'division by zero' OOPS:
[ 619.100000] mtd_stresstest: MTD device size 131072, eraseblock size 131072, page size 2048, count of eraseblocks 1, pages per eraseblock 64, OOB size 64 [ 619.120000] mtd_stresstest: scanning for bad eraseblocks [ 619.120000] mtd_stresstest: scanned 1 eraseblocks, 0 are bad [ 619.130000] mtd_stresstest: doing operations [ 619.130000] mtd_stresstest: 0 operations done [ 619.140000] Division by zero in kernel.
...
caused by
/* Read or write up 2 eraseblocks at a time - hence 'ebcnt - 1' */
eb %= (ebcnt - 1);--- drivers/mtd/tests/mtd_stresstest.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/mtd/tests/mtd_stresstest.c +7 -0
@@ -277,6 +277,12 @@ static int __init mtd_stresstest_init(vo (unsigned long long )mtd->size, mtd->erasesize, pgsize, ebcnt, pgcnt, mtd->oobsize); +if (ebcnt <2 ) { +printk (PRINT_PREF "error: need at least 2 eraseblocks\n" ); + err = -ENOSPC ; + goto out_put_mtd; + } +/* Read or write up 2 eraseblocks at a time */ bufsize = mtd->erasesize *2 ;
@@ -315,6 +321,7 @@ out:kfree (bbt);vfree (writebuf);vfree (readbuf); +out_put_mtd:put_mtd_device (mtd);if (err)printk (PRINT_PREF "error %d occurred\n" , err);
PATCH 5/90 drivers/rtc/interface.c: fix alarm rollover when day or month is out-of-range
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
commit e74a8f2edb92cb690b467cea0ab652c509e9f624 upstream.
Commit f44f7f96a20a ("RTC: Initialize kernel state from RTC") introduced a potential infinite loop. If an alarm time contains a wildcard month and an invalid day (> 31), or a wildcard year and an invalid month (>= 12), the loop searching for the next matching date will never terminate. Treat the invalid values as wildcards.
Fixes <http://bugs.debian.org/646429>, <http://bugs.debian.org/653331>
--- drivers/rtc/interface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/rtc/interface.c +2 -2
@@ -227,11 +227,11 @@ int __rtc_read_alarm(struct rtc_device * alarm->time.tm_hour = now.tm_hour;/* For simplicity, only support date rollover for now */ -if (alarm->time.tm_mday ==-1 ) { +if (alarm->time.tm_mday <1 || alarm->time.tm_mday >31 ) { alarm->time.tm_mday = now.tm_mday; missing = day; } -if (alarm->time.tm_mon ==-1 ) { +if ((unsigned )alarm->time.tm_mon >=12 ) { alarm->time.tm_mon = now.tm_mon;if (missing == none) missing = month;
PATCH 6/90 ext4: fix undefined behavior in ext4_fill_flex_info()
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xi Wang <[email protected]>
commit d50f2ab6f050311dbf7b8f5501b25f0bf64a439b upstream.
Commit 503358ae01b70ce6909d19dd01287093f6b6271c ("ext4: avoid divide by zero when trying to mount a corrupted file system") fixes CVE-2009-4307 by performing a sanity check on s_log_groups_per_flex, since it can be set to a bogus value by an attacker.
sbi->s_log_groups_per_flex = sbi->s_es->s_log_groups_per_flex;
groups_per_flex = 1 << sbi->s_log_groups_per_flex;
if (groups_per_flex < 2) { ... }This patch fixes two potential issues in the previous commit.
1) The sanity check might only work on architectures like PowerPC. On x86, 5 bits are used for the shifting amount. That means, given a large s_log_groups_per_flex value like 36, groups_per_flex = 1 << 36 is essentially 1 << 4 = 16, rather than 0. This will bypass the check, leaving s_log_groups_per_flex and groups_per_flex inconsistent.
2) The sanity check relies on undefined behavior, i.e., oversized shift. A standard-confirming C compiler could rewrite the check in unexpected ways. Consider the following equivalent form, assuming groups_per_flex is unsigned for simplicity.
groups_per_flex = 1 << sbi->s_log_groups_per_flex;
if (groups_per_flex == 0 || groups_per_flex == 1) {We compile the code snippet using Clang 3.0 and GCC 4.6. Clang will completely optimize away the check groups_per_flex == 0, leaving the patched code as vulnerable as the original. GCC keeps the check, but there is no guarantee that future versions will do the same.
--- fs/ext4/super.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
fs/ext4/super.c +3 -4
@@ -1957,17 +1957,16 @@ static int ext4_fill_flex_info(struct sustruct ext4_group_desc *gdp =NULL ;ext4_group_t flex_group_count;ext4_group_t flex_group; -int groups_per_flex =0 ; +unsigned int groups_per_flex =0 ;size_t size;int i; sbi->s_log_groups_per_flex = sbi->s_es->s_log_groups_per_flex; - groups_per_flex =1 << sbi->s_log_groups_per_flex; - -if (groups_per_flex <2 ) { +if (sbi->s_log_groups_per_flex <1 || sbi->s_log_groups_per_flex >31 ) { sbi->s_log_groups_per_flex =0 ;return 1 ; } + groups_per_flex =1 << sbi->s_log_groups_per_flex;/* We allocate both existing and potentially added groups */ flex_group_count = ((sbi->s_groups_count + groups_per_flex - 1) +
PATCH 7/90 ALSA: snd-usb-us122l: Delete calls to preempt_disable
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karsten Wiese <[email protected]>
commit d0f3a2eb9062560bebca8b923424f3ca02a331ba upstream.
They are not needed here.
--- sound/usb/usx2y/usb_stream.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
sound/usb/usx2y/usb_stream.c +2 -4
@@ -674,7 +674,7 @@ dotry: inurb->transfer_buffer_length = inurb->number_of_packets * inurb->iso_frame_desc[0 ].length; -preempt_disable (); +if (u ==0 ) {int now;struct usb_device *dev = inurb->dev;
@@ -686,19 +686,17 @@ dotry: } err =usb_submit_urb (inurb,GFP_ATOMIC );if (err <0 ) { -preempt_enable ();snd_printk (KERN_ERR "usb_submit_urb(sk->inurb[%i])" " returned %i\n" , u, err);return err; } err =usb_submit_urb (outurb,GFP_ATOMIC );if (err <0 ) { -preempt_enable ();snd_printk (KERN_ERR "usb_submit_urb(sk->outurb[%i])" " returned %i\n" , u, err);return err; } -preempt_enable (); +if (inurb->start_frame != outurb->start_frame) { snd_printd(KERN_DEBUG "u[%i] start_frames differ in:%u out:%u\n",
PATCH 8/90 ALSA: ice1724 - Check for ac97 to avoid kernel oops
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Hofman <[email protected]>
commit e7848163aa2a649d9065f230fadff80dc3519775 upstream.
Cards with identical PCI ids but no AC97 config in EEPROM do not have the ac97 field initialized. We must check for this case to avoid kernel oops.
--- sound/pci/ice1712/amp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
sound/pci/ice1712/amp.c +5 -2
@@ -68,8 +68,11 @@ static int __devinit snd_vt1724_amp_initstatic int __devinit snd_vt1724_amp_add_controls (struct snd_ice1712 *ice) { -/* we use pins 39 and 41 of the VT1616 for left and right read outputs */ -snd_ac97_write_cache (ice->ac97,0x5a ,snd_ac97_read (ice->ac97,0x5a ) & ~0x8000 ); +if (ice->ac97) +/* we use pins 39 and 41 of the VT1616 for left and right +read outputs */ +snd_ac97_write_cache (ice->ac97,0x5a , +snd_ac97_read (ice->ac97,0x5a ) & ~0x8000 );return 0 ; }
PATCH 9/90 ALSA: hda - Return the error from get_wcaps_type() for invalid NIDs
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 3a90274de3548ebb2aabfbf488cea8e275a73dc6 upstream.
When an invalid NID is given, get_wcaps() returns zero as the error, but get_wcaps_type() takes it as the normal value and returns a bogus AC_WID_AUD_OUT value. This confuses the parser.
With this patch, get_wcaps_type() returns -1 when value 0 is given, i.e. an invalid NID is passed to get_wcaps().
Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=740118
--- sound/pci/hda/hda_local.h | 7 ++++++- sound/pci/hda/hda_proc.c | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-)
sound/pci/hda/hda_local.h +6 -1
@@ -474,7 +474,12 @@ static inline u32 get_wcaps(struct hda_c }/* get the widget type from widget capability bits */ -#define get_wcaps_type (wcaps) (((wcaps) & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT) +static inline int get_wcaps_type (unsigned int wcaps) +{ +if (!wcaps) +return -1 ;/* invalid type */ +return (wcaps &AC_WCAP_TYPE ) >>AC_WCAP_TYPE_SHIFT ; +}static inline unsigned int get_wcaps_channels (u32 wcaps) {
sound/pci/hda/hda_proc.c +2 -0
@@ -54,6 +54,8 @@ static const char *get_wid_type_name(uns [AC_WID_BEEP] = "Beep Generator Widget", [AC_WID_VENDOR] = "Vendor Defined Widget", }; +if (wid_value ==-1 ) +return "UNKNOWN Widget" ; wid_value &=0xf ;if (names[wid_value])return names[wid_value];
PATCH 10/90 drm/radeon/kms: workaround invalid AVI infoframe checksum issue
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafał Miłecki <[email protected]>
commit 92db7f6c860b8190571a9dc1fcbc16d003422fe8 upstream.
This change was verified to fix both issues with no video I've investigated. I've also checked checksum calculation with fglrx on:
RV620, HD54xx, HD5450, HD6310, HD6320.
--- drivers/gpu/drm/radeon/r600_hdmi.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/radeon/r600_hdmi.c +7 -0
@@ -196,6 +196,13 @@ static void r600_hdmi_videoinfoframe( frame[0xD ] = (right_bar >>8 );r600_hdmi_infoframe_checksum (0x82 ,0x02 ,0x0D , frame); +/* Our header values (type, version, length) should be alright, Intel +* is using the same. Checksum function also seems to be OK, it works +* fine for audio infoframe. However calculated value is always lower +* by 2 in comparison to fglrx. It breaks displaying anything in case +* of TVs that strictly check the checksum. Hack it manually here to +* workaround this issue. */ + frame[0x0 ] +=2 ;WREG32 (offset+R600_HDMI_VIDEOINFOFRAME_0 , frame[0x0 ] | (frame[0x1 ] <<8 ) | (frame[0x2 ] <<16 ) | (frame[0x3 ] <<24 ));
PATCH 11/90 drm/radeon/kms: disable writeback on pre-R300 asics
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 28eebb703e28bc455ba704adb1026f76649b768c upstream.
We often end up missing fences on older asics with writeback enabled which leads to delays in the userspace accel code, so just disable it by default on those asics.
--- drivers/gpu/drm/radeon/radeon_device.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/radeon/radeon_device.c +4 -1
@@ -223,8 +223,11 @@ int radeon_wb_init(struct radeon_deviceif (radeon_no_wb ==1 ) rdev->wb.enabled = false;else { -/* often unreliable on AGP */ if (rdev->flags &RADEON_IS_AGP ) { +/* often unreliable on AGP */ + rdev->wb.enabled = false; + }else if (rdev->family <CHIP_R300 ) { +/* often unreliable on pre-r300 */ rdev->wb.enabled = false; }else { rdev->wb.enabled = true;
PATCH 12/90 radeon: Fix disabling PCI bus mastering on big endian hosts.
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michel Dänzer <[email protected]>
commit 3df96909b75835d487a9178761622b0cbd7310d4 upstream.
It would previously write basically random bits to PCI configuration space... Not very surprising that the GPU tended to stop responding completely. The resulting MCE even froze the whole machine sometimes.
Now resetting the GPU after a lockup has at least a fighting chance of succeeding.
--- drivers/gpu/drm/radeon/r100.c | 5 +++-- drivers/gpu/drm/radeon/rs600.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/radeon/r100.c +3 -2
@@ -2069,6 +2069,7 @@ bool r100_gpu_is_lockup(struct radeon_devoid r100_bm_disable (struct radeon_device *rdev) {u32 tmp; +u16 tmp16;/* disable bus mastering */ tmp =RREG32 (R_000030_BUS_CNTL );
@@ -2079,8 +2080,8 @@ void r100_bm_disable(struct radeon_devicWREG32 (R_000030_BUS_CNTL , (tmp &0xFFFFFFFF ) |0x00000040 ); tmp =RREG32 (RADEON_BUS_CNTL );mdelay (1 ); -pci_read_config_word (rdev->pdev,0x4 , (u16 *)&tmp); -pci_write_config_word (rdev->pdev,0x4 , tmp &0xFFFB ); +pci_read_config_word (rdev->pdev,0x4 , &tmp16); +pci_write_config_word (rdev->pdev,0x4 , tmp16 &0xFFFB );mdelay (1 ); }
drivers/gpu/drm/radeon/rs600.c +2 -2
@@ -324,10 +324,10 @@ void rs600_hpd_fini(struct radeon_devicevoid rs600_bm_disable (struct radeon_device *rdev) { -u32 tmp; +u16 tmp;/* disable bus mastering */ -pci_read_config_word (rdev->pdev,0x4 , (u16 *)&tmp); +pci_read_config_word (rdev->pdev,0x4 , &tmp);pci_write_config_word (rdev->pdev,0x4 , tmp &0xFFFB );mdelay (1 ); }
PATCH 13/90 NFS: Retry mounting NFSROOT
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
commit 43717c7daebf10b43f12e68512484b3095bb1ba5 upstream.
Lukas Razik <[email protected]> reports that on his SPARC system, booting with an NFS root file system stopped working after commit 56463e50 "NFS: Use super.c for NFSROOT mount option parsing."
We found that the network switch to which Lukas' client was attached was delaying access to the LAN after the client's NIC driver reported that its link was up. The delay was longer than the timeouts used in the NFS client during mounting.
NFSROOT worked for Lukas before commit 56463e50 because in those kernels, the client's first operation was an rpcbind request to determine which port the NFS server was listening on. When that request failed after a long timeout, the client simply selected the default NFS port (2049). By that time the switch was allowing access to the LAN, and the mount succeeded.
Neither of these client behaviors is desirable, so reverting 56463e50 is really not a choice. Instead, introduce a mechanism that retries the NFSROOT mount request several times. This is the same tactic that normal user space NFS mounts employ to overcome server and network delays.
--- init/do_mounts.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-)
init/do_mounts.c +31 -4
@@ -360,15 +360,42 @@ out: }#ifdef CONFIG_ROOT_NFS + +#define NFSROOT_TIMEOUT_MIN 5 +#define NFSROOT_TIMEOUT_MAX 30 +#define NFSROOT_RETRY_MAX 5 +static int __init mount_nfs_root (void ) {char *root_dev, *root_data; +unsigned int timeout; +int try, err; -if (nfs_root_data (&root_dev, &root_data) !=0 ) -return 0 ; -if (do_mount_root (root_dev,"nfs" , root_mountflags, root_data) !=0 ) + err =nfs_root_data (&root_dev, &root_data); +if (err !=0 )return 0 ; -return 1 ; + +/* +* The server or network may not be ready, so try several +* times. Stop after a few tries in case the client wants +* to fall back to other boot methods. +*/ + timeout =NFSROOT_TIMEOUT_MIN ; +for (try =1 ; ; try++) { + err =do_mount_root (root_dev,"nfs" , + root_mountflags, root_data); +if (err ==0 ) +return 1 ; +if (try >NFSROOT_RETRY_MAX ) +break ; + +/* Wait, in case the server refused us immediately */ +ssleep (timeout); + timeout <<=1 ; +if (timeout >NFSROOT_TIMEOUT_MAX ) + timeout =NFSROOT_TIMEOUT_MAX ; + } +return 0 ; }#endif
PATCH 14/90 NFSv4.1: fix backchannel slotid off-by-one bug
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Adamson <[email protected]>
commit 61f2e5106582d02f30b6807e3f9c07463c572ccb upstream.
--- fs/nfs/callback_proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/callback_proc.c +1 -1
@@ -324,7 +324,7 @@ validate_seqid(struct nfs4_slot_table *tdprintk ("%s enter. slotid %d seqid %d\n" , __func__, args->csa_slotid, args->csa_sequenceid); -if (args->csa_slotid >NFS41_BC_MAX_CALLBACKS ) +if (args->csa_slotid >=NFS41_BC_MAX_CALLBACKS )return htonl (NFS4ERR_BADSLOT ); slot = tbl->slots + args->csa_slotid;
PATCH 15/90 nfs: fix regression in handling of context= option in NFSv4
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
commit 8a0d551a59ac92d8ff048d6cb29d3a02073e81e8 upstream.
Setting the security context of a NFSv4 mount via the context= mount option is currently broken. The NFSv4 codepath allocates a parsed options struct, and then parses the mount options to fill it. It eventually calls nfs4_remote_mount which calls security_init_mnt_opts. That clobbers the lsm_opts struct that was populated earlier. This bug also looks like it causes a small memory leak on each v4 mount where context= is used.
Fix this by moving the initialization of the lsm_opts into nfs_alloc_parsed_mount_data. Also, add a destructor for nfs_parsed_mount_data to make it easier to free all of the allocations hanging off of it, and to ensure that the security_free_mnt_opts is called whenever security_init_mnt_opts is.
I believe this regression was introduced quite some time ago, probably by commit c02d7adf.
--- fs/nfs/super.c | 43 +++++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 24 deletions(-)
fs/nfs/super.c +19 -24
@@ -904,10 +904,24 @@ static struct nfs_parsed_mount_data *nfs data->auth_flavor_len =1 ; data->version = version; data->minorversion =0 ; +security_init_mnt_opts (&data->lsm_opts); }return data; } +static void nfs_free_parsed_mount_data (struct nfs_parsed_mount_data *data) +{ +if (data) { +kfree (data->client_address); +kfree (data->mount_server.hostname); +kfree (data->nfs_server.export_path); +kfree (data->nfs_server.hostname); +kfree (data->fscache_uniq); +security_free_mnt_opts (&data->lsm_opts); +kfree (data); + } +} +/* * Sanity-check a server address provided by the mount command. *
@@ -2218,9 +2232,7 @@ static struct dentry *nfs_fs_mount(struc data =nfs_alloc_parsed_mount_data (NFS_DEFAULT_VERSION ); mntfh =nfs_alloc_fhandle ();if (data ==NULL || mntfh ==NULL ) - goto out_free_fh; - -security_init_mnt_opts (&data->lsm_opts); + goto out;/* Validate the mount data */ error =nfs_validate_mount_data (raw_data, data, mntfh, dev_name);
@@ -2232,8 +2244,6 @@ static struct dentry *nfs_fs_mount(struc#ifdef CONFIG_NFS_V4 if (data->version ==4 ) { mntroot =nfs4_try_mount (flags, dev_name, data); -kfree (data->client_address); -kfree (data->nfs_server.export_path); goto out; }#endif /* CONFIG_NFS_V4 */
@@ -2284,13 +2294,8 @@ static struct dentry *nfs_fs_mount(struc s->s_flags |=MS_ACTIVE ; out: -kfree (data->nfs_server.hostname); -kfree (data->mount_server.hostname); -kfree (data->fscache_uniq); -security_free_mnt_opts (&data->lsm_opts); -out_free_fh: +nfs_free_parsed_mount_data (data);nfs_free_fhandle (mntfh); -kfree (data);return mntroot; out_err_nosb:
@@ -2613,9 +2618,7 @@ nfs4_remote_mount(struct file_system_typ mntfh =nfs_alloc_fhandle ();if (data ==NULL || mntfh ==NULL ) - goto out_free_fh; - -security_init_mnt_opts (&data->lsm_opts); + goto out;/* Get a volume representation */ server =nfs4_create_server (data, mntfh);
@@ -2663,13 +2666,10 @@ nfs4_remote_mount(struct file_system_typ s->s_flags |=MS_ACTIVE ; -security_free_mnt_opts (&data->lsm_opts);nfs_free_fhandle (mntfh);return mntroot; out: -security_free_mnt_opts (&data->lsm_opts); -out_free_fh:nfs_free_fhandle (mntfh);return ERR_PTR (error);
@@ -2855,7 +2855,7 @@ static struct dentry *nfs4_mount(struct data =nfs_alloc_parsed_mount_data (4 );if (data ==NULL ) - goto out_free_data; + goto out;/* Validate the mount data */ error =nfs4_validate_mount_data (raw_data, data, dev_name);
@@ -2869,12 +2869,7 @@ static struct dentry *nfs4_mount(struct error =PTR_ERR (res); out: -kfree (data->client_address); -kfree (data->nfs_server.export_path); -kfree (data->nfs_server.hostname); -kfree (data->fscache_uniq); -out_free_data: -kfree (data); +nfs_free_parsed_mount_data (data);dprintk ("<-- nfs4_mount() = %d%s\n" , error, error !=0 ?" [error]" :"" );return res;
PATCH 16/90 HID: bump maximum global item tag report size to 96 bytes
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chase Douglas <[email protected]>
commit e46e927b9b7e8d95526e69322855243882b7e1a3 upstream.
This allows the latest N-Trig devices to function properly.
--- drivers/hid/hid-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-core.c +1 -1
@@ -361,7 +361,7 @@ static int hid_parser_global(struct hid_case HID_GLOBAL_ITEM_TAG_REPORT_SIZE : parser->global.report_size =item_udata (item); -if (parser->global.report_size >32 ) { +if (parser->global.report_size >96 ) {dbg_hid ("invalid report_size %d\n" , parser->global.report_size);return -1 ;
PATCH 17/90 UBI: fix missing scrub when there is a bit-flip
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bhavesh Parekh <[email protected]>
commit e801e128b2200c40a0ec236cf2330b2586b6e05a upstream.
Under some cases, when scrubbing the PEB if we did not get the lock on the PEB it fails to scrub. Add that PEB again to the scrub list
Artem: minor amendments.
--- drivers/mtd/ubi/eba.c | 6 ++++-- drivers/mtd/ubi/ubi.h | 2 ++ drivers/mtd/ubi/wl.c | 5 ++++- 3 files changed, 10 insertions(+), 3 deletions(-)
drivers/mtd/ubi/eba.c +4 -2
@@ -1028,12 +1028,14 @@ int ubi_eba_copy_leb(struct ubi_device ** 'ubi_wl_put_peb()' function on the @ubi->move_mutex. In turn, we are * holding @ubi->move_mutex and go sleep on the LEB lock. So, if the * LEB is already locked, we just do not move it and return -* %MOVE_CANCEL_RACE, which means that UBI will re-try, but later. +* %MOVE_RETRY. Note, we do not return %MOVE_CANCEL_RACE here because +* we do not know the reasons of the contention - it may be just a +* normal I/O on this LEB, so we want to re-try. */ err =leb_write_trylock (ubi, vol_id, lnum);if (err) {dbg_wl ("contention on LEB %d:%d, cancel" , vol_id, lnum); -return MOVE_CANCEL_RACE ; +return MOVE_RETRY ; }/*
drivers/mtd/ubi/ubi.h +2 -0
@@ -121,6 +121,7 @@ enum {* PEB * MOVE_CANCEL_BITFLIPS: canceled because a bit-flip was detected in the * target PEB +* MOVE_RETRY: retry scrubbing the PEB */ enum {MOVE_CANCEL_RACE =1 ,
@@ -128,6 +129,7 @@ enum {MOVE_TARGET_RD_ERR ,MOVE_TARGET_WR_ERR ,MOVE_CANCEL_BITFLIPS , + MOVE_RETRY, };/**
drivers/mtd/ubi/wl.c +4 -1
@@ -792,7 +792,10 @@ static int wear_leveling_worker(struct u protect =1 ; goto out_not_moved; } - +if (err ==MOVE_RETRY ) { + scrubbing =1 ; + goto out_not_moved; + }if (err ==MOVE_CANCEL_BITFLIPS || err ==MOVE_TARGET_WR_ERR || err ==MOVE_TARGET_RD_ERR ) {/*
PATCH 18/90 UBI: fix use-after-free on error path
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Artem Bityutskiy <[email protected]>
commit e57e0d8e818512047fe379157c3f77f1b9fabffb upstream.
When we fail to erase a PEB, we free the corresponding erase entry object, but then re-schedule this object if the error code was something like -EAGAIN. Obviously, it is a bug to use the object after we have freed it.
--- drivers/mtd/ubi/wl.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/mtd/ubi/wl.c +4 -3
@@ -1049,7 +1049,6 @@ static int erase_worker(struct ubi_devicubi_err ("failed to erase PEB %d, error %d" , pnum, err);kfree (wl_wrk); -kmem_cache_free (ubi_wl_entry_slab, e);if (err == -EINTR || err == -ENOMEM || err == -EAGAIN || err == -EBUSY ) {
@@ -1062,14 +1061,16 @@ static int erase_worker(struct ubi_devic goto out_ro; }return err; - }else if (err != -EIO ) { + } + +kmem_cache_free (ubi_wl_entry_slab, e); +if (err != -EIO )/* * If this is not %-EIO, we have no idea what to do. Scheduling * this physical eraseblock for erasure again would cause * errors again and again. Well, lets switch to R/O mode. */ goto out_ro; - }/* It is %-EIO, the PEB went bad */
PATCH 19/90 PCI: Fix PCI_EXP_TYPE_RC_EC value
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Williamson <[email protected]>
commit 1830ea91c20b06608f7cdb2455ce05ba834b3214 upstream.
Spec shows this as 1010b = 0xa
--- include/linux/pci_regs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/pci_regs.h +1 -1
@@ -392,7 +392,7 @@#define PCI_EXP_TYPE_DOWNSTREAM 0x6/* Downstream Port */ #define PCI_EXP_TYPE_PCI_BRIDGE 0x7/* PCI/PCI-X Bridge */ #define PCI_EXP_TYPE_RC_END 0x9/* Root Complex Integrated Endpoint */ -#define PCI_EXP_TYPE_RC_EC 0x10/* Root Complex Event Collector */ +#define PCI_EXP_TYPE_RC_EC 0xa/* Root Complex Event Collector */ #define PCI_EXP_FLAGS_SLOT 0x0100/* Slot implemented */ #define PCI_EXP_FLAGS_IRQ 0x3e00/* Interrupt message number */ #define PCI_EXP_DEVCAP 4/* Device capabilities */
PATCH 20/90 PCI: msi: Disable msi interrupts when we initialize a pci device
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Eric W. Biederman" <[email protected]>
commit a776c491ca5e38c26d9f66923ff574d041e747f4 upstream.
I traced a nasty kexec on panic boot failure to the fact that we had screaming msi interrupts and we were not disabling the msi messages at kernel startup. The booting kernel had not enabled those interupts so was not prepared to handle them.
I can see no reason why we would ever want to leave the msi interrupts enabled at boot if something else has enabled those interrupts. The pci spec specifies that msi interrupts should be off by default. Drivers are expected to enable the msi interrupts if they want to use them. Our interrupt handling code reprograms the interrupt handlers at boot and will not be be able to do anything useful with an unexpected interrupt.
This patch applies cleanly all of the way back to 2.6.32 where I noticed the problem.
--- drivers/pci/msi.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/pci/msi.c +10 -0
@@ -869,5 +869,15 @@ EXPORT_SYMBOL(pci_msi_enabled);void pci_msi_init_pci_dev (struct pci_dev *dev) { +int pos;INIT_LIST_HEAD (&dev->msi_list); + +/* Disable the msi hardware to avoid screaming interrupts +* during boot. This is the power on reset default so +* usually this should be a noop. +*/ + pos =pci_find_capability (dev,PCI_CAP_ID_MSI ); +if (pos) +msi_set_enable (dev, pos,0 ); +msix_set_enable (dev,0 ); }
PATCH 21/90 x86/PCI: Ignore CPU non-addressable _CRS reserved memory resources
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gary Hade <[email protected]>
commit ae5cd86455381282ece162966183d3f208c6fad7 upstream.
This assures that a _CRS reserved host bridge window or window region is not used if it is not addressable by the CPU. The new code either trims the window to exclude the non-addressable portion or totally ignores the window if the entire window is non-addressable.
The current code has been shown to be problematic with 32-bit non-PAE kernels on systems where _CRS reserves resources above 4GB.
--- arch/x86/pci/acpi.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
arch/x86/pci/acpi.c +16 -2
@@ -149,7 +149,7 @@ setup_resource(struct acpi_resource *acpstruct acpi_resource_address64 addr;acpi_status status;unsigned long flags; -u64 start, end; +u64 start, orig_end, end; status =resource_to_addr (acpi_res, &addr);if (!ACPI_SUCCESS (status))
@@ -165,7 +165,21 @@ setup_resource(struct acpi_resource *acpreturn AE_OK ; start = addr.minimum + addr.translation_offset; - end = addr.maximum + addr.translation_offset; + orig_end = end = addr.maximum + addr.translation_offset; + +/* Exclude non-addressable range or non-addressable portion of range */ + end =min (end, (u64 )iomem_resource.end); +if (end <= start) { +dev_info (&info->bridge->dev, +"host bridge window [%#llx-%#llx] " +"(ignored, not CPU addressable)\n" , start, orig_end); +return AE_OK ; + }else if (orig_end != end) { +dev_info (&info->bridge->dev, +"host bridge window [%#llx-%#llx] " +"([%#llx-%#llx] ignored, not CPU addressable)\n" , + start, orig_end, end +1 , orig_end); + } res = &info->res[info->res_num]; res->name = info->name;
PATCH 22/90 x86/PCI: amd: factor out MMCONFIG discovery
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjorn Helgaas <[email protected]>
commit 24d25dbfa63c376323096660bfa9ad45a08870ce upstream.
This factors out the AMD native MMCONFIG discovery so we can use it outside amd_bus.c.
amd_bus.c reads AMD MSRs so it can remove the MMCONFIG area from the PCI resources. We may also need the MMCONFIG information to work around BIOS defects in the ACPI MCFG table.
--- arch/x86/include/asm/amd_nb.h | 2 ++ arch/x86/kernel/amd_nb.c | 31 +++++++++++++++++++++++++++++++ arch/x86/pci/amd_bus.c | 42 +++++++++++------------------------------- 3 files changed, 44 insertions(+), 31 deletions(-)
arch/x86/include/asm/amd_nb.h +2 -0
@@ -1,6 +1,7 @@#ifndef _ASM_X86_AMD_NB_H#define _ASM_X86_AMD_NB_H +#include <linux/ioport.h> #include <linux/pci.h> struct amd_nb_bus_dev_range {
@@ -13,6 +14,7 @@ extern const struct pci_device_id amd_nbextern const struct amd_nb_bus_dev_range amd_nb_bus_dev_ranges[];extern bool early_is_amd_nb (u32 value); +extern struct resource *amd_get_mmconfig_range (struct resource *res);extern int amd_cache_northbridges (void );extern void amd_flush_garts (void );extern int amd_numa_init (void );
arch/x86/kernel/amd_nb.c +31 -0
@@ -119,6 +119,37 @@ bool __init early_is_amd_nb(u32 device)return false; } +struct resource *amd_get_mmconfig_range (struct resource *res) +{ +u32 address; +u64 base, msr; +unsigned segn_busn_bits; + +if (boot_cpu_data.x86_vendor !=X86_VENDOR_AMD ) +return NULL ; + +/* assume all cpus from fam10h have mmconfig */ +if (boot_cpu_data.x86 <0x10 ) +return NULL ; + + address =MSR_FAM10H_MMIO_CONF_BASE ; +rdmsrl (address, msr); + +/* mmconfig is not enabled */ +if (!(msr &FAM10H_MMIO_CONF_ENABLE )) +return NULL ; + + base = msr & (FAM10H_MMIO_CONF_BASE_MASK <<FAM10H_MMIO_CONF_BASE_SHIFT ); + + segn_busn_bits = (msr >>FAM10H_MMIO_CONF_BUSRANGE_SHIFT ) & +FAM10H_MMIO_CONF_BUSRANGE_MASK ; + + res->flags =IORESOURCE_MEM ; + res->start = base; + res->end = base + (1ULL <<(segn_busn_bits +20 )) -1 ; +return res; +} +int amd_get_subcaches (int cpu) {struct pci_dev *link =node_to_amd_nb (amd_get_nb_id (cpu))->link;
arch/x86/pci/amd_bus.c +11 -31
63 lines not on this page · raw message
PATCH 23/90 x86/PCI: build amd_bus.o only when CONFIG_AMD_NB=y
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjorn Helgaas <[email protected]>
commit 5cf9a4e69c1ff0ccdd1d2b7404f95c0531355274 upstream.
We only need amd_bus.o for AMD systems with PCI. arch/x86/pci/Makefile already depends on CONFIG_PCI=y, so this patch just adds the dependency on CONFIG_AMD_NB.
--- arch/x86/pci/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/pci/Makefile +2 -1
@@ -18,8 +18,9 @@ obj-$(CONFIG_X86_NUMAQ) += numaq_32.o obj-$(CONFIG_X86_MRST) += mrst.o obj-y += common.o early.o -obj-y += amd_bus.o bus_numa.o +obj-y += bus_numa.o +obj-$(CONFIG_AMD_NB) += amd_bus.o obj-$(CONFIG_PCI_CNB20LE_QUIRK) += broadcom_bus.o ifeq ($(CONFIG_PCI_DEBUG),y)
PATCH 24/90 SCSI: mpt2sas: Release spinlock for the raid device list before blocking it
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: "[email protected]" <[email protected]>
commit 30c43282f3d347f47f9e05199d2b14f56f3f2837 upstream.
Added code to release the spinlock that is used to protect the raid device list before calling a function that can block. The blocking was causing a reschedule, and subsequently it is tried to acquire the same lock, resulting in a panic (NMI Watchdog detecting a CPU lockup).
--- drivers/scsi/mpt2sas/mpt2sas_scsih.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/scsi/mpt2sas/mpt2sas_scsih.c +4 -3
@@ -6425,6 +6425,7 @@ _scsih_mark_responding_raid_device(struc }else sas_target_priv_data =NULL ; raid_device->responding =1 ; +spin_unlock_irqrestore (&ioc->raid_device_lock, flags);starget_printk (KERN_INFO , raid_device->starget,"handle(0x%04x), wwid(0x%016llx)\n" , handle, (unsigned long long )raid_device->wwid);
@@ -6435,16 +6436,16 @@ _scsih_mark_responding_raid_device(struc*/ _scsih_init_warpdrive_properties (ioc, raid_device);if (raid_device->handle == handle) - goto out; +return ;printk (KERN_INFO "\thandle changed from(0x%04x)!!!\n" , raid_device->handle); raid_device->handle = handle;if (sas_target_priv_data) sas_target_priv_data->handle = handle; - goto out; +return ; } } - out: +spin_unlock_irqrestore (&ioc->raid_device_lock, flags); }
PATCH 25/90 SCSI: mpt2sas : Fix for memory allocation error for large host credits
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: "[email protected]" <[email protected]>
commit aff132d95ffe14eca96cab90597cdd010b457af7 upstream.
The amount of memory required for tracking chain buffers is rather large, and when the host credit count is big, memory allocation failure occurs inside __get_free_pages.
The fix is to limit the number of chains to 100,000. In addition, the number of host credits is limited to 30,000 IOs. However this limitation can be overridden this using the command line option max_queue_depth. The algorithm for calculating the reply_post_queue_depth is changed so that it is equal to (reply_free_queue_depth + 16), previously it was (reply_free_queue_depth * 2).
--- drivers/scsi/mpt2sas/mpt2sas_base.c | 83 +++++++++++------------------------ drivers/scsi/mpt2sas/mpt2sas_scsih.c | 4 - 2 files changed, 29 insertions(+), 58 deletions(-)
drivers/scsi/mpt2sas/mpt2sas_base.c +27 -56
@@ -66,6 +66,8 @@ static MPT_CALLBACK mpt_callbacks[MPT_MA#define FAULT_POLLING_INTERVAL 1000/* in milliseconds */ +#define MAX_HBA_QUEUE_DEPTH 30000 +#define MAX_CHAIN_DEPTH 100000static int max_queue_depth =-1 ;module_param (max_queue_depth, int,0 );MODULE_PARM_DESC (max_queue_depth," max controller queue depth " );
@@ -2098,8 +2100,6 @@ _base_release_memory_pools(struct MPT2SA }if (ioc->chain_dma_pool)pci_pool_destroy (ioc->chain_dma_pool); - } -if (ioc->chain_lookup) {free_pages ((ulong )ioc->chain_lookup, ioc->chain_pages); ioc->chain_lookup =NULL ; }
@@ -2117,9 +2117,7 @@ static int _base_allocate_memory_pools(struct MPT2SAS_ADAPTER *ioc, int sleep_flag) {struct mpt2sas_facts *facts; -u32 queue_size, queue_diff;u16 max_sge_elements; -u16 num_of_reply_frames;u16 chains_needed_per_io;u32 sz, total_sz;u32 retry_sz;
@@ -2146,7 +2144,8 @@ _base_allocate_memory_pools(struct MPT2S max_request_credit = (max_queue_depth < facts->RequestCredit) ? max_queue_depth : facts->RequestCredit; else - max_request_credit = facts->RequestCredit; + max_request_credit =min_t (u16, facts->RequestCredit, +MAX_HBA_QUEUE_DEPTH ); ioc->hba_queue_depth = max_request_credit; ioc->hi_priority_depth = facts->HighPriorityCredit;
@@ -2187,50 +2186,25 @@ _base_allocate_memory_pools(struct MPT2S } ioc->chains_needed_per_io = chains_needed_per_io; -/* reply free queue sizing - taking into account for events */ - num_of_reply_frames = ioc->hba_queue_depth +32 ; - -/* number of replies frames can't be a multiple of 16 */ -/* decrease number of reply frames by 1 */ -if (!(num_of_reply_frames %16 )) - num_of_reply_frames--; - -/* calculate number of reply free queue entries -* (must be multiple of 16) -*/ - -/* (we know reply_free_queue_depth is not a multiple of 16) */ - queue_size = num_of_reply_frames; - queue_size +=16 - (queue_size %16 ); - ioc->reply_free_queue_depth = queue_size; - -/* reply descriptor post queue sizing */ -/* this size should be the number of request frames + number of reply -* frames -*/ +/* reply free queue sizing - taking into account for 64 FW events */ + ioc->reply_free_queue_depth = ioc->hba_queue_depth +64 ; - queue_size = ioc->hba_queue_depth + num_of_reply_frames +1 ; -/* round up to 16 byte boundary */ -if (queue_size %16 ) - queue_size +=16 - (queue_size %16 ); - -/* check against IOC maximum reply post queue depth */ -if (queue_size > facts->MaxReplyDescriptorPostQueueDepth) { - queue_diff = queue_size - - facts->MaxReplyDescriptorPostQueueDepth; - -/* round queue_diff up to multiple of 16 */ -if (queue_diff %16 ) - queue_diff +=16 - (queue_diff %16 ); - -/* adjust hba_queue_depth, reply_free_queue_depth, -* and queue_size -*/ - ioc->hba_queue_depth -= (queue_diff /2 ); - ioc->reply_free_queue_depth -= (queue_diff /2 ); - queue_size = facts->MaxReplyDescriptorPostQueueDepth; +/* align the reply post queue on the next 16 count boundary */ +if (!ioc->reply_free_queue_depth %16 ) + ioc->reply_post_queue_depth = ioc->reply_free_queue_depth +16 ; +else + ioc->reply_post_queue_depth = ioc->reply_free_queue_depth + +32 - (ioc->reply_free_queue_depth %16 ); +if (ioc->reply_post_queue_depth > + facts->MaxReplyDescriptorPostQueueDepth) { + ioc->reply_post_queue_depth =min_t (u16, + (facts->MaxReplyDescriptorPostQueueDepth - + (facts->MaxReplyDescriptorPostQueueDepth %16 )), + (ioc->hba_queue_depth - (ioc->hba_queue_depth %16 ))); + ioc->reply_free_queue_depth = ioc->reply_post_queue_depth -16 ; + ioc->hba_queue_depth = ioc->reply_free_queue_depth -64 ; } - ioc->reply_post_queue_depth = queue_size; + dinitprintk(ioc, printk(MPT2SAS_INFO_FMT "scatter gather: " "sge_in_main_msg(%d), sge_per_chain(%d), sge_per_io(%d), "
@@ -2316,15 +2290,12 @@ _base_allocate_memory_pools(struct MPT2S"depth(%d)\n" , ioc->name, ioc->request, ioc->scsiio_depth)); -/* loop till the allocation succeeds */ -do { - sz = ioc->chain_depth *sizeof (struct chain_tracker ); - ioc->chain_pages =get_order (sz); - ioc->chain_lookup = (struct chain_tracker *)__get_free_pages ( -GFP_KERNEL , ioc->chain_pages); -if (ioc->chain_lookup ==NULL ) - ioc->chain_depth -=100 ; - }while (ioc->chain_lookup ==NULL ); + ioc->chain_depth =min_t (u32, ioc->chain_depth,MAX_CHAIN_DEPTH ); + sz = ioc->chain_depth *sizeof (struct chain_tracker ); + ioc->chain_pages =get_order (sz); + + ioc->chain_lookup = (struct chain_tracker *)__get_free_pages ( +GFP_KERNEL , ioc->chain_pages); ioc->chain_dma_pool =pci_pool_create ("chain pool" , ioc->pdev, ioc->request_sz,16 ,0 );if (!ioc->chain_dma_pool) {
drivers/scsi/mpt2sas/mpt2sas_scsih.c +2 -2
@@ -974,8 +974,8 @@ _scsih_get_chain_buffer_tracker(struct Mspin_lock_irqsave (&ioc->scsi_lookup_lock, flags);if (list_empty (&ioc->free_chain_list)) {spin_unlock_irqrestore (&ioc->scsi_lookup_lock, flags); -printk (MPT2SAS_WARN_FMT "chain buffers not available\n" , - ioc->name); +dfailprintk (ioc,printk (MPT2SAS_WARN_FMT "chain buffers not " +"available\n" , ioc->name));return NULL ; } chain_req = list_entry(ioc->free_chain_list.next,
PATCH 26/90 xen/xenbus: Reject replies with payload > XENSTORE_PAYLOAD_MAX.
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Campbell <[email protected]>
commit 9e7860cee18241633eddb36a4c34c7b61d8cecbc upstream.
Haogang Chen found out that:
There is a potential integer overflow in process_msg() that could result in cross-domain attack.
body = kmalloc(msg->hdr.len + 1, GFP_NOIO | __GFP_HIGH);
When a malicious guest passes 0xffffffff in msg->hdr.len, the subsequent call to xb_read() would write to a zero-length buffer.
The other end of this connection is always the xenstore backend daemon so there is no guest (malicious or otherwise) which can do this. The xenstore daemon is a trusted component in the system.
However this seem like a reasonable robustness improvement so we should have it.
And Ian when read the API docs found that:
The payload length (len field of the header) is limited to 4096 (XENSTORE_PAYLOAD_MAX) in both directions. If a client exceeds the limit, its xenstored connection will be immediately killed by xenstored, which is usually catastrophic from the client's point of view. Clients (particularly domains, which cannot just reconnect) should avoid this.
so this patch checks against that instead.
This also avoids a potential integer overflow pointed out by Haogang Chen.
--- drivers/xen/xenbus/xenbus_xs.c | 6 ++++++ include/xen/interface/io/xs_wire.h | 3 +++ 2 files changed, 9 insertions(+)
drivers/xen/xenbus/xenbus_xs.c +6 -0
@@ -801,6 +801,12 @@ static int process_msg(void) goto out; } +if (msg->hdr.len >XENSTORE_PAYLOAD_MAX ) { +kfree (msg); + err = -EINVAL ; + goto out; + } + body =kmalloc (msg->hdr.len +1 ,GFP_NOIO | __GFP_HIGH);if (body ==NULL ) {kfree (msg);
include/xen/interface/io/xs_wire.h +3 -0
@@ -84,4 +84,7 @@ struct xenstore_domain_interface { XENSTORE_RING_IDX rsp_cons, rsp_prod; }; +/* Violating this is very bad. See docs/misc/xenstore.txt. */ +#define XENSTORE_PAYLOAD_MAX 4096 +#endif /* _XS_WIRE_H */
PATCH 27/90 ima: free duplicate measurement memory
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roberto Sassu <[email protected]>
commit 45fae7493970d7c45626ccd96d4a74f5f1eea5a9 upstream.
Info about new measurements are cached in the iint for performance. When the inode is flushed from cache, the associated iint is flushed as well. Subsequent access to the inode will cause the inode to be re-measured and will attempt to add a duplicate entry to the measurement list.
This patch frees the duplicate measurement memory, fixing a memory leak.
--- security/integrity/ima/ima_api.c | 4 ++-- security/integrity/ima/ima_queue.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-)
security/integrity/ima/ima_api.c +2 -2
@@ -177,8 +177,8 @@ void ima_store_measurement(struct ima_iistrncpy (entry->template.file_name, filename,IMA_EVENT_NAME_LEN_MAX ); result =ima_store_template (entry, violation, inode); -if (!result) +if (!result || result == -EEXIST ) iint->flags |=IMA_MEASURED ; -else +if (result <0 )kfree (entry); }
security/integrity/ima/ima_queue.c +1 -0
@@ -114,6 +114,7 @@ int ima_add_template_entry(struct ima_tememcpy (digest, entry->digest,sizeof digest);if (ima_lookup_digest_entry (digest)) { audit_cause ="hash_exists" ; + result = -EEXIST ; goto out; } }
PATCH 28/90 ima: fix invalid memory reference
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roberto Sassu <[email protected]>
commit 7b7e5916aa2f46e57f8bd8cb89c34620ebfda5da upstream.
Don't free a valid measurement entry on TPM PCR extend failure.
--- security/integrity/ima/ima_queue.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
security/integrity/ima/ima_queue.c +11 -5
@@ -23,6 +23,8 @@#include <linux/slab.h> #include "ima.h" +#define AUDIT_CAUSE_LEN_MAX 32 +LIST_HEAD (ima_measurements);/* list of all measurements */ /* key: inode (before secure-hashing a file) */
@@ -94,7 +96,8 @@ static int ima_pcr_extend(const u8 *hash result =tpm_pcr_extend (TPM_ANY_NUM ,CONFIG_IMA_MEASURE_PCR_IDX , hash);if (result !=0 ) -pr_err ("IMA: Error Communicating to TPM chip\n" ); +pr_err ("IMA: Error Communicating to TPM chip, result: %d\n" , + result);return result; }
@@ -106,8 +109,9 @@ int ima_add_template_entry(struct ima_te {u8 digest[IMA_DIGEST_SIZE ];const char *audit_cause ="hash_added" ; +char tpm_audit_cause[AUDIT_CAUSE_LEN_MAX ];int audit_info =1 ; -int result =0 ; +int result =0 , tpmresult =0 ;mutex_lock (&ima_extend_list_mutex);if (!violation) {
@@ -129,9 +133,11 @@ int ima_add_template_entry(struct ima_teif (violation)/* invalidate pcr */ memset (digest,0xff ,sizeof digest); - result =ima_pcr_extend (digest); -if (result !=0 ) { - audit_cause ="TPM error" ; + tpmresult =ima_pcr_extend (digest); +if (tpmresult !=0 ) { +snprintf (tpm_audit_cause,AUDIT_CAUSE_LEN_MAX ,"TPM_error(%d)" , + tpmresult); + audit_cause = tpm_audit_cause; audit_info =0 ; } out:
PATCH 29/90 PNP: work around Dell 1536/1546 BIOS MMCONFIG bug that breaks USB
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjorn Helgaas <[email protected]>
commit eb31aae8cb5eb54e234ed2d857ddac868195d911 upstream.
Some Dell BIOSes have MCFG tables that don't report the entire MMCONFIG area claimed by the chipset. If we move PCI devices into that claimed-but-unreported area, they don't work.
This quirk reads the AMD MMCONFIG MSRs and adds PNP0C01 resources as needed to cover the entire area.
Example problem scenario:
BIOS-e820: 00000000cfec5400 - 00000000d4000000 (reserved)
Fam 10h mmconf [d0000000, dfffffff]
PCI: MMCONFIG for domain 0000 [bus 00-3f] at [mem 0xd0000000-0xd3ffffff] (base 0xd0000000) pnp 00:0c: [mem 0xd0000000-0xd3ffffff]
pci 0000:00:12.0: reg 10: [mem 0xffb00000-0xffb00fff]
pci 0000:00:12.0: no compatible bridge window for [mem 0xffb00000-0xffb00fff] pci 0000:00:12.0: BAR 0: assigned [mem 0xd4000000-0xd40000ff]
References: https://bugzilla.kernel.org/show_bug.cgi?id=31602
References: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/647043
References: https://bugzilla.redhat.com/show_bug.cgi?id=770308
--- drivers/pnp/quirks.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)
drivers/pnp/quirks.c +42 -0
@@ -295,6 +295,45 @@ static void quirk_system_pci_resources(s } } +#ifdef CONFIG_AMD_NB + +#include <asm/amd_nb.h> + +static void quirk_amd_mmconfig_area (struct pnp_dev *dev) +{ +resource_size_t start, end; +struct pnp_resource *pnp_res; +struct resource *res; +struct resource mmconfig_res, *mmconfig; + + mmconfig =amd_get_mmconfig_range (&mmconfig_res); +if (!mmconfig) +return ; + +list_for_each_entry (pnp_res, &dev->resources, list) { + res = &pnp_res->res; +if (res->end < mmconfig->start || res->start > mmconfig->end || + (res->start == mmconfig->start && res->end == mmconfig->end)) +continue ; + +dev_info (&dev->dev,FW_BUG +"%pR covers only part of AMD MMCONFIG area %pR; adding more reservations\n" , + res, mmconfig); +if (mmconfig->start < res->start) { + start = mmconfig->start; + end = res->start -1 ; +pnp_add_mem_resource (dev, start, end,0 ); + } +if (mmconfig->end > res->end) { + start = res->end +1 ; + end = mmconfig->end; +pnp_add_mem_resource (dev, start, end,0 ); + } +break ; + } +} +#endif +/* * PnP Quirks * Cards or devices that need some tweaking due to incomplete resource info
@@ -322,6 +361,9 @@ static struct pnp_fixup pnp_fixups[] = {/* PnP resources that might overlap PCI BARs */ {"PNP0c01", quirk_system_pci_resources}, {"PNP0c02", quirk_system_pci_resources}, +#ifdef CONFIG_AMD_NB + {"PNP0c01", quirk_amd_mmconfig_area}, +#endif {""} };
PATCH 30/90 rtl8192se: Fix BUG caused by failure to check skb allocation
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit d90db4b12bc1b9b8a787ef28550fdb767ee25a49 upstream.
When downloading firmware into the device, the driver fails to check the return when allocating an skb. When the allocation fails, a BUG can be generated, as seen in https://bugzilla.redhat.com/show_bug.cgi?id=771656.
--- drivers/net/wireless/rtlwifi/rtl8192se/fw.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/rtlwifi/rtl8192se/fw.c +4 -0
@@ -196,6 +196,8 @@ static bool _rtl92s_firmware_downloadcod/* Allocate skb buffer to contain firmware */ /* info and tx descriptor info. */ skb =dev_alloc_skb (frag_length); +if (!skb) +return false;skb_reserve (skb, extra_descoffset); seg_ptr = (u8 *)skb_put (skb, (u32)(frag_length - extra_descoffset));
@@ -575,6 +577,8 @@ static bool _rtl92s_firmware_set_h2c_cmd len =_rtl92s_get_h2c_cmdlen (MAX_TRANSMIT_BUFFER_SIZE ,1 , &cmd_len); skb =dev_alloc_skb (len); +if (!skb) +return false; cb_desc = (struct rtl_tcb_desc *)(skb->cb); cb_desc->queue_index =TXCMD_QUEUE ; cb_desc->cmd_or_init =DESC_PACKET_TYPE_NORMAL ;
PATCH 31/90 mac80211: fix rx->key NULL pointer dereference in promiscuous mode
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislaw Gruszka <[email protected]>
commit 1140afa862842ac3e56678693050760edc4ecde9 upstream.
Since:
commit 816c04fe7ef01dd9649f5ccfe796474db8708be5
Author: Christian Lamparter <[email protected]> Date: Sat Apr 30 15:24:30 2011 +0200
mac80211: consolidate MIC failure report handling
is possible to that we dereference rx->key == NULL when driver set RX_FLAG_MMIC_STRIPPED and not RX_FLAG_IV_STRIPPED and we are in promiscuous mode. This happen with rt73usb and rt61pci at least.
Before the commit we always check rx->key against NULL, so I assume fix should be done in mac80211 (also mic_fail path has similar check).
References:
https://bugzilla.redhat.com/show_bug.cgi?id=769766
http://rt2x00.serialmonkey.com/pipermail/users_rt2x00.serialmonkey.com/2012-January/004395.html
--- net/mac80211/wpa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/wpa.c +1 -1
@@ -109,7 +109,7 @@ ieee80211_rx_h_michael_mic_verify(structif (status->flag &RX_FLAG_MMIC_ERROR ) goto mic_fail; -if (!(status->flag &RX_FLAG_IV_STRIPPED )) +if (!(status->flag &RX_FLAG_IV_STRIPPED ) && rx->key) goto update_iv;return RX_CONTINUE ;
PATCH 32/90 memcg: add mem_cgroup_replace_page_cache() to fix LRU issue
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: KAMEZAWA Hiroyuki <[email protected]>
commit ab936cbcd02072a34b60d268f94440fd5cf1970b upstream.
Commit ef6a3c6311 ("mm: add replace_page_cache_page() function") added a function replace_page_cache_page(). This function replaces a page in the radix-tree with a new page. WHen doing this, memory cgroup needs to fix up the accounting information. memcg need to check PCG_USED bit etc.
In some(many?) cases, 'newpage' is on LRU before calling replace_page_cache(). So, memcg's LRU accounting information should be fixed, too.
This patch adds mem_cgroup_replace_page_cache() and removes the old hooks.
In that function, old pages will be unaccounted without touchingres_counter and new page will be accounted to the memcg (of old page). WHen overwriting pc->mem_cgroup of newpage, take zone->lru_lock and avoid races with LRU handling.
Background:
replace_page_cache_page() is called by FUSE code in its splice() handling. Here, 'newpage' is replacing oldpage but this newpage is not a newly allocated page and may be on LRU. LRU mis-accounting will be critical for memory cgroup because rmdir() checks the whole LRU is empty and there is no account leak. If a page is on the other LRU than it should be, rmdir() will fail.
This bug was added in March 2011, but no bug report yet. I guess there are not many people who use memcg and FUSE at the same time with upstream kernels.
The result of this bug is that admin cannot destroy a memcg because of account leak. So, no panic, no deadlock. And, even if an active cgroup exist, umount can succseed. So no problem at shutdown.
--- include/linux/memcontrol.h | 6 ++++++ mm/filemap.c | 18 ++---------------- mm/memcontrol.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 16 deletions(-)
include/linux/memcontrol.h +6 -0
@@ -119,6 +119,8 @@ struct zone_reclaim_stat* mem_cgroup_get_reclaim_stat_from_page(struct page *page);extern void mem_cgroup_print_oom_info (struct mem_cgroup *memcg,struct task_struct *p); +extern void mem_cgroup_replace_page_cache (struct page *oldpage, +struct page *newpage);#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP extern int do_swap_account;
@@ -370,6 +372,10 @@ static inlinevoid mem_cgroup_count_vm_event (struct mm_struct *mm,enum vm_event_item idx) { } +static inline void mem_cgroup_replace_page_cache (struct page *oldpage, +struct page *newpage) +{ +}#endif /* CONFIG_CGROUP_MEM_CONT */ #if !defined(CONFIG_CGROUP_MEM_RES_CTLR ) || !defined(CONFIG_DEBUG_VM )
mm/filemap.c +2 -16
@@ -396,24 +396,11 @@ EXPORT_SYMBOL(filemap_write_and_wait_ranint replace_page_cache_page (struct page *old,struct page *new,gfp_t gfp_mask) {int error; -struct mem_cgroup *memcg =NULL ;VM_BUG_ON (!PageLocked (old));VM_BUG_ON (!PageLocked (new));VM_BUG_ON (new->mapping); -/* -* This is not page migration, but prepare_migration and -* end_migration does enough work for charge replacement. -* -* In the longer term we probably want a specialized function -* for moving the charge from old to new in a more efficient -* manner. -*/ - error =mem_cgroup_prepare_migration (old, new, &memcg, gfp_mask); -if (error) -return error; - error =radix_tree_preload (gfp_mask & ~__GFP_HIGHMEM);if (!error) {struct address_space *mapping = old->mapping;
@@ -435,13 +422,12 @@ int replace_page_cache_page(struct pageif (PageSwapBacked (new))__inc_zone_page_state (new,NR_SHMEM );spin_unlock_irq (&mapping->tree_lock); +/* mem_cgroup codes must not be called under tree_lock */ +mem_cgroup_replace_page_cache (old, new);radix_tree_preload_end ();if (freepage)freepage (old);page_cache_release (old); -mem_cgroup_end_migration (memcg, old, new, true); - }else { -mem_cgroup_end_migration (memcg, old, new, false); }return error;
mm/memcontrol.c +44 -0
50 lines not on this page · raw message
PATCH 33/90 x86: Fix mmap random address range
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ludwig Nussel <[email protected]>
commit 9af0c7a6fa860698d080481f24a342ba74b68982 upstream.
On x86_32 casting the unsigned int result of get_random_int() to long may result in a negative value. On x86_32 the range of mmap_rnd() therefore was -255 to 255. The 32bit mode on x86_64 used 0 to 255 as intended.
The bug was introduced by 675a081 ("x86: unify mmap_{32|64}.c") in January 2008.
--- arch/x86/mm/mmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/mm/mmap.c +2 -2
@@ -87,9 +87,9 @@ static unsigned long mmap_rnd(void)*/ if (current->flags &PF_RANDOMIZE ) {if (mmap_is_ia32 ()) - rnd = (long )get_random_int () % (1 <<8 ); + rnd =get_random_int () % (1 <<8 );else - rnd = (long )(get_random_int () % (1 <<28 )); + rnd =get_random_int () % (1 <<28 ); }return rnd <<PAGE_SHIFT ; }
PATCH 34/90 UBI: fix nameless volumes handling
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Weinberger <[email protected]>
commit 4a59c797a18917a5cf3ff7ade296b46134d91e6a upstream.
Currently it's possible to create a volume without a name. E.g:
ubimkvol -n 32 -s 2MiB -t static /dev/ubi0 -N ""
After that vtbl_check() will always fail because it does not permit empty strings.
--- drivers/mtd/ubi/cdev.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/mtd/ubi/cdev.c +3 -0
@@ -628,6 +628,9 @@ static int verify_mkvol_req(const structif (req->alignment !=1 && n) goto bad; +if (!req->name[0 ] || !req->name_len) + goto bad; +if (req->name_len >UBI_VOL_NAME_MAX ) { err = -ENAMETOOLONG ; goto bad;
PATCH 35/90 UBI: fix debugging messages
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Artem Bityutskiy <[email protected]>
commit 72f0d453d81d35087b1d3ad7c8285628c2be6e1d upstream.
Patch ab50ff684707031ed4bad2fdd313208ae392e5bb broke UBI debugging messages:
before that commit when UBI debugging was enabled, users saw few useful debugging messages after attaching an MTD device. However, that patch turned 'dbg_msg()' into 'pr_debug()', so to enable the debugging messages users have to enable them first via /sys/kernel/debug/dynamic_debug/control, which is very impractical.
This commit makes 'dbg_msg()' to use 'printk()' instead of 'pr_debug()', just as it was before the breakage.
--- drivers/mtd/ubi/debug.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/mtd/ubi/debug.h +4 -1
@@ -51,7 +51,10 @@ struct ubi_mkvol_req; pr_debug("UBI DBG " type ": " fmt "\n", ##__VA_ARGS__) /* Just a debugging messages not related to any specific UBI subsystem */ -#define dbg_msg (fmt, ...) ubi_dbg_msg("msg", fmt, ##__VA_ARGS__) +#define dbg_msg (fmt, ...) \ + printk(KERN_DEBUG "UBI DBG (pid %d): %s: " fmt "\n", \ + current->pid, __func__, ##__VA_ARGS__) +/* General debugging messages */ #define dbg_gen (fmt, ...) ubi_dbg_msg("gen", fmt, ##__VA_ARGS__)/* Messages from the eraseblock association sub-system */
PATCH 36/90 UBIFS: fix debugging messages
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Artem Bityutskiy <[email protected]>
commit d34315da9146253351146140ea4b277193ee5e5f upstream.
Patch 56e46742e846e4de167dde0e1e1071ace1c882a5 broke UBIFS debugging messages:
before that commit when UBIFS debugging was enabled, users saw few useful debugging messages after mount. However, that patch turned 'dbg_msg()' into 'pr_debug()', so to enable the debugging messages users have to enable them first via /sys/kernel/debug/dynamic_debug/control, which is very impractical.
This commit makes 'dbg_msg()' to use 'printk()' instead of 'pr_debug()', just as it was before the breakage.
--- fs/ubifs/debug.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/ubifs/debug.h +4 -1
@@ -134,7 +134,10 @@ const char *dbg_key_str1(const struct ub }while (0 ) /* Just a debugging messages not related to any specific UBIFS subsystem */ -#define dbg_msg (fmt, ...) ubifs_dbg_msg("msg", fmt, ##__VA_ARGS__) +#define dbg_msg (fmt, ...) \ + printk(KERN_DEBUG "UBIFS DBG (pid %d): %s: " fmt "\n", current->pid, \ + __func__, ##__VA_ARGS__) +/* General messages */ #define dbg_gen (fmt, ...) ubifs_dbg_msg("gen", fmt, ##__VA_ARGS__)/* Additional journal messages */
PATCH 37/90 i2c: Fix error value returned by several bus drivers
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jean Delvare <[email protected]>
commit 7c1f59c9d5caf3a84f35549b5d58f3c055a68da5 upstream.
When adding checks for ACPI resource conflicts to many bus drivers, not enough attention was paid to the error paths, and for several drivers this causes 0 to be returned on error in some cases. Fix this by properly returning a non-zero value on every error.
--- drivers/i2c/busses/i2c-ali1535.c | 11 +++++++---- drivers/i2c/busses/i2c-nforce2.c | 2 +- drivers/i2c/busses/i2c-sis5595.c | 4 ++-- drivers/i2c/busses/i2c-sis630.c | 6 +++++- drivers/i2c/busses/i2c-viapro.c | 7 +++++-- 5 files changed, 20 insertions(+), 10 deletions(-)
drivers/i2c/busses/i2c-ali1535.c +7 -4
@@ -140,7 +140,7 @@ static unsigned short ali1535_smba;defined to make the transition easier. */ static int __devinit ali1535_setup (struct pci_dev *dev) { -int retval = -ENODEV ; +int retval;unsigned char temp;/* Check the following things:
@@ -155,6 +155,7 @@ static int __devinit ali1535_setup(strucif (ali1535_smba ==0 ) {dev_warn (&dev->dev,"ALI1535_smb region uninitialized - upgrade BIOS?\n" ); + retval = -ENODEV ; goto exit; }
@@ -167,6 +168,7 @@ static int __devinit ali1535_setup(struc ali1535_driver.name)) {dev_err (&dev->dev,"ALI1535_smb region 0x%x already in use!\n" , ali1535_smba); + retval = -EBUSY ; goto exit; }
@@ -174,6 +176,7 @@ static int __devinit ali1535_setup(strucpci_read_config_byte (dev,SMBCFG , &temp);if ((temp &ALI1535_SMBIO_EN ) ==0 ) {dev_err (&dev->dev,"SMB device not enabled - upgrade BIOS?\n" ); + retval = -ENODEV ; goto exit_free; }
@@ -181,6 +184,7 @@ static int __devinit ali1535_setup(strucpci_read_config_byte (dev,SMBHSTCFG , &temp);if ((temp &1 ) ==0 ) {dev_err (&dev->dev,"SMBus controller not enabled - upgrade BIOS?\n" ); + retval = -ENODEV ; goto exit_free; }
@@ -198,12 +202,11 @@ static int __devinit ali1535_setup(strucdev_dbg (&dev->dev,"SMBREV = 0x%X\n" , temp);dev_dbg (&dev->dev,"ALI1535_smba = 0x%X\n" , ali1535_smba); - retval =0 ; -exit: -return retval; +return 0 ; exit_free:release_region (ali1535_smba,ALI1535_SMB_IOSIZE ); +exit:return retval; }
drivers/i2c/busses/i2c-nforce2.c +1 -1
@@ -356,7 +356,7 @@ static int __devinit nforce2_probe_smb ( error =acpi_check_region (smbus->base, smbus->size, nforce2_driver.name);if (error) -return -1 ; +return error;if (!request_region (smbus->base, smbus->size, nforce2_driver.name)) { dev_err(&smbus->adapter.dev, "Error requesting region %02x .. %02X for %s\n",
drivers/i2c/busses/i2c-sis5595.c +2 -2
@@ -147,7 +147,7 @@ static int __devinit sis5595_setup(strucu16 a;u8 val;int *i; -int retval = -ENODEV ; +int retval;/* Look for imposters */ for (i = blacklist; *i !=0 ; i++) {
@@ -223,7 +223,7 @@ static int __devinit sis5595_setup(struc error:release_region (sis5595_base +SMB_INDEX ,2 ); -return retval; +return -ENODEV ; }static int sis5595_transaction (struct i2c_adapter *adap)
drivers/i2c/busses/i2c-sis630.c +5 -1
@@ -393,7 +393,7 @@ static int __devinit sis630_setup(struct {unsigned char b;struct pci_dev *dummy =NULL ; -int retval = -ENODEV , i; +int retval, i;/* check for supported SiS devices */ for (i=0 ; supported[i] >0 ; i++) {
@@ -418,18 +418,21 @@ static int __devinit sis630_setup(struct*/ if (pci_read_config_byte (sis630_dev,SIS630_BIOS_CTL_REG ,&b)) {dev_err (&sis630_dev->dev,"Error: Can't read bios ctl reg\n" ); + retval = -ENODEV ; goto exit; }/* if ACPI already enabled , do nothing */ if (!(b &0x80 ) &&pci_write_config_byte (sis630_dev,SIS630_BIOS_CTL_REG , b |0x80 )) {dev_err (&sis630_dev->dev,"Error: Can't enable ACPI\n" ); + retval = -ENODEV ; goto exit; }/* Determine the ACPI base address */ if (pci_read_config_word (sis630_dev,SIS630_ACPI_BASE_REG ,&acpi_base)) {dev_err (&sis630_dev->dev,"Error: Can't determine ACPI base address\n" ); + retval = -ENODEV ; goto exit; }
@@ -445,6 +448,7 @@ static int __devinit sis630_setup(struct sis630_driver.name)) {dev_err (&sis630_dev->dev,"SMBus registers 0x%04x-0x%04x already " "in use!\n" , acpi_base +SMB_STS , acpi_base +SMB_SAA ); + retval = -EBUSY ; goto exit; }
drivers/i2c/busses/i2c-viapro.c +5 -2
@@ -324,7 +324,7 @@ static int __devinit vt596_probe(struct const struct pci_device_id *id) {unsigned char temp; -int error = -ENODEV ; +int error;/* Determine the address of the SMBus areas */ if (force_addr) {
@@ -390,6 +390,7 @@ found:dev_err (&pdev->dev,"SMBUS: Error: Host SMBus " "controller not enabled! - upgrade BIOS or " "use force=1\n" ); + error = -ENODEV ; goto release_region; } }
@@ -422,9 +423,11 @@ found: "SMBus Via Pro adapter at %04x", vt596_smba); vt596_pdev =pci_dev_get (pdev); -if (i2c_add_adapter (&vt596_adapter)) { + error =i2c_add_adapter (&vt596_adapter); +if (error) {pci_dev_put (vt596_pdev); vt596_pdev =NULL ; + goto release_region; }/* Always return failure here. This is to allow other drivers to bind
PATCH 38/90 mmc: core: Fix voltage select in DDR mode
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Girish K S <[email protected]>
commit 913047e9e5787a90696533a9f109552b7694ecc9 upstream.
This patch fixes the wrong comparison before setting the interface voltage in DDR mode.
The assignment to the variable ddr before comaprison is either ddr = MMC_1_2V_DDR_MODE; or ddr == MMC_1_8V_DDR_MODE. But the comparison is done with the extended csd value if ddr == EXT_CSD_CARD_TYPE_DDR_1_2V.
--- drivers/mmc/core/mmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/core/mmc.c +1 -1
@@ -830,7 +830,7 @@ static int mmc_init_card(struct mmc_host* * WARNING: eMMC rules are NOT the same as SD DDR */ -if (ddr ==EXT_CSD_CARD_TYPE_DDR_1_2V ) { +if (ddr ==MMC_1_2V_DDR_MODE ) { err =mmc_set_signal_voltage (host,MMC_SIGNAL_VOLTAGE_120 ,0 );if (err)
PATCH 39/90 mmc: sdhci: Fix tuning timer incorrect setting when suspending host
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaron Lu <[email protected]>
commit c6ced0db08010ed75df221a2946c5228454b38d5 upstream.
When suspending host, the tuning timer shoule be deactivated. And the HOST_NEEDS_TUNING flag should be set after tuning timer is deactivated.
--- drivers/mmc/host/sdhci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mmc/host/sdhci.c +1 -2
@@ -2227,9 +2227,8 @@ int sdhci_suspend_host(struct sdhci_host/* Disable tuning since we are suspending */ if (host->version >=SDHCI_SPEC_300 && host->tuning_count && host->tuning_mode ==SDHCI_TUNING_MODE_1 ) { +del_timer_sync (&host->tuning_timer); host->flags &= ~SDHCI_NEEDS_RETUNING ; -mod_timer (&host->tuning_timer, jiffies + - host->tuning_count *HZ ); } ret =mmc_suspend_host (host->mmc);
PATCH 40/90 mmc: sd: Fix SDR12 timing regression
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Elbs <[email protected]>
commit dd8df17fe83483d7ea06ff229895e35a42071599 upstream.
This patch fixes a failure to recognize SD cards reported on a Dell Vostro with O2 Micro SD card reader. Patch 49c468f ("mmc: sd: add support for uhs bus speed mode selection") caused the problem, by setting the SDHCI_CTRL_HISPD flag even for legacy timings.
--- drivers/mmc/host/sdhci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mmc/host/sdhci.c +1 -2
@@ -1340,8 +1340,7 @@ static void sdhci_set_ios(struct mmc_hosif ((ios->timing ==MMC_TIMING_UHS_SDR50 ) || (ios->timing ==MMC_TIMING_UHS_SDR104 ) || (ios->timing ==MMC_TIMING_UHS_DDR50 ) || - (ios->timing ==MMC_TIMING_UHS_SDR25 ) || - (ios->timing ==MMC_TIMING_UHS_SDR12 )) + (ios->timing ==MMC_TIMING_UHS_SDR25 )) ctrl |=SDHCI_CTRL_HISPD ; ctrl_2 =sdhci_readw (host,SDHCI_HOST_CONTROL2 );
PATCH 41/90 V4L/DVB: v4l2-ioctl: integer overflow in video_usercopy()
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 6c06108be53ca5e94d8b0e93883d534dd9079646 upstream.
If ctrls->count is too high the multiplication could overflow and array_size would be lower than expected. Mauro and Hans Verkuil suggested that we cap it at 1024. That comes from the maximum number of controls with lots of room for expantion.
$ grep V4L2_CID include/linux/videodev2.h | wc -l 211
--- drivers/media/video/v4l2-ioctl.c | 4 ++++ include/linux/videodev2.h | 1 + 2 files changed, 5 insertions(+)
drivers/media/video/v4l2-ioctl.c +4 -0
@@ -2289,6 +2289,10 @@ static int check_array_args(unsigned intstruct v4l2_ext_controls *ctrls = parg;if (ctrls->count !=0 ) { +if (ctrls->count >V4L2_CID_MAX_CTRLS ) { + ret = -EINVAL ; +break ; + } *user_ptr = (void __user *)ctrls->controls; *kernel_ptr = (void **)&ctrls->controls; *array_size =sizeof (struct v4l2_ext_control )
include/linux/videodev2.h +1 -0
@@ -1075,6 +1075,7 @@ struct v4l2_querymenu {#define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000/* User-class control IDs defined by V4L2 */ +#define V4L2_CID_MAX_CTRLS 1024#define V4L2_CID_BASE (V4L2_CTRL_CLASS_USER | 0x900)#define V4L2_CID_USER_BASE V4L2_CID_BASE/* IDs reserved for driver specific controls */
PATCH 42/90 kconfig/streamline-config.pl: Simplify backslash line concatination
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <[email protected]>
commit d060d963e88f3e990cec2fe5214de49de9a49eca upstream.
Simplify the way lines ending with backslashes (continuation) in Makefiles is parsed. This is needed to implement a necessary fix.
--- scripts/kconfig/streamline_config.pl | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-)
scripts/kconfig/streamline_config.pl +12 -13
@@ -245,17 +245,22 @@ if ($kconfig) { # Read all Makefiles to map the configs to the objects foreach my $makefile (@makefiles) { - my $cont = 0; + my $line = ""; open(MIN,$makefile) || die "Can't open $makefile"; while (<MIN>) { - my $objs; - - # is this a line after a line with a backslash? - if ($cont && /(\S.*)$/) { - $objs = $1; + # if this line ends with a backslash, continue + chomp; + if (/^(.*)\\$/) { + $line .= $1; + next; } - $cont = 0; + + $line .= $_; + $_ = $line; + $line = ""; + + my $objs; # collect objects after obj-$(CONFIG_FOO_BAR) if (/obj-\$\((CONFIG_[^\)]*)\)\s*[+:]?=\s*(.*)/) {
@@ -263,12 +268,6 @@ foreach my $makefile (@makefiles) { $objs = $2; } if (defined($objs)) { - # test if the line ends with a backslash - if ($objs =~ m,(.*)\\$,) { - $objs = $1; - $cont = 1; - } - foreach my $obj (split /\s+/,$objs) { $obj =~ s/-/_/g; if ($obj =~ /(.*)\.o$/) {
PATCH 43/90 kconfig/streamline-config.pl: Fix parsing Makefile with variables
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <[email protected]>
commit 364212fddaaa60c5a64f67a0f5624ad996ecc8a0 upstream.
Thomas Lange reported that when he did a 'make localmodconfig', his config was missing the brcmsmac driver, even though he had the module loaded.
Looking into this, I found the file:drivers/net/wireless/brcm80211/brcmsmac/Makefile
had the following in the Makefile:
MODULEPFX := brcmsmac
obj-$(CONFIG_BRCMSMAC) += $(MODULEPFX).o
The way streamline-config.pl works, is parsing all the
obj-$(CONFIG_FOO) += foo.o
lines to find that CONFIG_FOO belongs to the module foo.ko.
But in this case, the brcmsmac.o was not used, but a variable in its place.
By changing streamline-config.pl to remember defined variables in Makefiles and substituting them when they are used in the obj-X lines, allows Thomas (and others) to have their brcmsmac module stay configured when it is loaded and running "make localmodconfig".
--- scripts/kconfig/streamline_config.pl | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
scripts/kconfig/streamline_config.pl +29 -0
@@ -242,10 +242,33 @@ if ($kconfig) { read_kconfig($kconfig); } +sub convert_vars { + my ($line, %vars) = @_; + + my $process = ""; + + while ($line =~ s/^(.*?)(\$\((.*?)\))//) { + my $start = $1; + my $variable = $2; + my $var = $3; + + if (defined($vars{$var})) { + $process .= $start . $vars{$var}; + } else { + $process .= $start . $variable; + } + } + + $process .= $line; + + return $process; +} + # Read all Makefiles to map the configs to the objects foreach my $makefile (@makefiles) { my $line = ""; + my %make_vars; open(MIN,$makefile) || die "Can't open $makefile"; while (<MIN>) {
@@ -262,10 +285,16 @@ foreach my $makefile (@makefiles) { my $objs; + $_ = convert_vars($_, %make_vars); + # collect objects after obj-$(CONFIG_FOO_BAR) if (/obj-\$\((CONFIG_[^\)]*)\)\s*[+:]?=\s*(.*)/) { $var = $1; $objs = $2; + + # check if variables are set + } elsif (/^\s*(\S+)\s*[:]?=\s*(.*\S)/) { + $make_vars{$1} = $2; } if (defined($objs)) { foreach my $obj (split /\s+/,$objs) {
PATCH 44/90 svcrpc: fix double-free on shutdown of nfsd after changing pool mode
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: "J. Bruce Fields" <[email protected]>
commit 61c8504c428edcebf23b97775a129c5b393a302b upstream.
The pool_to and to_pool fields of the global svc_pool_map are freed on shutdown, but are initialized in nfsd startup only in the SVC_POOL_PERCPU and SVC_POOL_PERNODE cases.
They *are* initialized to zero on kernel startup. So as long as you use only SVC_POOL_GLOBAL (the default), this will never be a problem.
You're also OK if you only ever use SVC_POOL_PERCPU or SVC_POOL_PERNODE.
However, the following sequence events leads to a double-free:
1. set SVC_POOL_PERCPU or SVC_POOL_PERNODE
2. start nfsd: both fields are initialized.
3. shutdown nfsd: both fields are freed.
4. set SVC_POOL_GLOBAL
5. start nfsd: the fields are left untouched.
6. shutdown nfsd: now we try to free them again.
Step 4 is actually unnecessary, since (for some bizarre reason), nfsd automatically resets the pool mode to SVC_POOL_GLOBAL on shutdown.
--- net/sunrpc/svc.c | 3 +++ 1 file changed, 3 insertions(+)
net/sunrpc/svc.c +3 -0
@@ -167,6 +167,7 @@ svc_pool_map_alloc_arrays(struct svc_poo fail_free:kfree (m->to_pool); + m->to_pool =NULL ; fail:return -ENOMEM ; }
@@ -287,7 +288,9 @@ svc_pool_map_put(void)if (!--m->count) { m->mode =SVC_POOL_DEFAULT ;kfree (m->to_pool); + m->to_pool =NULL ;kfree (m->pool_to); + m->pool_to =NULL ; m->npools =0 ; }
PATCH 45/90 svcrpc: destroy server sockets all at once
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: "J. Bruce Fields" <[email protected]>
commit 2fefb8a09e7ed251ae8996e0c69066e74c5aa560 upstream.
There's no reason I can see that we need to call sv_shutdown between closing the two lists of sockets.
--- include/linux/sunrpc/svcsock.h | 2 +- net/sunrpc/svc.c | 7 +------ net/sunrpc/svc_xprt.c | 11 ++++++++++- 3 files changed, 12 insertions(+), 8 deletions(-)
include/linux/sunrpc/svcsock.h +1 -1
@@ -34,7 +34,7 @@ struct svc_sock {/* * Function prototypes. */ -void svc_close_all (struct list_head *); +void svc_close_all (struct svc_serv *);int svc_recv (struct svc_rqst *,long );int svc_send (struct svc_rqst *);void svc_drop (struct svc_rqst *);
net/sunrpc/svc.c +1 -6
@@ -476,16 +476,11 @@ svc_destroy(struct svc_serv *serv)del_timer_sync (&serv->sv_temptimer); -svc_close_all (&serv->sv_tempsocks); +svc_close_all (serv);if (serv->sv_shutdown) serv->sv_shutdown (serv); -svc_close_all (&serv->sv_permsocks); - -BUG_ON (!list_empty (&serv->sv_permsocks)); -BUG_ON (!list_empty (&serv->sv_tempsocks)); -cache_clean_deferred (serv);if (svc_serv_is_pooled (serv))
net/sunrpc/svc_xprt.c +10 -1
@@ -936,7 +936,7 @@ void svc_close_xprt(struct svc_xprt *xpr }EXPORT_SYMBOL_GPL (svc_close_xprt); -void svc_close_all (struct list_head *xprt_list) +static void svc_close_list (struct list_head *xprt_list) {struct svc_xprt *xprt;struct svc_xprt *tmp;
@@ -954,6 +954,15 @@ void svc_close_all(struct list_head *xpr } } +void svc_close_all (struct svc_serv *serv) +{ +svc_close_list (&serv->sv_tempsocks); +svc_close_list (&serv->sv_permsocks); +BUG_ON (!list_empty (&serv->sv_permsocks)); +BUG_ON (!list_empty (&serv->sv_tempsocks)); + +} +/* * Handle defer and revisit of requests */
PATCH 46/90 svcrpc: avoid memory-corruption on pool shutdown
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: "J. Bruce Fields" <[email protected]>
commit b4f36f88b3ee7cf26bf0be84e6c7fc15f84dcb71 upstream.
Socket callbacks use svc_xprt_enqueue() to add an xprt to a pool->sp_sockets list. In normal operation a server thread will later come along and take the xprt off that list. On shutdown, after all the threads have exited, we instead manually walk the sv_tempsocks and sv_permsocks lists to find all the xprt's and delete them.
So the sp_sockets lists don't really matter any more. As a result, we've mostly just ignored them and hoped they would go away.
Which has gotten us into trouble; witness for example ebc63e531cc6 "svcrpc: fix list-corrupting race on nfsd shutdown", the result of Ben Greear noticing that a still-running svc_xprt_enqueue() could re-add an xprt to an sp_sockets list just before it was deleted. The fix was to remove it from the list at the end of svc_delete_xprt(). But that only made corruption less likely--I can see nothing that prevents a svc_xprt_enqueue() from adding another xprt to the list at the same moment that we're removing this xprt from the list. In fact, despite the earlier xpo_detach(), I don't even see what guarantees that svc_xprt_enqueue() couldn't still be running on this xprt.
So, instead, note that svc_xprt_enqueue() essentially does:
lock sp_lock
if XPT_BUSY unset
add to sp_sockets
unlock sp_lock
So, if we do:
set XPT_BUSY on every xprt.
Empty every sp_sockets list, under the sp_socks locks.
Then we're left knowing that the sp_sockets lists are all empty and will stay that way, since any svc_xprt_enqueue() will check XPT_BUSY under the sp_lock and see it set.
And *then* we can continue deleting the xprt's.
(Thanks to Jeff Layton for being correctly suspicious of this code....)
--- net/sunrpc/svc.c | 10 +++++++++- net/sunrpc/svc_xprt.c | 48 +++++++++++++++++++++++++++++------------------- 2 files changed, 38 insertions(+), 20 deletions(-)
net/sunrpc/svc.c +9 -1
@@ -475,7 +475,15 @@ svc_destroy(struct svc_serv *serv)printk ("svc_destroy: no threads for serv=%p!\n" , serv);del_timer_sync (&serv->sv_temptimer); - +/* +* The set of xprts (contained in the sv_tempsocks and +* sv_permsocks lists) is now constant, since it is modified +* only by accepting new sockets (done by service threads in +* svc_recv) or aging old ones (done by sv_temptimer), or +* configuration changes (excluded by whatever locking the +* caller is using--nfsd_mutex in the case of nfsd). So it's +* safe to traverse those lists and shut everything down: +*/ svc_close_all (serv);if (serv->sv_shutdown)
net/sunrpc/svc_xprt.c +29 -19
71 lines not on this page · raw message
PATCH 47/90 nfsd: Fix oops when parsing a 0 length export
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sasha Levin <[email protected]>
commit b2ea70afade7080360ac55c4e64ff7a5fafdb67b upstream.
expkey_parse() oopses when handling a 0 length export. This is easily triggerable from usermode by writing 0 bytes into '/proc/[proc id]/net/rpc/nfsd.fh/channel'.
Below is the log:
[ 1402.286893] BUG: unable to handle kernel paging request at ffff880077c49fff [ 1402.287632] IP: [<ffffffff812b4b99>] expkey_parse+0x28/0x2e1 [ 1402.287632] PGD 2206063 PUD 1fdfd067 PMD 1ffbc067 PTE 8000000077c49160 [ 1402.287632] Oops: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC [ 1402.287632] CPU 1 [ 1402.287632] Pid: 20198, comm: trinity Not tainted 3.2.0-rc2-sasha-00058-gc65cd37 #6 [ 1402.287632] RIP: 0010:[<ffffffff812b4b99>] [<ffffffff812b4b99>] expkey_parse+0x28/0x2e1 [ 1402.287632] RSP: 0018:ffff880077f0fd68 EFLAGS: 00010292 [ 1402.287632] RAX: ffff880077c49fff RBX: 00000000ffffffea RCX: 0000000001043400 [ 1402.287632] RDX: 0000000000000000 RSI: ffff880077c4a000 RDI: ffffffff82283de0 [ 1402.287632] RBP: ffff880077f0fe18 R08: 0000000000000001 R09: ffff880000000000 [ 1402.287632] R10: 0000000000000000 R11: 0000000000000001 R12: ffff880077c4a000 [ 1402.287632] R13: ffffffff82283de0 R14: 0000000001043400 R15: ffffffff82283de0 [ 1402.287632] FS: 00007f25fec3f700(0000) GS:ffff88007d400000(0000) knlGS:0000000000000000 [ 1402.287632] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [ 1402.287632] CR2: ffff880077c49fff CR3: 0000000077e1d000 CR4: 00000000000406e0 [ 1402.287632] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 1402.287632] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 [ 1402.287632] Process trinity (pid: 20198, threadinfo ffff880077f0e000, task ffff880077db17b0) [ 1402.287632] Stack: [ 1402.287632] ffff880077db17b0 ffff880077c4a000 ffff880077f0fdb8 ffffffff810b411e [ 1402.287632] ffff880000000000 ffff880077db17b0 ffff880077c4a000 ffffffff82283de0 [ 1402.287632] 0000000001043400 ffffffff82283de0 ffff880077f0fde8 ffffffff81111f63 [ 1402.287632] Call Trace: [ 1402.287632] [<ffffffff810b411e>] ? lock_release+0x1af/0x1bc [ 1402.287632] [<ffffffff81111f63>] ? might_fault+0x97/0x9e [ 1402.287632] [<ffffffff81111f1a>] ? might_fault+0x4e/0x9e [ 1402.287632] [<ffffffff81a8bcf2>] cache_do_downcall+0x3e/0x4f [ 1402.287632] [<ffffffff81a8c950>] cache_write.clone.16+0xbb/0x130 [ 1402.287632] [<ffffffff81a8c9df>] ? cache_write_pipefs+0x1a/0x1a [ 1402.287632] [<ffffffff81a8c9f8>] cache_write_procfs+0x19/0x1b [ 1402.287632] [<ffffffff8118dc54>] proc_reg_write+0x8e/0xad [ 1402.287632] [<ffffffff8113fe81>] vfs_write+0xaa/0xfd [ 1402.287632] [<ffffffff8114142d>] ? fget_light+0x35/0x9e [ 1402.287632] [<ffffffff8113ff8b>] sys_write+0x48/0x6f [ 1402.287632] [<ffffffff81bbdb92>] system_call_fastpath+0x16/0x1b [ 1402.287632] Code: c0 c9 c3 55 48 63 d2 48 89 e5 48 8d 44 32 ff 41 57 41 56 41 55 41 54 53 bb ea ff ff ff 48 81 ec 88 00 00 00 48 89 b5 58 ff ff ff [ 1402.287632] 38 0a 0f 85 89 02 00 00 c6 00 00 48 8b 3d 44 4a e5 01 48 85 [ 1402.287632] RIP [<ffffffff812b4b99>] expkey_parse+0x28/0x2e1 [ 1402.287632] RSP <ffff880077f0fd68> [ 1402.287632] CR2: ffff880077c49fff [ 1402.287632] ---[ end trace 368ef53ff773a5e3 ]---
--- fs/nfsd/export.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfsd/export.c +1 -1
@@ -88,7 +88,7 @@ static int expkey_parse(struct cache_detstruct svc_expkey key;struct svc_expkey *ek =NULL ; -if (mesg[mlen-1 ] !='\n' ) +if (mlen <1 || mesg[mlen-1 ] !='\n' )return -EINVAL ; mesg[mlen-1 ] =0 ;
PATCH 48/90 fsnotify: dont BUG in fsnotify_destroy_mark()
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miklos Szeredi <[email protected]>
commit fed474857efbed79cd390d0aee224231ca718f63 upstream.
Removing the parent of a watched file results in "kernel BUG at fs/notify/mark.c:139".
To reproduce
add "-w /tmp/audit/dir/watched_file" to audit.rules rm -rf /tmp/audit/dir
This is caused by fsnotify_destroy_mark() being called without an extra reference taken by the caller.
Reported by Francesco Cosoleto here:
https://bugzilla.novell.com/show_bug.cgi?id=689860
Fix by removing the BUG_ON and adding a comment about not accessing mark after the iput.
--- fs/notify/mark.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
fs/notify/mark.c +5 -3
@@ -135,9 +135,6 @@ void fsnotify_destroy_mark(struct fsnoti mark->flags &= ~FSNOTIFY_MARK_FLAG_ALIVE ; -/* 1 from caller and 1 for being on i_list/g_list */ -BUG_ON (atomic_read (&mark->refcnt) <2 ); -spin_lock (&group->mark_lock);if (mark->flags &FSNOTIFY_MARK_FLAG_INODE ) {
@@ -182,6 +179,11 @@ void fsnotify_destroy_mark(struct fsnotiiput (inode);/* +* We don't necessarily have a ref on mark from caller so the above iput +* may have already destroyed it. Don't touch from now on. +*/ + +/* * it's possible that this group tried to destroy itself, but this * this mark was simultaneously being freed by inode. If that's the * case, we finish freeing the group here.
PATCH 49/90 x86, UV: Update Boot messages for SGI UV2 platform
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jack Steiner <[email protected]>
commit da517a08ac5913cd80ce3507cddd00f2a091b13c upstream.
SGI UV systems print a message during boot:
UV: Found <num> blades
Due to packaging changes, the blade count is not accurate for on the next generation of the platform. This patch corrects the count.
--- arch/x86/kernel/apic/x2apic_uv_x.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
arch/x86/kernel/apic/x2apic_uv_x.c +6 -1
@@ -779,7 +779,12 @@ void __init uv_system_init(void)for (i =0 ; i <UVH_NODE_PRESENT_TABLE_DEPTH ; i++) uv_possible_blades +=hweight64 (uv_read_local_mmr (UVH_NODE_PRESENT_TABLE + i *8 )); -printk (KERN_DEBUG "UV: Found %d blades\n" ,uv_num_possible_blades ()); + +/* uv_num_possible_blades() is really the hub count */ +printk (KERN_INFO "UV: Found %d blades, %d hubs\n" , +is_uv1_hub () ?uv_num_possible_blades () : + (uv_num_possible_blades () +1 ) /2 , +uv_num_possible_blades ()); bytes =sizeof (struct uv_blade_info ) *uv_num_possible_blades (); uv_blade_info =kzalloc (bytes,GFP_KERNEL );
PATCH 50/90 recordmcount: Fix handling of elf64 big-endian objects.
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Daney <[email protected]>
commit 2e885057b7f75035f0b85e02f737891482815a81 upstream.
In ELF64, the sh_flags field is 64-bits wide. recordmcount was erroneously treating it as a 32-bit wide field. For little endian objects this works because the flags of interest (SHF_EXECINSTR) reside in the lower 32 bits of the word, and you get the same result with either a 32-bit or 64-bit read. Big endian objects on the other hand do not work at all with this error.
The fix: Correctly treat sh_flags as 64-bits wide in elf64 objects.
The symptom I observed was that my __start_mcount_loc..__stop_mcount_loc was empty even though ftrace function tracing was enabled.
--- scripts/recordmcount.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/recordmcount.h +1 -1
@@ -462,7 +462,7 @@ __has_rel_mcount(Elf_Shdr const *const rsucceed_file (); }if (w (txthdr->sh_type) !=SHT_PROGBITS || - !(w (txthdr->sh_flags) &SHF_EXECINSTR )) + !(_w (txthdr->sh_flags) &SHF_EXECINSTR ))return NULL ;return txtname; }
PATCH 51/90 uvcvideo: Fix integer overflow in uvc_ioctl_ctrl_map()
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haogang Chen <[email protected]>
commit 806e23e95f94a27ee445022d724060b9b45cb64a upstream.
There is a potential integer overflow in uvc_ioctl_ctrl_map(). When a large xmap->menu_count is passed from the userspace, the subsequent call to kmalloc() will allocate a buffer smaller than expected. map->menu_count and map->menu_info would later be used in a loop (e.g. in uvc_query_v4l2_ctrl), which leads to out-of-bound access.
The patch checks the ioctl argument and returns -EINVAL for zero or too large values in xmap->menu_count.
--- drivers/media/video/uvc/uvc_v4l2.c | 9 +++++++++ drivers/media/video/uvc/uvcvideo.h | 1 + 2 files changed, 10 insertions(+)
drivers/media/video/uvc/uvc_v4l2.c +9 -0
@@ -65,6 +65,15 @@ static int uvc_ioctl_ctrl_map(struct uvc goto done; } +/* Prevent excessive memory consumption, as well as integer +* overflows. +*/ +if (xmap->menu_count ==0 || + xmap->menu_count >UVC_MAX_CONTROL_MENU_ENTRIES ) { + ret = -EINVAL ; + goto done; + } + size = xmap->menu_count *sizeof (*map->menu_info); map->menu_info =kmalloc (size,GFP_KERNEL );if (map->menu_info ==NULL ) {
drivers/media/video/uvc/uvcvideo.h +1 -0
@@ -200,6 +200,7 @@ struct uvc_xu_control {/* Maximum allowed number of control mappings per device */ #define UVC_MAX_CONTROL_MAPPINGS 1024 +#define UVC_MAX_CONTROL_MENU_ENTRIES 32/* Devices quirks */ #define UVC_QUIRK_STATUS_INTERVAL 0x00000001
PATCH 52/90 fix shrink_dcache_parent() livelock
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miklos Szeredi <[email protected]>
commit eaf5f9073533cde21c7121c136f1c3f072d9cf59 upstream.
Two (or more) concurrent calls of shrink_dcache_parent() on the same dentry may cause shrink_dcache_parent() to loop forever.
Here's what appears to happen:
1 - CPU0: select_parent(P) finds C and puts it on dispose list, returns 1
2 - CPU1: select_parent(P) locks P->d_lock
3 - CPU0: shrink_dentry_list() locks C->d_lock
dentry_kill(C) tries to lock P->d_lock but fails, unlocks C->d_lock
4 - CPU1: select_parent(P) locks C->d_lock,
moves C from dispose list being processed on CPU0 to the new
dispose list, returns 1
5 - CPU0: shrink_dentry_list() finds dispose list empty, returns
6 - Goto 2 with CPU0 and CPU1 switched
Basically select_parent() steals the dentry from shrink_dentry_list() and thinks it found a new one, causing shrink_dentry_list() to think it's making progress and loop over and over.
One way to trigger this is to make udev calls stat() on the sysfs file while it is going away.
Having a file in /lib/udev/rules.d/ with only this one rule seems to the trick:
ATTR{vendor}=="0x8086", ATTR{device}=="0x10ca", ENV{PCI_SLOT_NAME}="%k", ENV{MATCHADDR}="$attr{address}", RUN+="/bin/true"
Then execute the following loop:
while true; do
echo -bond0 > /sys/class/net/bonding_masters echo +bond0 > /sys/class/net/bonding_masters echo -bond1 > /sys/class/net/bonding_masters echo +bond1 > /sys/class/net/bonding_masters
done
One fix would be to check all callers and prevent concurrent calls to shrink_dcache_parent(). But I think a better solution is to stop the stealing behavior.
This patch adds a new dentry flag that is set when the dentry is added to the dispose list. The flag is cleared in dentry_lru_del() in case the dentry gets a new reference just before being pruned.
If the dentry has this flag, select_parent() will skip it and let shrink_dentry_list() retry pruning it. With select_parent() skipping those dentries there will not be the appearance of progress (new dentries found) when there is none, hence shrink_dcache_parent() will not loop forever.
Set the flag is also set in prune_dcache_sb() for consistency as suggested by Linus.
--- fs/dcache.c | 14 ++++++++++---- include/linux/dcache.h | 1 + 2 files changed, 11 insertions(+), 4 deletions(-)
fs/dcache.c +10 -4
@@ -241,6 +241,7 @@ static void dentry_lru_add(struct dentrystatic void __dentry_lru_del (struct dentry *dentry) {list_del_init (&dentry->d_lru); + dentry->d_flags &= ~DCACHE_SHRINK_LIST ; dentry->d_sb->s_nr_dentry_unused--; dentry_stat.nr_unused--; }
@@ -753,6 +754,7 @@ relock:spin_unlock (&dentry->d_lock); }else {list_move_tail (&dentry->d_lru, &tmp); + dentry->d_flags |=DCACHE_SHRINK_LIST ;spin_unlock (&dentry->d_lock);if (!--cnt)break ;
@@ -1144,14 +1146,18 @@ resume:/* * move only zero ref count dentries to the end * of the unused list for prune_dcache +* +* Those which are presently on the shrink list, being processed +* by shrink_dentry_list(), shouldn't be moved. Otherwise the +* loop in shrink_dcache_parent() might not make any progress +* and loop forever. */ -if (!dentry->d_count) { +if (dentry->d_count) { +dentry_lru_del (dentry); + }else if (!(dentry->d_flags &DCACHE_SHRINK_LIST )) {dentry_lru_move_tail (dentry); found++; - }else { -dentry_lru_del (dentry); } -/* * We can return to the caller if we have found some (this * ensures forward progress). We'll be coming back to find
include/linux/dcache.h +1 -0
@@ -207,6 +207,7 @@ struct dentry_operations {#define DCACHE_CANT_MOUNT 0x0100#define DCACHE_GENOCIDE 0x0200 +#define DCACHE_SHRINK_LIST 0x0400#define DCACHE_OP_HASH 0x1000#define DCACHE_OP_COMPARE 0x2000
PATCH 53/90 ah: Correctly pass error codes in ahash output callback.
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nick Bowler <[email protected]>
commit 069294e813ed5f27f82613b027609bcda5f1b914 upstream.
The AH4/6 ahash output callbacks pass nexthdr to xfrm_output_resume instead of the error code. This appears to be a copy+paste error from the input case, where nexthdr is expected. This causes the driver to continuously add AH headers to the datagram until either an allocation fails and the packet is dropped or the ahash driver hits a synchronous fallback and the resulting monstrosity is transmitted.
Correct this issue by simply passing the error code unadulterated.
--- net/ipv4/ah4.c | 2 -- net/ipv6/ah6.c | 2 -- 2 files changed, 4 deletions(-)
net/ipv4/ah4.c +0 -2
@@ -136,8 +136,6 @@ static void ah_output_done(struct cryptomemcpy (top_iph+1 , iph+1 , top_iph->ihl*4 -sizeof (struct iphdr )); } - err = ah->nexthdr; -kfree (AH_SKB_CB (skb)->tmp);xfrm_output_resume (skb, err); }
net/ipv6/ah6.c +0 -2
@@ -324,8 +324,6 @@ static void ah6_output_done(struct crypt#endif } - err = ah->nexthdr; -kfree (AH_SKB_CB (skb)->tmp);xfrm_output_resume (skb, err); }
PATCH 54/90 ah: Read nexthdr value before overwriting it in ahash input callback.
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nick Bowler <[email protected]>
commit b7ea81a58adc123a4e980cb0eff9eb5c144b5dc7 upstream.
The AH4/6 ahash input callbacks read out the nexthdr field from the AH header *after* they overwrite that header. This is obviously not going to end well. Fix it up.
--- net/ipv4/ah4.c | 4 ++-- net/ipv6/ah6.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
net/ipv4/ah4.c +2 -2
@@ -262,12 +262,12 @@ static void ah_input_done(struct crypto_if (err) goto out; + err = ah->nexthdr; + skb->network_header += ah_hlen;memcpy (skb_network_header (skb), work_iph, ihl);__skb_pull (skb, ah_hlen + ihl);skb_set_transport_header (skb, -ihl); - - err = ah->nexthdr; out:kfree (AH_SKB_CB (skb)->tmp);xfrm_input_resume (skb, err);
net/ipv6/ah6.c +2 -2
@@ -464,12 +464,12 @@ static void ah6_input_done(struct cryptoif (err) goto out; + err = ah->nexthdr; + skb->network_header += ah_hlen;memcpy (skb_network_header (skb), work_iph, hdr_len);__skb_pull (skb, ah_hlen + hdr_len);skb_set_transport_header (skb, -hdr_len); - - err = ah->nexthdr; out:kfree (AH_SKB_CB (skb)->tmp);xfrm_input_resume (skb, err);
PATCH 55/90 HID: hid-multitouch - add another eGalax id
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Bagwell <[email protected]>
commit 1fd8f047490dd0ec4e4db710fcbc1bd4798d944c upstream.
This allows ASUS Eee Slate touchscreens to work.
--- drivers/hid/hid-core.c | 1 + drivers/hid/hid-ids.h | 1 + drivers/hid/hid-multitouch.c | 3 +++ 3 files changed, 5 insertions(+)
drivers/hid/hid-core.c +1 -0
@@ -1387,6 +1387,7 @@ static const struct hid_device_id hid_ha { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH2) }, { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH3) }, { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH4) }, + { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH5) }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084) }, { HID_USB_DEVICE(USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2515) }, { HID_USB_DEVICE(USB_VENDOR_ID_EMS, USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II) },
drivers/hid/hid-ids.h +1 -0
@@ -235,6 +235,7 @@#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH2 0x72a1#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH3 0x480e#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH4 0x726b +#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH5 0xa001#define USB_VENDOR_ID_ELECOM 0x056e#define USB_DEVICE_ID_ELECOM_BM084 0x0061
drivers/hid/hid-multitouch.c +3 -0
@@ -646,6 +646,9 @@ static const struct hid_device_id mt_dev { .driver_data = MT_CLS_EGALAX,HID_USB_DEVICE (USB_VENDOR_ID_DWAV , USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH4) }, + { .driver_data = MT_CLS_EGALAX, +HID_USB_DEVICE (USB_VENDOR_ID_DWAV , + USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH5) }, /* Elo TouchSystems IntelliTouch Plus panel */ { .driver_data = MT_CLS_DUAL_NSMU_CONTACTID,
PATCH 56/90 HID: multitouch: cleanup with eGalax PID definitions
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Tissoires <[email protected]>
commit e36f690b37945e0a9bb1554e1546eeec93f7d1f6 upstream.
This is just a renaming of USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH{N} to USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_{PID} to handle more eGalax devices.
--- drivers/hid/hid-core.c | 12 ++++++------ drivers/hid/hid-ids.h | 12 ++++++------ drivers/hid/hid-multitouch.c | 24 ++++++++++++------------ 3 files changed, 24 insertions(+), 24 deletions(-)
drivers/hid/hid-core.c +6 -6
@@ -1382,12 +1382,12 @@ static const struct hid_device_id hid_ha { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_TRUETOUCH) }, { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0006) }, { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0011) }, - { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH) }, - { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH1) }, - { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH2) }, - { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH3) }, - { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH4) }, - { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH5) }, + { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480D) }, + { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480E) }, + { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_720C) }, + { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_726B) }, + { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72A1) }, + { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001) }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084) }, { HID_USB_DEVICE(USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2515) }, { HID_USB_DEVICE(USB_VENDOR_ID_EMS, USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II) },
drivers/hid/hid-ids.h +6 -6
@@ -230,12 +230,12 @@#define USB_VENDOR_ID_DWAV 0x0eef#define USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER 0x0001 -#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH 0x480d -#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH1 0x720c -#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH2 0x72a1 -#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH3 0x480e -#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH4 0x726b -#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH5 0xa001 +#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480D 0x480d +#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480E 0x480e +#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_720C 0x720c +#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_726B 0x726b +#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72A1 0x72a1 +#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001 0xa001#define USB_VENDOR_ID_ELECOM 0x056e#define USB_DEVICE_ID_ELECOM_BM084 0x0061
drivers/hid/hid-multitouch.c +12 -12
@@ -629,26 +629,26 @@ static const struct hid_device_id mt_dev USB_DEVICE_ID_CYPRESS_TRUETOUCH) },/* eGalax devices (resistive) */ - { .driver_data = MT_CLS_EGALAX, + { .driver_data = MT_CLS_EGALAX,HID_USB_DEVICE (USB_VENDOR_ID_DWAV , - USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH) }, - { .driver_data = MT_CLS_EGALAX, + USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480D) }, + { .driver_data = MT_CLS_EGALAX,HID_USB_DEVICE (USB_VENDOR_ID_DWAV , - USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH3) }, + USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480E) }, /* eGalax devices (capacitive) */ - { .driver_data = MT_CLS_EGALAX, + { .driver_data = MT_CLS_EGALAX,HID_USB_DEVICE (USB_VENDOR_ID_DWAV , - USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH1) }, - { .driver_data = MT_CLS_EGALAX, + USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_720C) }, + { .driver_data = MT_CLS_EGALAX,HID_USB_DEVICE (USB_VENDOR_ID_DWAV , - USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH2) }, - { .driver_data = MT_CLS_EGALAX, + USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_726B) }, + { .driver_data = MT_CLS_EGALAX,HID_USB_DEVICE (USB_VENDOR_ID_DWAV , - USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH4) }, - { .driver_data = MT_CLS_EGALAX, + USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72A1) }, + { .driver_data = MT_CLS_EGALAX,HID_USB_DEVICE (USB_VENDOR_ID_DWAV , - USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH5) }, + USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001) }, /* Elo TouchSystems IntelliTouch Plus panel */ { .driver_data = MT_CLS_DUAL_NSMU_CONTACTID,
PATCH 57/90 HID: multitouch: Add egalax ID for Acer Iconia W500
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
commit bb9ff21072043634f147c05ac65dbf8185d4af6d upstream.
This patch adds USB ID for the touchpanel in Acer Iconia W500. The panel supports up to five fingers, therefore the need for a new addition of panel types.
--- drivers/hid/hid-core.c | 1 + drivers/hid/hid-ids.h | 1 + drivers/hid/hid-multitouch.c | 3 +++ 3 files changed, 5 insertions(+)
drivers/hid/hid-core.c +1 -0
@@ -1387,6 +1387,7 @@ static const struct hid_device_id hid_ha { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_720C) }, { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_726B) }, { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72A1) }, + { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7302) }, { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001) }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084) }, { HID_USB_DEVICE(USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2515) },
drivers/hid/hid-ids.h +1 -0
@@ -235,6 +235,7 @@#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_720C 0x720c#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_726B 0x726b#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72A1 0x72a1 +#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7302 0x7302#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001 0xa001#define USB_VENDOR_ID_ELECOM 0x056e
drivers/hid/hid-multitouch.c +3 -0
@@ -648,6 +648,9 @@ static const struct hid_device_id mt_dev USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72A1) }, { .driver_data = MT_CLS_EGALAX,HID_USB_DEVICE (USB_VENDOR_ID_DWAV , + USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7302) }, + { .driver_data = MT_CLS_EGALAX, +HID_USB_DEVICE (USB_VENDOR_ID_DWAV , USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001) },/* Elo TouchSystems IntelliTouch Plus panel */
PATCH 58/90 HID: multitouch: add support for the MSI Windpad 110W
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Tissoires <[email protected]>
commit 66f06127f34ad6e8a1b24a2c03144b694d19f99f upstream.
Just another eGalax device.
Please note that adding this device to have_special_driver in hid-core.c is not required anymore.
--- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-multitouch.c | 3 +++ 2 files changed, 4 insertions(+)
drivers/hid/hid-ids.h +1 -0
@@ -235,6 +235,7 @@#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_720C 0x720c#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_726B 0x726b#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72A1 0x72a1 +#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72FA 0x72fa#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7302 0x7302#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001 0xa001
drivers/hid/hid-multitouch.c +3 -0
@@ -648,6 +648,9 @@ static const struct hid_device_id mt_dev USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72A1) }, { .driver_data = MT_CLS_EGALAX,HID_USB_DEVICE (USB_VENDOR_ID_DWAV , + USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72FA) }, + { .driver_data = MT_CLS_EGALAX, +HID_USB_DEVICE (USB_VENDOR_ID_DWAV , USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7302) }, { .driver_data = MT_CLS_EGALAX, HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
PATCH 59/90 HID: multitouch: add support for 3M 32"
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Tissoires <[email protected]>
commit c4fad877cd0efb51d8180ae2eaa791c99c92051c upstream.
--- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-multitouch.c | 3 +++ 2 files changed, 4 insertions(+)
drivers/hid/hid-ids.h +1 -0
@@ -21,6 +21,7 @@#define USB_VENDOR_ID_3M 0x0596#define USB_DEVICE_ID_3M1968 0x0500#define USB_DEVICE_ID_3M2256 0x0502 +#define USB_DEVICE_ID_3M3266 0x0506#define USB_VENDOR_ID_A4TECH 0x09da#define USB_DEVICE_ID_A4TECH_WCP32PU 0x0006
drivers/hid/hid-multitouch.c +3 -0
@@ -593,6 +593,9 @@ static const struct hid_device_id mt_dev { .driver_data = MT_CLS_3M,HID_USB_DEVICE (USB_VENDOR_ID_3M , USB_DEVICE_ID_3M2256) }, + { .driver_data = MT_CLS_3M, +HID_USB_DEVICE (USB_VENDOR_ID_3M , + USB_DEVICE_ID_3M3266) }, /* ActionStar panels */ { .driver_data = MT_CLS_DEFAULT,
PATCH 60/90 fix cputime overflow in uptime_proc_show
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
commit c3e0ef9a298e028a82ada28101ccd5cf64d209ee upstream.
For 32-bit architectures using standard jiffies the idletime calculation in uptime_proc_show will quickly overflow. It takes (2^32 / HZ) seconds of idle-time, or e.g. 12.45 days with no load on a quad-core with HZ=1000. Switch to 64-bit calculations.
--- fs/proc/uptime.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
fs/proc/uptime.c +7 -2
@@ -11,15 +11,20 @@ static int uptime_proc_show(struct seq_f {struct timespec uptime;struct timespec idle; +cputime64_t idletime; +u64 nsec; +u32 rem;int i; -cputime_t idletime = cputime_zero; + idletime =0 ;for_each_possible_cpu (i) idletime =cputime64_add (idletime,kstat_cpu (i).cpustat.idle);do_posix_clock_monotonic_gettime (&uptime);monotonic_to_bootbased (&uptime); -cputime_to_timespec (idletime, &idle); + nsec =cputime64_to_jiffies64 (idletime) *TICK_NSEC ; + idle.tv_sec =div_u64_rem (nsec,NSEC_PER_SEC , &rem); + idle.tv_nsec = rem; seq_printf(m, "%lu.%02lu %lu.%02lu\n", (unsigned long) uptime.tv_sec, (uptime.tv_nsec / (NSEC_PER_SEC / 100)),
PATCH 61/90 block: add and use scsi_blk_cmd_ioctl
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Bonzini <[email protected]>
commit 577ebb374c78314ac4617242f509e2f5e7156649 upstream.
Introduce a wrapper around scsi_cmd_ioctl that takes a block device.
The function will then be enhanced to detect partition block devices and, in that case, subject the ioctls to whitelisting.
--- block/scsi_ioctl.c | 7 +++++++ drivers/block/cciss.c | 6 +++--- drivers/block/ub.c | 3 +-- drivers/block/virtio_blk.c | 4 ++-- drivers/cdrom/cdrom.c | 3 +-- drivers/ide/ide-floppy_ioctl.c | 3 +-- drivers/scsi/sd.c | 2 +- include/linux/blkdev.h | 2 ++ 8 files changed, 18 insertions(+), 12 deletions(-)
block/scsi_ioctl.c +7 -0
@@ -691,6 +691,13 @@ int scsi_cmd_ioctl(struct request_queue }EXPORT_SYMBOL (scsi_cmd_ioctl); +int scsi_cmd_blk_ioctl (struct block_device *bd,fmode_t mode, +unsigned int cmd,void __user *arg) +{ +return scsi_cmd_ioctl (bd->bd_disk->queue, bd->bd_disk, mode, cmd, arg); +} +EXPORT_SYMBOL (scsi_cmd_blk_ioctl); +static int __init blk_scsi_ioctl_init (void ) {blk_set_cmd_filter_defaults (&blk_default_cmd_filter);
drivers/block/cciss.c +3 -3
@@ -1716,7 +1716,7 @@ static int cciss_ioctl(struct block_devicase CCISS_BIG_PASSTHRU :return cciss_bigpassthru (h, argp); -/* scsi_cmd_ioctl handles these, below, though some are not */ +/* scsi_cmd_blk_ioctl handles these, below, though some are not */ /* very meaningful for cciss. SG_IO is the main one people want. */ case SG_GET_VERSION_NUM :
@@ -1727,9 +1727,9 @@ static int cciss_ioctl(struct block_devicase SG_EMULATED_HOST :case SG_IO :case SCSI_IOCTL_SEND_COMMAND : -return scsi_cmd_ioctl (disk->queue, disk, mode, cmd, argp); +return scsi_cmd_blk_ioctl (bdev, mode, cmd, argp); -/* scsi_cmd_ioctl would normally handle these, below, but */ +/* scsi_cmd_blk_ioctl would normally handle these, below, but */ /* they aren't a good fit for cciss, as CD-ROMs are */ /* not supported, and we don't have any bus/target/lun */ /* which we present to the kernel. */
drivers/block/ub.c +1 -2
@@ -1744,12 +1744,11 @@ static int ub_bd_release(struct gendiskstatic int ub_bd_ioctl (struct block_device *bdev,fmode_t mode,unsigned int cmd,unsigned long arg) { -struct gendisk *disk = bdev->bd_disk;void __user *usermem = (void __user *) arg;int ret;mutex_lock (&ub_mutex); - ret =scsi_cmd_ioctl (disk->queue, disk, mode, cmd, usermem); + ret =scsi_cmd_blk_ioctl (bdev, mode, cmd, usermem);mutex_unlock (&ub_mutex);return ret;
drivers/block/virtio_blk.c +2 -2
@@ -236,8 +236,8 @@ static int virtblk_ioctl(struct block_deif (!virtio_has_feature (vblk->vdev,VIRTIO_BLK_F_SCSI ))return -ENOTTY ; -return scsi_cmd_ioctl (disk->queue, disk, mode, cmd, - (void __user *)data); +return scsi_cmd_blk_ioctl (bdev, mode, cmd, + (void __user *)data); }/* We provide getgeo only to please some old bootloader/partitioning tools */
drivers/cdrom/cdrom.c +1 -2
@@ -2741,12 +2741,11 @@ int cdrom_ioctl(struct cdrom_device_info {void __user *argp = (void __user *)arg;int ret; -struct gendisk *disk = bdev->bd_disk;/* * Try the generic SCSI command ioctl's first. */ - ret =scsi_cmd_ioctl (disk->queue, disk, mode, cmd, argp); + ret =scsi_cmd_blk_ioctl (bdev, mode, cmd, argp);if (ret != -ENOTTY )return ret;
drivers/ide/ide-floppy_ioctl.c +1 -2
@@ -292,8 +292,7 @@ int ide_floppy_ioctl(ide_drive_t *drive,* and CDROM_SEND_PACKET (legacy) ioctls */ if (cmd !=CDROM_SEND_PACKET && cmd !=SCSI_IOCTL_SEND_COMMAND ) - err =scsi_cmd_ioctl (bdev->bd_disk->queue, bdev->bd_disk, - mode, cmd, argp); + err =scsi_cmd_blk_ioctl (bdev, mode, cmd, argp);if (err == -ENOTTY ) err =generic_ide_ioctl (drive, bdev, cmd, arg);
drivers/scsi/sd.c +1 -1
@@ -1095,7 +1095,7 @@ static int sd_ioctl(struct block_device error =scsi_ioctl (sdp, cmd, p);break ;default : - error =scsi_cmd_ioctl (disk->queue, disk, mode, cmd, p); + error =scsi_cmd_blk_ioctl (bdev, mode, cmd, p);if (error != -ENOTTY )break ; error =scsi_ioctl (sdp, cmd, p);
include/linux/blkdev.h +2 -0
@@ -670,6 +670,8 @@ extern int blk_insert_cloned_request(str struct request *rq);extern void blk_delay_queue (struct request_queue *,unsigned long );extern void blk_recount_segments (struct request_queue *,struct bio *); +extern int scsi_cmd_blk_ioctl (struct block_device *,fmode_t , +unsigned int ,void __user *);extern int scsi_cmd_ioctl (struct request_queue *,struct gendisk *,fmode_t ,unsigned int ,void __user *); extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t,
PATCH 62/90 block: fail SCSI passthrough ioctls on partition devices
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Bonzini <[email protected]>
commit 0bfc96cb77224736dfa35c3c555d37b3646ef35e upstream.
Linux allows executing the SG_IO ioctl on a partition or LVM volume, and will pass the command to the underlying block device. This is well-known, but it is also a large security problem when (via Unix permissions, ACLs, SELinux or a combination thereof) a program or user needs to be granted access only to part of the disk.
This patch lets partitions forward a small set of harmless ioctls; others are logged with printk so that we can see which ioctls are actually sent. In my tests only CDROM_GET_CAPABILITY actually occurred. Of course it was being sent to a (partition on a) hard disk, so it would have failed with ENOTTY and the patch isn't changing anything in practice. Still, I'm treating it specially to avoid spamming the logs.
In principle, this restriction should include programs running with CAP_SYS_RAWIO. If for example I let a program access /dev/sda2 and /dev/sdb, it still should not be able to read/write outside the boundaries of /dev/sda2 independent of the capabilities. However, for now programs with CAP_SYS_RAWIO will still be allowed to send the ioctls. Their actions will still be logged.
This patch does not affect the non-libata IDE driver. That driver however already tests for bd != bd->bd_contains before issuing some ioctl; it could be restricted further to forbid these ioctls even for programs running with CAP_SYS_ADMIN/CAP_SYS_RAWIO.
--- block/scsi_ioctl.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ drivers/scsi/sd.c | 11 +++++++++-- include/linux/blkdev.h | 1 + 3 files changed, 55 insertions(+), 2 deletions(-)
block/scsi_ioctl.c +45 -0
@@ -24,6 +24,7 @@#include <linux/capability.h> #include <linux/completion.h> #include <linux/cdrom.h> +#include <linux/ratelimit.h> #include <linux/slab.h> #include <linux/times.h> #include <asm/uaccess.h>
@@ -691,9 +692,53 @@ int scsi_cmd_ioctl(struct request_queue }EXPORT_SYMBOL (scsi_cmd_ioctl); +int scsi_verify_blk_ioctl (struct block_device *bd,unsigned int cmd) +{ +if (bd && bd == bd->bd_contains) +return 0 ; + +/* Actually none of these is particularly useful on a partition, +* but they are safe. +*/ +switch (cmd) { +case SCSI_IOCTL_GET_IDLUN : +case SCSI_IOCTL_GET_BUS_NUMBER : +case SCSI_IOCTL_GET_PCI : +case SCSI_IOCTL_PROBE_HOST : +case SG_GET_VERSION_NUM : +case SG_SET_TIMEOUT : +case SG_GET_TIMEOUT : +case SG_GET_RESERVED_SIZE : +case SG_SET_RESERVED_SIZE : +case SG_EMULATED_HOST : +return 0 ; +case CDROM_GET_CAPABILITY : +/* Keep this until we remove the printk below. udev sends it +* and we do not want to spam dmesg about it. CD-ROMs do +* not have partitions, so we get here only for disks. +*/ +return -ENOIOCTLCMD ; +default : +break ; + } + +/* In particular, rule out all resets and host-specific ioctls. */ +printk_ratelimited (KERN_WARNING +"%s: sending ioctl %x to a partition!\n" , current->comm, cmd); + +return capable (CAP_SYS_RAWIO ) ?0 : -ENOIOCTLCMD ; +} +EXPORT_SYMBOL (scsi_verify_blk_ioctl); +int scsi_cmd_blk_ioctl (struct block_device *bd,fmode_t mode,unsigned int cmd,void __user *arg) { +int ret; + + ret =scsi_verify_blk_ioctl (bd, cmd); +if (ret <0 ) +return ret; +return scsi_cmd_ioctl (bd->bd_disk->queue, bd->bd_disk, mode, cmd, arg); }EXPORT_SYMBOL (scsi_cmd_blk_ioctl);
drivers/scsi/sd.c +9 -2
@@ -1073,6 +1073,10 @@ static int sd_ioctl(struct block_deviceSCSI_LOG_IOCTL (1 ,printk ("sd_ioctl: disk=%s, cmd=0x%x\n" , disk->disk_name, cmd)); + error =scsi_verify_blk_ioctl (bdev, cmd); +if (error <0 ) +return error; +/* * If we are in the middle of error recovery, don't let anyone * else try and use this device. Also, if error recovery fails, it
@@ -1265,6 +1269,11 @@ static int sd_compat_ioctl(struct block_ unsigned int cmd, unsigned long arg) {struct scsi_device *sdev =scsi_disk (bdev->bd_disk)->device; +int ret; + + ret =scsi_verify_blk_ioctl (bdev, cmd); +if (ret <0 ) +return ret;/* * If we are in the middle of error recovery, don't let anyone
@@ -1276,8 +1285,6 @@ static int sd_compat_ioctl(struct block_return -ENODEV ;if (sdev->host->hostt->compat_ioctl) { -int ret; - ret = sdev->host->hostt->compat_ioctl (sdev, cmd, (void __user *)arg);return ret;
include/linux/blkdev.h +1 -0
@@ -670,6 +670,7 @@ extern int blk_insert_cloned_request(str struct request *rq);extern void blk_delay_queue (struct request_queue *,unsigned long );extern void blk_recount_segments (struct request_queue *,struct bio *); +extern int scsi_verify_blk_ioctl (struct block_device *,unsigned int );extern int scsi_cmd_blk_ioctl (struct block_device *,fmode_t ,unsigned int ,void __user *); extern int scsi_cmd_ioctl(struct request_queue *, struct gendisk *, fmode_t,
Paolo Bonzini
reviewerRe: [62/90] block: fail SCSI passthrough ioctls on partition devices
Fixed patch follows.
You need to return -ENOTTY from scsi_verify_blk_ioctl and -ENOIOCTLCMD from sd_compat_ioctl, because -ENOIOCTLCMD will not be handled correctly by block/ioctl.c. This would break BLKROSET and BLKFLSBUF done by non-root but with the appropriate capabilities.
Fixed patch follows. If you prefer that I send an interdiff, let me know.
Paolo
-------- 8< ---------
From: Paolo Bonzini <[email protected]>
Subject: [PATCH] block: fail SCSI passthrough ioctls on partition devices
commit 0bfc96cb77224736dfa35c3c555d37b3646ef35e upstream.
Linux allows executing the SG_IO ioctl on a partition or LVM volume, and will pass the command to the underlying block device. This is well-known, but it is also a large security problem when (via Unix permissions, ACLs, SELinux or a combination thereof) a program or user needs to be granted access only to part of the disk.
This patch lets partitions forward a small set of harmless ioctls; others are logged with printk so that we can see which ioctls are actually sent. In my tests only CDROM_GET_CAPABILITY actually occurred. Of course it was being sent to a (partition on a) hard disk, so it would have failed with ENOTTY and the patch isn't changing anything in practice. Still, I'm treating it specially to avoid spamming the logs.
In principle, this restriction should include programs running with CAP_SYS_RAWIO. If for example I let a program access /dev/sda2 and /dev/sdb, it still should not be able to read/write outside the boundaries of /dev/sda2 independent of the capabilities. However, for now programs with CAP_SYS_RAWIO will still be allowed to send the ioctls. Their actions will still be logged.
This patch does not affect the non-libata IDE driver. That driver however already tests for bd != bd->bd_contains before issuing some ioctl; it could be restricted further to forbid these ioctls even for programs running with CAP_SYS_ADMIN/CAP_SYS_RAWIO.
[ Changes with respect to 3.3: return -ENOTTY from scsi_verify_blk_ioctl
and -ENOIOCTLCMD from sd_compat_ioctl. ]
--- block/scsi_ioctl.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ drivers/scsi/sd.c | 11 +++++++++-- include/linux/blkdev.h | 1 + 3 files changed, 55 insertions(+), 2 deletions(-)
block/scsi_ioctl.c +45 -0
@@ -24,6 +24,7 @@#include <linux/capability.h> #include <linux/completion.h> #include <linux/cdrom.h> +#include <linux/ratelimit.h> #include <linux/slab.h> #include <linux/times.h> #include <asm/uaccess.h>
@@ -691,9 +692,53 @@ int scsi_cmd_ioctl(struct request_queue }EXPORT_SYMBOL (scsi_cmd_ioctl); +int scsi_verify_blk_ioctl (struct block_device *bd,unsigned int cmd) +{ +if (bd && bd == bd->bd_contains) +return 0 ; + +/* Actually none of these is particularly useful on a partition, +* but they are safe. +*/ +switch (cmd) { +case SCSI_IOCTL_GET_IDLUN : +case SCSI_IOCTL_GET_BUS_NUMBER : +case SCSI_IOCTL_GET_PCI : +case SCSI_IOCTL_PROBE_HOST : +case SG_GET_VERSION_NUM : +case SG_SET_TIMEOUT : +case SG_GET_TIMEOUT : +case SG_GET_RESERVED_SIZE : +case SG_SET_RESERVED_SIZE : +case SG_EMULATED_HOST : +return 0 ; +case CDROM_GET_CAPABILITY : +/* Keep this until we remove the printk below. udev sends it +* and we do not want to spam dmesg about it. CD-ROMs do +* not have partitions, so we get here only for disks. +*/ +return -ENOTTY ; +default : +break ; + } + +/* In particular, rule out all resets and host-specific ioctls. */ +printk_ratelimited (KERN_WARNING +"%s: sending ioctl %x to a partition!\n" , current->comm, cmd); + +return capable (CAP_SYS_RAWIO ) ?0 : -ENOTTY ; +} +EXPORT_SYMBOL (scsi_verify_blk_ioctl); +int scsi_cmd_blk_ioctl (struct block_device *bd,fmode_t mode,unsigned int cmd,void __user *arg) { +int ret; + + ret =scsi_verify_blk_ioctl (bd, cmd); +if (ret <0 ) +return ret; +return scsi_cmd_ioctl (bd->bd_disk->queue, bd->bd_disk, mode, cmd, arg); }EXPORT_SYMBOL (scsi_cmd_blk_ioctl);
drivers/scsi/sd.c +9 -2
@@ -1073,6 +1073,10 @@ static int sd_ioctl(struct block_deviceSCSI_LOG_IOCTL (1 ,printk ("sd_ioctl: disk=%s, cmd=0x%x\n" , disk->disk_name, cmd)); + error =scsi_verify_blk_ioctl (bdev, cmd); +if (error <0 ) +return error; +/* * If we are in the middle of error recovery, don't let anyone * else try and use this device. Also, if error recovery fails, it
@@ -1265,6 +1269,11 @@ static int sd_compat_ioctl(struct block_ unsigned int cmd, unsigned long arg) {struct scsi_device *sdev =scsi_disk (bdev->bd_disk)->device; +int ret; + + ret =scsi_verify_blk_ioctl (bdev, cmd); +if (ret <0 ) +return -ENOIOCTLCMD ;/* * If we are in the middle of error recovery, don't let anyone
@@ -1276,8 +1285,6 @@ static int sd_compat_ioctl(struct block_return -ENODEV ;if (sdev->host->hostt->compat_ioctl) { -int ret; - ret = sdev->host->hostt->compat_ioctl (sdev, cmd, (void __user *)arg);return ret;
include/linux/blkdev.h +1 -0
@@ -670,6 +670,7 @@ extern int blk_insert_cloned_request(str struct request *rq);extern void blk_delay_queue (struct request_queue *,unsigned long );extern void blk_recount_segments (struct request_queue *,struct bio *); +extern int scsi_verify_blk_ioctl (struct block_device *,unsigned int );extern int scsi_cmd_blk_ioctl (struct block_device *,fmode_t ,unsigned int ,void __user *); extern int scsi_cmd_ioctl(struct request_queue *, struct gendisk *, fmode_t,
PATCH 63/90 dm: do not forward ioctls from logical volumes to the underlying device
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Bonzini <[email protected]>
commit ec8013beddd717d1740cfefb1a9b900deef85462 upstream.
A logical volume can map to just part of underlying physical volume. In this case, it must be treated like a partition.
Based on a patch from Alasdair G Kergon.
--- drivers/md/dm-flakey.c | 11 ++++++++++- drivers/md/dm-linear.c | 12 +++++++++++- drivers/md/dm-mpath.c | 6 ++++++ 3 files changed, 27 insertions(+), 2 deletions(-)
drivers/md/dm-flakey.c +10 -1
@@ -149,8 +149,17 @@ static int flakey_status(struct dm_targestatic int flakey_ioctl (struct dm_target *ti,unsigned int cmd,unsigned long arg) {struct flakey_c *fc = ti->private; +struct dm_dev *dev = fc->dev; +int r =0 ; -return __blkdev_driver_ioctl (fc->dev->bdev, fc->dev->mode, cmd, arg); +/* +* Only pass ioctls through if the device sizes match exactly. +*/ +if (fc->start || + ti->len !=i_size_read (dev->bdev->bd_inode) >>SECTOR_SHIFT ) + r =scsi_verify_blk_ioctl (NULL , cmd); + +return r ? :__blkdev_driver_ioctl (dev->bdev, dev->mode, cmd, arg); } static int flakey_merge(struct dm_target *ti, struct bvec_merge_data *bvm,
drivers/md/dm-linear.c +11 -1
@@ -116,7 +116,17 @@ static int linear_ioctl(struct dm_target unsigned long arg) {struct linear_c *lc = (struct linear_c *) ti->private; -return __blkdev_driver_ioctl (lc->dev->bdev, lc->dev->mode, cmd, arg); +struct dm_dev *dev = lc->dev; +int r =0 ; + +/* +* Only pass ioctls through if the device sizes match exactly. +*/ +if (lc->start || + ti->len !=i_size_read (dev->bdev->bd_inode) >>SECTOR_SHIFT ) + r =scsi_verify_blk_ioctl (NULL , cmd); + +return r ? :__blkdev_driver_ioctl (dev->bdev, dev->mode, cmd, arg); } static int linear_merge(struct dm_target *ti, struct bvec_merge_data *bvm,
drivers/md/dm-mpath.c +6 -0
@@ -1584,6 +1584,12 @@ static int multipath_ioctl(struct dm_tarspin_unlock_irqrestore (&m->lock, flags); +/* +* Only pass ioctls through if the device sizes match exactly. +*/ +if (!r && ti->len !=i_size_read (bdev->bd_inode) >>SECTOR_SHIFT ) + r =scsi_verify_blk_ioctl (NULL , cmd); +return r ? :__blkdev_driver_ioctl (bdev, mode, cmd, arg); }
PATCH 64/90 proc: clean up and fix /proc/<pid>/mem handling
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit e268337dfe26dfc7efd422a804dbb27977a3cccc upstream.
Jüri Aedla reported that the /proc/<pid>/mem handling really isn't very robust, and it also doesn't match the permission checking of any of the other related files.
This changes it to do the permission checks at open time, and instead of tracking the process, it tracks the VM at the time of the open. That simplifies the code a lot, but does mean that if you hold the file descriptor open over an execve(), you'll continue to read from the _old_ VM.
That is different from our previous behavior, but much simpler. If somebody actually finds a load where this matters, we'll need to revert this commit.
I suspect that nobody will ever notice - because the process mapping addresses will also have changed as part of the execve. So you cannot actually usefully access the fd across a VM change simply because all the offsets for IO would have changed too.
--- fs/proc/base.c | 145 +++++++++++++++------------------------------------------ 1 file changed, 39 insertions(+), 106 deletions(-)
fs/proc/base.c +39 -106
@@ -194,65 +194,7 @@ static int proc_root_link(struct inode *return result; } -static struct mm_struct *__check_mem_permission (struct task_struct *task) -{ -struct mm_struct *mm; - - mm =get_task_mm (task); -if (!mm) -return ERR_PTR (-EINVAL ); - -/* -* A task can always look at itself, in case it chooses -* to use system calls instead of load instructions. -*/ -if (task == current) -return mm; - -/* -* If current is actively ptrace'ing, and would also be -* permitted to freshly attach with ptrace now, permit it. -*/ -if (task_is_stopped_or_traced (task)) { -int match; -rcu_read_lock (); - match = (tracehook_tracer_task (task) == current); -rcu_read_unlock (); -if (match &&ptrace_may_access (task,PTRACE_MODE_ATTACH )) -return mm; - } - -/* -* No one else is allowed. -*/ -mmput (mm); -return ERR_PTR (-EPERM ); -} - -/* -* If current may access user memory in @task return a reference to the -* corresponding mm, otherwise ERR_PTR. -*/ -static struct mm_struct *check_mem_permission (struct task_struct *task) -{ -struct mm_struct *mm; -int err; - -/* -* Avoid racing if task exec's as we might get a new mm but validate -* against old credentials. -*/ - err =mutex_lock_killable (&task->signal->cred_guard_mutex); -if (err) -return ERR_PTR (err); - - mm =__check_mem_permission (task); -mutex_unlock (&task->signal->cred_guard_mutex); - -return mm; -} - -struct mm_struct *mm_for_maps (struct task_struct *task) +static struct mm_struct *mm_access (struct task_struct *task,unsigned int mode) {struct mm_struct *mm;int err;
@@ -263,7 +205,7 @@ struct mm_struct *mm_for_maps(struct tas mm =get_task_mm (task);if (mm && mm != current->mm && - !ptrace_may_access (task,PTRACE_MODE_READ )) { + !ptrace_may_access (task, mode)) {mmput (mm); mm =ERR_PTR (-EACCES ); }
@@ -272,6 +214,11 @@ struct mm_struct *mm_for_maps(struct tasreturn mm; } +struct mm_struct *mm_for_maps (struct task_struct *task) +{ +return mm_access (task,PTRACE_MODE_READ ); +} +static int proc_pid_cmdline (struct task_struct *task,char * buffer) {int res =0 ;
@@ -816,38 +763,39 @@ static const struct file_operations procstatic int mem_open (struct inode * inode,struct file * file) { - file->private_data = (void *)((long )current->self_exec_id); +struct task_struct *task =get_proc_task (file->f_path.dentry->d_inode); +struct mm_struct *mm; + +if (!task) +return -ESRCH ; + + mm =mm_access (task,PTRACE_MODE_ATTACH ); +put_task_struct (task); + +if (IS_ERR (mm)) +return PTR_ERR (mm); +/* OK to pass negative loff_t, we can catch out-of-range */ file->f_mode |=FMODE_UNSIGNED_OFFSET ; + file->private_data = mm; +return 0 ; }static ssize_t mem_read (struct file * file,char __user * buf,size_t count,loff_t *ppos) { -struct task_struct *task =get_proc_task (file->f_path.dentry->d_inode); +int ret;char *page;unsigned long src = *ppos; -int ret = -ESRCH ; -struct mm_struct *mm; +struct mm_struct *mm = file->private_data; -if (!task) - goto out_no_task; +if (!mm) +return 0 ; - ret = -ENOMEM ; page = (char *)__get_free_page (GFP_TEMPORARY );if (!page) - goto out; - - mm =check_mem_permission (task); - ret =PTR_ERR (mm); -if (IS_ERR (mm)) - goto out_free; - - ret = -EIO ; - -if (file->private_data != (void *)((long )current->self_exec_id)) - goto out_put; +return -ENOMEM ; ret =0 ;
@@ -874,13 +822,7 @@ static ssize_t mem_read(struct file * fi } *ppos = src; -out_put: -mmput (mm); -out_free:free_page ((unsigned long ) page); -out: -put_task_struct (task); -out_no_task:return ret; }
@@ -889,27 +831,15 @@ static ssize_t mem_write(struct file * f {int copied;char *page; -struct task_struct *task =get_proc_task (file->f_path.dentry->d_inode);unsigned long dst = *ppos; -struct mm_struct *mm; +struct mm_struct *mm = file->private_data; - copied = -ESRCH ; -if (!task) - goto out_no_task; +if (!mm) +return 0 ; - copied = -ENOMEM ; page = (char *)__get_free_page (GFP_TEMPORARY );if (!page) - goto out_task; - - mm =check_mem_permission (task); - copied =PTR_ERR (mm); -if (IS_ERR (mm)) - goto out_free; - - copied = -EIO ; -if (file->private_data != (void *)((long )current->self_exec_id)) - goto out_mm; +return -ENOMEM ; copied =0 ;while (count >0 ) {
@@ -933,13 +863,7 @@ static ssize_t mem_write(struct file * f } *ppos = dst; -out_mm: -mmput (mm); -out_free:free_page ((unsigned long ) page); -out_task: -put_task_struct (task); -out_no_task:return copied; }
@@ -959,11 +883,20 @@ loff_t mem_lseek(struct file *file, loffreturn file->f_pos; } +static int mem_release (struct inode *inode,struct file *file) +{ +struct mm_struct *mm = file->private_data; + +mmput (mm); +return 0 ; +} +static const struct file_operations proc_mem_operations = { .llseek = mem_lseek, .read = mem_read, .write = mem_write, .open = mem_open, + .release = mem_release, }; static ssize_t environ_read(struct file *file, char __user *buf,
PATCH 65/90 ALSA: virtuoso: Xonar DS: fix polarity of front output
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Clemens Ladisch <[email protected]>
commit f0e48b6bd4e407459715240cd241ddb6b89bdf81 upstream.
The two DACs for the front output and the surround/center/LFE/back outputs are wired up out of phase, so when channels are duplicated, their sound can cancel out each other and result in a weaker bass response. To fix this, reverse the polarity of the neutron flow to the front output.
--- sound/pci/oxygen/xonar_wm87x6.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/oxygen/xonar_wm87x6.c +1 -0
@@ -177,6 +177,7 @@ static void wm8776_registers_init(structstruct xonar_wm87x6 *data = chip->model_data;wm8776_write (chip,WM8776_RESET ,0 ); +wm8776_write (chip,WM8776_PHASESWAP ,WM8776_PH_MASK );wm8776_write (chip,WM8776_DACCTRL1 ,WM8776_DZCEN |WM8776_PL_LEFT_LEFT |WM8776_PL_RIGHT_RIGHT );wm8776_write (chip,WM8776_DACMUTE , chip->dac_mute ?WM8776_DMUTE :0 );
PATCH 66/90 ALSA: HDA: Fix internal microphone on Dell Studio 16 XPS 1645
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Henningsson <[email protected]>
commit ffe535edb9a9c5b4d5fe03dfa3d89a1495580f1b upstream.
More than one user reports that changing the model from "both" to "dmic" makes their Internal Mic work.
--- sound/pci/hda/patch_sigmatel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/hda/patch_sigmatel.c +1 -1
@@ -1602,7 +1602,7 @@ static const struct snd_pci_quirk stac92SND_PCI_QUIRK (PCI_VENDOR_ID_DELL ,0x02bd ,"Dell Studio 1557" ,STAC_DELL_M6_DMIC ),SND_PCI_QUIRK (PCI_VENDOR_ID_DELL ,0x02fe , -"Dell Studio XPS 1645" ,STAC_DELL_M6_BOTH ), +"Dell Studio XPS 1645" ,STAC_DELL_M6_DMIC ),SND_PCI_QUIRK (PCI_VENDOR_ID_DELL ,0x0413 , "Dell Studio 1558", STAC_DELL_M6_DMIC), {} /* terminator */
PATCH 67/90 intel idle: Make idle driver more robust
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Renninger <[email protected]>
commit 5c2a9f06a9cd7194f884cdc88144866235dec07d upstream.
kvm -cpu host passes the original cpuid info to the guest.
Latest kvm version seem to return true for mwait_leaf cpuid function on recent Intel CPUs. But it does not return mwait C-states (mwait_substates), instead zero is returned.
While real CPUs seem to always return non-zero values, the intel idle driver should not get active in kvm (mwait_substates == 0) case and bail out.
Otherwise a Null pointer exception will happen later when the cpuidle subsystem tries to get active:
[0.984807] BUG: unable to handle kernel NULL pointer dereference at (null) [0.984807] IP: [<(null)>] (null) ... [0.984807][<ffffffff8143cf34>] ? cpuidle_idle_call+0xb4/0x340 [0.984807][<ffffffff8159e7bc>] ? __atomic_notifier_call_chain+0x4c/0x70 [0.984807][<ffffffff81001198>] ? cpu_idle+0x78/0xd0
Reference:
https://bugzilla.novell.com/show_bug.cgi?id=726296
--- drivers/idle/intel_idle.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/idle/intel_idle.c +2 -1
@@ -321,7 +321,8 @@ static int intel_idle_probe(void)cpuid (CPUID_MWAIT_LEAF , &eax, &ebx, &ecx, &mwait_substates);if (!(ecx &CPUID5_ECX_EXTENSIONS_SUPPORTED ) || - !(ecx &CPUID5_ECX_INTERRUPT_BREAK )) + !(ecx &CPUID5_ECX_INTERRUPT_BREAK ) || + !mwait_substates)return -ENODEV ;pr_debug (PREFIX "MWAIT substates: 0x%x\n" , mwait_substates);
Re: [67/90] intel idle: Make idle driver more robust
Quoted 41 lines · Greg KH
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Renninger <[email protected]>
commit
5c2a9f06a9cd7194f884cdc88144866235dec07dupstream.kvm -cpu host passes the original cpuid info to the guest.
Latest kvm version seem to return true for
mwait_leafcpuid function on recent Intel CPUs. But it does not return mwait C-states (mwait_substates), instead zero is returned.While real CPUs seem to always return non-zero values, the intel idle driver should not get active in kvm (
mwait_substates== 0) case and bail out.
Otherwise a Null pointer exception will happen later when the cpuidle subsystem tries to get active:[0.984807] BUG: unable to handle kernel NULL pointer dereference at (null) [0.984807] IP: [<(null)>] (null) ... [0.984807][<ffffffff8143cf34>] ? cpuidle_idle_call+0xb4/0x340 [0.984807][<ffffffff8159e7bc>] ? __atomic_notifier_call_chain+0x4c/0x70 [0.984807][<ffffffff81001198>] ? cpu_idle+0x78/0xd0Reference:
https://bugzilla.novell.com/show_bug.cgi?id=726296Signed-off-by Thomas Renninger <[email protected]>CC Bruno Friedmann <[email protected]>Signed-off-by Len Brown <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/idle/intel_idle.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/idle/intel_idle.c static int intel_idle_probe(void) · line 326
Quoted 7 lines
drivers/idle/intel_idle.c +2
-1@@ -321,7 +321,8 @@ static int intel_idle_probe(void)cpuid (CPUID_MWAIT_LEAF , &eax, &ebx, &ecx, &mwait_substates);if (!(ecx &CPUID5_ECX_EXTENSIONS_SUPPORTED ) || - !(ecx &CPUID5_ECX_INTERRUPT_BREAK )) + !(ecx &CPUID5_ECX_INTERRUPT_BREAK ) || + !mwait_substates)return -ENODEV ;
It breaks build for me.
Quoted 1 line
From
4b26a35ab3bf4094efb31911587b676158f675b5Mon Sep 17 00:00:00 2001
From: "Kirill A. Shutemov" <[email protected]>
Date: Thu, 26 Jan 2012 16:24:50 +0200
Subject: [PATCH] intel_idle: fix build issue
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
CC drivers/idle/intel_idle.o/home/space/kas/git/public/linux-3.0-mid/drivers/idle/intel_idle.c: In function ‘intel_idle_probe’:/home/space/kas/git/public/linux-3.0-mid/drivers/idle/intel_idle.c:508:7: error: ‘mwait_substates’ undeclared (first use in this function) /home/space/kas/git/public/linux-3.0-mid/drivers/idle/intel_idle.c:508:7: note: each undeclared identifier is reported only once for each function it appears in make[3]: *** [drivers/idle/intel_idle.o] Error 1
Variable 'substates' hasn't renamed to 'mwait_substates' in 3.0. See c423628 intel_idle: delete substates DEBUG modparam
--- drivers/idle/intel_idle.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/idle/intel_idle.c +1 -1
@@ -505,7 +505,7 @@ static int intel_idle_probe(void)if (!(ecx &CPUID5_ECX_EXTENSIONS_SUPPORTED ) || !(ecx &CPUID5_ECX_INTERRUPT_BREAK ) || - !mwait_substates) + !substates)return -ENODEV ;if (substates ==0 )/* can over-ride via modparam */
Signature · 1 line
Kirill A. Shutemov
Re: [67/90] intel idle: Make idle driver more robust
Quoted 10 lines · Kirill A. Shutemov
Quoted 10 lines
From: Thomas Renninger<[email protected]>
commit
5c2a9f06a9cd7194f884cdc88144866235dec07dupstream.kvm -cpu host passes the original cpuid info to the guest.
Latest kvm version seem to return true for
mwait_leafcpuid function on recent Intel CPUs. But it does not return mwait C-states (mwait_substates), instead zero is returned.
[]
Quoted 8 lines
Quoted 8 lines
drivers/idle/intel_idle.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/idle/intel_idle.c +0
-0@@ -321,7 +321,8 @@ static int intel_idle_probe(void)cpuid (CPUID_MWAIT_LEAF ,&eax,&ebx,&ecx,&mwait_substates);
Quoted 7 lines
drivers/idle/intel_idle.c static int intel_idle_probe(void) · line 326
Quoted 5 lines
drivers/idle/intel_idle.c +2
-1if (!(ecx&CPUID5_ECX_EXTENSIONS_SUPPORTED ) || - !(ecx&CPUID5_ECX_INTERRUPT_BREAK )) + !(ecx&CPUID5_ECX_INTERRUPT_BREAK ) || + !mwait_substates)return -ENODEV ;It breaks build for me.
[]
Quoted 8 lines
CC
drivers/idle/intel_idle.o/home/space/kas/git/public/linux-3.0-mid/drivers/idle/intel_idle.c: In function ‘intel_idle_probe’:/home/space/kas/git/public/linux-3.0-mid/drivers/idle/intel_idle.c:508:7: error: ‘mwait_substates’ undeclared (first use in this function)/home/space/kas/git/public/linux-3.0-mid/drivers/idle/intel_idle.c:508:7: note: each undeclared identifier is reported only once for each function it appears in make[3]: *** [drivers/idle/intel_idle.o] Error 1Variable 'substates' hasn't renamed to '
mwait_substates' in 3.0. See c423628intel_idle: delete substates DEBUG modparam
I wonder why in my 3.0.18 this variable is properly defined in the same file, in line 77:
...
74 /* intel_idle.max_cstate=0 disables driver */ 75 static int max_cstate = MWAIT_MAX_NUM_CSTATES - 1; 76
77 static unsigned int mwait_substates;
78
79 #define LAPIC_TIMER_ALWAYS_RELIABLE 0xFFFFFFFF
...
Quoted 10 lines
Signed-off-by Kirill A. Shutemov<[email protected]>--- drivers/idle/intel_idle.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/idle/intel_idle.c +0
-0
drivers/idle/intel_idle.c static int intel_idle_probe(void) · line 508
Quoted 5 lines
drivers/idle/intel_idle.c +1
-1@@ -505,7 +505,7 @@ static int intel_idle_probe(void)if (!(ecx&CPUID5_ECX_EXTENSIONS_SUPPORTED ) || !(ecx&CPUID5_ECX_INTERRUPT_BREAK ) || - !mwait_substates) + !substates)
With this patch my build of 3.0.18 fails with "substates undeclared" message...
drivers/idle/intel_idle.c static int intel_idle_probe(void) · line 511
Quoted 2 lines
drivers/idle/intel_idle.c +0
-0if (substates ==0 )/* can over-ride via modparam */
And I don't have this context line in my version.
It is 3.0 from kernel.org patched by patch-3.0.18.xz
Thanks,
/mjt
Re: [67/90] intel idle: Make idle driver more robust
Quoted 41 lines · Michael Tokarev
Quoted 10 lines · Kirill A. Shutemov
Quoted 10 lines
From: Thomas Renninger<[email protected]>
commit
5c2a9f06a9cd7194f884cdc88144866235dec07dupstream.kvm -cpu host passes the original cpuid info to the guest.
Latest kvm version seem to return true for
mwait_leafcpuid function on recent Intel CPUs. But it does not return mwait C-states (mwait_substates), instead zero is returned.[]
Quoted 8 lines
Quoted 8 lines
drivers/idle/intel_idle.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/idle/intel_idle.c +0
-0@@ -321,7 +321,8 @@ static int intel_idle_probe(void)cpuid (CPUID_MWAIT_LEAF ,&eax,&ebx,&ecx,&mwait_substates);Quoted 7 lines
drivers/idle/intel_idle.c static int intel_idle_probe(void) · line 326
Quoted 5 lines
drivers/idle/intel_idle.c +2
-1if (!(ecx&CPUID5_ECX_EXTENSIONS_SUPPORTED ) || - !(ecx&CPUID5_ECX_INTERRUPT_BREAK )) + !(ecx&CPUID5_ECX_INTERRUPT_BREAK ) || + !mwait_substates)return -ENODEV ;It breaks build for me.
[]
Quoted 8 lines
CC
drivers/idle/intel_idle.o/home/space/kas/git/public/linux-3.0-mid/drivers/idle/intel_idle.c: In function ‘intel_idle_probe’:/home/space/kas/git/public/linux-3.0-mid/drivers/idle/intel_idle.c:508:7: error: ‘mwait_substates’ undeclared (first use in this function)/home/space/kas/git/public/linux-3.0-mid/drivers/idle/intel_idle.c:508:7: note: each undeclared identifier is reported only once for each function it appears in make[3]: *** [drivers/idle/intel_idle.o] Error 1Variable 'substates' hasn't renamed to '
mwait_substates' in 3.0. See c423628intel_idle: delete substates DEBUG modparamI wonder why in my 3.0.18 this variable is properly defined in the same file, in line 77:
Quoted 8 lines
...
74 /* intel_idle.max_cstate=0 disables driver */ 75 static intmax_cstate=MWAIT_MAX_NUM_CSTATES- 1; 76
77 static unsigned intmwait_substates;
78
79 #defineLAPIC_TIMER_ALWAYS_RELIABLE0xFFFFFFFF
...
Oosp. Sorry for noise. My local patch breaks it.
Signature · 1 line
Kirill A. Shutemov
Re: [67/90] intel idle: Make idle driver more robust
Quoted 51 lines · Kirill A. Shutemov
Quoted 41 lines · Michael Tokarev
Quoted 10 lines · Kirill A. Shutemov
Quoted 10 lines
From: Thomas Renninger<[email protected]>
commit
5c2a9f06a9cd7194f884cdc88144866235dec07dupstream.kvm -cpu host passes the original cpuid info to the guest.
Latest kvm version seem to return true for
mwait_leafcpuid function on recent Intel CPUs. But it does not return mwait C-states (mwait_substates), instead zero is returned.[]
Quoted 8 lines
Quoted 8 lines
drivers/idle/intel_idle.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/idle/intel_idle.c +0
-0@@ -321,7 +321,8 @@ static int intel_idle_probe(void)cpuid (CPUID_MWAIT_LEAF ,&eax,&ebx,&ecx,&mwait_substates);Quoted 7 lines
drivers/idle/intel_idle.c static int intel_idle_probe(void) · line 326
Quoted 5 lines
drivers/idle/intel_idle.c +2
-1if (!(ecx&CPUID5_ECX_EXTENSIONS_SUPPORTED ) || - !(ecx&CPUID5_ECX_INTERRUPT_BREAK )) + !(ecx&CPUID5_ECX_INTERRUPT_BREAK ) || + !mwait_substates)return -ENODEV ;It breaks build for me.
[]
Quoted 8 lines
CC
drivers/idle/intel_idle.o/home/space/kas/git/public/linux-3.0-mid/drivers/idle/intel_idle.c: In function ‘intel_idle_probe’:/home/space/kas/git/public/linux-3.0-mid/drivers/idle/intel_idle.c:508:7: error: ‘mwait_substates’ undeclared (first use in this function)/home/space/kas/git/public/linux-3.0-mid/drivers/idle/intel_idle.c:508:7: note: each undeclared identifier is reported only once for each function it appears in make[3]: *** [drivers/idle/intel_idle.o] Error 1Variable 'substates' hasn't renamed to '
mwait_substates' in 3.0. See c423628intel_idle: delete substates DEBUG modparamI wonder why in my 3.0.18 this variable is properly defined in the same file, in line 77:
Quoted 8 lines
...
74 /* intel_idle.max_cstate=0 disables driver */ 75 static intmax_cstate=MWAIT_MAX_NUM_CSTATES- 1; 76
77 static unsigned intmwait_substates;
78
79 #defineLAPIC_TIMER_ALWAYS_RELIABLE0xFFFFFFFF
...
Quoted 1 line
Oosp. Sorry for noise. My local patch breaks it.
So, 3.0.18 is just fine, right?
Re: [67/90] intel idle: Make idle driver more robust
Quoted 52 lines · Greg KH
Quoted 51 lines · Kirill A. Shutemov
Quoted 49 lines · Michael Tokarev
Quoted 10 lines · Kirill A. Shutemov
Quoted 10 lines
From: Thomas Renninger<[email protected]>
commit
5c2a9f06a9cd7194f884cdc88144866235dec07dupstream.kvm -cpu host passes the original cpuid info to the guest.
Latest kvm version seem to return true for
mwait_leafcpuid function on recent Intel CPUs. But it does not return mwait C-states (mwait_substates), instead zero is returned.[]
Quoted 8 lines
Quoted 8 lines
drivers/idle/intel_idle.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/idle/intel_idle.c +0
-0@@ -321,7 +321,8 @@ static int intel_idle_probe(void)cpuid (CPUID_MWAIT_LEAF ,&eax,&ebx,&ecx,&mwait_substates);Quoted 7 lines
drivers/idle/intel_idle.c static int intel_idle_probe(void) · line 326
Quoted 5 lines
drivers/idle/intel_idle.c +2
-1if (!(ecx&CPUID5_ECX_EXTENSIONS_SUPPORTED ) || - !(ecx&CPUID5_ECX_INTERRUPT_BREAK )) + !(ecx&CPUID5_ECX_INTERRUPT_BREAK ) || + !mwait_substates)return -ENODEV ;It breaks build for me.
[]
Quoted 8 lines
CC
drivers/idle/intel_idle.o/home/space/kas/git/public/linux-3.0-mid/drivers/idle/intel_idle.c: In function ‘intel_idle_probe’:/home/space/kas/git/public/linux-3.0-mid/drivers/idle/intel_idle.c:508:7: error: ‘mwait_substates’ undeclared (first use in this function)/home/space/kas/git/public/linux-3.0-mid/drivers/idle/intel_idle.c:508:7: note: each undeclared identifier is reported only once for each function it appears in make[3]: *** [drivers/idle/intel_idle.o] Error 1Variable 'substates' hasn't renamed to '
mwait_substates' in 3.0. See c423628intel_idle: delete substates DEBUG modparamI wonder why in my 3.0.18 this variable is properly defined in the same file, in line 77:
...
74 /* intel_idle.max_cstate=0 disables driver */ 75 static intmax_cstate=MWAIT_MAX_NUM_CSTATES- 1; 76
77 static unsigned intmwait_substates;
78
79 #defineLAPIC_TIMER_ALWAYS_RELIABLE0xFFFFFFFF
...
Quoted 3 lines
Quoted 1 line
Oosp. Sorry for noise. My local patch breaks it.
So, 3.0.18 is just fine, right?
Yes.
Signature · 1 line
Kirill A. Shutemov
PATCH 68/90 intel_idle: fix API misuse
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shaohua Li <[email protected]>
commit 39a74fdedd1c1461d6fb6d330b5266886513c98f upstream.
smp_call_function() only lets all other CPUs execute a specific function, while we expect all CPUs do in intel_idle. Without the fix, we could have one cpu which has auto_demotion enabled or has no broadcast timer setup. Usually we don't see impact because auto demotion just harms power and the intel_idle init is called in CPU 0, where boradcast timer delivers interrupt, but this still could be a problem.
--- drivers/idle/intel_idle.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/idle/intel_idle.c +3 -3
@@ -368,7 +368,7 @@ static int intel_idle_probe(void)if (boot_cpu_has (X86_FEATURE_ARAT ))/* Always Reliable APIC Timer */ lapic_timer_reliable_states =LAPIC_TIMER_ALWAYS_RELIABLE ;else { -smp_call_function (__setup_broadcast_timer, (void *)true,1 ); +on_each_cpu (__setup_broadcast_timer, (void *)true,1 );register_cpu_notifier (&setup_broadcast_notifier); }
@@ -460,7 +460,7 @@ static int intel_idle_cpuidle_devices_in } }if (auto_demotion_disable_flags) -smp_call_function (auto_demotion_disable,NULL ,1 ); +on_each_cpu (auto_demotion_disable,NULL ,1 );return 0 ; }
@@ -500,7 +500,7 @@ static void __exit intel_idle_exit(void)cpuidle_unregister_driver (&intel_idle_driver);if (lapic_timer_reliable_states !=LAPIC_TIMER_ALWAYS_RELIABLE ) { -smp_call_function (__setup_broadcast_timer, (void *)false,1 ); +on_each_cpu (__setup_broadcast_timer, (void *)false,1 );unregister_cpu_notifier (&setup_broadcast_notifier); }
PATCH 69/90 ACPI: Store SRAT table revision
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kurt Garloff <[email protected]>
commit 8df0eb7c9d96f9e82f233ee8b74e0f0c8471f868 upstream.
In SRAT v1, we had 8bit proximity domain (PXM) fields; SRAT v2 provides 32bits for these. The new fields were reserved before. According to the ACPI spec, the OS must disregrard reserved fields. In order to know whether or not, we must know what version the SRAT table has.
This patch stores the SRAT table revision for later consumption by arch specific __init functions.
--- drivers/acpi/numa.c | 6 ++++++ include/acpi/acpi_numa.h | 1 + 2 files changed, 7 insertions(+)
drivers/acpi/numa.c +6 -0
@@ -45,6 +45,8 @@ static int pxm_to_node_map[MAX_PXM_DOMAIstatic int node_to_pxm_map[MAX_NUMNODES ] = { [0 ...MAX_NUMNODES -1 ] =PXM_INVAL }; +unsigned char acpi_srat_revision__initdata ; +int pxm_to_node (int pxm) {if (pxm <0 )
@@ -255,9 +257,13 @@ acpi_parse_memory_affinity(struct acpi_sstatic int __init acpi_parse_srat (struct acpi_table_header *table) { +struct acpi_table_srat *srat;if (!table)return -EINVAL ; + srat = (struct acpi_table_srat *)table; + acpi_srat_revision = srat->header.revision; +/* Real work done in acpi_table_parse_srat below. */ return 0 ;
include/acpi/acpi_numa.h +1 -0
@@ -15,6 +15,7 @@ extern int pxm_to_node(int);extern int node_to_pxm (int );extern void __acpi_map_pxm_to_node (int ,int );extern int acpi_map_pxm_to_node (int ); +extern unsigned char acpi_srat_revision;#endif /* CONFIG_ACPI_NUMA */ #endif /* __ACP_NUMA_H */
PATCH 70/90 ACPI, x86: Use SRAT table rev to use 8bit or 32bit PXM fields (x86/x86-64)
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kurt Garloff <[email protected]>
commit cd298f60a2451a16e0f077404bf69b62ec868733 upstream.
In SRAT v1, we had 8bit proximity domain (PXM) fields; SRAT v2 provides 32bits for these. The new fields were reserved before. According to the ACPI spec, the OS must disregrard reserved fields.
x86/x86-64 was rather inconsistent prior to this patch; it used 8 bits for the pxm field in cpu_affinity, but 32 bits in mem_affinity. This patch makes it consistent: Either use 8 bits consistently (SRAT rev 1 or lower) or 32 bits (SRAT rev 2 or higher).
--- arch/x86/mm/srat.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/x86/mm/srat.c +4 -0
@@ -104,6 +104,8 @@ acpi_numa_processor_affinity_init(structif ((pa->flags &ACPI_SRAT_CPU_ENABLED ) ==0 )return ; pxm = pa->proximity_domain_lo; +if (acpi_srat_revision >=2 ) + pxm |= *((unsigned int *)pa->proximity_domain_hi) <<8 ; node =setup_node (pxm);if (node <0 ) {printk (KERN_ERR "SRAT: Too many proximity domains %x\n" , pxm);
@@ -155,6 +157,8 @@ acpi_numa_memory_affinity_init(struct ac start = ma->base_address; end = start + ma->length; pxm = ma->proximity_domain; +if (acpi_srat_revision <=1 ) + pxm &=0xff ; node =setup_node (pxm);if (node <0 ) {printk (KERN_ERR "SRAT: Too many proximity domains.\n" );
PATCH 71/90 ACPI, ia64: Use SRAT table rev to use 8bit or 16/32bit PXM fields (ia64)
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kurt Garloff <[email protected]>
commit 9f10f6a520deb3639fac78d81151a3ade88b4e7f upstream.
In SRAT v1, we had 8bit proximity domain (PXM) fields; SRAT v2 provides 32bits for these. The new fields were reserved before. According to the ACPI spec, the OS must disregrard reserved fields.
ia64 did handle the PXM fields almost consistently, but depending on sgi's sn2 platform. This patch leaves the sn2 logic in, but does also use 16/32 bits for PXM if the SRAT has rev 2 or higher.
The patch also adds __init to the two pxm accessor functions, as they access __initdata now and are called from an __init function only anyway.
Note that the code only uses 16 bits for the PXM field in the processor proximity field; the patch does not address this as 16 bits are more than enough.
--- arch/ia64/kernel/acpi.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
arch/ia64/kernel/acpi.c +6 -4
@@ -429,22 +429,24 @@ static u32 __devinitdata pxm_flag[PXM_FLstatic struct acpi_table_slit __initdata *slit_table;cpumask_t early_cpu_possible_map =CPU_MASK_NONE ; -static int get_processor_proximity_domain (struct acpi_srat_cpu_affinity *pa) +static int __init +get_processor_proximity_domain (struct acpi_srat_cpu_affinity *pa) {int pxm; pxm = pa->proximity_domain_lo; -if (ia64_platform_is ("sn2" )) +if (ia64_platform_is ("sn2" ) || acpi_srat_revision >=2 ) pxm += pa->proximity_domain_hi[0 ] <<8 ;return pxm; } -static int get_memory_proximity_domain (struct acpi_srat_mem_affinity *ma) +static int __init +get_memory_proximity_domain (struct acpi_srat_mem_affinity *ma) {int pxm; pxm = ma->proximity_domain; -if (!ia64_platform_is ("sn2" )) +if (!ia64_platform_is ("sn2" ) && acpi_srat_revision <=1 ) pxm &=0xff ;return pxm;
PATCH 72/90 ACPICA: Put back the call to acpi_os_validate_address
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lin Ming <[email protected]>
commit da4d8b287abe783d30e968155614531a0937d090 upstream.
The call to acpi_os_validate_address in acpi_ds_get_region_arguments was removed by mistake in commit 9ad19ac(ACPICA: Split large dsopcode and dsload.c files).
Put it back.
--- drivers/acpi/acpica/dsargs.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/acpi/acpica/dsargs.c +24 -0
@@ -387,5 +387,29 @@ acpi_status acpi_ds_get_region_arguments status =acpi_ds_execute_arguments (node, node->parent, extra_desc->extra.aml_length, extra_desc->extra.aml_start); +if (ACPI_FAILURE (status)) { +return_ACPI_STATUS (status); + } + +/* Validate the region address/length via the host OS */ + + status =acpi_os_validate_address (obj_desc->region.space_id, + obj_desc->region.address, + (acpi_size ) obj_desc->region.length, +acpi_ut_get_node_name (node)); + +if (ACPI_FAILURE (status)) { +/* +* Invalid address/length. We will emit an error message and mark +* the region as invalid, so that it will cause an additional error if +* it is ever used. Then return AE_OK. +*/ +ACPI_EXCEPTION ((AE_INFO , status, +"During address validation of OpRegion [%4.4s]" , + node->name.ascii)); + obj_desc->common.flags |=AOPOBJ_INVALID ; + status =AE_OK ; + } +return_ACPI_STATUS (status); }
PATCH 73/90 ACPI: processor: fix acpi_get_cpuid for UP processor
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lin Ming <[email protected]>
commit d640113fe80e45ebd4a5b420b220d3f6bf37f682 upstream.
For UP processor, it is likely that no _MAT method or MADT table defined. So currently acpi_get_cpuid(...) always return -1 for UP processor. This is wrong. It should return valid value for CPU0.
In the other hand, BIOS may define multiple CPU handles even for UP processor, for example
Scope (_PR)
{
Processor (CPU0, 0x00, 0x00000410, 0x06) {}
Processor (CPU1, 0x01, 0x00000410, 0x06) {}
Processor (CPU2, 0x02, 0x00000410, 0x06) {}
Processor (CPU3, 0x03, 0x00000410, 0x06) {}
}We should only return valid value for CPU0's acpi handle. And return invalid value for others.
http://marc.info/?t=132329819900003&r=1&w=2
--- drivers/acpi/processor_core.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)
drivers/acpi/processor_core.c +24 -2
@@ -172,8 +172,30 @@ int acpi_get_cpuid(acpi_handle handle, i apic_id =map_mat_entry (handle, type, acpi_id);if (apic_id ==-1 ) apic_id =map_madt_entry (type, acpi_id); -if (apic_id ==-1 ) -return apic_id; +if (apic_id ==-1 ) { +/* +* On UP processor, there is no _MAT or MADT table. +* So above apic_id is always set to -1. +* +* BIOS may define multiple CPU handles even for UP processor. +* For example, +* +* Scope (_PR) +* { +* Processor (CPU0, 0x00, 0x00000410, 0x06) {} +* Processor (CPU1, 0x01, 0x00000410, 0x06) {} +* Processor (CPU2, 0x02, 0x00000410, 0x06) {} +* Processor (CPU3, 0x03, 0x00000410, 0x06) {} +* } +* +* Ignores apic_id and always return 0 for CPU0's handle. +* Return -1 for other CPU's handle. +*/ +if (acpi_id ==0 ) +return acpi_id; +else +return apic_id; + }#ifdef CONFIG_SMP for_each_possible_cpu (i) {
PATCH 74/90 sym53c8xx: Fix NULL pointer dereference in slave_destroy
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stratos Psomadakis <[email protected]>
commit cced5041ed5a2d1352186510944b0ddfbdbe4c0b upstream.
sym53c8xx_slave_destroy unconditionally assumes that sym53c8xx_slave_alloc has succesesfully allocated a sym_lcb. This can lead to a NULL pointer dereference (exposed by commit 4e6c82b).
--- drivers/scsi/sym53c8xx_2/sym_glue.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/scsi/sym53c8xx_2/sym_glue.c +4 -0
@@ -839,6 +839,10 @@ static void sym53c8xx_slave_destroy(strustruct sym_lcb *lp =sym_lp (tp, sdev->lun);unsigned long flags; +/* if slave_alloc returned before allocating a sym_lcb, return */ +if (!lp) +return ; +spin_lock_irqsave (np->s.host->host_lock, flags);if (lp->busy_itlq || lp->busy_itl) {
PATCH 75/90 target: Set response format in INQUIRY response
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roland Dreier <[email protected]>
commit ce136176fea522fc8f4c16dcae7e8ed1d890ca39 upstream.
Current SCSI specs say that the "response format" field in the standard INQUIRY response should be set to 2, and all the real SCSI devices I have do put 2 here. So let's do that too.
--- drivers/target/target_core_cdb.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/target/target_core_cdb.c +12 -0
@@ -84,6 +84,18 @@ target_emulate_inquiry_std(struct se_cmd buf[2 ] = dev->transport->get_device_rev (dev);/* +* NORMACA and HISUP = 0, RESPONSE DATA FORMAT = 2 +* +* SPC4 says: +* A RESPONSE DATA FORMAT field set to 2h indicates that the +* standard INQUIRY data is in the format defined in this +* standard. Response data format values less than 2h are +* obsolete. Response data format values greater than 2h are +* reserved. +*/ + buf[3 ] =2 ; + +/* * Enable SCCS and TPGS fields for Emulated ALUA */ if (T10_ALUA (dev->se_sub_dev)->alua_type ==SPC3_ALUA_EMULATED )
PATCH 76/90 target: Set additional sense length field in sense data
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roland Dreier <[email protected]>
commit 895f3022523361e9b383cf48f51feb1f7d5e7e53 upstream.
The target code was not setting the additional sense length field in the sense data it returned, which meant that at least the Linux stack ignored the ASC/ASCQ fields. For example, without this patch, on a tcm_loop device:
# sg_raw -v /dev/sda 2 0 0 0 0 0
gives
cdb to send: 02 00 00 00 00 00
SCSI Status: Check Condition
Sense Information:
Fixed format, current; Sense key: Illegal Request
Raw sense data (in hex):
70 00 05 00 00 00 00 00
while after the patch we correctly get the following (which matches what a regular disk returns):
cdb to send: 02 00 00 00 00 00
SCSI Status: Check Condition
Sense Information:
Fixed format, current; Sense key: Illegal Request Additional sense: Invalid command operation code Raw sense data (in hex):
70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 00 00 00
--- drivers/target/target_core_transport.c | 14 ++++++++++++++ include/target/target_core_base.h | 1 + 2 files changed, 15 insertions(+)
drivers/target/target_core_transport.c +14 -0
@@ -5668,6 +5668,8 @@ int transport_send_check_condition_and_scase TCM_SECTOR_COUNT_TOO_MANY :/* CURRENT ERROR */ buffer[offset] =0x70 ; + buffer[offset+SPC_ADD_SENSE_LEN_OFFSET ] =10 ; + buffer[offset+SPC_ADD_SENSE_LEN_OFFSET ] =10 ;/* ILLEGAL REQUEST */ buffer[offset+SPC_SENSE_KEY_OFFSET ] =ILLEGAL_REQUEST ;/* INVALID COMMAND OPERATION CODE */
@@ -5676,6 +5678,7 @@ int transport_send_check_condition_and_scase TCM_UNKNOWN_MODE_PAGE :/* CURRENT ERROR */ buffer[offset] =0x70 ; + buffer[offset+SPC_ADD_SENSE_LEN_OFFSET ] =10 ;/* ILLEGAL REQUEST */ buffer[offset+SPC_SENSE_KEY_OFFSET ] =ILLEGAL_REQUEST ;/* INVALID FIELD IN CDB */
@@ -5684,6 +5687,7 @@ int transport_send_check_condition_and_scase TCM_CHECK_CONDITION_ABORT_CMD :/* CURRENT ERROR */ buffer[offset] =0x70 ; + buffer[offset+SPC_ADD_SENSE_LEN_OFFSET ] =10 ;/* ABORTED COMMAND */ buffer[offset+SPC_SENSE_KEY_OFFSET ] =ABORTED_COMMAND ;/* BUS DEVICE RESET FUNCTION OCCURRED */
@@ -5693,6 +5697,7 @@ int transport_send_check_condition_and_scase TCM_INCORRECT_AMOUNT_OF_DATA :/* CURRENT ERROR */ buffer[offset] =0x70 ; + buffer[offset+SPC_ADD_SENSE_LEN_OFFSET ] =10 ;/* ABORTED COMMAND */ buffer[offset+SPC_SENSE_KEY_OFFSET ] =ABORTED_COMMAND ;/* WRITE ERROR */
@@ -5703,6 +5708,7 @@ int transport_send_check_condition_and_scase TCM_INVALID_CDB_FIELD :/* CURRENT ERROR */ buffer[offset] =0x70 ; + buffer[offset+SPC_ADD_SENSE_LEN_OFFSET ] =10 ;/* ABORTED COMMAND */ buffer[offset+SPC_SENSE_KEY_OFFSET ] =ABORTED_COMMAND ;/* INVALID FIELD IN CDB */
@@ -5711,6 +5717,7 @@ int transport_send_check_condition_and_scase TCM_INVALID_PARAMETER_LIST :/* CURRENT ERROR */ buffer[offset] =0x70 ; + buffer[offset+SPC_ADD_SENSE_LEN_OFFSET ] =10 ;/* ABORTED COMMAND */ buffer[offset+SPC_SENSE_KEY_OFFSET ] =ABORTED_COMMAND ;/* INVALID FIELD IN PARAMETER LIST */
@@ -5719,6 +5726,7 @@ int transport_send_check_condition_and_scase TCM_UNEXPECTED_UNSOLICITED_DATA :/* CURRENT ERROR */ buffer[offset] =0x70 ; + buffer[offset+SPC_ADD_SENSE_LEN_OFFSET ] =10 ;/* ABORTED COMMAND */ buffer[offset+SPC_SENSE_KEY_OFFSET ] =ABORTED_COMMAND ;/* WRITE ERROR */
@@ -5729,6 +5737,7 @@ int transport_send_check_condition_and_scase TCM_SERVICE_CRC_ERROR :/* CURRENT ERROR */ buffer[offset] =0x70 ; + buffer[offset+SPC_ADD_SENSE_LEN_OFFSET ] =10 ;/* ABORTED COMMAND */ buffer[offset+SPC_SENSE_KEY_OFFSET ] =ABORTED_COMMAND ;/* PROTOCOL SERVICE CRC ERROR */
@@ -5739,6 +5748,7 @@ int transport_send_check_condition_and_scase TCM_SNACK_REJECTED :/* CURRENT ERROR */ buffer[offset] =0x70 ; + buffer[offset+SPC_ADD_SENSE_LEN_OFFSET ] =10 ;/* ABORTED COMMAND */ buffer[offset+SPC_SENSE_KEY_OFFSET ] =ABORTED_COMMAND ;/* READ ERROR */
@@ -5749,6 +5759,7 @@ int transport_send_check_condition_and_scase TCM_WRITE_PROTECTED :/* CURRENT ERROR */ buffer[offset] =0x70 ; + buffer[offset+SPC_ADD_SENSE_LEN_OFFSET ] =10 ;/* DATA PROTECT */ buffer[offset+SPC_SENSE_KEY_OFFSET ] =DATA_PROTECT ;/* WRITE PROTECTED */
@@ -5757,6 +5768,7 @@ int transport_send_check_condition_and_scase TCM_CHECK_CONDITION_UNIT_ATTENTION :/* CURRENT ERROR */ buffer[offset] =0x70 ; + buffer[offset+SPC_ADD_SENSE_LEN_OFFSET ] =10 ;/* UNIT ATTENTION */ buffer[offset+SPC_SENSE_KEY_OFFSET ] =UNIT_ATTENTION ;core_scsi3_ua_for_check_condition (cmd, &asc, &ascq);
@@ -5766,6 +5778,7 @@ int transport_send_check_condition_and_scase TCM_CHECK_CONDITION_NOT_READY :/* CURRENT ERROR */ buffer[offset] =0x70 ; + buffer[offset+SPC_ADD_SENSE_LEN_OFFSET ] =10 ;/* Not Ready */ buffer[offset+SPC_SENSE_KEY_OFFSET ] =NOT_READY ;transport_get_sense_codes (cmd, &asc, &ascq);
@@ -5776,6 +5789,7 @@ int transport_send_check_condition_and_sdefault :/* CURRENT ERROR */ buffer[offset] =0x70 ; + buffer[offset+SPC_ADD_SENSE_LEN_OFFSET ] =10 ;/* ILLEGAL REQUEST */ buffer[offset+SPC_SENSE_KEY_OFFSET ] =ILLEGAL_REQUEST ;/* LOGICAL UNIT COMMUNICATION FAILURE */
include/target/target_core_base.h +1 -0
@@ -36,6 +36,7 @@#define TRANSPORT_SENSE_BUFFER SCSI_SENSE_BUFFERSIZE/* Used by transport_send_check_condition_and_sense() */ #define SPC_SENSE_KEY_OFFSET 2 +#define SPC_ADD_SENSE_LEN_OFFSET 7#define SPC_ASC_KEY_OFFSET 12#define SPC_ASCQ_KEY_OFFSET 13#define TRANSPORT_IQN_LEN 224
PATCH 77/90 I2C: OMAP: correct SYSC register offset for OMAP4
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Aring <[email protected]>
commit 2727b1753934e154931d6b3bdf20c9b2398457a2 upstream.
Correct OMAP_I2C_SYSC_REG offset in omap4 register map. Offset 0x20 is reserved and OMAP_I2C_SYSC_REG has 0x10 as offset.
--- drivers/i2c/busses/i2c-omap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-omap.c +1 -1
@@ -235,7 +235,7 @@ const static u8 omap4_reg_map[] = { [OMAP_I2C_BUF_REG] = 0x94, [OMAP_I2C_CNT_REG] = 0x98, [OMAP_I2C_DATA_REG] = 0x9c, - [OMAP_I2C_SYSC_REG] = 0x20, + [OMAP_I2C_SYSC_REG] = 0x10, [OMAP_I2C_CON_REG] = 0xa4, [OMAP_I2C_OA_REG] = 0xa8, [OMAP_I2C_SA_REG] = 0xac,
PATCH 78/90 x86/UV2: Fix BAU destination timeout initialization
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cliff Wickman <[email protected]>
commit d059f9fa84a30e04279c6ff615e9e2cf3b260191 upstream.
Move the call to enable_timeouts() forward so that BAU_MISC_CONTROL is initialized before using it in calculate_destination_timeout().
Fix the calculation of a BAU destination timeout for UV2 (in calculate_destination_timeout()).
--- arch/x86/platform/uv/tlb_uv.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
arch/x86/platform/uv/tlb_uv.c +7 -6
@@ -1575,14 +1575,14 @@ static int calculate_destination_timeout ts_ns = base * mult1 * mult2; ret = ts_ns /1000 ; }else { -/* 4 bits 0/1 for 10/80us, 3 bits of multiplier */ - mmr_image =uv_read_local_mmr (UVH_AGING_PRESCALE_SEL ); +/* 4 bits 0/1 for 10/80us base, 3 bits of multiplier */ + mmr_image =uv_read_local_mmr (UVH_LB_BAU_MISC_CONTROL ); mmr_image = (mmr_image &UV_SA_MASK ) >>UV_SA_SHFT ;if (mmr_image & (1L <<UV2_ACK_UNITS_SHFT )) - mult1 =80 ; + base =80 ;else - mult1 =10 ; - base = mmr_image &UV2_ACK_MASK ; + base =10 ; + mult1 = mmr_image &UV2_ACK_MASK ; ret = mult1 * base; }return ret;
@@ -1820,6 +1820,8 @@ static int __init uv_bau_init(void) uv_base_pnode =uv_blade_to_pnode (uvhub); } +enable_timeouts (); +if (init_per_cpu (nuvhubs, uv_base_pnode)) { nobau =1 ;return 0 ;
@@ -1830,7 +1832,6 @@ static int __init uv_bau_init(void)if (uv_blade_nr_possible_cpus (uvhub))init_uvhub (uvhub, vector, uv_base_pnode); -enable_timeouts ();alloc_intr_gate (vector, uv_bau_message_intr1);for_each_possible_blade (uvhub) {
PATCH 79/90 rt2800pci: fix spurious interrupts generation
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislaw Gruszka <[email protected]>
commit dfd00c4c8f3dfa1fd7cec45f83d98b2a49743dcd upstream.
Same devices can generate interrupt without properly setting bit in INT_SOURCE_CSR register (spurious interrupt), what will cause IRQ line will be disabled by interrupts controller driver.
We discovered that clearing INT_MASK_CSR stops such behaviour. We previously first read that register, and then clear all know interrupt sources bits and do not touch reserved bits. After this patch, we write to all register content (I believe writing to reserved bits on that register will not cause any problems, I tested that on my rt2800pci device).
This fix very bad performance problem, practically making device unusable (since worked without interrupts), reported in:
https://bugzilla.redhat.com/show_bug.cgi?id=658451
We previously tried to workaround that issue in commit 4ba7d9997869d25bd223dea7536fc1ce9fab3b3b "rt2800pci: handle spurious interrupts", but it was reverted in commit 82e5fc2a34fa9ffea38f00c4066b7e600a0ca5e6
as thing, that will prevent to detect real spurious interrupts.
--- drivers/net/wireless/rt2x00/rt2800pci.c | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-)
drivers/net/wireless/rt2x00/rt2800pci.c +8 -20
@@ -426,7 +426,6 @@ static int rt2800pci_init_queues(structstatic void rt2800pci_toggle_irq (struct rt2x00_dev *rt2x00dev,enum dev_state state) { -int mask = (state ==STATE_RADIO_IRQ_ON );u32 reg;unsigned long flags;
@@ -448,25 +447,14 @@ static void rt2800pci_toggle_irq(struct }spin_lock_irqsave (&rt2x00dev->irqmask_lock, flags); -rt2x00pci_register_read (rt2x00dev,INT_MASK_CSR , ®); -rt2x00_set_field32 (®,INT_MASK_CSR_RXDELAYINT ,0 ); -rt2x00_set_field32 (®,INT_MASK_CSR_TXDELAYINT ,0 ); -rt2x00_set_field32 (®,INT_MASK_CSR_RX_DONE , mask); -rt2x00_set_field32 (®,INT_MASK_CSR_AC0_DMA_DONE ,0 ); -rt2x00_set_field32 (®,INT_MASK_CSR_AC1_DMA_DONE ,0 ); -rt2x00_set_field32 (®,INT_MASK_CSR_AC2_DMA_DONE ,0 ); -rt2x00_set_field32 (®,INT_MASK_CSR_AC3_DMA_DONE ,0 ); -rt2x00_set_field32 (®,INT_MASK_CSR_HCCA_DMA_DONE ,0 ); -rt2x00_set_field32 (®,INT_MASK_CSR_MGMT_DMA_DONE ,0 ); -rt2x00_set_field32 (®,INT_MASK_CSR_MCU_COMMAND ,0 ); -rt2x00_set_field32 (®,INT_MASK_CSR_RXTX_COHERENT ,0 ); -rt2x00_set_field32 (®,INT_MASK_CSR_TBTT , mask); -rt2x00_set_field32 (®,INT_MASK_CSR_PRE_TBTT , mask); -rt2x00_set_field32 (®,INT_MASK_CSR_TX_FIFO_STATUS , mask); -rt2x00_set_field32 (®,INT_MASK_CSR_AUTO_WAKEUP , mask); -rt2x00_set_field32 (®,INT_MASK_CSR_GPTIMER ,0 ); -rt2x00_set_field32 (®,INT_MASK_CSR_RX_COHERENT ,0 ); -rt2x00_set_field32 (®,INT_MASK_CSR_TX_COHERENT ,0 ); + reg =0 ; +if (state ==STATE_RADIO_IRQ_ON ) { +rt2x00_set_field32 (®,INT_MASK_CSR_RX_DONE ,1 ); +rt2x00_set_field32 (®,INT_MASK_CSR_TBTT ,1 ); +rt2x00_set_field32 (®,INT_MASK_CSR_PRE_TBTT ,1 ); +rt2x00_set_field32 (®,INT_MASK_CSR_TX_FIFO_STATUS ,1 ); +rt2x00_set_field32 (®,INT_MASK_CSR_AUTO_WAKEUP ,1 ); + }rt2x00pci_register_write (rt2x00dev,INT_MASK_CSR , reg);spin_unlock_irqrestore (&rt2x00dev->irqmask_lock, flags);
PATCH 80/90 pnfs-obj: pNFS errors are communicated on iodata->pnfs_error
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boaz Harrosh <[email protected]>
commit 5c0b4129c07b902b27d3f3ebc087757f534a3abd upstream.
Some time along the way pNFS IO errors were switched to communicate with a special iodata->pnfs_error member instead of the regular RPC members. But objlayout was not switched over.
Fix that!
Without this fix any IO error is hanged, because IO is not switched to MDS and pages are never cleared or read.
--- fs/nfs/objlayout/objlayout.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
fs/nfs/objlayout/objlayout.c +7 -3
@@ -294,9 +294,11 @@ objlayout_read_done(struct objlayout_io_dprintk ("%s: Begin status=%zd eof=%d\n" , __func__, status, eof); rdata = state->rpcdata; rdata->task.tk_status = status; -if (status >=0 ) { +if (likely (status >=0 )) { rdata->res.count = status; rdata->res.eof = eof; + }else { + rdata->pnfs_error = status; }objlayout_iodone (state);/* must not use state after this point */
@@ -380,15 +382,17 @@ objlayout_write_done(struct objlayout_io wdata = state->rpcdata; state->status = status; wdata->task.tk_status = status; -if (status >=0 ) { +if (likely (status >=0 )) { wdata->res.count = status; wdata->verf.committed = state->committed;dprintk ("%s: Return status %d committed %d\n" , __func__, wdata->task.tk_status, wdata->verf.committed); - }else + }else { + wdata->pnfs_error = status;dprintk ("%s: Return status %d\n" , __func__, wdata->task.tk_status); + }objlayout_iodone (state);/* must not use state after this point */
PATCH 81/90 pnfs-obj: Must return layout on IO error
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boaz Harrosh <[email protected]>
commit fe0fe83585f88346557868a803a479dfaaa0688a upstream.
As mandated by the standard. In case of an IO error, a pNFS objects layout driver must return it's layout. This is because all device errors are reported to the server as part of the layout return buffer.
This is implemented the same way PNFS_LAYOUTRET_ON_SETATTR is done, through a bit flag on the pnfs_layoutdriver_type->flags member. The flag is set by the layout driver that wants a layout_return preformed at pnfs_ld_{write,read}_done in case of an error.
(Though I have not defined a wrapper like pnfs_ld_layoutret_on_setattr
because this code is never called outside of pnfs.c and pnfs IO paths)
Without this patch 3.[0-2] Kernels leak memory and have an annoying WARN_ON after every IO error utilizing the pnfs-obj driver.
--- fs/nfs/objlayout/objio_osd.c | 3 ++- fs/nfs/pnfs.c | 12 ++++++++++++ fs/nfs/pnfs.h | 1 + 3 files changed, 15 insertions(+), 1 deletion(-)
fs/nfs/objlayout/objio_osd.c +2 -1
@@ -1006,7 +1006,8 @@ static bool objio_pg_test(struct nfs_pagstatic struct pnfs_layoutdriver_type objlayout_type = { .id =LAYOUT_OSD2_OBJECTS , .name ="LAYOUT_OSD2_OBJECTS" , - .flags =PNFS_LAYOUTRET_ON_SETATTR , + .flags =PNFS_LAYOUTRET_ON_SETATTR | +PNFS_LAYOUTRET_ON_ERROR , .alloc_layout_hdr = objlayout_alloc_layout_hdr, .free_layout_hdr = objlayout_free_layout_hdr,
fs/nfs/pnfs.c +12 -0
@@ -1119,6 +1119,14 @@ pnfs_ld_write_done(struct nfs_write_data data->mds_ops->rpc_release (data);return 0 ; } +if (NFS_SERVER (data->inode)->pnfs_curr_ld->flags & +PNFS_LAYOUTRET_ON_ERROR ) { +/* Don't lo_commit on error, Server will needs to +* preform a file recovery. +*/ +clear_bit (NFS_INO_LAYOUTCOMMIT , &NFS_I (data->inode)->flags); +pnfs_return_layout (data->inode); + }dprintk ("%s: pnfs_error=%d, retry via MDS\n" , __func__, data->pnfs_error);
@@ -1167,6 +1175,10 @@ pnfs_ld_read_done(struct nfs_read_data *return 0 ; } +if (NFS_SERVER (data->inode)->pnfs_curr_ld->flags & +PNFS_LAYOUTRET_ON_ERROR ) +pnfs_return_layout (data->inode); +dprintk ("%s: pnfs_error=%d, retry via MDS\n" , __func__, data->pnfs_error); status = nfs_initiate_read(data, NFS_CLIENT(data->inode),
fs/nfs/pnfs.h +1 -0
@@ -68,6 +68,7 @@ enum {enum layoutdriver_policy_flags {/* Should the pNFS client commit and return the layout upon a setattr */ PNFS_LAYOUTRET_ON_SETATTR =1 <<0 , +PNFS_LAYOUTRET_ON_ERROR =1 <<1 , };struct nfs4_deviceid_node ;
PATCH 82/90 net: Fix driver name for mdio-gpio.c
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dirk Eibach <[email protected]>
commit f42af6c486aa5ca6ee62800cb45c5b252020509d upstream.
Since commit
"7488876... dt/net: Eliminate users of of_platform_{,un}register_driver" there are two platform drivers named "mdio-gpio" registered. I renamed the of variant to "mdio-ofgpio".
--- drivers/net/phy/mdio-gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/mdio-gpio.c +1 -1
@@ -241,7 +241,7 @@ MODULE_DEVICE_TABLE(of, mdio_ofgpio_matcstatic struct platform_driver mdio_ofgpio_driver = { .driver = { - .name ="mdio-gpio" , + .name ="mdio-ofgpio" , .owner =THIS_MODULE , .of_match_table = mdio_ofgpio_match, },
PATCH 83/90 i2c-eg20t: modified the setting of transfer rate.
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Toshiharu Okada <[email protected]>
commit ff35e8b18984ad2a82cbd259fc07f0be4b34b1aa upstream.
This patch modified the setting value of
I2C Bus Transfer Rate Setting Counter regisrer.
--- drivers/i2c/busses/i2c-eg20t.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-eg20t.c +1 -1
@@ -242,7 +242,7 @@ static void pch_i2c_init(struct i2c_algoif (pch_clk >PCH_MAX_CLK ) pch_clk =62500 ; - pch_i2cbc = (pch_clk + (pch_i2c_speed *4 )) / pch_i2c_speed *8 ; + pch_i2cbc = (pch_clk + (pch_i2c_speed *4 )) / (pch_i2c_speed *8 );/* Set transfer speed in I2CBC */ iowrite32 (pch_i2cbc, p +PCH_I2CBC );
PATCH 84/90 score: fix off-by-one index into syscall table
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Rosenberg <[email protected]>
commit c25a785d6647984505fa165b5cd84cfc9a95970b upstream.
If the provided system call number is equal to __NR_syscalls, the current check will pass and a function pointer just after the system call table may be called, since sys_call_table is an array with total size __NR_syscalls.
Whether or not this is a security bug depends on what the compiler puts immediately after the system call table. It's likely that this won't do anything bad because there is an additional NULL check on the syscall entry, but if there happens to be a non-NULL value immediately after the system call table, this may result in local privilege escalation.
--- arch/score/kernel/entry.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/score/kernel/entry.S +1 -1
@@ -408,7 +408,7 @@ ENTRY(handle_sys) sw r9, [r0, PT_EPC] cmpi.c r27, __NR_syscalls # check syscall number - bgtu illegal_syscall + bgeu illegal_syscall slli r8, r27, 2 # get syscall routine la r11, sys_call_table
PATCH 85/90 kprobes: initialize before using a hlist
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ananth N Mavinakayanahalli <[email protected]>
commit d496aab567e7e52b3e974c9192a5de6e77dce32c upstream.
Commit ef53d9c5e ("kprobes: improve kretprobe scalability with hashed locking") introduced a bug where we can potentially leak kretprobe_instances since we initialize a hlist head after having used it.
Initialize the hlist head before using it.
Reported by: Jim Keniston <[email protected]>
--- kernel/kprobes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/kprobes.c +1 -1
@@ -1077,6 +1077,7 @@ void __kprobes kprobe_flush_task(struct/* Early boot. kretprobe_table_locks not yet initialized. */ return ; +INIT_HLIST_HEAD (&empty_rp); hash =hash_ptr (tk,KPROBE_HASH_BITS ); head = &kretprobe_inst_table[hash];kretprobe_table_lock (hash, &flags);
@@ -1085,7 +1086,6 @@ void __kprobes kprobe_flush_task(structrecycle_rp_inst (ri, &empty_rp); }kretprobe_table_unlock (hash, &flags); -INIT_HLIST_HEAD (&empty_rp);hlist_for_each_entry_safe (ri, node, tmp, &empty_rp, hlist) {hlist_del (&ri->hlist);kfree (ri);
PATCH 86/90 proc: clear_refs: do not clear reserved pages
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit 85e72aa5384b1a614563ad63257ded0e91d1a620 upstream.
/proc/pid/clear_refs is used to clear the Referenced and YOUNG bits for pages and corresponding page table entries of the task with PID pid, which includes any special mappings inserted into the page tables in order to provide things like vDSOs and user helper functions.
On ARM this causes a problem because the vectors page is mapped as a global mapping and since ec706dab ("ARM: add a vma entry for the user accessible vector page"), a VMA is also inserted into each task for this page to aid unwinding through signals and syscall restarts. Since the vectors page is required for handling faults, clearing the YOUNG bit (and subsequently writing a faulting pte) means that we lose the vectors page *globally* and cannot fault it back in. This results in a system deadlock on the next exception.
To see this problem in action, just run:
$ echo 1 > /proc/self/clear_refs
on an ARM platform (as any user) and watch your system hang. I think this has been the case since 2.6.37
This patch avoids clearing the aforementioned bits for reserved pages, therefore leaving the vectors page intact on ARM. Since reserved pages are not candidates for swap, this change should not have any impact on the usefulness of clear_refs.
--- fs/proc/task_mmu.c | 3 +++ 1 file changed, 3 insertions(+)
fs/proc/task_mmu.c +3 -0
@@ -516,6 +516,9 @@ static int clear_refs_pte_range(pmd_t *pif (!page)continue ; +if (PageReserved (page)) +continue ; +/* Clear accessed and referenced bits. */ ptep_test_and_clear_young (vma, addr, pte);ClearPageReferenced (page);
PATCH 87/90 mm: fix NULL ptr dereference in __count_immobile_pages
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Hocko <[email protected]>
commit 687875fb7de4a95223af20ee024282fa9099f860 upstream.
Fix the following NULL ptr dereference caused by
cat /sys/devices/system/memory/memory0/removable
Pid: 13979, comm: sed Not tainted 3.0.13-0.5-default #1 IBM BladeCenter LS21 -[7971PAM]-/Server Blade
RIP: __count_immobile_pages+0x4/0x100 Process sed (pid: 13979, threadinfo ffff880221c36000, task ffff88022e788480) Call Trace: is_pageblock_removable_nolock+0x34/0x40 is_mem_section_removable+0x74/0xf0 show_mem_removable+0x41/0x70 sysfs_read_file+0xfe/0x1c0 vfs_read+0xc7/0x130 sys_read+0x53/0xa0 system_call_fastpath+0x16/0x1b
We are crashing because we are trying to dereference NULL zone which came from pfn=0 (struct page ffffea0000000000). According to the boot log this page is marked reserved:
e820 update range: 0000000000000000 - 0000000000010000 (usable) ==> (reserved)
and early_node_map confirms that:
early_node_map[3] active PFN ranges
1: 0x00000010 -> 0x0000009c
1: 0x00000100 -> 0x000bffa3
1: 0x00100000 -> 0x00240000The problem is that memory_present works in PAGE_SECTION_MASK aligned blocks so the reserved range sneaks into the the section as well. This also means that free_area_init_node will not take care of those reserved pages and they stay uninitialized.
When we try to read the removable status we walk through all available sections and hope that the zone is valid for all pages in the section. But this is not true in this case as the zone and nid are not initialized.
We have only one node in this particular case and it is marked as node=1 (rather than 0) and that made the problem visible because page_to_nid will return 0 and there are no zones on the node.
Let's check that the zone is valid and that the given pfn falls into its boundaries and mark the section not removable. This might cause some false positives, probably, but we do not have any sane way to find out whether the page is reserved by the platform or it is just not used for whatever other reasons.
--- mm/page_alloc.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
mm/page_alloc.c +11 -0
@@ -5565,6 +5565,17 @@ __count_immobile_pages(struct zone *zonebool is_pageblock_removable_nolock (struct page *page) {struct zone *zone =page_zone (page); +unsigned long pfn =page_to_pfn (page); + +/* +* We have to be careful here because we are iterating over memory +* sections which are not zone aware so we might end up outside of +* the zone but still within the section. +*/ +if (!zone || zone->zone_start_pfn > pfn || + zone->zone_start_pfn + zone->spanned_pages <= pfn) +return false; +return __count_immobile_pages (zone, page,0 ); }
PATCH 88/90 iwlagn: check for SMPS mode
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wey-Yi Guy <[email protected]>
commit b2ccccdca46273c7b321ecf5041c362cd950da20 upstream.
Check and report WARN only when its invalid
Resolves:
https://bugzilla.kernel.org/show_bug.cgi?id=42621
https://bugzilla.redhat.com/show_bug.cgi?id=766071
--- drivers/net/wireless/iwlwifi/iwl-agn-lib.c | 1 + drivers/net/wireless/iwlwifi/iwl-agn-rxon.c | 3 +++ 2 files changed, 4 insertions(+)
drivers/net/wireless/iwlwifi/iwl-agn-lib.c +1 -0
@@ -2023,6 +2023,7 @@ static int iwl_get_idle_rx_chain_count(scase IEEE80211_SMPS_STATIC :case IEEE80211_SMPS_DYNAMIC :return IWL_NUM_IDLE_CHAINS_SINGLE ; +case IEEE80211_SMPS_AUTOMATIC :case IEEE80211_SMPS_OFF :return active_cnt;default :
drivers/net/wireless/iwlwifi/iwl-agn-rxon.c +3 -0
@@ -442,6 +442,9 @@ int iwlagn_mac_config(struct ieee80211_hmutex_lock (&priv->mutex); +if (test_bit (STATUS_EXIT_PENDING , &priv->status)) + goto out; +if (unlikely (test_bit (STATUS_SCANNING , &priv->status))) {IWL_DEBUG_MAC80211 (priv,"leave - scanning\n" ); goto out;
PATCH 89/90 iwlegacy: 3945: fix hw passive scan on radar channels
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislaw Gruszka <[email protected]>
commit 68acc4afb040d98ddfd2cae0de09e2f4e1ee127f upstream.
Patch fix firmware error on "iw dev wlan0 scan passive" for hardware scanning (with disable_hw_scan=0 module parameter).
iwl3945 0000:03:00.0: Microcode SW error detected. Restarting 0x82000008. iwl3945 0000:03:00.0: Loaded firmware version: 15.32.2.9
iwl3945 0000:03:00.0: Start IWL Error Log Dump:
iwl3945 0000:03:00.0: Status: 0x0002A2E4, count: 1
iwl3945 0000:03:00.0: Desc Time asrtPC blink2 ilink1 nmiPC Line
iwl3945 0000:03:00.0: SYSASSERT (0x5) 0041263900 0x13756 0x0031C 0x00000 764
iwl3945 0000:03:00.0: Error Reply type 0x000002FC cmd C_SCAN (0x80) seq 0x443E ser 0x00340000 iwl3945 0000:03:00.0: Command C_SCAN failed: FW Error
iwl3945 0000:03:00.0: Can't stop Rx DMA.
We have disable ability to change passive scanning to active on particular channel when traffic is detected on that channel. Otherwise firmware will report error, when we try to do passive scan on radar channels.
--- drivers/net/wireless/iwlegacy/iwl3945-base.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/net/wireless/iwlegacy/iwl3945-base.c +4 -5
@@ -2910,14 +2910,13 @@ int iwl3945_request_scan(struct iwl_privIWL_WARN (priv,"Invalid scan band\n" );return -EIO ; } -/* -* If active scaning is requested but a certain channel -* is marked passive, we can do active scanning if we -* detect transmissions. +* If active scaning is requested but a certain channel is marked +* passive, we can do active scanning if we detect transmissions. For +* passive only scanning disable switching to active on any channel. */ scan->good_CRC_th = is_active ?IWL_GOOD_CRC_TH_DEFAULT : -IWL_GOOD_CRC_TH_DISABLED ; +IWL_GOOD_CRC_TH_NEVER ;if (!priv->is_internal_short_scan) { scan->tx_cmd.len = cpu_to_le16(
PATCH 90/90 UBIFS: make debugging messages light again
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Artem Bityutskiy <[email protected]>
commit 1f5d78dc4823a85f112aaa2d0f17624f8c2a6c52 upstream.
We switch to dynamic debugging in commit 56e46742e846e4de167dde0e1e1071ace1c882a5 but did not take into account that now we do not control anymore whether a specific message is enabled or not. So now we lock the "dbg_lock" and release it in every debugging macro, which make them not so light-weight.
This commit removes the "dbg_lock" protection from the debugging macros to fix the issue.
The downside is that now our DBGKEY() stuff is broken, but this is not critical at all and will be fixed later.
--- fs/ubifs/debug.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
fs/ubifs/debug.h +5 -7
@@ -121,17 +121,15 @@ const char *dbg_key_str1(const struct ub const union ubifs_key *key);/* -* DBGKEY macros require @dbg_lock to be held, which it is in the dbg message -* macros. +* TODO: these macros are now broken because there is no locking around them +* and we use a global buffer for the key string. This means that in case of +* concurrent execution we will end up with incorrect and messy key strings. */ #define DBGKEY (key) dbg_key_str0(c, (key))#define DBGKEY1 (key) dbg_key_str1(c, (key)) -#define ubifs_dbg_msg (type, fmt, ...) do { \ - spin_lock(&dbg_lock); \ - pr_debug("UBIFS DBG " type ": " fmt "\n", ##__VA_ARGS__); \ - spin_unlock(&dbg_lock); \ -} while (0) +#define ubifs_dbg_msg (type, fmt, ...) \ + pr_debug("UBIFS DBG " type ": " fmt "\n", ##__VA_ARGS__)/* Just a debugging messages not related to any specific UBIFS subsystem */ #define dbg_msg (fmt, ...) \