remove not needed patches
This commit is contained in:
		
							parent
							
								
									ed46d9df24
								
							
						
					
					
						commit
						43b4e19ca9
					
				@ -1,74 +0,0 @@
 | 
			
		||||
From 5d77ba2d26110c678b40fd723866a17d4036de12 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Lucas De Marchi <lucas.demarchi@intel.com>
 | 
			
		||||
Date: Tue, 18 Feb 2014 02:19:26 -0300
 | 
			
		||||
Subject: [PATCH 01/10] Bluetooth: allocate static minor for vhci
 | 
			
		||||
 | 
			
		||||
Commit bfacbb9 (Bluetooth: Use devname:vhci module alias for virtual HCI
 | 
			
		||||
driver) added the module alias to hci_vhci module so it's possible to
 | 
			
		||||
create the /dev/vhci node. However creating an alias without
 | 
			
		||||
specifying the minor doesn't allow us to create the node ahead,
 | 
			
		||||
triggerring module auto-load when it's first accessed.
 | 
			
		||||
 | 
			
		||||
Starting with depmod from kmod 16 we started to warn if there's a
 | 
			
		||||
devname alias without specifying the major and minor.
 | 
			
		||||
 | 
			
		||||
Let's do the same done for uhid, kvm, fuse and others, specifying a
 | 
			
		||||
fixed minor. In systems with systemd as the init the following will
 | 
			
		||||
happen: on early boot systemd will call "kmod static-nodes" to read
 | 
			
		||||
/lib/modules/$(uname -r)/modules.devname and then create the nodes. When
 | 
			
		||||
first accessed these "dead" nodes will trigger the module loading.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
 | 
			
		||||
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 | 
			
		||||
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
 | 
			
		||||
---
 | 
			
		||||
 Documentation/devices.txt    | 1 +
 | 
			
		||||
 drivers/bluetooth/hci_vhci.c | 3 ++-
 | 
			
		||||
 include/linux/miscdevice.h   | 1 +
 | 
			
		||||
 3 files changed, 4 insertions(+), 1 deletion(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/Documentation/devices.txt b/Documentation/devices.txt
 | 
			
		||||
index 10378cc..04356f5 100644
 | 
			
		||||
--- a/Documentation/devices.txt
 | 
			
		||||
+++ b/Documentation/devices.txt
 | 
			
		||||
@@ -353,6 +353,7 @@ Your cooperation is appreciated.
 | 
			
		||||
 		133 = /dev/exttrp	External device trap
 | 
			
		||||
 		134 = /dev/apm_bios	Advanced Power Management BIOS
 | 
			
		||||
 		135 = /dev/rtc		Real Time Clock
 | 
			
		||||
+		137 = /dev/vhci		Bluetooth virtual HCI driver
 | 
			
		||||
 		139 = /dev/openprom	SPARC OpenBoot PROM
 | 
			
		||||
 		140 = /dev/relay8	Berkshire Products Octal relay card
 | 
			
		||||
 		141 = /dev/relay16	Berkshire Products ISO-16 relay card
 | 
			
		||||
diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c
 | 
			
		||||
index 1ef6990..add1c6a 100644
 | 
			
		||||
--- a/drivers/bluetooth/hci_vhci.c
 | 
			
		||||
+++ b/drivers/bluetooth/hci_vhci.c
 | 
			
		||||
@@ -359,7 +359,7 @@ static const struct file_operations vhci_fops = {
 | 
			
		||||
 static struct miscdevice vhci_miscdev= {
 | 
			
		||||
 	.name	= "vhci",
 | 
			
		||||
 	.fops	= &vhci_fops,
 | 
			
		||||
-	.minor	= MISC_DYNAMIC_MINOR,
 | 
			
		||||
+	.minor	= VHCI_MINOR,
 | 
			
		||||
 };
 | 
			
		||||
 
 | 
			
		||||
 static int __init vhci_init(void)
 | 
			
		||||
@@ -385,3 +385,4 @@ MODULE_DESCRIPTION("Bluetooth virtual HCI driver ver " VERSION);
 | 
			
		||||
 MODULE_VERSION(VERSION);
 | 
			
		||||
 MODULE_LICENSE("GPL");
 | 
			
		||||
 MODULE_ALIAS("devname:vhci");
 | 
			
		||||
+MODULE_ALIAS_MISCDEV(VHCI_MINOR);
 | 
			
		||||
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
 | 
			
		||||
index 3737f72..7bb6148 100644
 | 
			
		||||
--- a/include/linux/miscdevice.h
 | 
			
		||||
+++ b/include/linux/miscdevice.h
 | 
			
		||||
@@ -23,6 +23,7 @@
 | 
			
		||||
 #define TEMP_MINOR		131	/* Temperature Sensor */
 | 
			
		||||
 #define RTC_MINOR		135
 | 
			
		||||
 #define EFI_RTC_MINOR		136	/* EFI Time services */
 | 
			
		||||
+#define VHCI_MINOR		137
 | 
			
		||||
 #define SUN_OPENPROM_MINOR	139
 | 
			
		||||
 #define DMAPI_MINOR		140	/* DMAPI */
 | 
			
		||||
 #define NVRAM_MINOR		144
 | 
			
		||||
-- 
 | 
			
		||||
1.9.2
 | 
			
		||||
 | 
			
		||||
@ -1,93 +0,0 @@
 | 
			
		||||
From 9bc5b710f5957763d6944f38143b627d127c15ff Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Tom Gundersen <teg@jklm.no>
 | 
			
		||||
Date: Mon, 3 Feb 2014 11:14:13 +1030
 | 
			
		||||
Subject: [PATCH 02/10] module: allow multiple calls to MODULE_DEVICE_TABLE()
 | 
			
		||||
 per module
 | 
			
		||||
 | 
			
		||||
Commit 78551277e4df5: "Input: i8042 - add PNP modaliases" had a bug, where the
 | 
			
		||||
second call to MODULE_DEVICE_TABLE() overrode the first resulting in not all
 | 
			
		||||
the modaliases being exposed.
 | 
			
		||||
 | 
			
		||||
This fixes the problem by including the name of the device_id table in the
 | 
			
		||||
__mod_*_device_table alias, allowing us to export several device_id tables
 | 
			
		||||
per module.
 | 
			
		||||
 | 
			
		||||
Suggested-by: Kay Sievers <kay@vrfy.org>
 | 
			
		||||
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 | 
			
		||||
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
 | 
			
		||||
Signed-off-by: Tom Gundersen <teg@jklm.no>
 | 
			
		||||
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
 | 
			
		||||
---
 | 
			
		||||
 include/linux/module.h   |  2 +-
 | 
			
		||||
 scripts/mod/file2alias.c | 14 +++++++++-----
 | 
			
		||||
 2 files changed, 10 insertions(+), 6 deletions(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/include/linux/module.h b/include/linux/module.h
 | 
			
		||||
index eaf60ff..ad18f60 100644
 | 
			
		||||
--- a/include/linux/module.h
 | 
			
		||||
+++ b/include/linux/module.h
 | 
			
		||||
@@ -142,7 +142,7 @@ extern const struct gtype##_id __mod_##gtype##_table		\
 | 
			
		||||
 #define MODULE_DESCRIPTION(_description) MODULE_INFO(description, _description)
 | 
			
		||||
 
 | 
			
		||||
 #define MODULE_DEVICE_TABLE(type, name)		\
 | 
			
		||||
-  MODULE_GENERIC_TABLE(type##_device, name)
 | 
			
		||||
+  MODULE_GENERIC_TABLE(type##__##name##_device, name)
 | 
			
		||||
 
 | 
			
		||||
 /* Version of form [<epoch>:]<version>[-<extra-version>].
 | 
			
		||||
  * Or for CVS/RCS ID version, everything but the number is stripped.
 | 
			
		||||
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
 | 
			
		||||
index 25e5cb0..ce16404 100644
 | 
			
		||||
--- a/scripts/mod/file2alias.c
 | 
			
		||||
+++ b/scripts/mod/file2alias.c
 | 
			
		||||
@@ -42,7 +42,7 @@ typedef unsigned char	__u8;
 | 
			
		||||
 
 | 
			
		||||
 /* This array collects all instances that use the generic do_table */
 | 
			
		||||
 struct devtable {
 | 
			
		||||
-	const char *device_id; /* name of table, __mod_<name>_device_table. */
 | 
			
		||||
+	const char *device_id; /* name of table, __mod_<name>__*_device_table. */
 | 
			
		||||
 	unsigned long id_size;
 | 
			
		||||
 	void *function;
 | 
			
		||||
 };
 | 
			
		||||
@@ -146,7 +146,8 @@ static void device_id_check(const char *modname, const char *device_id,
 | 
			
		||||
 
 | 
			
		||||
 	if (size % id_size || size < id_size) {
 | 
			
		||||
 		fatal("%s: sizeof(struct %s_device_id)=%lu is not a modulo "
 | 
			
		||||
-		      "of the size of section __mod_%s_device_table=%lu.\n"
 | 
			
		||||
+		      "of the size of "
 | 
			
		||||
+		      "section __mod_%s__<identifier>_device_table=%lu.\n"
 | 
			
		||||
 		      "Fix definition of struct %s_device_id "
 | 
			
		||||
 		      "in mod_devicetable.h\n",
 | 
			
		||||
 		      modname, device_id, id_size, device_id, size, device_id);
 | 
			
		||||
@@ -1206,7 +1207,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
 | 
			
		||||
 {
 | 
			
		||||
 	void *symval;
 | 
			
		||||
 	char *zeros = NULL;
 | 
			
		||||
-	const char *name;
 | 
			
		||||
+	const char *name, *identifier;
 | 
			
		||||
 	unsigned int namelen;
 | 
			
		||||
 
 | 
			
		||||
 	/* We're looking for a section relative symbol */
 | 
			
		||||
@@ -1217,7 +1218,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
 | 
			
		||||
 	if (ELF_ST_TYPE(sym->st_info) != STT_OBJECT)
 | 
			
		||||
 		return;
 | 
			
		||||
 
 | 
			
		||||
-	/* All our symbols are of form <prefix>__mod_XXX_device_table. */
 | 
			
		||||
+	/* All our symbols are of form <prefix>__mod_<name>__<identifier>_device_table. */
 | 
			
		||||
 	name = strstr(symname, "__mod_");
 | 
			
		||||
 	if (!name)
 | 
			
		||||
 		return;
 | 
			
		||||
@@ -1227,7 +1228,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
 | 
			
		||||
 		return;
 | 
			
		||||
 	if (strcmp(name + namelen - strlen("_device_table"), "_device_table"))
 | 
			
		||||
 		return;
 | 
			
		||||
-	namelen -= strlen("_device_table");
 | 
			
		||||
+	identifier = strstr(name, "__");
 | 
			
		||||
+	if (!identifier)
 | 
			
		||||
+		return;
 | 
			
		||||
+	namelen = identifier - name;
 | 
			
		||||
 
 | 
			
		||||
 	/* Handle all-NULL symbols allocated into .bss */
 | 
			
		||||
 	if (info->sechdrs[get_secindex(info, sym)].sh_type & SHT_NOBITS) {
 | 
			
		||||
-- 
 | 
			
		||||
1.9.2
 | 
			
		||||
 | 
			
		||||
@ -1,75 +0,0 @@
 | 
			
		||||
From 06d2e746733a83469944481cb7f4fb1c7134a8ce Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Rusty Russell <rusty@rustcorp.com.au>
 | 
			
		||||
Date: Mon, 3 Feb 2014 11:15:13 +1030
 | 
			
		||||
Subject: [PATCH 03/10] module: remove MODULE_GENERIC_TABLE
 | 
			
		||||
 | 
			
		||||
MODULE_DEVICE_TABLE() calles MODULE_GENERIC_TABLE(); make it do the
 | 
			
		||||
work directly.  This also removes a wart introduced in the last patch,
 | 
			
		||||
where the alias is defined to be an unknown struct type "struct
 | 
			
		||||
type##__##name##_device_id" instead of "struct type##_device_id" (it's
 | 
			
		||||
an extern so GCC doesn't care, but it's wrong).
 | 
			
		||||
 | 
			
		||||
The other user of MODULE_GENERIC_TABLE (ISAPNP_CARD_TABLE) is unused,
 | 
			
		||||
so delete it.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
 | 
			
		||||
---
 | 
			
		||||
 include/linux/isapnp.h |  4 ----
 | 
			
		||||
 include/linux/module.h | 19 ++++++++-----------
 | 
			
		||||
 2 files changed, 8 insertions(+), 15 deletions(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/include/linux/isapnp.h b/include/linux/isapnp.h
 | 
			
		||||
index e2d28b0..3c77bf9 100644
 | 
			
		||||
--- a/include/linux/isapnp.h
 | 
			
		||||
+++ b/include/linux/isapnp.h
 | 
			
		||||
@@ -56,10 +56,6 @@
 | 
			
		||||
 #define ISAPNP_DEVICE_ID(_va, _vb, _vc, _function) \
 | 
			
		||||
 		{ .vendor = ISAPNP_VENDOR(_va, _vb, _vc), .function = ISAPNP_FUNCTION(_function) }
 | 
			
		||||
 
 | 
			
		||||
-/* export used IDs outside module */
 | 
			
		||||
-#define ISAPNP_CARD_TABLE(name) \
 | 
			
		||||
-		MODULE_GENERIC_TABLE(isapnp_card, name)
 | 
			
		||||
-
 | 
			
		||||
 struct isapnp_card_id {
 | 
			
		||||
 	unsigned long driver_data;	/* data private to the driver */
 | 
			
		||||
 	unsigned short card_vendor, card_device;
 | 
			
		||||
diff --git a/include/linux/module.h b/include/linux/module.h
 | 
			
		||||
index ad18f60..5686b37 100644
 | 
			
		||||
--- a/include/linux/module.h
 | 
			
		||||
+++ b/include/linux/module.h
 | 
			
		||||
@@ -82,15 +82,6 @@ void sort_extable(struct exception_table_entry *start,
 | 
			
		||||
 void sort_main_extable(void);
 | 
			
		||||
 void trim_init_extable(struct module *m);
 | 
			
		||||
 
 | 
			
		||||
-#ifdef MODULE
 | 
			
		||||
-#define MODULE_GENERIC_TABLE(gtype, name)			\
 | 
			
		||||
-extern const struct gtype##_id __mod_##gtype##_table		\
 | 
			
		||||
-  __attribute__ ((unused, alias(__stringify(name))))
 | 
			
		||||
-
 | 
			
		||||
-#else  /* !MODULE */
 | 
			
		||||
-#define MODULE_GENERIC_TABLE(gtype, name)
 | 
			
		||||
-#endif
 | 
			
		||||
-
 | 
			
		||||
 /* Generic info of form tag = "info" */
 | 
			
		||||
 #define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info)
 | 
			
		||||
 
 | 
			
		||||
@@ -141,8 +132,14 @@ extern const struct gtype##_id __mod_##gtype##_table		\
 | 
			
		||||
 /* What your module does. */
 | 
			
		||||
 #define MODULE_DESCRIPTION(_description) MODULE_INFO(description, _description)
 | 
			
		||||
 
 | 
			
		||||
-#define MODULE_DEVICE_TABLE(type, name)		\
 | 
			
		||||
-  MODULE_GENERIC_TABLE(type##__##name##_device, name)
 | 
			
		||||
+#ifdef MODULE
 | 
			
		||||
+/* Creates an alias so file2alias.c can find device table. */
 | 
			
		||||
+#define MODULE_DEVICE_TABLE(type, name)					\
 | 
			
		||||
+  extern const struct type##_device_id __mod_##type##__##name##_device_table \
 | 
			
		||||
+  __attribute__ ((unused, alias(__stringify(name))))
 | 
			
		||||
+#else  /* !MODULE */
 | 
			
		||||
+#define MODULE_DEVICE_TABLE(type, name)
 | 
			
		||||
+#endif
 | 
			
		||||
 
 | 
			
		||||
 /* Version of form [<epoch>:]<version>[-<extra-version>].
 | 
			
		||||
  * Or for CVS/RCS ID version, everything but the number is stripped.
 | 
			
		||||
-- 
 | 
			
		||||
1.9.2
 | 
			
		||||
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@ -1,110 +0,0 @@
 | 
			
		||||
From 720a9dbf61c88bd57d6f8198ed8ccb2bd4a6abd8 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Matt Fleming <matt@console-pimps.org>
 | 
			
		||||
Date: Wed, 9 Apr 2014 10:33:49 +0200
 | 
			
		||||
Subject: [PATCH 07/10] x86/efi: Correct EFI boot stub use of code32_start
 | 
			
		||||
MIME-Version: 1.0
 | 
			
		||||
Content-Type: text/plain; charset=UTF-8
 | 
			
		||||
Content-Transfer-Encoding: 8bit
 | 
			
		||||
 | 
			
		||||
code32_start should point at the start of the protected mode code, and
 | 
			
		||||
*not* at the beginning of the bzImage. This is much easier to do in
 | 
			
		||||
assembly so document that callers of make_boot_params() need to fill out
 | 
			
		||||
code32_start.
 | 
			
		||||
 | 
			
		||||
The fallout from this bug is that we would end up relocating the image
 | 
			
		||||
but copying the image at some offset, resulting in what appeared to be
 | 
			
		||||
memory corruption.
 | 
			
		||||
 | 
			
		||||
Reported-by: Thomas Bächler <thomas@archlinux.org>
 | 
			
		||||
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
 | 
			
		||||
---
 | 
			
		||||
 arch/x86/boot/compressed/eboot.c   |  5 +++--
 | 
			
		||||
 arch/x86/boot/compressed/head_32.S | 14 ++++++++------
 | 
			
		||||
 arch/x86/boot/compressed/head_64.S |  9 +++------
 | 
			
		||||
 3 files changed, 14 insertions(+), 14 deletions(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
 | 
			
		||||
index a7677ba..78cbb2d 100644
 | 
			
		||||
--- a/arch/x86/boot/compressed/eboot.c
 | 
			
		||||
+++ b/arch/x86/boot/compressed/eboot.c
 | 
			
		||||
@@ -425,6 +425,9 @@ void setup_graphics(struct boot_params *boot_params)
 | 
			
		||||
  * Because the x86 boot code expects to be passed a boot_params we
 | 
			
		||||
  * need to create one ourselves (usually the bootloader would create
 | 
			
		||||
  * one for us).
 | 
			
		||||
+ *
 | 
			
		||||
+ * The caller is responsible for filling out ->code32_start in the
 | 
			
		||||
+ * returned boot_params.
 | 
			
		||||
  */
 | 
			
		||||
 struct boot_params *make_boot_params(void *handle, efi_system_table_t *_table)
 | 
			
		||||
 {
 | 
			
		||||
@@ -483,8 +486,6 @@ struct boot_params *make_boot_params(void *handle, efi_system_table_t *_table)
 | 
			
		||||
 	hdr->vid_mode = 0xffff;
 | 
			
		||||
 	hdr->boot_flag = 0xAA55;
 | 
			
		||||
 
 | 
			
		||||
-	hdr->code32_start = (__u64)(unsigned long)image->image_base;
 | 
			
		||||
-
 | 
			
		||||
 	hdr->type_of_loader = 0x21;
 | 
			
		||||
 
 | 
			
		||||
 	/* Convert unicode cmdline to ascii */
 | 
			
		||||
diff --git a/arch/x86/boot/compressed/head_32.S b/arch/x86/boot/compressed/head_32.S
 | 
			
		||||
index 9116aac..f45ab7a 100644
 | 
			
		||||
--- a/arch/x86/boot/compressed/head_32.S
 | 
			
		||||
+++ b/arch/x86/boot/compressed/head_32.S
 | 
			
		||||
@@ -50,6 +50,13 @@ ENTRY(efi_pe_entry)
 | 
			
		||||
 	pushl	%eax
 | 
			
		||||
 	pushl	%esi
 | 
			
		||||
 	pushl	%ecx
 | 
			
		||||
+
 | 
			
		||||
+	call	reloc
 | 
			
		||||
+reloc:
 | 
			
		||||
+	popl	%ecx
 | 
			
		||||
+	subl	reloc, %ecx
 | 
			
		||||
+	movl	%ecx, BP_code32_start(%eax)
 | 
			
		||||
+
 | 
			
		||||
 	sub	$0x4, %esp
 | 
			
		||||
 
 | 
			
		||||
 ENTRY(efi_stub_entry)
 | 
			
		||||
@@ -63,12 +70,7 @@ ENTRY(efi_stub_entry)
 | 
			
		||||
 	hlt
 | 
			
		||||
 	jmp	1b
 | 
			
		||||
 2:
 | 
			
		||||
-	call	3f
 | 
			
		||||
-3:
 | 
			
		||||
-	popl	%eax
 | 
			
		||||
-	subl	$3b, %eax
 | 
			
		||||
-	subl	BP_pref_address(%esi), %eax
 | 
			
		||||
-	add	BP_code32_start(%esi), %eax
 | 
			
		||||
+	movl	BP_code32_start(%esi), %eax
 | 
			
		||||
 	leal	preferred_addr(%eax), %eax
 | 
			
		||||
 	jmp	*%eax
 | 
			
		||||
 
 | 
			
		||||
diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S
 | 
			
		||||
index c5c1ae0..b10fa66 100644
 | 
			
		||||
--- a/arch/x86/boot/compressed/head_64.S
 | 
			
		||||
+++ b/arch/x86/boot/compressed/head_64.S
 | 
			
		||||
@@ -217,6 +217,8 @@ ENTRY(efi_pe_entry)
 | 
			
		||||
 	cmpq	$0,%rax
 | 
			
		||||
 	je	1f
 | 
			
		||||
 	mov	%rax, %rdx
 | 
			
		||||
+	leaq	startup_32(%rip), %rax
 | 
			
		||||
+	movl	%eax, BP_code32_start(%rdx)
 | 
			
		||||
 	popq	%rsi
 | 
			
		||||
 	popq	%rdi
 | 
			
		||||
 
 | 
			
		||||
@@ -230,12 +232,7 @@ ENTRY(efi_stub_entry)
 | 
			
		||||
 	hlt
 | 
			
		||||
 	jmp	1b
 | 
			
		||||
 2:
 | 
			
		||||
-	call	3f
 | 
			
		||||
-3:
 | 
			
		||||
-	popq	%rax
 | 
			
		||||
-	subq	$3b, %rax
 | 
			
		||||
-	subq	BP_pref_address(%rsi), %rax
 | 
			
		||||
-	add	BP_code32_start(%esi), %eax
 | 
			
		||||
+	movl	BP_code32_start(%esi), %eax
 | 
			
		||||
 	leaq	preferred_addr(%rax), %rax
 | 
			
		||||
 	jmp	*%rax
 | 
			
		||||
 
 | 
			
		||||
-- 
 | 
			
		||||
1.9.2
 | 
			
		||||
 | 
			
		||||
@ -1,94 +0,0 @@
 | 
			
		||||
From aafcd8f8692fb9e389608c1efad2e57c0bbb9362 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Linus Torvalds <torvalds@linux-foundation.org>
 | 
			
		||||
Date: Tue, 8 Apr 2014 15:30:07 -0700
 | 
			
		||||
Subject: [PATCH 08/10] futex: avoid race between requeue and wake
 | 
			
		||||
 | 
			
		||||
commit 69cd9eba38867a493a043bb13eb9b33cad5f1a9a upstream.
 | 
			
		||||
 | 
			
		||||
Jan Stancek reported:
 | 
			
		||||
 "pthread_cond_broadcast/4-1.c testcase from openposix testsuite (LTP)
 | 
			
		||||
  occasionally fails, because some threads fail to wake up.
 | 
			
		||||
 | 
			
		||||
  Testcase creates 5 threads, which are all waiting on same condition.
 | 
			
		||||
  Main thread then calls pthread_cond_broadcast() without holding mutex,
 | 
			
		||||
  which calls:
 | 
			
		||||
 | 
			
		||||
      futex(uaddr1, FUTEX_CMP_REQUEUE_PRIVATE, 1, 2147483647, uaddr2, ..)
 | 
			
		||||
 | 
			
		||||
  This immediately wakes up single thread A, which unlocks mutex and
 | 
			
		||||
  tries to wake up another thread:
 | 
			
		||||
 | 
			
		||||
      futex(uaddr2, FUTEX_WAKE_PRIVATE, 1)
 | 
			
		||||
 | 
			
		||||
  If thread A manages to call futex_wake() before any waiters are
 | 
			
		||||
  requeued for uaddr2, no other thread is woken up"
 | 
			
		||||
 | 
			
		||||
The ordering constraints for the hash bucket waiter counting are that
 | 
			
		||||
the waiter counts have to be incremented _before_ getting the spinlock
 | 
			
		||||
(because the spinlock acts as part of the memory barrier), but the
 | 
			
		||||
"requeue" operation didn't honor those rules, and nobody had even
 | 
			
		||||
thought about that case.
 | 
			
		||||
 | 
			
		||||
This fairly simple patch just increments the waiter count for the target
 | 
			
		||||
hash bucket (hb2) when requeing a futex before taking the locks.  It
 | 
			
		||||
then decrements them again after releasing the lock - the code that
 | 
			
		||||
actually moves the futex(es) between hash buckets will do the additional
 | 
			
		||||
required waiter count housekeeping.
 | 
			
		||||
 | 
			
		||||
Reported-and-tested-by: Jan Stancek <jstancek@redhat.com>
 | 
			
		||||
Acked-by: Davidlohr Bueso <davidlohr@hp.com>
 | 
			
		||||
Cc: Peter Zijlstra <peterz@infradead.org>
 | 
			
		||||
Cc: Thomas Gleixner <tglx@linutronix.de>
 | 
			
		||||
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
 | 
			
		||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 | 
			
		||||
---
 | 
			
		||||
 kernel/futex.c | 5 +++++
 | 
			
		||||
 1 file changed, 5 insertions(+)
 | 
			
		||||
 | 
			
		||||
diff --git a/kernel/futex.c b/kernel/futex.c
 | 
			
		||||
index 08ec814..16b1f2c 100644
 | 
			
		||||
--- a/kernel/futex.c
 | 
			
		||||
+++ b/kernel/futex.c
 | 
			
		||||
@@ -1450,6 +1450,7 @@ retry:
 | 
			
		||||
 	hb2 = hash_futex(&key2);
 | 
			
		||||
 
 | 
			
		||||
 retry_private:
 | 
			
		||||
+	hb_waiters_inc(hb2);
 | 
			
		||||
 	double_lock_hb(hb1, hb2);
 | 
			
		||||
 
 | 
			
		||||
 	if (likely(cmpval != NULL)) {
 | 
			
		||||
@@ -1459,6 +1460,7 @@ retry_private:
 | 
			
		||||
 
 | 
			
		||||
 		if (unlikely(ret)) {
 | 
			
		||||
 			double_unlock_hb(hb1, hb2);
 | 
			
		||||
+			hb_waiters_dec(hb2);
 | 
			
		||||
 
 | 
			
		||||
 			ret = get_user(curval, uaddr1);
 | 
			
		||||
 			if (ret)
 | 
			
		||||
@@ -1508,6 +1510,7 @@ retry_private:
 | 
			
		||||
 			break;
 | 
			
		||||
 		case -EFAULT:
 | 
			
		||||
 			double_unlock_hb(hb1, hb2);
 | 
			
		||||
+			hb_waiters_dec(hb2);
 | 
			
		||||
 			put_futex_key(&key2);
 | 
			
		||||
 			put_futex_key(&key1);
 | 
			
		||||
 			ret = fault_in_user_writeable(uaddr2);
 | 
			
		||||
@@ -1517,6 +1520,7 @@ retry_private:
 | 
			
		||||
 		case -EAGAIN:
 | 
			
		||||
 			/* The owner was exiting, try again. */
 | 
			
		||||
 			double_unlock_hb(hb1, hb2);
 | 
			
		||||
+			hb_waiters_dec(hb2);
 | 
			
		||||
 			put_futex_key(&key2);
 | 
			
		||||
 			put_futex_key(&key1);
 | 
			
		||||
 			cond_resched();
 | 
			
		||||
@@ -1592,6 +1596,7 @@ retry_private:
 | 
			
		||||
 
 | 
			
		||||
 out_unlock:
 | 
			
		||||
 	double_unlock_hb(hb1, hb2);
 | 
			
		||||
+	hb_waiters_dec(hb2);
 | 
			
		||||
 
 | 
			
		||||
 	/*
 | 
			
		||||
 	 * drop_futex_key_refs() must be called outside the spinlocks. During
 | 
			
		||||
-- 
 | 
			
		||||
1.9.2
 | 
			
		||||
 | 
			
		||||
@ -1,125 +0,0 @@
 | 
			
		||||
From 06af061dd673d749d5516bea41e2becb034e00b8 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Eyal Shapira <eyal@wizery.com>
 | 
			
		||||
Date: Sun, 16 Mar 2014 05:23:21 +0200
 | 
			
		||||
Subject: [PATCH 09/10] iwlwifi: mvm: rs: fix search cycle rules
 | 
			
		||||
 | 
			
		||||
commit 8930b05090acd321b1fc7c642528c697cb105c42 upstream.
 | 
			
		||||
 | 
			
		||||
We should explore all possible columns when searching to be
 | 
			
		||||
as resilient as possible to changing conditions. This fixes
 | 
			
		||||
for example a scenario where even after a sudden creation of
 | 
			
		||||
rssi difference between the 2 antennas we would keep doing MIMO
 | 
			
		||||
at a low rate instead of switching to SISO at a higher rate using
 | 
			
		||||
the better antenna which was the optimal configuration.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Eyal Shapira <eyalx.shapira@intel.com>
 | 
			
		||||
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
 | 
			
		||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 | 
			
		||||
---
 | 
			
		||||
 drivers/net/wireless/iwlwifi/mvm/rs.c | 36 +++++++++++++++++------------------
 | 
			
		||||
 1 file changed, 18 insertions(+), 18 deletions(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/drivers/net/wireless/iwlwifi/mvm/rs.c b/drivers/net/wireless/iwlwifi/mvm/rs.c
 | 
			
		||||
index 6abf74e..5bc8715 100644
 | 
			
		||||
--- a/drivers/net/wireless/iwlwifi/mvm/rs.c
 | 
			
		||||
+++ b/drivers/net/wireless/iwlwifi/mvm/rs.c
 | 
			
		||||
@@ -211,9 +211,9 @@ static const struct rs_tx_column rs_tx_columns[] = {
 | 
			
		||||
 		.next_columns = {
 | 
			
		||||
 			RS_COLUMN_LEGACY_ANT_B,
 | 
			
		||||
 			RS_COLUMN_SISO_ANT_A,
 | 
			
		||||
+			RS_COLUMN_SISO_ANT_B,
 | 
			
		||||
 			RS_COLUMN_MIMO2,
 | 
			
		||||
-			RS_COLUMN_INVALID,
 | 
			
		||||
-			RS_COLUMN_INVALID,
 | 
			
		||||
+			RS_COLUMN_MIMO2_SGI,
 | 
			
		||||
 		},
 | 
			
		||||
 	},
 | 
			
		||||
 	[RS_COLUMN_LEGACY_ANT_B] = {
 | 
			
		||||
@@ -221,10 +221,10 @@ static const struct rs_tx_column rs_tx_columns[] = {
 | 
			
		||||
 		.ant = ANT_B,
 | 
			
		||||
 		.next_columns = {
 | 
			
		||||
 			RS_COLUMN_LEGACY_ANT_A,
 | 
			
		||||
+			RS_COLUMN_SISO_ANT_A,
 | 
			
		||||
 			RS_COLUMN_SISO_ANT_B,
 | 
			
		||||
 			RS_COLUMN_MIMO2,
 | 
			
		||||
-			RS_COLUMN_INVALID,
 | 
			
		||||
-			RS_COLUMN_INVALID,
 | 
			
		||||
+			RS_COLUMN_MIMO2_SGI,
 | 
			
		||||
 		},
 | 
			
		||||
 	},
 | 
			
		||||
 	[RS_COLUMN_SISO_ANT_A] = {
 | 
			
		||||
@@ -234,8 +234,8 @@ static const struct rs_tx_column rs_tx_columns[] = {
 | 
			
		||||
 			RS_COLUMN_SISO_ANT_B,
 | 
			
		||||
 			RS_COLUMN_MIMO2,
 | 
			
		||||
 			RS_COLUMN_SISO_ANT_A_SGI,
 | 
			
		||||
-			RS_COLUMN_INVALID,
 | 
			
		||||
-			RS_COLUMN_INVALID,
 | 
			
		||||
+			RS_COLUMN_SISO_ANT_B_SGI,
 | 
			
		||||
+			RS_COLUMN_MIMO2_SGI,
 | 
			
		||||
 		},
 | 
			
		||||
 		.checks = {
 | 
			
		||||
 			rs_siso_allow,
 | 
			
		||||
@@ -248,8 +248,8 @@ static const struct rs_tx_column rs_tx_columns[] = {
 | 
			
		||||
 			RS_COLUMN_SISO_ANT_A,
 | 
			
		||||
 			RS_COLUMN_MIMO2,
 | 
			
		||||
 			RS_COLUMN_SISO_ANT_B_SGI,
 | 
			
		||||
-			RS_COLUMN_INVALID,
 | 
			
		||||
-			RS_COLUMN_INVALID,
 | 
			
		||||
+			RS_COLUMN_SISO_ANT_A_SGI,
 | 
			
		||||
+			RS_COLUMN_MIMO2_SGI,
 | 
			
		||||
 		},
 | 
			
		||||
 		.checks = {
 | 
			
		||||
 			rs_siso_allow,
 | 
			
		||||
@@ -263,8 +263,8 @@ static const struct rs_tx_column rs_tx_columns[] = {
 | 
			
		||||
 			RS_COLUMN_SISO_ANT_B_SGI,
 | 
			
		||||
 			RS_COLUMN_MIMO2_SGI,
 | 
			
		||||
 			RS_COLUMN_SISO_ANT_A,
 | 
			
		||||
-			RS_COLUMN_INVALID,
 | 
			
		||||
-			RS_COLUMN_INVALID,
 | 
			
		||||
+			RS_COLUMN_SISO_ANT_B,
 | 
			
		||||
+			RS_COLUMN_MIMO2,
 | 
			
		||||
 		},
 | 
			
		||||
 		.checks = {
 | 
			
		||||
 			rs_siso_allow,
 | 
			
		||||
@@ -279,8 +279,8 @@ static const struct rs_tx_column rs_tx_columns[] = {
 | 
			
		||||
 			RS_COLUMN_SISO_ANT_A_SGI,
 | 
			
		||||
 			RS_COLUMN_MIMO2_SGI,
 | 
			
		||||
 			RS_COLUMN_SISO_ANT_B,
 | 
			
		||||
-			RS_COLUMN_INVALID,
 | 
			
		||||
-			RS_COLUMN_INVALID,
 | 
			
		||||
+			RS_COLUMN_SISO_ANT_A,
 | 
			
		||||
+			RS_COLUMN_MIMO2,
 | 
			
		||||
 		},
 | 
			
		||||
 		.checks = {
 | 
			
		||||
 			rs_siso_allow,
 | 
			
		||||
@@ -292,10 +292,10 @@ static const struct rs_tx_column rs_tx_columns[] = {
 | 
			
		||||
 		.ant = ANT_AB,
 | 
			
		||||
 		.next_columns = {
 | 
			
		||||
 			RS_COLUMN_SISO_ANT_A,
 | 
			
		||||
+			RS_COLUMN_SISO_ANT_B,
 | 
			
		||||
+			RS_COLUMN_SISO_ANT_A_SGI,
 | 
			
		||||
+			RS_COLUMN_SISO_ANT_B_SGI,
 | 
			
		||||
 			RS_COLUMN_MIMO2_SGI,
 | 
			
		||||
-			RS_COLUMN_INVALID,
 | 
			
		||||
-			RS_COLUMN_INVALID,
 | 
			
		||||
-			RS_COLUMN_INVALID,
 | 
			
		||||
 		},
 | 
			
		||||
 		.checks = {
 | 
			
		||||
 			rs_mimo_allow,
 | 
			
		||||
@@ -307,10 +307,10 @@ static const struct rs_tx_column rs_tx_columns[] = {
 | 
			
		||||
 		.sgi = true,
 | 
			
		||||
 		.next_columns = {
 | 
			
		||||
 			RS_COLUMN_SISO_ANT_A_SGI,
 | 
			
		||||
+			RS_COLUMN_SISO_ANT_B_SGI,
 | 
			
		||||
+			RS_COLUMN_SISO_ANT_A,
 | 
			
		||||
+			RS_COLUMN_SISO_ANT_B,
 | 
			
		||||
 			RS_COLUMN_MIMO2,
 | 
			
		||||
-			RS_COLUMN_INVALID,
 | 
			
		||||
-			RS_COLUMN_INVALID,
 | 
			
		||||
-			RS_COLUMN_INVALID,
 | 
			
		||||
 		},
 | 
			
		||||
 		.checks = {
 | 
			
		||||
 			rs_mimo_allow,
 | 
			
		||||
-- 
 | 
			
		||||
1.9.2
 | 
			
		||||
 | 
			
		||||
@ -1,13 +0,0 @@
 | 
			
		||||
diff --git a/fs/kernfs/file.c b/fs/kernfs/file.c
 | 
			
		||||
index 8034706..e01ea4a 100644
 | 
			
		||||
--- a/fs/kernfs/file.c
 | 
			
		||||
+++ b/fs/kernfs/file.c
 | 
			
		||||
@@ -484,6 +484,8 @@ static int kernfs_fop_mmap(struct file *file, struct vm_area_struct *vma)
 | 
			
		||||
 
 | 
			
		||||
 	ops = kernfs_ops(of->kn);
 | 
			
		||||
 	rc = ops->mmap(of, vma);
 | 
			
		||||
+	if (rc)
 | 
			
		||||
+		goto out_put;
 | 
			
		||||
 
 | 
			
		||||
 	/*
 | 
			
		||||
 	 * PowerPC's pci_mmap of legacy_mem uses shmem_zero_setup()
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user