From 05d4e2ea5798ff9782773eb124056b35b341bb8f Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 1 Mar 2013 11:30:14 -0800 Subject: [PATCH] 3.8-stable patches added patches: acpi-overriding-acpi-tables-via-initrd-only-works-with-an-initrd-and-on-x86.patch ahci-add-device-ids-for-intel-wellsburg-pch.patch ahci-ahci-mode-sata-patch-for-intel-avoton-deviceids.patch ata_piix-add-device-ids-for-intel-wellsburg-pch.patch ata_piix-ide-mode-sata-patch-for-intel-avoton-deviceids.patch efivarfs-guid-part-of-filenames-are-case-insensitive.patch efivarfs-validate-filenames-much-more-aggressively.patch staging-comedi-check-s-async-for-poll-read-and-write.patch usb-hid-quirks-for-masterkit-ma901-usb-radio.patch x86-efi-allow-slash-in-file-path-of-initrd.patch --- ...only-works-with-an-initrd-and-on-x86.patch | 44 +++++ ...d-device-ids-for-intel-wellsburg-pch.patch | 36 ++++ ...ata-patch-for-intel-avoton-deviceids.patch | 44 +++++ ...d-device-ids-for-intel-wellsburg-pch.patch | 37 ++++ ...ata-patch-for-intel-avoton-deviceids.patch | 36 ++++ ...rt-of-filenames-are-case-insensitive.patch | 162 ++++++++++++++++++ ...ate-filenames-much-more-aggressively.patch | 111 ++++++++++++ queue-3.8/series | 10 ++ ...heck-s-async-for-poll-read-and-write.patch | 68 ++++++++ ...quirks-for-masterkit-ma901-usb-radio.patch | 45 +++++ ...i-allow-slash-in-file-path-of-initrd.patch | 93 ++++++++++ 11 files changed, 686 insertions(+) create mode 100644 queue-3.8/acpi-overriding-acpi-tables-via-initrd-only-works-with-an-initrd-and-on-x86.patch create mode 100644 queue-3.8/ahci-add-device-ids-for-intel-wellsburg-pch.patch create mode 100644 queue-3.8/ahci-ahci-mode-sata-patch-for-intel-avoton-deviceids.patch create mode 100644 queue-3.8/ata_piix-add-device-ids-for-intel-wellsburg-pch.patch create mode 100644 queue-3.8/ata_piix-ide-mode-sata-patch-for-intel-avoton-deviceids.patch create mode 100644 queue-3.8/efivarfs-guid-part-of-filenames-are-case-insensitive.patch create mode 100644 queue-3.8/efivarfs-validate-filenames-much-more-aggressively.patch create mode 100644 queue-3.8/staging-comedi-check-s-async-for-poll-read-and-write.patch create mode 100644 queue-3.8/usb-hid-quirks-for-masterkit-ma901-usb-radio.patch create mode 100644 queue-3.8/x86-efi-allow-slash-in-file-path-of-initrd.patch diff --git a/queue-3.8/acpi-overriding-acpi-tables-via-initrd-only-works-with-an-initrd-and-on-x86.patch b/queue-3.8/acpi-overriding-acpi-tables-via-initrd-only-works-with-an-initrd-and-on-x86.patch new file mode 100644 index 00000000000..cd5bd9c62b7 --- /dev/null +++ b/queue-3.8/acpi-overriding-acpi-tables-via-initrd-only-works-with-an-initrd-and-on-x86.patch @@ -0,0 +1,44 @@ +From 565d956a7e191e95d81f515196951715f2616e6b Mon Sep 17 00:00:00 2001 +From: Thomas Renninger +Date: Fri, 22 Feb 2013 14:12:22 +0100 +Subject: ACPI: Overriding ACPI tables via initrd only works with an initrd and on X86 + +From: Thomas Renninger + +commit 565d956a7e191e95d81f515196951715f2616e6b upstream. + +Reflect this dependency in Kconfig, to prevent build failures. + +Shorten the config description as suggested by Borislav Petkov. + +Finding a suitable memory area to store the modified table(s) has been +taken over from arch/x86/kernel/setup.c and makes use of max_low_pfn_mapped: +memblock_find_in_range(0, max_low_pfn_mapped,...) +This one is X86 specific. It may not be hard to extend this functionality +for other ACPI aware architectures if there is need for. + +For now make this feature only available for X86 to avoid build failures on +IA64, compare with: +https://bugzilla.kernel.org/show_bug.cgi?id=54091 + +Signed-off-by: Thomas Renninger +Link: http://lkml.kernel.org/r/1361538742-67599-3-git-send-email-trenn@suse.de +Signed-off-by: H. Peter Anvin +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/acpi/Kconfig | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/acpi/Kconfig ++++ b/drivers/acpi/Kconfig +@@ -268,7 +268,8 @@ config ACPI_CUSTOM_DSDT + default ACPI_CUSTOM_DSDT_FILE != "" + + config ACPI_INITRD_TABLE_OVERRIDE +- bool "ACPI tables can be passed via uncompressed cpio in initrd" ++ bool "ACPI tables override via initrd" ++ depends on BLK_DEV_INITRD && X86 + default n + help + This option provides functionality to override arbitrary ACPI tables diff --git a/queue-3.8/ahci-add-device-ids-for-intel-wellsburg-pch.patch b/queue-3.8/ahci-add-device-ids-for-intel-wellsburg-pch.patch new file mode 100644 index 00000000000..23039859b12 --- /dev/null +++ b/queue-3.8/ahci-add-device-ids-for-intel-wellsburg-pch.patch @@ -0,0 +1,36 @@ +From 151743fd8dfb02956c5184b5f4f0f42677eb75bc Mon Sep 17 00:00:00 2001 +From: James Ralston +Date: Fri, 8 Feb 2013 17:34:47 -0800 +Subject: ahci: Add Device IDs for Intel Wellsburg PCH + +From: James Ralston + +commit 151743fd8dfb02956c5184b5f4f0f42677eb75bc upstream. + +This patch adds the AHCI-mode SATA Device IDs for the Intel Wellsburg PCH + +Signed-off-by: James Ralston +Signed-off-by: Jeff Garzik +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/ata/ahci.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/drivers/ata/ahci.c ++++ b/drivers/ata/ahci.c +@@ -281,6 +281,14 @@ static const struct pci_device_id ahci_p + { PCI_VDEVICE(INTEL, 0x1f37), board_ahci }, /* Avoton RAID */ + { PCI_VDEVICE(INTEL, 0x1f3e), board_ahci }, /* Avoton RAID */ + { PCI_VDEVICE(INTEL, 0x1f3f), board_ahci }, /* Avoton RAID */ ++ { PCI_VDEVICE(INTEL, 0x8d02), board_ahci }, /* Wellsburg AHCI */ ++ { PCI_VDEVICE(INTEL, 0x8d04), board_ahci }, /* Wellsburg RAID */ ++ { PCI_VDEVICE(INTEL, 0x8d06), board_ahci }, /* Wellsburg RAID */ ++ { PCI_VDEVICE(INTEL, 0x8d0e), board_ahci }, /* Wellsburg RAID */ ++ { PCI_VDEVICE(INTEL, 0x8d62), board_ahci }, /* Wellsburg AHCI */ ++ { PCI_VDEVICE(INTEL, 0x8d64), board_ahci }, /* Wellsburg RAID */ ++ { PCI_VDEVICE(INTEL, 0x8d66), board_ahci }, /* Wellsburg RAID */ ++ { PCI_VDEVICE(INTEL, 0x8d6e), board_ahci }, /* Wellsburg RAID */ + + /* JMicron 360/1/3/5/6, match class to avoid IDE function */ + { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, diff --git a/queue-3.8/ahci-ahci-mode-sata-patch-for-intel-avoton-deviceids.patch b/queue-3.8/ahci-ahci-mode-sata-patch-for-intel-avoton-deviceids.patch new file mode 100644 index 00000000000..9667c798d47 --- /dev/null +++ b/queue-3.8/ahci-ahci-mode-sata-patch-for-intel-avoton-deviceids.patch @@ -0,0 +1,44 @@ +From 29e674dd5c8e781589f09c3ee139c80f6da274e4 Mon Sep 17 00:00:00 2001 +From: Seth Heasley +Date: Fri, 25 Jan 2013 12:01:05 -0800 +Subject: ahci: AHCI-mode SATA patch for Intel Avoton DeviceIDs + +From: Seth Heasley + +commit 29e674dd5c8e781589f09c3ee139c80f6da274e4 upstream. + +This patch adds the AHCI and RAID-mode SATA DeviceIDs for the Intel Avoton SOC. + +Signed-off-by: Seth Heasley +Signed-off-by: Jeff Garzik +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/ata/ahci.c | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +--- a/drivers/ata/ahci.c ++++ b/drivers/ata/ahci.c +@@ -265,6 +265,22 @@ static const struct pci_device_id ahci_p + { PCI_VDEVICE(INTEL, 0x9c07), board_ahci }, /* Lynx Point-LP RAID */ + { PCI_VDEVICE(INTEL, 0x9c0e), board_ahci }, /* Lynx Point-LP RAID */ + { PCI_VDEVICE(INTEL, 0x9c0f), board_ahci }, /* Lynx Point-LP RAID */ ++ { PCI_VDEVICE(INTEL, 0x1f22), board_ahci }, /* Avoton AHCI */ ++ { PCI_VDEVICE(INTEL, 0x1f23), board_ahci }, /* Avoton AHCI */ ++ { PCI_VDEVICE(INTEL, 0x1f24), board_ahci }, /* Avoton RAID */ ++ { PCI_VDEVICE(INTEL, 0x1f25), board_ahci }, /* Avoton RAID */ ++ { PCI_VDEVICE(INTEL, 0x1f26), board_ahci }, /* Avoton RAID */ ++ { PCI_VDEVICE(INTEL, 0x1f27), board_ahci }, /* Avoton RAID */ ++ { PCI_VDEVICE(INTEL, 0x1f2e), board_ahci }, /* Avoton RAID */ ++ { PCI_VDEVICE(INTEL, 0x1f2f), board_ahci }, /* Avoton RAID */ ++ { PCI_VDEVICE(INTEL, 0x1f32), board_ahci }, /* Avoton AHCI */ ++ { PCI_VDEVICE(INTEL, 0x1f33), board_ahci }, /* Avoton AHCI */ ++ { PCI_VDEVICE(INTEL, 0x1f34), board_ahci }, /* Avoton RAID */ ++ { PCI_VDEVICE(INTEL, 0x1f35), board_ahci }, /* Avoton RAID */ ++ { PCI_VDEVICE(INTEL, 0x1f36), board_ahci }, /* Avoton RAID */ ++ { PCI_VDEVICE(INTEL, 0x1f37), board_ahci }, /* Avoton RAID */ ++ { PCI_VDEVICE(INTEL, 0x1f3e), board_ahci }, /* Avoton RAID */ ++ { PCI_VDEVICE(INTEL, 0x1f3f), board_ahci }, /* Avoton RAID */ + + /* JMicron 360/1/3/5/6, match class to avoid IDE function */ + { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, diff --git a/queue-3.8/ata_piix-add-device-ids-for-intel-wellsburg-pch.patch b/queue-3.8/ata_piix-add-device-ids-for-intel-wellsburg-pch.patch new file mode 100644 index 00000000000..0a443859958 --- /dev/null +++ b/queue-3.8/ata_piix-add-device-ids-for-intel-wellsburg-pch.patch @@ -0,0 +1,37 @@ +From 3aee8bc52c415aba8148f144e5e5359b0fd75dd1 Mon Sep 17 00:00:00 2001 +From: James Ralston +Date: Fri, 8 Feb 2013 17:24:12 -0800 +Subject: ata_piix: Add Device IDs for Intel Wellsburg PCH + +From: James Ralston + +commit 3aee8bc52c415aba8148f144e5e5359b0fd75dd1 upstream. + +This patch adds the IDE-mode SATA Device IDs for the Intel Wellsburg PCH + +Signed-off-by: James Ralston +Signed-off-by: Jeff Garzik +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/ata/ata_piix.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +--- a/drivers/ata/ata_piix.c ++++ b/drivers/ata/ata_piix.c +@@ -325,6 +325,15 @@ static const struct pci_device_id piix_p + { 0x8086, 0x1f30, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, + /* SATA Controller IDE (Avoton) */ + { 0x8086, 0x1f31, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, ++ /* SATA Controller IDE (Wellsburg) */ ++ { 0x8086, 0x8d00, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb }, ++ /* SATA Controller IDE (Wellsburg) */ ++ { 0x8086, 0x8d08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, ++ /* SATA Controller IDE (Wellsburg) */ ++ { 0x8086, 0x8d60, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb }, ++ /* SATA Controller IDE (Wellsburg) */ ++ { 0x8086, 0x8d68, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, ++ + { } /* terminate list */ + }; + diff --git a/queue-3.8/ata_piix-ide-mode-sata-patch-for-intel-avoton-deviceids.patch b/queue-3.8/ata_piix-ide-mode-sata-patch-for-intel-avoton-deviceids.patch new file mode 100644 index 00000000000..58ac2f7b256 --- /dev/null +++ b/queue-3.8/ata_piix-ide-mode-sata-patch-for-intel-avoton-deviceids.patch @@ -0,0 +1,36 @@ +From aaa515277db9585eeb4fdeb4637b9f9df50a1dd9 Mon Sep 17 00:00:00 2001 +From: Seth Heasley +Date: Fri, 25 Jan 2013 11:57:05 -0800 +Subject: ata_piix: IDE-mode SATA patch for Intel Avoton DeviceIDs + +From: Seth Heasley + +commit aaa515277db9585eeb4fdeb4637b9f9df50a1dd9 upstream. + +This patch adds the IDE-mode SATA DeviceIDs for the Intel Avoton SOC. + +Signed-off-by: Seth Heasley +Signed-off-by: Jeff Garzik +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/ata/ata_piix.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/drivers/ata/ata_piix.c ++++ b/drivers/ata/ata_piix.c +@@ -317,6 +317,14 @@ static const struct pci_device_id piix_p + { 0x8086, 0x9c09, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, + /* SATA Controller IDE (DH89xxCC) */ + { 0x8086, 0x2326, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, ++ /* SATA Controller IDE (Avoton) */ ++ { 0x8086, 0x1f20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb }, ++ /* SATA Controller IDE (Avoton) */ ++ { 0x8086, 0x1f21, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb }, ++ /* SATA Controller IDE (Avoton) */ ++ { 0x8086, 0x1f30, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, ++ /* SATA Controller IDE (Avoton) */ ++ { 0x8086, 0x1f31, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, + { } /* terminate list */ + }; + diff --git a/queue-3.8/efivarfs-guid-part-of-filenames-are-case-insensitive.patch b/queue-3.8/efivarfs-guid-part-of-filenames-are-case-insensitive.patch new file mode 100644 index 00000000000..d079b743b7c --- /dev/null +++ b/queue-3.8/efivarfs-guid-part-of-filenames-are-case-insensitive.patch @@ -0,0 +1,162 @@ +From da27a24383b2b10bf6ebd0db29b325548aafecb4 Mon Sep 17 00:00:00 2001 +From: Matt Fleming +Date: Fri, 1 Feb 2013 11:02:28 +0000 +Subject: efivarfs: guid part of filenames are case-insensitive + +From: Matt Fleming + +commit da27a24383b2b10bf6ebd0db29b325548aafecb4 upstream. + +It makes no sense to treat the following filenames as unique, + + VarName-abcdefab-abcd-abcd-abcd-abcdefabcdef + VarName-ABCDEFAB-ABCD-ABCD-ABCD-ABCDEFABCDEF + VarName-ABcDEfAB-ABcD-ABcD-ABcD-ABcDEfABcDEf + VarName-aBcDEfAB-aBcD-aBcD-aBcD-aBcDEfaBcDEf + ... etc ... + +since the guid will be converted into a binary representation, which +has no case. + +Roll our own dentry operations so that we can treat the variable name +part of filenames ("VarName" in the above example) as case-sensitive, +but the guid portion as case-insensitive. That way, efivarfs will +refuse to create the above files if any one already exists. + +Reported-by: Lingzhu Xiang +Cc: Matthew Garrett +Cc: Jeremy Kerr +Cc: Al Viro +Signed-off-by: Matt Fleming +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/firmware/efivars.c | 95 ++++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 93 insertions(+), 2 deletions(-) + +--- a/drivers/firmware/efivars.c ++++ b/drivers/firmware/efivars.c +@@ -1043,6 +1043,84 @@ static int efivarfs_unlink(struct inode + return -EINVAL; + }; + ++/* ++ * Compare two efivarfs file names. ++ * ++ * An efivarfs filename is composed of two parts, ++ * ++ * 1. A case-sensitive variable name ++ * 2. A case-insensitive GUID ++ * ++ * So we need to perform a case-sensitive match on part 1 and a ++ * case-insensitive match on part 2. ++ */ ++static int efivarfs_d_compare(const struct dentry *parent, const struct inode *pinode, ++ const struct dentry *dentry, const struct inode *inode, ++ unsigned int len, const char *str, ++ const struct qstr *name) ++{ ++ int guid = len - GUID_LEN; ++ ++ if (name->len != len) ++ return 1; ++ ++ /* Case-sensitive compare for the variable name */ ++ if (memcmp(str, name->name, guid)) ++ return 1; ++ ++ /* Case-insensitive compare for the GUID */ ++ return strncasecmp(name->name + guid, str + guid, GUID_LEN); ++} ++ ++static int efivarfs_d_hash(const struct dentry *dentry, ++ const struct inode *inode, struct qstr *qstr) ++{ ++ unsigned long hash = init_name_hash(); ++ const unsigned char *s = qstr->name; ++ unsigned int len = qstr->len; ++ ++ if (!efivarfs_valid_name(s, len)) ++ return -EINVAL; ++ ++ while (len-- > GUID_LEN) ++ hash = partial_name_hash(*s++, hash); ++ ++ /* GUID is case-insensitive. */ ++ while (len--) ++ hash = partial_name_hash(tolower(*s++), hash); ++ ++ qstr->hash = end_name_hash(hash); ++ return 0; ++} ++ ++/* ++ * Retaining negative dentries for an in-memory filesystem just wastes ++ * memory and lookup time: arrange for them to be deleted immediately. ++ */ ++static int efivarfs_delete_dentry(const struct dentry *dentry) ++{ ++ return 1; ++} ++ ++static struct dentry_operations efivarfs_d_ops = { ++ .d_compare = efivarfs_d_compare, ++ .d_hash = efivarfs_d_hash, ++ .d_delete = efivarfs_delete_dentry, ++}; ++ ++static struct dentry *efivarfs_alloc_dentry(struct dentry *parent, char *name) ++{ ++ struct qstr q; ++ ++ q.name = name; ++ q.len = strlen(name); ++ ++ if (efivarfs_d_hash(NULL, NULL, &q)) ++ return NULL; ++ ++ return d_alloc(parent, &q); ++} ++ + static int efivarfs_fill_super(struct super_block *sb, void *data, int silent) + { + struct inode *inode = NULL; +@@ -1058,6 +1136,7 @@ static int efivarfs_fill_super(struct su + sb->s_blocksize_bits = PAGE_CACHE_SHIFT; + sb->s_magic = EFIVARFS_MAGIC; + sb->s_op = &efivarfs_ops; ++ sb->s_d_op = &efivarfs_d_ops; + sb->s_time_gran = 1; + + inode = efivarfs_get_inode(sb, NULL, S_IFDIR | 0755, 0); +@@ -1098,7 +1177,7 @@ static int efivarfs_fill_super(struct su + if (!inode) + goto fail_name; + +- dentry = d_alloc_name(root, name); ++ dentry = efivarfs_alloc_dentry(root, name); + if (!dentry) + goto fail_inode; + +@@ -1148,8 +1227,20 @@ static struct file_system_type efivarfs_ + .kill_sb = efivarfs_kill_sb, + }; + ++/* ++ * Handle negative dentry. ++ */ ++static struct dentry *efivarfs_lookup(struct inode *dir, struct dentry *dentry, ++ unsigned int flags) ++{ ++ if (dentry->d_name.len > NAME_MAX) ++ return ERR_PTR(-ENAMETOOLONG); ++ d_add(dentry, NULL); ++ return NULL; ++} ++ + static const struct inode_operations efivarfs_dir_inode_operations = { +- .lookup = simple_lookup, ++ .lookup = efivarfs_lookup, + .unlink = efivarfs_unlink, + .create = efivarfs_create, + }; diff --git a/queue-3.8/efivarfs-validate-filenames-much-more-aggressively.patch b/queue-3.8/efivarfs-validate-filenames-much-more-aggressively.patch new file mode 100644 index 00000000000..4947aeb3933 --- /dev/null +++ b/queue-3.8/efivarfs-validate-filenames-much-more-aggressively.patch @@ -0,0 +1,111 @@ +From 47f531e8ba3bc3901a0c493f4252826c41dea1a1 Mon Sep 17 00:00:00 2001 +From: Matt Fleming +Date: Thu, 31 Jan 2013 19:02:03 +0000 +Subject: efivarfs: Validate filenames much more aggressively + +From: Matt Fleming + +commit 47f531e8ba3bc3901a0c493f4252826c41dea1a1 upstream. + +The only thing that efivarfs does to enforce a valid filename is +ensure that the name isn't too short. We need to strongly sanitise any +filenames, not least because variable creation is delayed until +efivarfs_file_write(), which means we can't rely on the firmware to +inform us of an invalid name, because if the file is never written to +we'll never know it's invalid. + +Perform a couple of steps before agreeing to create a new file, + + * hex_to_bin() returns a value indicating whether or not it was able + to convert its arguments to a binary representation - we should + check it. + + * Ensure that the GUID portion of the filename is the correct length + and format. + + * The variable name portion of the filename needs to be at least one + character in size. + +Reported-by: Lingzhu Xiang +Cc: Matthew Garrett +Cc: Jeremy Kerr +Cc: Al Viro +Signed-off-by: Matt Fleming +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/firmware/efivars.c | 49 ++++++++++++++++++++++++++++++++++++++++----- + 1 file changed, 44 insertions(+), 5 deletions(-) + +--- a/drivers/firmware/efivars.c ++++ b/drivers/firmware/efivars.c +@@ -79,6 +79,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -900,6 +901,48 @@ static struct inode *efivarfs_get_inode( + return inode; + } + ++/* ++ * Return true if 'str' is a valid efivarfs filename of the form, ++ * ++ * VariableName-12345678-1234-1234-1234-1234567891bc ++ */ ++static bool efivarfs_valid_name(const char *str, int len) ++{ ++ static const char dashes[GUID_LEN] = { ++ [8] = 1, [13] = 1, [18] = 1, [23] = 1 ++ }; ++ const char *s = str + len - GUID_LEN; ++ int i; ++ ++ /* ++ * We need a GUID, plus at least one letter for the variable name, ++ * plus the '-' separator ++ */ ++ if (len < GUID_LEN + 2) ++ return false; ++ ++ /* GUID should be right after the first '-' */ ++ if (s - 1 != strchr(str, '-')) ++ return false; ++ ++ /* ++ * Validate that 's' is of the correct format, e.g. ++ * ++ * 12345678-1234-1234-1234-123456789abc ++ */ ++ for (i = 0; i < GUID_LEN; i++) { ++ if (dashes[i]) { ++ if (*s++ != '-') ++ return false; ++ } else { ++ if (!isxdigit(*s++)) ++ return false; ++ } ++ } ++ ++ return true; ++} ++ + static void efivarfs_hex_to_guid(const char *str, efi_guid_t *guid) + { + guid->b[0] = hex_to_bin(str[6]) << 4 | hex_to_bin(str[7]); +@@ -928,11 +971,7 @@ static int efivarfs_create(struct inode + struct efivar_entry *var; + int namelen, i = 0, err = 0; + +- /* +- * We need a GUID, plus at least one letter for the variable name, +- * plus the '-' separator +- */ +- if (dentry->d_name.len < GUID_LEN + 2) ++ if (!efivarfs_valid_name(dentry->d_name.name, dentry->d_name.len)) + return -EINVAL; + + inode = efivarfs_get_inode(dir->i_sb, dir, mode, 0); diff --git a/queue-3.8/series b/queue-3.8/series index 5bdb9ce0fab..0a5f7f0dca9 100644 --- a/queue-3.8/series +++ b/queue-3.8/series @@ -65,3 +65,13 @@ bq27x00_battery-fix-bugs-introduced-with-bq27425-support.patch ab8500-chargalg-only-root-should-have-write-permission-on-sysfs-file.patch ab8500_btemp-demote-initcall-sequence.patch acpi-add-dmi-entry-for-sony-vgn-fw41e_h.patch +staging-comedi-check-s-async-for-poll-read-and-write.patch +ata_piix-ide-mode-sata-patch-for-intel-avoton-deviceids.patch +ata_piix-add-device-ids-for-intel-wellsburg-pch.patch +ahci-ahci-mode-sata-patch-for-intel-avoton-deviceids.patch +ahci-add-device-ids-for-intel-wellsburg-pch.patch +usb-hid-quirks-for-masterkit-ma901-usb-radio.patch +x86-efi-allow-slash-in-file-path-of-initrd.patch +acpi-overriding-acpi-tables-via-initrd-only-works-with-an-initrd-and-on-x86.patch +efivarfs-validate-filenames-much-more-aggressively.patch +efivarfs-guid-part-of-filenames-are-case-insensitive.patch diff --git a/queue-3.8/staging-comedi-check-s-async-for-poll-read-and-write.patch b/queue-3.8/staging-comedi-check-s-async-for-poll-read-and-write.patch new file mode 100644 index 00000000000..5e2651e2ca9 --- /dev/null +++ b/queue-3.8/staging-comedi-check-s-async-for-poll-read-and-write.patch @@ -0,0 +1,68 @@ +From abbotti@mev.co.uk Fri Mar 1 11:20:18 2013 +From: Ian Abbott +Date: Wed, 27 Feb 2013 10:56:19 +0000 +Subject: staging: comedi: check s->async for poll(), read() and write() +To: stable@vger.kernel.org +Cc: gregkh@linuxfoundation.org, Ian Abbott +Message-ID: <1361962579-4790-1-git-send-email-abbotti@mev.co.uk> + +From: Ian Abbott + +commit cc400e185c07c15a42d2635995f422de5b94b696 upstream. + +Some low-level comedi drivers (incorrectly) point `dev->read_subdev` or +`dev->write_subdev` to a subdevice that does not support asynchronous +commands. Comedi's poll(), read() and write() file operation handlers +assume these subdevices do support asynchronous commands. In +particular, they assume `s->async` is valid (where `s` points to the +read or write subdevice), which it won't be if it has been set +incorrectly. This can lead to a NULL pointer dereference. + +Check `s->async` is non-NULL in `comedi_poll()`, `comedi_read()` and +`comedi_write()` to avoid the bug. + +Signed-off-by: Ian Abbott +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/staging/comedi/comedi_fops.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/drivers/staging/comedi/comedi_fops.c ++++ b/drivers/staging/comedi/comedi_fops.c +@@ -1779,7 +1779,7 @@ static unsigned int comedi_poll(struct f + + mask = 0; + read_subdev = comedi_get_read_subdevice(dev_file_info); +- if (read_subdev) { ++ if (read_subdev && read_subdev->async) { + poll_wait(file, &read_subdev->async->wait_head, wait); + if (!read_subdev->busy + || comedi_buf_read_n_available(read_subdev->async) > 0 +@@ -1789,7 +1789,7 @@ static unsigned int comedi_poll(struct f + } + } + write_subdev = comedi_get_write_subdevice(dev_file_info); +- if (write_subdev) { ++ if (write_subdev && write_subdev->async) { + poll_wait(file, &write_subdev->async->wait_head, wait); + comedi_buf_write_alloc(write_subdev->async, + write_subdev->async->prealloc_bufsz); +@@ -1831,7 +1831,7 @@ static ssize_t comedi_write(struct file + } + + s = comedi_get_write_subdevice(dev_file_info); +- if (s == NULL) { ++ if (s == NULL || s->async == NULL) { + retval = -EIO; + goto done; + } +@@ -1942,7 +1942,7 @@ static ssize_t comedi_read(struct file * + } + + s = comedi_get_read_subdevice(dev_file_info); +- if (s == NULL) { ++ if (s == NULL || s->async == NULL) { + retval = -EIO; + goto done; + } diff --git a/queue-3.8/usb-hid-quirks-for-masterkit-ma901-usb-radio.patch b/queue-3.8/usb-hid-quirks-for-masterkit-ma901-usb-radio.patch new file mode 100644 index 00000000000..967262c25c2 --- /dev/null +++ b/queue-3.8/usb-hid-quirks-for-masterkit-ma901-usb-radio.patch @@ -0,0 +1,45 @@ +From 0322bd3980b3ebf7dde8474e22614cb443d6479a Mon Sep 17 00:00:00 2001 +From: Alexey Klimov +Date: Mon, 12 Nov 2012 02:57:03 -0300 +Subject: [hid] usb hid quirks for Masterkit MA901 usb radio + +From: Alexey Klimov + +commit 0322bd3980b3ebf7dde8474e22614cb443d6479a upstream. + +Don't let Masterkit MA901 USB radio be handled by usb hid drivers. +This device will be handled by radio-ma901.c driver. + +Signed-off-by: Alexey Klimov +Acked-by: Hans Verkuil +Acked-by: Jiri Kosina +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/hid/hid-core.c | 1 + + drivers/hid/hid-ids.h | 3 +++ + 2 files changed, 4 insertions(+) + +--- a/drivers/hid/hid-core.c ++++ b/drivers/hid/hid-core.c +@@ -2071,6 +2071,7 @@ static const struct hid_device_id hid_ig + { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HYBRID) }, + { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HEATCONTROL) }, + { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_BEATPAD) }, ++ { HID_USB_DEVICE(USB_VENDOR_ID_MASTERKIT, USB_DEVICE_ID_MASTERKIT_MA901RADIO) }, + { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS) }, + { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS) }, + { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1) }, +--- a/drivers/hid/hid-ids.h ++++ b/drivers/hid/hid-ids.h +@@ -554,6 +554,9 @@ + #define USB_VENDOR_ID_MADCATZ 0x0738 + #define USB_DEVICE_ID_MADCATZ_BEATPAD 0x4540 + ++#define USB_VENDOR_ID_MASTERKIT 0x16c0 ++#define USB_DEVICE_ID_MASTERKIT_MA901RADIO 0x05df ++ + #define USB_VENDOR_ID_MCC 0x09db + #define USB_DEVICE_ID_MCC_PMD1024LS 0x0076 + #define USB_DEVICE_ID_MCC_PMD1208LS 0x007a diff --git a/queue-3.8/x86-efi-allow-slash-in-file-path-of-initrd.patch b/queue-3.8/x86-efi-allow-slash-in-file-path-of-initrd.patch new file mode 100644 index 00000000000..28510001aa8 --- /dev/null +++ b/queue-3.8/x86-efi-allow-slash-in-file-path-of-initrd.patch @@ -0,0 +1,93 @@ +From deb94101c4fda22e152c2a311210cf09ae51adf6 Mon Sep 17 00:00:00 2001 +From: "Lee, Chun-Yi" +Date: Thu, 20 Dec 2012 19:33:22 +0800 +Subject: x86, efi: Allow slash in file path of initrd + +From: "Lee, Chun-Yi" + +commit deb94101c4fda22e152c2a311210cf09ae51adf6 upstream. + +When initrd file didn't put at the same place with stub kernel, we +need give the file path of initrd, but need use backslash to separate +directory and file. It's not friendly to unix/linux user, and not so +intuitive for bootloader forward paramters to efi stub kernel by +chainloading. + +This patch add support to handle_ramdisks for allow slash in file path +of initrd, it convert slash to backlash when parsing path. + +In additional, this patch also separates print code of efi_char16_t from +efi_printk, and print out the path/filename of initrd when failed to open +initrd file. It's good for debug and discover typo. + +Signed-off-by: Lee, Chun-Yi +Cc: Matthew Garrett +Cc: H. Peter Anvin +Signed-off-by: Matt Fleming +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/boot/compressed/eboot.c | 26 +++++++++++++++++++------- + 1 file changed, 19 insertions(+), 7 deletions(-) + +--- a/arch/x86/boot/compressed/eboot.c ++++ b/arch/x86/boot/compressed/eboot.c +@@ -19,23 +19,28 @@ + + static efi_system_table_t *sys_table; + ++static void efi_char16_printk(efi_char16_t *str) ++{ ++ struct efi_simple_text_output_protocol *out; ++ ++ out = (struct efi_simple_text_output_protocol *)sys_table->con_out; ++ efi_call_phys2(out->output_string, out, str); ++} ++ + static void efi_printk(char *str) + { + char *s8; + + for (s8 = str; *s8; s8++) { +- struct efi_simple_text_output_protocol *out; + efi_char16_t ch[2] = { 0 }; + + ch[0] = *s8; +- out = (struct efi_simple_text_output_protocol *)sys_table->con_out; +- + if (*s8 == '\n') { + efi_char16_t nl[2] = { '\r', 0 }; +- efi_call_phys2(out->output_string, out, nl); ++ efi_char16_printk(nl); + } + +- efi_call_phys2(out->output_string, out, ch); ++ efi_char16_printk(ch); + } + } + +@@ -709,7 +714,12 @@ static efi_status_t handle_ramdisks(efi_ + if ((u8 *)p >= (u8 *)filename_16 + sizeof(filename_16)) + break; + +- *p++ = *str++; ++ if (*str == '/') { ++ *p++ = '\\'; ++ *str++; ++ } else { ++ *p++ = *str++; ++ } + } + + *p = '\0'; +@@ -737,7 +747,9 @@ static efi_status_t handle_ramdisks(efi_ + status = efi_call_phys5(fh->open, fh, &h, filename_16, + EFI_FILE_MODE_READ, (u64)0); + if (status != EFI_SUCCESS) { +- efi_printk("Failed to open initrd file\n"); ++ efi_printk("Failed to open initrd file: "); ++ efi_char16_printk(filename_16); ++ efi_printk("\n"); + goto close_handles; + } + -- 2.47.3