Skip to contentSkip to conversation

Linux 3.0.92

DISCUSSION Greg KH 5 participants 10 messages Aug 20, 2013

Subsystems (3)
lore
Share & tools
lore

Greg KH

author maintainer
#0 lore raw

I'm announcing the release of the 3.0.92 kernel.

All users of the 3.0 kernel series must upgrade.

The updated 3.0.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-3.0.y
and can be browsed at the normal kernel.org git web browser:
http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h

------------

 Makefile                                   |    2 +-
 arch/arm/include/asm/hardware/cache-l2x0.h |    9 +++++++--
 arch/arm/mm/cache-l2x0.c                   |   21 +++++++++++++++++++++
 arch/cris/kernel/vmlinux.lds.S             |    1 +
 arch/m68k/emu/natfeat.c                    |   23 +++++++++++++++++++----
 arch/m68k/include/asm/div64.h              |    9 +++++----
 arch/powerpc/Makefile                      |    2 +-
 arch/sparc/lib/Makefile                    |    2 +-
 arch/sparc/lib/ucmpdi2.c                   |   19 +++++++++++++++++++
 drivers/usb/core/quirks.c                  |    6 ++++++
 drivers/usb/serial/mos7720.c               |   21 ++++++++++++++-------
 include/linux/hugetlb.h                    |   16 ++++++++++++++++
 kernel/futex.c                             |    3 ++-
 mm/hugetlb.c                               |   17 +++++++++++++++++
 mm/nommu.c                                 |   10 ++++++++++
 net/key/af_key.c                           |    1 +
 net/netlink/genetlink.c                    |    7 +++++++
 17 files changed, 148 insertions(+), 21 deletions(-)

Andreas Schwab (1):
m68k: Truncate base in do_div()

Anton Blanchard (1):
powerpc: Use -mtraceback=no

David S. Miller (1):
sparc32: Add ucmpdi2.o to obj-y instead of lib-y.

Geert Uytterhoeven (1):
m68k/atari: ARAnyM - Fix NatFeat module support

Greg Kroah-Hartman (1):

      Linux 3.0.92

Jesper Nilsson (1):
CRIS: Add _sdata to vmlinux.lds.S

Johan Hovold (1):
USB: mos7720: fix broken control requests

Johannes Berg (1):
genetlink: fix family dump race

Linus Torvalds (1):
vm: add no-mmu vm_iomap_memory() stub

Linus Walleij (1):
ARM: 7080/1: l2x0: make sure I&D are not locked down on init

Nicolas Dichtel (1):
af_key: initialize satype in key_notify_policy_flush()

Oliver Neukum (1):
usb: add two quirky touchscreen

Sam Ravnborg (1):
sparc32: add ucmpdi2

Zhang Yi (1):
futex: Take hugepages into account when generating futex_key

author maintainer
#1 lore raw
Makefile +1 -1
index ab2f30a..a846aa8 100644
@@ -1,6 +1,6 @@
 VERSION = 3
 PATCHLEVEL = 0
-SUBLEVEL = 91
+SUBLEVEL = 92
 EXTRAVERSION =
 NAME = Sneaky Weasel
 
arch/arm/include/asm/hardware/cache-l2x0.h +7 -2
index bfa706f..99a6ed7 100644
@@ -45,8 +45,13 @@
 #define L2X0_CLEAN_INV_LINE_PA		0x7F0
 #define L2X0_CLEAN_INV_LINE_IDX		0x7F8
 #define L2X0_CLEAN_INV_WAY		0x7FC
-#define L2X0_LOCKDOWN_WAY_D		0x900
-#define L2X0_LOCKDOWN_WAY_I		0x904
+/*
+ * The lockdown registers repeat 8 times for L310, the L210 has only one
+ * D and one I lockdown register at 0x0900 and 0x0904.
+ */
+#define L2X0_LOCKDOWN_WAY_D_BASE	0x900
+#define L2X0_LOCKDOWN_WAY_I_BASE	0x904
+#define L2X0_LOCKDOWN_STRIDE		0x08
 #define L2X0_TEST_OPERATION		0xF00
 #define L2X0_LINE_DATA			0xF10
 #define L2X0_LINE_TAG			0xF30
arch/arm/mm/cache-l2x0.c +21 -0
index 44c0867..9ecfdb5 100644
@@ -277,6 +277,25 @@ static void l2x0_disable(void)
 	spin_unlock_irqrestore(&l2x0_lock, flags);
 }
 
+static void __init l2x0_unlock(__u32 cache_id)
+{
+	int lockregs;
+	int i;
+
+	if (cache_id == L2X0_CACHE_ID_PART_L310)
+		lockregs = 8;
+	else
+		/* L210 and unknown types */
+		lockregs = 1;
+
+	for (i = 0; i < lockregs; i++) {
+		writel_relaxed(0x0, l2x0_base + L2X0_LOCKDOWN_WAY_D_BASE +
+			       i * L2X0_LOCKDOWN_STRIDE);
+		writel_relaxed(0x0, l2x0_base + L2X0_LOCKDOWN_WAY_I_BASE +
+			       i * L2X0_LOCKDOWN_STRIDE);
+	}
+}
+
 void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask)
 {
 	__u32 aux;
@@ -328,6 +347,8 @@ void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask)
 	 * accessing the below registers will fault.
 	 */
 	if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & 1)) {
+		/* Make sure that I&D is not locked down when starting */
+		l2x0_unlock(cache_id);
 
 		/* l2x0 controller is disabled */
 		writel_relaxed(aux, l2x0_base + L2X0_AUX_CTRL);
arch/cris/kernel/vmlinux.lds.S +1 -0
index a6990cb..a68b983 100644
@@ -52,6 +52,7 @@ SECTIONS
 
 	EXCEPTION_TABLE(4)
 
+	_sdata = .;
 	RODATA
 
 	. = ALIGN (4);
arch/m68k/emu/natfeat.c +19 -4
index 2291a7d..fa277ae 100644
@@ -18,9 +18,11 @@
 #include <asm/machdep.h>
 #include <asm/natfeat.h>
 
+extern long nf_get_id2(const char *feature_name);
+
 asm("\n"
-"	.global nf_get_id,nf_call\n"
-"nf_get_id:\n"
+"	.global nf_get_id2,nf_call\n"
+"nf_get_id2:\n"
 "	.short	0x7300\n"
 "	rts\n"
 "nf_call:\n"
@@ -29,12 +31,25 @@ asm("\n"
 "1:	moveq.l	#0,%d0\n"
 "	rts\n"
 "	.section __ex_table,\"a\"\n"
-"	.long	nf_get_id,1b\n"
+"	.long	nf_get_id2,1b\n"
 "	.long	nf_call,1b\n"
 "	.previous");
-EXPORT_SYMBOL_GPL(nf_get_id);
 EXPORT_SYMBOL_GPL(nf_call);
 
+long nf_get_id(const char *feature_name)
+{
+	/* feature_name may be in vmalloc()ed memory, so make a copy */
+	char name_copy[32];
+	size_t n;
+
+	n = strlcpy(name_copy, feature_name, sizeof(name_copy));
+	if (n >= sizeof(name_copy))
+		return 0;
+
+	return nf_get_id2(name_copy);
+}
+EXPORT_SYMBOL_GPL(nf_get_id);
+
 void nfprint(const char *fmt, ...)
 {
 	static char buf[256];
arch/m68k/include/asm/div64.h +5 -4
index edb6614..7558032 100644
@@ -13,16 +13,17 @@
 		unsigned long long n64;				\
 	} __n;							\
 	unsigned long __rem, __upper;				\
+	unsigned long __base = (base);				\
 								\
 	__n.n64 = (n);						\
 	if ((__upper = __n.n32[0])) {				\
 		asm ("divul.l %2,%1:%0"				\
-			: "=d" (__n.n32[0]), "=d" (__upper)	\
-			: "d" (base), "0" (__n.n32[0]));	\
+		     : "=d" (__n.n32[0]), "=d" (__upper)	\
+		     : "d" (__base), "0" (__n.n32[0]));		\
 	}							\
 	asm ("divu.l %2,%1:%0"					\
-		: "=d" (__n.n32[1]), "=d" (__rem)		\
-		: "d" (base), "1" (__upper), "0" (__n.n32[1]));	\
+	     : "=d" (__n.n32[1]), "=d" (__rem)			\
+	     : "d" (__base), "1" (__upper), "0" (__n.n32[1]));	\
 	(n) = __n.n64;						\
 	__rem;							\
 })
arch/powerpc/Makefile +1 -1
index b7212b6..f1b5251 100644
@@ -67,7 +67,7 @@ LDFLAGS_vmlinux-yy := -Bstatic
 LDFLAGS_vmlinux-$(CONFIG_PPC64)$(CONFIG_RELOCATABLE) := -pie
 LDFLAGS_vmlinux	:= $(LDFLAGS_vmlinux-yy)
 
-CFLAGS-$(CONFIG_PPC64)	:= -mminimal-toc -mtraceback=none  -mcall-aixdesc
+CFLAGS-$(CONFIG_PPC64)	:= -mminimal-toc -mtraceback=no -mcall-aixdesc
 CFLAGS-$(CONFIG_PPC32)	:= -ffixed-r2 -mmultiple
 KBUILD_CPPFLAGS	+= -Iarch/$(ARCH)
 KBUILD_AFLAGS	+= -Iarch/$(ARCH)
arch/sparc/lib/Makefile +1 -1
index a3fc437..4961516 100644
@@ -40,7 +40,7 @@ lib-$(CONFIG_SPARC64) += copy_in_user.o user_fixup.o memmove.o
 lib-$(CONFIG_SPARC64) += mcount.o ipcsum.o xor.o hweight.o ffs.o
 
 obj-y                 += iomap.o
-obj-$(CONFIG_SPARC32) += atomic32.o
+obj-$(CONFIG_SPARC32) += atomic32.o ucmpdi2.o
 obj-y                 += ksyms.o
 obj-$(CONFIG_SPARC64) += PeeCeeI.o
 obj-y                 += usercopy.o
arch/sparc/lib/ucmpdi2.c new file +19 -0
new file mode 100644
index 0000000..1e06ed5
@@ -0,0 +1,19 @@
+#include <linux/module.h>
+#include "libgcc.h"
+
+word_type __ucmpdi2(unsigned long long a, unsigned long long b)
+{
+	const DWunion au = {.ll = a};
+	const DWunion bu = {.ll = b};
+
+	if ((unsigned int) au.s.high < (unsigned int) bu.s.high)
+		return 0;
+	else if ((unsigned int) au.s.high > (unsigned int) bu.s.high)
+		return 2;
+	if ((unsigned int) au.s.low < (unsigned int) bu.s.low)
+		return 0;
+	else if ((unsigned int) au.s.low > (unsigned int) bu.s.low)
+		return 2;
+	return 1;
+}
+EXPORT_SYMBOL(__ucmpdi2);
drivers/usb/core/quirks.c +6 -0
index f88ad63..8659cd9 100644
@@ -100,6 +100,12 @@ static const struct usb_device_id usb_quirk_list[] = {
 	{ USB_DEVICE(0x04d8, 0x000c), .driver_info =
 			USB_QUIRK_CONFIG_INTF_STRINGS },
 
+	/* CarrolTouch 4000U */
+	{ USB_DEVICE(0x04e7, 0x0009), .driver_info = USB_QUIRK_RESET_RESUME },
+
+	/* CarrolTouch 4500U */
+	{ USB_DEVICE(0x04e7, 0x0030), .driver_info = USB_QUIRK_RESET_RESUME },
+
 	/* Samsung Android phone modem - ID conflict with SPH-I500 */
 	{ USB_DEVICE(0x04e8, 0x6601), .driver_info =
 			USB_QUIRK_CONFIG_INTF_STRINGS },
drivers/usb/serial/mos7720.c +14 -7
index 703d1fa..267dff9 100644
@@ -97,6 +97,7 @@ struct urbtracker {
 	struct list_head        urblist_entry;
 	struct kref             ref_count;
 	struct urb              *urb;
+	struct usb_ctrlrequest	*setup;
 };
 
 enum mos7715_pp_modes {
@@ -279,6 +280,7 @@ static void destroy_urbtracker(struct kref *kref)
 	struct mos7715_parport *mos_parport = urbtrack->mos_parport;
 	dbg("%s called", __func__);
 	usb_free_urb(urbtrack->urb);
+	kfree(urbtrack->setup);
 	kfree(urbtrack);
 	kref_put(&mos_parport->ref_count, destroy_mos_parport);
 }
@@ -363,7 +365,6 @@ static int write_parport_reg_nonblock(struct mos7715_parport *mos_parport,
 	struct urbtracker *urbtrack;
 	int ret_val;
 	unsigned long flags;
-	struct usb_ctrlrequest setup;
 	struct usb_serial *serial = mos_parport->serial;
 	struct usb_device *usbdev = serial->dev;
 	dbg("%s called", __func__);
@@ -382,14 +383,20 @@ static int write_parport_reg_nonblock(struct mos7715_parport *mos_parport,
 		kfree(urbtrack);
 		return -ENOMEM;
 	}
-	setup.bRequestType = (__u8)0x40;
-	setup.bRequest = (__u8)0x0e;
-	setup.wValue = get_reg_value(reg, dummy);
-	setup.wIndex = get_reg_index(reg);
-	setup.wLength = 0;
+	urbtrack->setup = kmalloc(sizeof(*urbtrack->setup), GFP_KERNEL);
+	if (!urbtrack->setup) {
+		usb_free_urb(urbtrack->urb);
+		kfree(urbtrack);
+		return -ENOMEM;
+	}
+	urbtrack->setup->bRequestType = (__u8)0x40;
+	urbtrack->setup->bRequest = (__u8)0x0e;
+	urbtrack->setup->wValue = get_reg_value(reg, dummy);
+	urbtrack->setup->wIndex = get_reg_index(reg);
+	urbtrack->setup->wLength = 0;
 	usb_fill_control_urb(urbtrack->urb, usbdev,
 			     usb_sndctrlpipe(usbdev, 0),
-			     (unsigned char *)&setup,
+			     (unsigned char *)urbtrack->setup,
 			     NULL, 0, async_complete, urbtrack);
 	kref_init(&urbtrack->ref_count);
 	INIT_LIST_HEAD(&urbtrack->urblist_entry);
include/linux/hugetlb.h +16 -0
index 59225ef..db70f1b 100644
@@ -313,6 +313,17 @@ static inline unsigned hstate_index_to_shift(unsigned index)
 	return hstates[index].order + PAGE_SHIFT;
 }
 
+pgoff_t __basepage_index(struct page *page);
+
+/* Return page->index in PAGE_SIZE units */
+static inline pgoff_t basepage_index(struct page *page)
+{
+	if (!PageCompound(page))
+		return page->index;
+
+	return __basepage_index(page);
+}
+
 #else
 struct hstate {};
 #define alloc_huge_page_node(h, nid) NULL
@@ -331,6 +342,11 @@ static inline unsigned int pages_per_huge_page(struct hstate *h)
 	return 1;
 }
 #define hstate_index_to_shift(index) 0
+
+static inline pgoff_t basepage_index(struct page *page)
+{
+	return page->index;
+}
 #endif
 
 #endif /* _LINUX_HUGETLB_H */
kernel/futex.c +2 -1
index 91691e9..5c305c0 100644
@@ -60,6 +60,7 @@
 #include <linux/pid.h>
 #include <linux/nsproxy.h>
 #include <linux/ptrace.h>
+#include <linux/hugetlb.h>
 
 #include <asm/futex.h>
 
@@ -363,7 +364,7 @@ again:
 	} else {
 		key->both.offset |= FUT_OFF_INODE; /* inode-based key */
 		key->shared.inode = page_head->mapping->host;
-		key->shared.pgoff = page_head->index;
+		key->shared.pgoff = basepage_index(page);
 	}
 
 	get_futex_key_refs(key);
mm/hugetlb.c +17 -0
index a3498eb..6fdad25 100644
@@ -602,6 +602,23 @@ int PageHuge(struct page *page)
 
 EXPORT_SYMBOL_GPL(PageHuge);
 
+pgoff_t __basepage_index(struct page *page)
+{
+	struct page *page_head = compound_head(page);
+	pgoff_t index = page_index(page_head);
+	unsigned long compound_idx;
+
+	if (!PageHuge(page_head))
+		return page_index(page);
+
+	if (compound_order(page_head) >= MAX_ORDER)
+		compound_idx = page_to_pfn(page) - page_to_pfn(page_head);
+	else
+		compound_idx = page - page_head;
+
+	return (index << compound_order(page_head)) + compound_idx;
+}
+
 static struct page *alloc_fresh_huge_page_node(struct hstate *h, int nid)
 {
 	struct page *page;
mm/nommu.c +10 -0
index 1692fef..9242924 100644
@@ -1826,6 +1826,16 @@ int remap_pfn_range(struct vm_area_struct *vma, unsigned long addr,
 }
 EXPORT_SYMBOL(remap_pfn_range);
 
+int vm_iomap_memory(struct vm_area_struct *vma, phys_addr_t start, unsigned long len)
+{
+	unsigned long pfn = start >> PAGE_SHIFT;
+	unsigned long vm_len = vma->vm_end - vma->vm_start;
+
+	pfn += vma->vm_pgoff;
+	return io_remap_pfn_range(vma, vma->vm_start, pfn, vm_len, vma->vm_page_prot);
+}
+EXPORT_SYMBOL(vm_iomap_memory);
+
 int remap_vmalloc_range(struct vm_area_struct *vma, void *addr,
 			unsigned long pgoff)
 {
net/key/af_key.c +1 -0
index d040880..020a602 100644
@@ -2687,6 +2687,7 @@ static int key_notify_policy_flush(const struct km_event *c)
 	hdr->sadb_msg_pid = c->pid;
 	hdr->sadb_msg_version = PF_KEY_V2;
 	hdr->sadb_msg_errno = (uint8_t) 0;
+	hdr->sadb_msg_satype = SADB_SATYPE_UNSPEC;
 	hdr->sadb_msg_len = (sizeof(struct sadb_msg) / sizeof(uint64_t));
 	hdr->sadb_msg_reserved = 0;
 	pfkey_broadcast(skb_out, GFP_ATOMIC, BROADCAST_ALL, NULL, c->net);
net/netlink/genetlink.c +7 -0
index 874f8ff..409dd40 100644
@@ -700,6 +700,10 @@ static int ctrl_dumpfamily(struct sk_buff *skb, struct netlink_callback *cb)
 	struct net *net = sock_net(skb->sk);
 	int chains_to_skip = cb->args[0];
 	int fams_to_skip = cb->args[1];
+	bool need_locking = chains_to_skip || fams_to_skip;
+
+	if (need_locking)
+		genl_lock();
 
 	for (i = chains_to_skip; i < GENL_FAM_TAB_SIZE; i++) {
 		n = 0;
@@ -721,6 +725,9 @@ errout:
 	cb->args[0] = i;
 	cb->args[1] = n;
 
+	if (need_locking)
+		genl_unlock();
+
 	return skb->len;
 }
 
#2 lore raw
In reply to Greg KH
Quoted 3 lines · Greg KH

Johannes Berg (1):
genetlink: fix family dump race

This one turns out to be buggy, see thread called "3.11-rc6 genetlink locking fix offends lockdep".

I really think there should be delay before stable picks up stuff from mainline, unless it's something particularly critical and well-discussed.. Maybe a week or so.

Now it's both in 3.0 and 3.10, so the revert (unless we find a better fix - and the first two patches have already failed) will have to go there too.

Linus

author maintainer
#3 lore raw
Quoted 7 lines · Linus Torvalds
Quoted 3 lines · Greg KH

Johannes Berg (1):
genetlink: fix family dump race

This one turns out to be buggy, see thread called "3.11-rc6 genetlink locking fix offends lockdep".

Yeah, I messed up in keeping it here, I'll go revert it and push out a new 3.0 release.

Quoted 3 lines

I really think there should be delay before stable picks up stuff from mainline, unless it's something particularly critical and well-discussed.. Maybe a week or so.

I can do that, it's just hard to tell from my end what is "well discussed" all the time.

Quoted 3 lines

Now it's both in 3.0 and 3.10, so the revert (unless we find a better fix - and the first two patches have already failed) will have to go there too.

I thought that there was a fix already for this... Ah, no, that was for another reported regression in an older 3.10-stable release, my bad.

Johannes, what do you want to do here? Just revert it in Linus's tree for now, given the late -rc cycle?

thanks,

greg k-h

#4 lore raw

[too many email threads, so + a few folks]

Quoted 5 lines
Quoted 2 lines

This one turns out to be buggy, see thread called "3.11-rc6 genetlink locking fix offends lockdep".

Yeah, I messed up in keeping it here, I'll go revert it and push out a new 3.0 release.

Sorry everyone, I thought I tested that code but clearly I didn't test it well enough. I can easily reproduce the issues now so not sure why I didn't see it before.

Quoted 5 lines

I thought that there was a fix already for this... Ah, no, that was for another reported regression in an older 3.10-stable release, my bad.

Johannes, what do you want to do here? Just revert it in Linus's tree for now, given the late -rc cycle?

I think that'd be the best course of action for now. I just tried a few other approaches but I can't come up with a dead-lock free way to actually add locking here, short of providing some way for dump to actually always have locking from "outside" (netlink code).

I think the better way would be to convert it to just use RCU. This isn't very efficient, but then again we don't unregister generic netlink families all the time. Below patch works without lockdep complaining, but that's obvious since it can't check RCU ... I'm not sure I want to do this so close to a release?

johannes

Quoted 1 line

From 5b4790a1188c40422e99b4fc8840e4860d57f0d0 Mon Sep 17 00:00:00 2001

From: Johannes Berg <[email protected]>
Date: Tue, 20 Aug 2013 21:31:48 +0200
Subject: [PATCH] genetlink: convert family dump code to use RCU

In my previous commit 58ad436fcf49810aa006016107f494c9ac9013db ("genetlink: fix family dump race") I attempted to solve an issue in generic netlink that could lead to crashes, but it turns out that this introduced a possibility for deadlock. As I haven't found a way to actually add locking without causing that, convert the family, family ops/mcast group lists all to use RCU, so the family dump code can simply use RCU protection instead of locking.

---
 net/netlink/genetlink.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
net/netlink/genetlink.c +14 -14
index f85f8a2..ceeaee4 100644
@@ -246,7 +246,7 @@ static void __genl_unregister_mc_group(struct genl_family *family,
 	netlink_table_ungrab();
 
 	clear_bit(grp->id, mc_groups);
-	list_del(&grp->list);
+	list_del_rcu(&grp->list);
 	genl_ctrl_event(CTRL_CMD_DELMCAST_GRP, grp);
 	grp->id = 0;
 	grp->family = NULL;
@@ -272,6 +272,7 @@ void genl_unregister_mc_group(struct genl_family *family,
 	genl_lock_all();
 	__genl_unregister_mc_group(family, grp);
 	genl_unlock_all();
+	synchronize_rcu();
 }
 EXPORT_SYMBOL(genl_unregister_mc_group);
 
@@ -281,6 +282,7 @@ static void genl_unregister_mc_groups(struct genl_family *family)
 
 	list_for_each_entry_safe(grp, tmp, &family->mcast_groups, list)
 		__genl_unregister_mc_group(family, grp);
+	synchronize_rcu();
 }
 
 /**
@@ -351,9 +353,10 @@ int genl_unregister_ops(struct genl_family *family, struct genl_ops *ops)
 	genl_lock_all();
 	list_for_each_entry(rc, &family->ops_list, ops_list) {
 		if (rc == ops) {
-			list_del(&ops->ops_list);
+			list_del_rcu(&ops->ops_list);
 			genl_unlock_all();
 			genl_ctrl_event(CTRL_CMD_DELOPS, ops);
+			synchronize_rcu();
 			return 0;
 		}
 	}
@@ -418,7 +421,7 @@ int genl_register_family(struct genl_family *family)
 	} else
 		family->attrbuf = NULL;
 
-	list_add_tail(&family->family_list, genl_family_chain(family->id));
+	list_add_tail_rcu(&family->family_list, genl_family_chain(family->id));
 	genl_unlock_all();
 
 	genl_ctrl_event(CTRL_CMD_NEWFAMILY, family);
@@ -498,7 +501,8 @@ int genl_unregister_family(struct genl_family *family)
 		if (family->id != rc->id || strcmp(rc->name, family->name))
 			continue;
 
-		list_del(&rc->family_list);
+		list_del_rcu(&rc->family_list);
+		synchronize_rcu();
 		INIT_LIST_HEAD(&family->ops_list);
 		genl_unlock_all();
 
@@ -692,7 +696,7 @@ static int ctrl_fill_info(struct genl_family *family, u32 portid, u32 seq,
 		if (nla_ops == NULL)
 			goto nla_put_failure;
 
-		list_for_each_entry(ops, &family->ops_list, ops_list) {
+		list_for_each_entry_rcu(ops, &family->ops_list, ops_list) {
 			struct nlattr *nest;
 
 			nest = nla_nest_start(skb, idx++);
@@ -718,7 +722,7 @@ static int ctrl_fill_info(struct genl_family *family, u32 portid, u32 seq,
 		if (nla_grps == NULL)
 			goto nla_put_failure;
 
-		list_for_each_entry(grp, &family->mcast_groups, list) {
+		list_for_each_entry_rcu(grp, &family->mcast_groups, list) {
 			struct nlattr *nest;
 
 			nest = nla_nest_start(skb, idx++);
@@ -789,14 +793,11 @@ static int ctrl_dumpfamily(struct sk_buff *skb, struct netlink_callback *cb)
 	struct net *net = sock_net(skb->sk);
 	int chains_to_skip = cb->args[0];
 	int fams_to_skip = cb->args[1];
-	bool need_locking = chains_to_skip || fams_to_skip;
-
-	if (need_locking)
-		genl_lock();
 
+	rcu_read_lock();
 	for (i = chains_to_skip; i < GENL_FAM_TAB_SIZE; i++) {
 		n = 0;
-		list_for_each_entry(rt, genl_family_chain(i), family_list) {
+		list_for_each_entry_rcu(rt, genl_family_chain(i), family_list) {
 			if (!rt->netnsok && !net_eq(net, &init_net))
 				continue;
 			if (++n < fams_to_skip)
@@ -811,12 +812,11 @@ static int ctrl_dumpfamily(struct sk_buff *skb, struct netlink_callback *cb)
 	}
 
 errout:
+	rcu_read_unlock();
+
 	cb->args[0] = i;
 	cb->args[1] = n;
 
-	if (need_locking)
-		genl_unlock();
-
 	return skb->len;
 }
 
Signature · 1 line
1.8.4.rc2
#5 lore raw
In reply to Greg KH
Quoted 23 lines · Greg KH
Quoted 7 lines · Linus Torvalds
Quoted 3 lines · Greg KH

Johannes Berg (1):
genetlink: fix family dump race

This one turns out to be buggy, see thread called "3.11-rc6 genetlink locking fix offends lockdep".

Yeah, I messed up in keeping it here, I'll go revert it and push out a new 3.0 release.

Quoted 3 lines

I really think there should be delay before stable picks up stuff from mainline, unless it's something particularly critical and well-discussed.. Maybe a week or so.

I can do that, it's just hard to tell from my end what is "well discussed" all the time.

Quoted 3 lines

Now it's both in 3.0 and 3.10, so the revert (unless we find a better fix - and the first two patches have already failed) will have to go there too.

Quoted 6 lines

I thought that there was a fix already for this... Ah, no, that was for another reported regression in an older 3.10-stable release, my bad.

Johannes, what do you want to do here? Just revert it in Linus's tree for now, given the late -rc cycle?

Does this patch have to be reverted in 3.10 as well ? Linus' e-mail seems to suggest it, but Shuah didn't see the problem there. I ran a quick test with 3.10.8 on an x86 system and did not see a problem either, at least not immediately.

I want to add some networking to my qemu tests, but it would help to know how to catch such errors automatically ... that is, if there is a way to do that.

Guenter

#6 lore raw
Quoted 4 lines · Guenter Roeck

Does this patch have to be reverted in 3.10 as well ? Linus' e-mail seems to suggest it, but Shuah didn't see the problem there. I ran a quick test with 3.10.8 on an x86 system and did not see a problem either, at least not immediately.

Yes, it does. I'm not sure how hard it is to actually run into the deadlock, though Sergey Senozhatsky said he had seen it.

The patch I just posted with the RCU protection actually pretty much reverts my other patch as part of it.

johannes

#7 lore raw
In reply to Guenter Roeck
Quoted 5 lines · Guenter Roeck
Quoted 1 line

Does this patch have to be reverted in 3.10 as well ? Linus' e-mail seems to suggest it, but Shuah didn't see the problem there. I ran a quick test with 3.10.8 on an x86 system and did not see a problem either, at least not immediately.

Do you run with lockdep?

The patch causes a _possibility_ of a deadlock, but unless you have lockdep enabled, you're almost guaranteed to not actually ever see that deadlock in practice.

Linus

#8 lore raw
Quoted 7 lines · Linus Torvalds
Quoted 5 lines · Guenter Roeck
Quoted 1 line

Does this patch have to be reverted in 3.10 as well ? Linus' e-mail seems to suggest it, but Shuah didn't see the problem there. I ran a quick test with 3.10.8 on an x86 system and did not see a problem either, at least not immediately.

Quoted 6 lines

Do you run with lockdep?

The patch causes a _possibility_ of a deadlock, but unless you have lockdep enabled, you're almost guaranteed to not actually ever see that deadlock in practice.

I have CONFIG_LOCKDEP_SUPPORT enabled. Guess I need CONFIG_LOCKUP_DETECTOR as well. I'll give it a try.

Guenter

maintainer
#9 lore raw
In reply to Linus Torvalds

From: Linus Torvalds <[email protected]>
Date: Tue, 20 Aug 2013 09:33:30 -0700

Quoted 3 lines

I really think there should be delay before stable picks up stuff from mainline, unless it's something particularly critical and well-discussed.. Maybe a week or so.

That's how I typically work, I do all the submissions by hand after they've sit in your tree for at least a week.

But in this case, Johanned added an explicit stable CC: to the commit message and I failed to remove it, my bad.