From eafa3b52ddf93966386a133280d4b29bd35e3afd Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 7 Apr 2010 15:24:02 -0700 Subject: [PATCH] .33 patches --- ...hda-add-asrock-mobo-to-msi-blacklist.patch | 29 ++++ ...-add-msi-blacklist-for-aopen-mz915-m.patch | 29 ++++ ...-lenovo-thinkpad-models-using-ad1981.patch | 41 +++++ ...alsa-mixart-range-checking-proc-file.patch | 69 ++++++++ ...ia_bl-add-five-more-macbook-variants.patch | 73 +++++++++ ...update-the-superblock-in-ext3_statfs.patch | 45 ++++++ .../hid-fix-oops-in-gyration_event.patch | 37 +++++ ...include-linux-kfifo.h-fix-init_kfifo.patch | 39 +++++ ...bata-disable-ncq-on-crucial-c300-ssd.patch | 55 +++++++ .../libata-unlock-hpa-if-device-shrunk.patch | 149 ++++++++++++++++++ .../pata_via-add-via-vx900-support.patch | 27 ++++ .../raw-fsync-method-is-now-required.patch | 89 +++++++++++ .../readahead-fix-null-filp-dereference.patch | 37 +++++ queue-2.6.33/series | 13 ++ 14 files changed, 732 insertions(+) create mode 100644 queue-2.6.33/alsa-hda-add-asrock-mobo-to-msi-blacklist.patch create mode 100644 queue-2.6.33/alsa-hda-add-msi-blacklist-for-aopen-mz915-m.patch create mode 100644 queue-2.6.33/alsa-hda-fix-0-db-offset-for-lenovo-thinkpad-models-using-ad1981.patch create mode 100644 queue-2.6.33/alsa-mixart-range-checking-proc-file.patch create mode 100644 queue-2.6.33/backlight-mbp_nvidia_bl-add-five-more-macbook-variants.patch create mode 100644 queue-2.6.33/ext3-don-t-update-the-superblock-in-ext3_statfs.patch create mode 100644 queue-2.6.33/hid-fix-oops-in-gyration_event.patch create mode 100644 queue-2.6.33/include-linux-kfifo.h-fix-init_kfifo.patch create mode 100644 queue-2.6.33/libata-disable-ncq-on-crucial-c300-ssd.patch create mode 100644 queue-2.6.33/libata-unlock-hpa-if-device-shrunk.patch create mode 100644 queue-2.6.33/pata_via-add-via-vx900-support.patch create mode 100644 queue-2.6.33/raw-fsync-method-is-now-required.patch create mode 100644 queue-2.6.33/readahead-fix-null-filp-dereference.patch diff --git a/queue-2.6.33/alsa-hda-add-asrock-mobo-to-msi-blacklist.patch b/queue-2.6.33/alsa-hda-add-asrock-mobo-to-msi-blacklist.patch new file mode 100644 index 00000000000..01b5b610342 --- /dev/null +++ b/queue-2.6.33/alsa-hda-add-asrock-mobo-to-msi-blacklist.patch @@ -0,0 +1,29 @@ +From 4193d13b2c2b694aa59e629e6daf6269d7922f13 Mon Sep 17 00:00:00 2001 +From: Michele Ballabio +Date: Sat, 6 Mar 2010 21:06:46 +0100 +Subject: ALSA: hda - Add ASRock mobo to MSI blacklist + +From: Michele Ballabio + +commit 4193d13b2c2b694aa59e629e6daf6269d7922f13 upstream. + +This avoids a lockup at boot. + +Signed-off-by: Michele Ballabio +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/hda_intel.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/sound/pci/hda/hda_intel.c ++++ b/sound/pci/hda/hda_intel.c +@@ -2357,6 +2357,7 @@ static struct snd_pci_quirk msi_black_li + SND_PCI_QUIRK(0x1043, 0x81f2, "ASUS", 0), /* Athlon64 X2 + nvidia */ + SND_PCI_QUIRK(0x1043, 0x81f6, "ASUS", 0), /* nvidia */ + SND_PCI_QUIRK(0x1043, 0x822d, "ASUS", 0), /* Athlon64 X2 + nvidia MCP55 */ ++ SND_PCI_QUIRK(0x1849, 0x0888, "ASRock", 0), /* Athlon64 X2 + nvidia */ + {} + }; + diff --git a/queue-2.6.33/alsa-hda-add-msi-blacklist-for-aopen-mz915-m.patch b/queue-2.6.33/alsa-hda-add-msi-blacklist-for-aopen-mz915-m.patch new file mode 100644 index 00000000000..7608a6ac07a --- /dev/null +++ b/queue-2.6.33/alsa-hda-add-msi-blacklist-for-aopen-mz915-m.patch @@ -0,0 +1,29 @@ +From 3815595e78d2baae6feb866e737f92d8ef48b337 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Sun, 4 Apr 2010 12:14:03 +0200 +Subject: ALSA: hda - Add MSI blacklist for Aopen MZ915-M + +From: Takashi Iwai + +commit 3815595e78d2baae6feb866e737f92d8ef48b337 upstream. + +The device needs MSI disablement. Added to the quirk list. + +Reported-by: Harald Dunkel +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/hda_intel.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/sound/pci/hda/hda_intel.c ++++ b/sound/pci/hda/hda_intel.c +@@ -2358,6 +2358,7 @@ static struct snd_pci_quirk msi_black_li + SND_PCI_QUIRK(0x1043, 0x81f6, "ASUS", 0), /* nvidia */ + SND_PCI_QUIRK(0x1043, 0x822d, "ASUS", 0), /* Athlon64 X2 + nvidia MCP55 */ + SND_PCI_QUIRK(0x1849, 0x0888, "ASRock", 0), /* Athlon64 X2 + nvidia */ ++ SND_PCI_QUIRK(0xa0a0, 0x0575, "Aopen MZ915-M", 0), /* ICH6 */ + {} + }; + diff --git a/queue-2.6.33/alsa-hda-fix-0-db-offset-for-lenovo-thinkpad-models-using-ad1981.patch b/queue-2.6.33/alsa-hda-fix-0-db-offset-for-lenovo-thinkpad-models-using-ad1981.patch new file mode 100644 index 00000000000..a022f2fa226 --- /dev/null +++ b/queue-2.6.33/alsa-hda-fix-0-db-offset-for-lenovo-thinkpad-models-using-ad1981.patch @@ -0,0 +1,41 @@ +From b8e80cf386419453678b01bef830f53445ebb15d Mon Sep 17 00:00:00 2001 +From: Daniel T Chen +Date: Tue, 30 Mar 2010 13:29:28 -0400 +Subject: ALSA: hda: Fix 0 dB offset for Lenovo Thinkpad models using AD1981 + +From: Daniel T Chen + +commit b8e80cf386419453678b01bef830f53445ebb15d upstream. + +BugLink: https://launchpad.net/bugs/551606 + +The OR's hardware distorts at PCM 100% because it does not correspond to +0 dB. Fix this in patch_ad1981() for all models using the Thinkpad +quirk. + +Reported-by: Jane Silber +Signed-off-by: Daniel T Chen +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/patch_analog.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/sound/pci/hda/patch_analog.c ++++ b/sound/pci/hda/patch_analog.c +@@ -1805,6 +1805,14 @@ static int patch_ad1981(struct hda_codec + case AD1981_THINKPAD: + spec->mixers[0] = ad1981_thinkpad_mixers; + spec->input_mux = &ad1981_thinkpad_capture_source; ++ /* set the upper-limit for mixer amp to 0dB for avoiding the ++ * possible damage by overloading ++ */ ++ snd_hda_override_amp_caps(codec, 0x11, HDA_INPUT, ++ (0x17 << AC_AMPCAP_OFFSET_SHIFT) | ++ (0x17 << AC_AMPCAP_NUM_STEPS_SHIFT) | ++ (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) | ++ (1 << AC_AMPCAP_MUTE_SHIFT)); + break; + case AD1981_TOSHIBA: + spec->mixers[0] = ad1981_hp_mixers; diff --git a/queue-2.6.33/alsa-mixart-range-checking-proc-file.patch b/queue-2.6.33/alsa-mixart-range-checking-proc-file.patch new file mode 100644 index 00000000000..0773423046b --- /dev/null +++ b/queue-2.6.33/alsa-mixart-range-checking-proc-file.patch @@ -0,0 +1,69 @@ +From b0cc58a25d04160d39a80e436847eaa2fbc5aa09 Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Tue, 6 Apr 2010 19:31:26 +0300 +Subject: ALSA: mixart: range checking proc file + +From: Dan Carpenter + +commit b0cc58a25d04160d39a80e436847eaa2fbc5aa09 upstream. + +The original code doesn't take into consideration that the value of +MIXART_BA0_SIZE - pos can be less than zero which would lead to a large +unsigned value for "count". + +Also I moved the check that read size is a multiple of 4 bytes below +the code that adjusts "count". + +Signed-off-by: Dan Carpenter +Acked-by: Linus Torvalds +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/mixart/mixart.c | 24 ++++++++++++++---------- + 1 file changed, 14 insertions(+), 10 deletions(-) + +--- a/sound/pci/mixart/mixart.c ++++ b/sound/pci/mixart/mixart.c +@@ -1161,13 +1161,15 @@ static long snd_mixart_BA0_read(struct s + unsigned long count, unsigned long pos) + { + struct mixart_mgr *mgr = entry->private_data; ++ unsigned long maxsize; + +- count = count & ~3; /* make sure the read size is a multiple of 4 bytes */ +- if(count <= 0) ++ if (pos >= MIXART_BA0_SIZE) + return 0; +- if(pos + count > MIXART_BA0_SIZE) +- count = (long)(MIXART_BA0_SIZE - pos); +- if(copy_to_user_fromio(buf, MIXART_MEM( mgr, pos ), count)) ++ maxsize = MIXART_BA0_SIZE - pos; ++ if (count > maxsize) ++ count = maxsize; ++ count = count & ~3; /* make sure the read size is a multiple of 4 bytes */ ++ if (copy_to_user_fromio(buf, MIXART_MEM(mgr, pos), count)) + return -EFAULT; + return count; + } +@@ -1180,13 +1182,15 @@ static long snd_mixart_BA1_read(struct s + unsigned long count, unsigned long pos) + { + struct mixart_mgr *mgr = entry->private_data; ++ unsigned long maxsize; + +- count = count & ~3; /* make sure the read size is a multiple of 4 bytes */ +- if(count <= 0) ++ if (pos > MIXART_BA1_SIZE) + return 0; +- if(pos + count > MIXART_BA1_SIZE) +- count = (long)(MIXART_BA1_SIZE - pos); +- if(copy_to_user_fromio(buf, MIXART_REG( mgr, pos ), count)) ++ maxsize = MIXART_BA1_SIZE - pos; ++ if (count > maxsize) ++ count = maxsize; ++ count = count & ~3; /* make sure the read size is a multiple of 4 bytes */ ++ if (copy_to_user_fromio(buf, MIXART_REG(mgr, pos), count)) + return -EFAULT; + return count; + } diff --git a/queue-2.6.33/backlight-mbp_nvidia_bl-add-five-more-macbook-variants.patch b/queue-2.6.33/backlight-mbp_nvidia_bl-add-five-more-macbook-variants.patch new file mode 100644 index 00000000000..99604a50cd0 --- /dev/null +++ b/queue-2.6.33/backlight-mbp_nvidia_bl-add-five-more-macbook-variants.patch @@ -0,0 +1,73 @@ +From 36bc5ee6a8d13333980fa54e97d3469d3d4cda98 Mon Sep 17 00:00:00 2001 +From: Evan McClain +Date: Tue, 9 Mar 2010 19:20:58 -0500 +Subject: backlight: mbp_nvidia_bl - add five more MacBook variants + +From: Evan McClain + +commit 36bc5ee6a8d13333980fa54e97d3469d3d4cda98 upstream. + +This adds the MacBook 1,1 2,1 3,1 4,1 and 4,2 to the DMI tables. + +Signed-off-by: Evan McClain +Signed-off-by: Richard Purdie +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/video/backlight/mbp_nvidia_bl.c | 45 ++++++++++++++++++++++++++++++++ + 1 file changed, 45 insertions(+) + +--- a/drivers/video/backlight/mbp_nvidia_bl.c ++++ b/drivers/video/backlight/mbp_nvidia_bl.c +@@ -139,6 +139,51 @@ static int mbp_dmi_match(const struct dm + static const struct dmi_system_id __initdata mbp_device_table[] = { + { + .callback = mbp_dmi_match, ++ .ident = "MacBook 1,1", ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), ++ DMI_MATCH(DMI_PRODUCT_NAME, "MacBook1,1"), ++ }, ++ .driver_data = (void *)&intel_chipset_data, ++ }, ++ { ++ .callback = mbp_dmi_match, ++ .ident = "MacBook 2,1", ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), ++ DMI_MATCH(DMI_PRODUCT_NAME, "MacBook2,1"), ++ }, ++ .driver_data = (void *)&intel_chipset_data, ++ }, ++ { ++ .callback = mbp_dmi_match, ++ .ident = "MacBook 3,1", ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), ++ DMI_MATCH(DMI_PRODUCT_NAME, "MacBook3,1"), ++ }, ++ .driver_data = (void *)&intel_chipset_data, ++ }, ++ { ++ .callback = mbp_dmi_match, ++ .ident = "MacBook 4,1", ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), ++ DMI_MATCH(DMI_PRODUCT_NAME, "MacBook4,1"), ++ }, ++ .driver_data = (void *)&intel_chipset_data, ++ }, ++ { ++ .callback = mbp_dmi_match, ++ .ident = "MacBook 4,2", ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), ++ DMI_MATCH(DMI_PRODUCT_NAME, "MacBook4,2"), ++ }, ++ .driver_data = (void *)&intel_chipset_data, ++ }, ++ { ++ .callback = mbp_dmi_match, + .ident = "MacBookPro 3,1", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), diff --git a/queue-2.6.33/ext3-don-t-update-the-superblock-in-ext3_statfs.patch b/queue-2.6.33/ext3-don-t-update-the-superblock-in-ext3_statfs.patch new file mode 100644 index 00000000000..96a57f79728 --- /dev/null +++ b/queue-2.6.33/ext3-don-t-update-the-superblock-in-ext3_statfs.patch @@ -0,0 +1,45 @@ +From b918397542388de75bd86c32fbfa820e5d629fa9 Mon Sep 17 00:00:00 2001 +From: Eric Sandeen +Date: Mon, 16 Nov 2009 16:34:51 -0600 +Subject: ext3: Don't update the superblock in ext3_statfs() + +From: Eric Sandeen + +commit b918397542388de75bd86c32fbfa820e5d629fa9 upstream. + +commit a71ce8c6c9bf269b192f352ea555217815cf027e updated ext3_statfs() +to update the on-disk superblock counters, but modified this buffer +directly without any journaling of the change. This is one of the +accesses that was causing the crc errors in journal replay as seen in +kernel.org bugzilla #14354. + +The modifications were originally to keep the sb "more" in sync, +so that a readonly fsck of the device didn't flag this as an +error (as often), but apparently e2fsprogs deals with this differently +now, anyway. + +Based on Ted's patch for ext4, which was in turn based on my +work on that bug and another preliminary patch... + +Signed-off-by: Eric Sandeen +Signed-off-by: Jan Kara +Signed-off-by: Greg Kroah-Hartman + +diff --git a/fs/ext3/super.c b/fs/ext3/super.c +index 427496c..ca3068f 100644 +--- a/fs/ext3/super.c ++++ b/fs/ext3/super.c +@@ -2686,13 +2686,11 @@ static int ext3_statfs (struct dentry * dentry, struct kstatfs * buf) + buf->f_bsize = sb->s_blocksize; + buf->f_blocks = le32_to_cpu(es->s_blocks_count) - sbi->s_overhead_last; + buf->f_bfree = percpu_counter_sum_positive(&sbi->s_freeblocks_counter); +- es->s_free_blocks_count = cpu_to_le32(buf->f_bfree); + buf->f_bavail = buf->f_bfree - le32_to_cpu(es->s_r_blocks_count); + if (buf->f_bfree < le32_to_cpu(es->s_r_blocks_count)) + buf->f_bavail = 0; + buf->f_files = le32_to_cpu(es->s_inodes_count); + buf->f_ffree = percpu_counter_sum_positive(&sbi->s_freeinodes_counter); +- es->s_free_inodes_count = cpu_to_le32(buf->f_ffree); + buf->f_namelen = EXT3_NAME_LEN; + fsid = le64_to_cpup((void *)es->s_uuid) ^ + le64_to_cpup((void *)es->s_uuid + sizeof(u64)); diff --git a/queue-2.6.33/hid-fix-oops-in-gyration_event.patch b/queue-2.6.33/hid-fix-oops-in-gyration_event.patch new file mode 100644 index 00000000000..f92c7e5084f --- /dev/null +++ b/queue-2.6.33/hid-fix-oops-in-gyration_event.patch @@ -0,0 +1,37 @@ +From d8e4ebf8b603bdcd091540e6b5bddf0dec10d516 Mon Sep 17 00:00:00 2001 +From: Jiri Kosina +Date: Tue, 23 Mar 2010 16:32:37 +0100 +Subject: HID: fix oops in gyration_event() + +From: Jiri Kosina + +commit d8e4ebf8b603bdcd091540e6b5bddf0dec10d516 upstream. + +Fix oops caused by dereferencing field->hidinput in cases where +the device hasn't been claimed by hid-input. + +Reported-by: Andreas Demmer +Signed-off-by: Jiri Kosina +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/hid/hid-gyration.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/drivers/hid/hid-gyration.c ++++ b/drivers/hid/hid-gyration.c +@@ -53,10 +53,13 @@ static int gyration_input_mapping(struct + static int gyration_event(struct hid_device *hdev, struct hid_field *field, + struct hid_usage *usage, __s32 value) + { +- struct input_dev *input = field->hidinput->input; ++ ++ if (!(hdev->claimed & HID_CLAIMED_INPUT) || !field->hidinput) ++ return 0; + + if ((usage->hid & HID_USAGE_PAGE) == HID_UP_GENDESK && + (usage->hid & 0xff) == 0x82) { ++ struct input_dev *input = field->hidinput->input; + input_event(input, usage->type, usage->code, 1); + input_sync(input); + input_event(input, usage->type, usage->code, 0); diff --git a/queue-2.6.33/include-linux-kfifo.h-fix-init_kfifo.patch b/queue-2.6.33/include-linux-kfifo.h-fix-init_kfifo.patch new file mode 100644 index 00000000000..0e07aa5ea50 --- /dev/null +++ b/queue-2.6.33/include-linux-kfifo.h-fix-init_kfifo.patch @@ -0,0 +1,39 @@ +From 530cd330dc3865e3107304a6e84fdc332aa72f7d Mon Sep 17 00:00:00 2001 +From: David Härdeman +Date: Tue, 6 Apr 2010 14:34:43 -0700 +Subject: include/linux/kfifo.h: fix INIT_KFIFO() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: David Härdeman + +commit 530cd330dc3865e3107304a6e84fdc332aa72f7d upstream. + +DECLARE_KFIFO creates a union with a struct kfifo and a buffer array with +size [size + sizeof(struct kfifo)]. + +INIT_KFIFO then sets the buffer pointer in struct kfifo to point to the +beginning of the buffer array which means that the first call to kfifo_in +will overwrite members of the struct kfifo. + +Signed-off-by: David Härdeman +Acked-by: Stefani Seibold +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h +index ece0b1c..e117b1a 100644 +--- a/include/linux/kfifo.h ++++ b/include/linux/kfifo.h +@@ -86,7 +86,8 @@ union { \ + */ + #define INIT_KFIFO(name) \ + name = __kfifo_initializer(sizeof(name##kfifo_buffer) - \ +- sizeof(struct kfifo), name##kfifo_buffer) ++ sizeof(struct kfifo), \ ++ name##kfifo_buffer + sizeof(struct kfifo)) + + /** + * DEFINE_KFIFO - macro to define and initialize a kfifo diff --git a/queue-2.6.33/libata-disable-ncq-on-crucial-c300-ssd.patch b/queue-2.6.33/libata-disable-ncq-on-crucial-c300-ssd.patch new file mode 100644 index 00000000000..00bbe2e27eb --- /dev/null +++ b/queue-2.6.33/libata-disable-ncq-on-crucial-c300-ssd.patch @@ -0,0 +1,55 @@ +From 68b0ddb289220b6d4d865be128939663be34959d Mon Sep 17 00:00:00 2001 +From: Tejun Heo +Date: Mon, 5 Apr 2010 10:51:26 +0900 +Subject: libata: disable NCQ on Crucial C300 SSD +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Tejun Heo + +commit 68b0ddb289220b6d4d865be128939663be34959d upstream. + +Crucial said, + + Thank you for contacting us. We know that with our M225 line of SSDs + you sometimes need to disable NCQ (native command queuing) to avoid + just the type of errors you're seeing. Our recommendation for the + M225 is to add libata.force=noncq to your Linux kernel boot options, + under the kernel ATA library option. + + I have sent your feedback to the engineers working on the C300, and + asked them to please pass it on to the firmware team. I have been + notified that they are in the process of testing and finalizing a + new firmware version, that you can expect to see released around the + end of April. We’ll keep you posted as to when it will be available + for download. + +So, turn off NCQ on the drive w/ the current firmware revision. + +Reported in the following bug. + + https://bugzilla.kernel.org/show_bug.cgi?id=15573 + +Signed-off-by: Tejun Heo +Reported-by: lethalwp@scarlet.be +Reported-by: Luke Macken +Signed-off-by: Jeff Garzik +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/ata/libata-core.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/ata/libata-core.c ++++ b/drivers/ata/libata-core.c +@@ -4348,6 +4348,9 @@ static const struct ata_blacklist_entry + { "HTS541080G9SA00", "MB4OC60D", ATA_HORKAGE_NONCQ, }, + { "HTS541010G9SA00", "MBZOC60D", ATA_HORKAGE_NONCQ, }, + ++ /* https://bugzilla.kernel.org/show_bug.cgi?id=15573 */ ++ { "C300-CTFDDAC128MAG", "0001", ATA_HORKAGE_NONCQ, }, ++ + /* devices which puke on READ_NATIVE_MAX */ + { "HDS724040KLSA80", "KFAOA20N", ATA_HORKAGE_BROKEN_HPA, }, + { "WDC WD3200JD-00KLB0", "WD-WCAMR1130137", ATA_HORKAGE_BROKEN_HPA }, diff --git a/queue-2.6.33/libata-unlock-hpa-if-device-shrunk.patch b/queue-2.6.33/libata-unlock-hpa-if-device-shrunk.patch new file mode 100644 index 00000000000..9ab9b60af0b --- /dev/null +++ b/queue-2.6.33/libata-unlock-hpa-if-device-shrunk.patch @@ -0,0 +1,149 @@ +From 445d211b0da4e9a6e6d576edff85085c2aaf53df Mon Sep 17 00:00:00 2001 +From: Tejun Heo +Date: Mon, 5 Apr 2010 10:33:13 +0900 +Subject: libata: unlock HPA if device shrunk + +From: Tejun Heo + +commit 445d211b0da4e9a6e6d576edff85085c2aaf53df upstream. + +Some BIOSes don't configure HPA during boot but do so while resuming. +This causes harddrives to shrink during resume making libata detach +and reattach them. This can be worked around by unlocking HPA if old +size equals native size. + +Add ATA_DFLAG_UNLOCK_HPA so that HPA unlocking can be controlled +per-device and update ata_dev_revalidate() such that it sets +ATA_DFLAG_UNLOCK_HPA and fails with -EIO when the above condition is +detected. + +This patch fixes the following bug. + + https://bugzilla.kernel.org/show_bug.cgi?id=15396 + +Signed-off-by: Tejun Heo +Reported-by: Oleksandr Yermolenko +Signed-off-by: Jeff Garzik + +--- + drivers/ata/libata-core.c | 74 +++++++++++++++++++++++++++------------------- + include/linux/libata.h | 1 + 2 files changed, 46 insertions(+), 29 deletions(-) + +--- a/drivers/ata/libata-core.c ++++ b/drivers/ata/libata-core.c +@@ -1493,6 +1493,7 @@ static int ata_hpa_resize(struct ata_dev + { + struct ata_eh_context *ehc = &dev->link->eh_context; + int print_info = ehc->i.flags & ATA_EHI_PRINTINFO; ++ bool unlock_hpa = ata_ignore_hpa || dev->flags & ATA_DFLAG_UNLOCK_HPA; + u64 sectors = ata_id_n_sectors(dev->id); + u64 native_sectors; + int rc; +@@ -1509,7 +1510,7 @@ static int ata_hpa_resize(struct ata_dev + /* If device aborted the command or HPA isn't going to + * be unlocked, skip HPA resizing. + */ +- if (rc == -EACCES || !ata_ignore_hpa) { ++ if (rc == -EACCES || !unlock_hpa) { + ata_dev_printk(dev, KERN_WARNING, "HPA support seems " + "broken, skipping HPA handling\n"); + dev->horkage |= ATA_HORKAGE_BROKEN_HPA; +@@ -1524,7 +1525,7 @@ static int ata_hpa_resize(struct ata_dev + dev->n_native_sectors = native_sectors; + + /* nothing to do? */ +- if (native_sectors <= sectors || !ata_ignore_hpa) { ++ if (native_sectors <= sectors || !unlock_hpa) { + if (!print_info || native_sectors == sectors) + return 0; + +@@ -4180,36 +4181,51 @@ int ata_dev_revalidate(struct ata_device + goto fail; + + /* verify n_sectors hasn't changed */ +- if (dev->class == ATA_DEV_ATA && n_sectors && +- dev->n_sectors != n_sectors) { +- ata_dev_printk(dev, KERN_WARNING, "n_sectors mismatch " +- "%llu != %llu\n", +- (unsigned long long)n_sectors, +- (unsigned long long)dev->n_sectors); +- /* +- * Something could have caused HPA to be unlocked +- * involuntarily. If n_native_sectors hasn't changed +- * and the new size matches it, keep the device. +- */ +- if (dev->n_native_sectors == n_native_sectors && +- dev->n_sectors > n_sectors && +- dev->n_sectors == n_native_sectors) { +- ata_dev_printk(dev, KERN_WARNING, +- "new n_sectors matches native, probably " +- "late HPA unlock, continuing\n"); +- /* keep using the old n_sectors */ +- dev->n_sectors = n_sectors; +- } else { +- /* restore original n_[native]_sectors and fail */ +- dev->n_native_sectors = n_native_sectors; +- dev->n_sectors = n_sectors; +- rc = -ENODEV; +- goto fail; +- } ++ if (dev->class != ATA_DEV_ATA || !n_sectors || ++ dev->n_sectors == n_sectors) ++ return 0; ++ ++ /* n_sectors has changed */ ++ ata_dev_printk(dev, KERN_WARNING, "n_sectors mismatch %llu != %llu\n", ++ (unsigned long long)n_sectors, ++ (unsigned long long)dev->n_sectors); ++ ++ /* ++ * Something could have caused HPA to be unlocked ++ * involuntarily. If n_native_sectors hasn't changed and the ++ * new size matches it, keep the device. ++ */ ++ if (dev->n_native_sectors == n_native_sectors && ++ dev->n_sectors > n_sectors && dev->n_sectors == n_native_sectors) { ++ ata_dev_printk(dev, KERN_WARNING, ++ "new n_sectors matches native, probably " ++ "late HPA unlock, continuing\n"); ++ /* keep using the old n_sectors */ ++ dev->n_sectors = n_sectors; ++ return 0; + } + +- return 0; ++ /* ++ * Some BIOSes boot w/o HPA but resume w/ HPA locked. Try ++ * unlocking HPA in those cases. ++ * ++ * https://bugzilla.kernel.org/show_bug.cgi?id=15396 ++ */ ++ if (dev->n_native_sectors == n_native_sectors && ++ dev->n_sectors < n_sectors && n_sectors == n_native_sectors && ++ !(dev->horkage & ATA_HORKAGE_BROKEN_HPA)) { ++ ata_dev_printk(dev, KERN_WARNING, ++ "old n_sectors matches native, probably " ++ "late HPA lock, will try to unlock HPA\n"); ++ /* try unlocking HPA */ ++ dev->flags |= ATA_DFLAG_UNLOCK_HPA; ++ rc = -EIO; ++ } else ++ rc = -ENODEV; + ++ /* restore original n_[native_]sectors and fail */ ++ dev->n_native_sectors = n_native_sectors; ++ dev->n_sectors = n_sectors; + fail: + ata_dev_printk(dev, KERN_ERR, "revalidation failed (errno=%d)\n", rc); + return rc; +--- a/include/linux/libata.h ++++ b/include/linux/libata.h +@@ -146,6 +146,7 @@ enum { + ATA_DFLAG_SLEEPING = (1 << 15), /* device is sleeping */ + ATA_DFLAG_DUBIOUS_XFER = (1 << 16), /* data transfer not verified */ + ATA_DFLAG_NO_UNLOAD = (1 << 17), /* device doesn't support unload */ ++ ATA_DFLAG_UNLOCK_HPA = (1 << 18), /* unlock HPA */ + ATA_DFLAG_INIT_MASK = (1 << 24) - 1, + + ATA_DFLAG_DETACH = (1 << 24), diff --git a/queue-2.6.33/pata_via-add-via-vx900-support.patch b/queue-2.6.33/pata_via-add-via-vx900-support.patch new file mode 100644 index 00000000000..94a73c16798 --- /dev/null +++ b/queue-2.6.33/pata_via-add-via-vx900-support.patch @@ -0,0 +1,27 @@ +From 4f1deba435ef75380c1d06fda860c7a15ea16fdf Mon Sep 17 00:00:00 2001 +From: JosephChan@via.com.tw +Date: Fri, 19 Mar 2010 14:08:11 +0800 +Subject: pata_via: Add VIA VX900 support + +From: JosephChan@via.com.tw + +commit 4f1deba435ef75380c1d06fda860c7a15ea16fdf upstream. + +Signed-off-by: Joseph Chan +Signed-off-by: Jeff Garzik +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/ata/pata_via.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/ata/pata_via.c ++++ b/drivers/ata/pata_via.c +@@ -697,6 +697,7 @@ static const struct pci_device_id via[] + { PCI_VDEVICE(VIA, 0x3164), }, + { PCI_VDEVICE(VIA, 0x5324), }, + { PCI_VDEVICE(VIA, 0xC409), VIA_IDFLAG_SINGLE }, ++ { PCI_VDEVICE(VIA, 0x9001), VIA_IDFLAG_SINGLE }, + + { }, + }; diff --git a/queue-2.6.33/raw-fsync-method-is-now-required.patch b/queue-2.6.33/raw-fsync-method-is-now-required.patch new file mode 100644 index 00000000000..00e4deca1db --- /dev/null +++ b/queue-2.6.33/raw-fsync-method-is-now-required.patch @@ -0,0 +1,89 @@ +From 55ab3a1ff843e3f0e24d2da44e71bffa5d853010 Mon Sep 17 00:00:00 2001 +From: Anton Blanchard +Date: Tue, 6 Apr 2010 14:34:58 -0700 +Subject: raw: fsync method is now required + +From: Anton Blanchard + +commit 55ab3a1ff843e3f0e24d2da44e71bffa5d853010 upstream. + +Commit 148f948ba877f4d3cdef036b1ff6d9f68986706a (vfs: Introduce new +helpers for syncing after writing to O_SYNC file or IS_SYNC inode) broke +the raw driver. + +We now call through generic_file_aio_write -> generic_write_sync -> +vfs_fsync_range. vfs_fsync_range has: + + if (!fop || !fop->fsync) { + ret = -EINVAL; + goto out; + } + +But drivers/char/raw.c doesn't set an fsync method. + +We have two options: fix it or remove the raw driver completely. I'm +happy to do either, the fact this has been broken for so long suggests it +is rarely used. + +The patch below adds an fsync method to the raw driver. My knowledge of +the block layer is pretty sketchy so this could do with a once over. + +If we instead decide to remove the raw driver, this patch might still be +useful as a backport to 2.6.33 and 2.6.32. + +Signed-off-by: Anton Blanchard +Reviewed-by: Jan Kara +Cc: Christoph Hellwig +Cc: Alexander Viro +Cc: Jens Axboe +Reviewed-by: Jeff Moyer +Tested-by: Jeff Moyer +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/char/raw.c | 1 + + fs/block_dev.c | 3 ++- + include/linux/fs.h | 1 + + 3 files changed, 4 insertions(+), 1 deletion(-) + +--- a/drivers/char/raw.c ++++ b/drivers/char/raw.c +@@ -247,6 +247,7 @@ static const struct file_operations raw_ + .aio_read = generic_file_aio_read, + .write = do_sync_write, + .aio_write = blkdev_aio_write, ++ .fsync = block_fsync, + .open = raw_open, + .release= raw_release, + .ioctl = raw_ioctl, +--- a/fs/block_dev.c ++++ b/fs/block_dev.c +@@ -404,7 +404,7 @@ static loff_t block_llseek(struct file * + * NULL first argument is nfsd_sync_dir() and that's not a directory. + */ + +-static int block_fsync(struct file *filp, struct dentry *dentry, int datasync) ++int block_fsync(struct file *filp, struct dentry *dentry, int datasync) + { + struct block_device *bdev = I_BDEV(filp->f_mapping->host); + int error; +@@ -418,6 +418,7 @@ static int block_fsync(struct file *filp + error = 0; + return error; + } ++EXPORT_SYMBOL(block_fsync); + + /* + * pseudo-fs +--- a/include/linux/fs.h ++++ b/include/linux/fs.h +@@ -2214,6 +2214,7 @@ extern int generic_segment_checks(const + /* fs/block_dev.c */ + extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov, + unsigned long nr_segs, loff_t pos); ++extern int block_fsync(struct file *filp, struct dentry *dentry, int datasync); + + /* fs/splice.c */ + extern ssize_t generic_file_splice_read(struct file *, loff_t *, diff --git a/queue-2.6.33/readahead-fix-null-filp-dereference.patch b/queue-2.6.33/readahead-fix-null-filp-dereference.patch new file mode 100644 index 00000000000..ffede33b903 --- /dev/null +++ b/queue-2.6.33/readahead-fix-null-filp-dereference.patch @@ -0,0 +1,37 @@ +From 70655c06bd3f25111312d63985888112aed15ac5 Mon Sep 17 00:00:00 2001 +From: Wu Fengguang +Date: Tue, 6 Apr 2010 14:34:53 -0700 +Subject: readahead: fix NULL filp dereference + +From: Wu Fengguang + +commit 70655c06bd3f25111312d63985888112aed15ac5 upstream. + +btrfs relocate_file_extent_cluster() calls us with NULL filp: + + [ 4005.426805] BUG: unable to handle kernel NULL pointer dereference at 00000021 + [ 4005.426818] IP: [] page_cache_sync_readahead+0x18/0x3e + +Signed-off-by: Wu Fengguang +Cc: Yan Zheng +Reported-by: Kirill A. Shutemov +Tested-by: Kirill A. Shutemov +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + mm/readahead.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/mm/readahead.c ++++ b/mm/readahead.c +@@ -502,7 +502,7 @@ void page_cache_sync_readahead(struct ad + return; + + /* be dumb */ +- if (filp->f_mode & FMODE_RANDOM) { ++ if (filp && (filp->f_mode & FMODE_RANDOM)) { + force_page_cache_readahead(mapping, filp, offset, req_size); + return; + } diff --git a/queue-2.6.33/series b/queue-2.6.33/series index d7a64dcb963..57e175e2b94 100644 --- a/queue-2.6.33/series +++ b/queue-2.6.33/series @@ -27,3 +27,16 @@ watchdog-hpwdt-fix-lower-timeout-limit.patch watchdog-itco_wdt-tco-watchdog-patch-for-additional-intel-cougar-point-deviceids.patch genirq-force-msi-irq-handlers-to-run-with-interrupts-disabled.patch tty-release_one_tty-forgets-to-put-pids.patch +hid-fix-oops-in-gyration_event.patch +raw-fsync-method-is-now-required.patch +readahead-fix-null-filp-dereference.patch +include-linux-kfifo.h-fix-init_kfifo.patch +alsa-mixart-range-checking-proc-file.patch +alsa-hda-fix-0-db-offset-for-lenovo-thinkpad-models-using-ad1981.patch +alsa-hda-add-asrock-mobo-to-msi-blacklist.patch +alsa-hda-add-msi-blacklist-for-aopen-mz915-m.patch +backlight-mbp_nvidia_bl-add-five-more-macbook-variants.patch +pata_via-add-via-vx900-support.patch +libata-disable-ncq-on-crucial-c300-ssd.patch +libata-unlock-hpa-if-device-shrunk.patch +ext3-don-t-update-the-superblock-in-ext3_statfs.patch -- 2.47.3