Skip to contentSkip to conversation

2.6.24-stable review

PATCH In review Chris Wright 12 participants 100 messages Mar 21, 2008 – Mar 27, 2008

Subsystems (52)
lore
Share & tools
lore
#31 lore raw

PATCH 16/76 MIPS: Mark all but i8259 interrupts as no-probe.

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Ralf Baechle <[email protected]>

Use set_irq_noprobe() to mark all MIPS interrupts as non-probe. Override that default for i8259 interrupts.

---
 arch/mips/kernel/i8259.c |    4 +++-
 arch/mips/kernel/irq.c   |    5 +++++
 2 files changed, 8 insertions(+), 1 deletion(-)
arch/mips/kernel/i8259.c +3 -1
@@ -338,8 +338,10 @@ void __init init_i8259_irqs(void)
 
 	init_8259A(0);
 
-	for (i = I8259A_IRQ_BASE; i < I8259A_IRQ_BASE + 16; i++)
+	for (i = I8259A_IRQ_BASE; i < I8259A_IRQ_BASE + 16; i++) {
 		set_irq_chip_and_handler(i, &i8259A_chip, handle_level_irq);
+		set_irq_probe(i);
+	}
 
 	setup_irq(I8259A_IRQ_BASE + PIC_CASCADE_IR, &irq2);
 }
arch/mips/kernel/irq.c +5 -0
@@ -145,6 +145,11 @@ __setup("nokgdb", nokgdb);
 
 void __init init_IRQ(void)
 {
+	int i;
+
+	for (i = 0; i < NR_IRQS; i++)
+		set_irq_noprobe(i);
+
 	arch_init_irq();
 
 #ifdef CONFIG_KGDB
#32 lore raw

PATCH 17/76 ub: fix up the conversion to sg_init_table()

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Pete Zaitcev <[email protected]>

---
 drivers/block/ub.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/ub.c +1 -1
@@ -657,7 +657,6 @@ static int ub_request_fn_1(struct ub_lun
 	if ((cmd = ub_get_cmd(lun)) == NULL)
 		return -1;
 	memset(cmd, 0, sizeof(struct ub_scsi_cmd));
-	sg_init_table(cmd->sgv, UB_MAX_REQ_SG);
 
 	blkdev_dequeue_request(rq);
 
@@ -668,6 +667,7 @@ static int ub_request_fn_1(struct ub_lun
 	/*
 	 * get scatterlist from block layer
 	 */
+	sg_init_table(&urq->sgv[0], UB_MAX_REQ_SG);
 	n_elem = blk_rq_map_sg(lun->disk->queue, rq, &urq->sgv[0]);
 	if (n_elem < 0) {
 		/* Impossible, because blk_rq_map_sg should not hit ENOMEM. */
#42 lore raw

PATCH 27/76 SCSI ips: fix data buffer accessors conversion bug

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: FUJITA Tomonori <[email protected]>

This fixes a bug that can't handle a passthru command with more than two sg entries.

Big thanks to Tim Pepper for debugging the problem.

---
 drivers/scsi/ips.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/ips.c +1 -1
@@ -1580,7 +1580,7 @@ ips_make_passthru(ips_ha_t *ha, struct s
 	METHOD_TRACE("ips_make_passthru", 1);
 
         scsi_for_each_sg(SC, sg, scsi_sg_count(SC), i)
-                length += sg[i].length;
+		length += sg->length;
 
 	if (length < sizeof (ips_passthru_t)) {
 		/* wrong size */
#37 lore raw

PATCH 22/76 SCSI ips: handle scsi_add_host() failure, and other err cleanups

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Jeff Garzik <[email protected]>

commit 2551a13e61d3c3df6c2da6de5a3ece78e6d67111

FUJITA Tomonori notes:
It didn't intend to fix a critical bug, however, it turned out that it does. Without this patch, the ips driver in 2.6.23 and 2.6.24 doesn't work at all. You can find the more details at the following thread:

http://marc.info/?t=120293911900023&r=1&w=2

---
 drivers/scsi/ips.c |   18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/scsi/ips.c +13 -5
@@ -6842,13 +6842,10 @@ ips_register_scsi(int index)
 	if (request_irq(ha->irq, do_ipsintr, IRQF_SHARED, ips_name, ha)) {
 		IPS_PRINTK(KERN_WARNING, ha->pcidev,
 			   "Unable to install interrupt handler\n");
-		scsi_host_put(sh);
-		return -1;
+		goto err_out_sh;
 	}
 
 	kfree(oldha);
-	ips_sh[index] = sh;
-	ips_ha[index] = ha;
 
 	/* Store away needed values for later use */
 	sh->io_port = ha->io_addr;
@@ -6867,10 +6864,21 @@ ips_register_scsi(int index)
 	sh->max_channel = ha->nbus - 1;
 	sh->can_queue = ha->max_cmds - 1;
 
-	scsi_add_host(sh, NULL);
+	if (scsi_add_host(sh, &ha->pcidev->dev))
+		goto err_out;
+
+	ips_sh[index] = sh;
+	ips_ha[index] = ha;
+
 	scsi_scan_host(sh);
 
 	return 0;
+
+err_out:
+	free_irq(ha->pcidev->irq, ha);
+err_out_sh:
+	scsi_host_put(sh);
+	return -1;
 }
 
 /*---------------------------------------------------------------------------*/
#87 lore raw

PATCH 67/76 NETFILTER: nfnetlink_queue: fix computation of allocated size for netlink skb

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Eric Leblond <[email protected]>

Upstream commit cabaa9bf:

Size of the netlink skb was wrongly computed because the formula was using NLMSG_ALIGN instead of NLMSG_SPACE. NLMSG_ALIGN does not add the room for netlink header as NLMSG_SPACE does. This was causing a failure of message building in some cases.

On my test system, all messages for packets in range [8*k+41, 8*k+48] where k is an integer were invalid and the corresponding packets were dropped.

---

 net/netfilter/nfnetlink_queue.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nfnetlink_queue.c +1 -1
@@ -353,7 +353,7 @@ nfqnl_build_packet_message(struct nfqnl_
 
 	QDEBUG("entered\n");
 
-	size =    NLMSG_ALIGN(sizeof(struct nfgenmsg))
+	size =    NLMSG_SPACE(sizeof(struct nfgenmsg))
 		+ nla_total_size(sizeof(struct nfqnl_msg_packet_hdr))
 		+ nla_total_size(sizeof(u_int32_t))	/* ifindex */
 		+ nla_total_size(sizeof(u_int32_t))	/* ifindex */
#56 lore raw

PATCH 36/76 ufs: fix parenthesisation in ufs_set_fs_state()

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Roel Kluin <[email protected]>

This bug snuck in with

commit 252e211e90ce56bf005cb533ad5a297c18c19407

Author: Mark Fortescue <[email protected]>
Date:   Tue Oct 16 23:26:31 2007 -0700

Add in SunOS 4.1.x compatible mode for UFS

---
 fs/ufs/util.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ufs/util.h +1 -1
@@ -58,7 +58,7 @@ ufs_set_fs_state(struct super_block *sb,
 {
 	switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) {
 	case UFS_ST_SUNOS:
-		if (fs32_to_cpu(sb, usb3->fs_postblformat == UFS_42POSTBLFMT)) {
+		if (fs32_to_cpu(sb, usb3->fs_postblformat) == UFS_42POSTBLFMT) {
 			usb1->fs_u0.fs_sun.fs_state = cpu_to_fs32(sb, value);
 			break;
 		}
#35 lore raw

PATCH 20/76 drivers: fix dma_get_required_mask

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: James Bottomley <[email protected]>

There's a bug in the current implementation of dma_get_required_mask() where it ands the returned mask with the current device mask. This rather defeats the purpose if you're using the call to determine what your mask should be (since you will at that time have the default DMA_32BIT_MASK). This bug results in any driver that uses this function *always* getting a 32 bit mask, which is wrong.

Fix by removing the and with dev->dma_mask.

---
 drivers/base/platform.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/platform.c +1 -1
@@ -647,7 +647,7 @@ u64 dma_get_required_mask(struct device 
 		high_totalram += high_totalram - 1;
 		mask = (((u64)high_totalram) << 32) + 0xffffffff;
 	}
-	return mask & *dev->dma_mask;
+	return mask;
 }
 EXPORT_SYMBOL_GPL(dma_get_required_mask);
 #endif
#2 lore raw

PATCH 2/76 SPARC64: Loosen checks in exception table handling.

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: David S. Miller <[email protected]>

Upstream commits: 622eaec613130e6ea78f2a5d5070e3278b21cd8f

                  be71716e464f4ea38f08034dc666f2feb55535d9

Some parts of the kernel now do things like do *_user() accesses while set_fs(KERNEL_DS) that fault on purpose.

See, for example, the code added by changeset a0c1e9073ef7428a14309cba010633a6cd6719ea ("futex: runtime enable pi and robust functionality").

That trips up the ASI sanity checking we make in do_kernel_fault().

Just remove it for now. Maybe we can add it back later with an added conditional which looks at the current get_fs() value.

Also, because of the new futex validation init handler, we have to accept faults in init section text as well as the normal kernel text.

Thanks to Tom Callaway for the bug report.

---
 arch/sparc64/mm/fault.c |   14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
arch/sparc64/mm/fault.c +3 -11
@@ -244,16 +244,8 @@ static void do_kernel_fault(struct pt_re
 	if (regs->tstate & TSTATE_PRIV) {
 		const struct exception_table_entry *entry;
 
-		if (asi == ASI_P && (insn & 0xc0800000) == 0xc0800000) {
-			if (insn & 0x2000)
-				asi = (regs->tstate >> 24);
-			else
-				asi = (insn >> 5);
-		}
-	
-		/* Look in asi.h: All _S asis have LS bit set */
-		if ((asi & 0x1) &&
-		    (entry = search_exception_tables(regs->tpc))) {
+		entry = search_exception_tables(regs->tpc);
+		if (entry) {
 			regs->tpc = entry->fixup;
 			regs->tnpc = regs->tpc + 4;
 			return;
@@ -294,7 +286,7 @@ asmlinkage void __kprobes do_sparc64_fau
 		unsigned long tpc = regs->tpc;
 
 		/* Sanity check the PC. */
-		if ((tpc >= KERNBASE && tpc < (unsigned long) _etext) ||
+		if ((tpc >= KERNBASE && tpc < (unsigned long) __init_end) ||
 		    (tpc >= MODULES_VADDR && tpc < MODULES_END)) {
 			/* Valid, no problems... */
 		} else {
#43 lore raw

PATCH 28/76 SCSI gdth: dont call pci_free_consistent under spinlock

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: James Bottomley <[email protected]>

The spinlock is held over too large a region: pscratch is a permanent address (it's allocated at boot time and never changes). All you need the smp lock for is mediating the scratch in use flag, so fix this by moving the spinlock into the case where we set the pscratch_busy flag to false.

---
 drivers/scsi/gdth_proc.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/scsi/gdth_proc.c +2 -4
@@ -694,15 +694,13 @@ static void gdth_ioctl_free(gdth_ha_str 
 {
     ulong flags;
 
-    spin_lock_irqsave(&ha->smp_lock, flags);
-
     if (buf == ha->pscratch) {
+	spin_lock_irqsave(&ha->smp_lock, flags);
         ha->scratch_busy = FALSE;
+	spin_unlock_irqrestore(&ha->smp_lock, flags);
     } else {
         pci_free_consistent(ha->pdev, size, buf, paddr);
     }
-
-    spin_unlock_irqrestore(&ha->smp_lock, flags);
 }
 
 #ifdef GDTH_IOCTL_PROC
#93 lore raw

PATCH 73/76 async_tx: avoid the async xor_zero_sum path when src_cnt > device->max_xor

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Dan Williams <[email protected]>

If the channel cannot perform the operation in one call to ->device_prep_dma_zero_sum, then fallback to the xor+page_is_zero path. This only affects users with arrays larger than 16 devices on iop13xx or 32 devices on iop3xx.

---
please verify the backport makes sense

 crypto/async_tx/async_xor.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
crypto/async_tx/async_xor.c +1 -1
@@ -264,7 +264,7 @@ async_xor_zero_sum(struct page *dest, st
 
 	BUG_ON(src_cnt <= 1);
 
-	if (tx) {
+	if (tx && src_cnt <= device->max_xor) {
 		dma_addr_t dma_addr;
 		enum dma_data_direction dir;
 
#3 lore raw

PATCH 3/76 SPARC: Fix link errors with gcc-4.3

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: David S. Miller <[email protected]>

Upstream commit: f0e98c387e61de00646be31fab4c2fa0224e1efb

Reported by Adrian Bunk.

Just like in changeset a3f9985843b674cbcb58f39fab8416675e7ab842 ("[SPARC64]: Move kernel unaligned trap handlers into assembler file.") we have to move the assembler bits into a seperate asm file because as far as the compiler is concerned these inline bits we're doing in unaligned.c are unreachable.

---
 arch/sparc/kernel/Makefile    |    5 
 arch/sparc/kernel/una_asm.S   |  153 +++++++++++++++++++++++++
 arch/sparc/kernel/unaligned.c |  252 +++++++-----------------------------------
 3 files changed, 203 insertions(+), 207 deletions(-)
arch/sparc/kernel/Makefile +3 -2
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.62 2000/12/15 00:41:17 davem Exp $
+#
 # Makefile for the linux kernel.
 #
 
@@ -12,7 +12,8 @@ obj-y    := entry.o wof.o wuf.o etrap.o 
 	    sys_sparc.o sunos_asm.o systbls.o \
 	    time.o windows.o cpu.o devices.o sclow.o \
 	    tadpole.o tick14.o ptrace.o sys_solaris.o \
-	    unaligned.o muldiv.o semaphore.o prom.o of_device.o devres.o
+	    unaligned.o una_asm.o muldiv.o semaphore.o \
+	    prom.o of_device.o devres.o
 
 devres-y = ../../../kernel/irq/devres.o
 
arch/sparc/kernel/una_asm.S new file +153 -0

153 lines not on this page · raw message

arch/sparc/kernel/unaligned.c +47 -205

325 lines not on this page · raw message

#96 lore raw

PATCH 76/76 relay: fix subbuf_splice_actor() adding too many pages

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Jens Axboe <[email protected]>

If subbuf_pages was larger than the max number of pages the pipe buffer will hold, subbuf_splice_actor() would happily go beyond the array size.

---
 kernel/relay.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
kernel/relay.c +3 -2
@@ -1072,7 +1072,7 @@ static int subbuf_splice_actor(struct fi
 			       unsigned int flags,
 			       int *nonpad_ret)
 {
-	unsigned int pidx, poff, total_len, subbuf_pages, ret;
+	unsigned int pidx, poff, total_len, subbuf_pages, nr_pages, ret;
 	struct rchan_buf *rbuf = in->private_data;
 	unsigned int subbuf_size = rbuf->chan->subbuf_size;
 	uint64_t pos = (uint64_t) *ppos;
@@ -1103,8 +1103,9 @@ static int subbuf_splice_actor(struct fi
 	subbuf_pages = rbuf->chan->alloc_size >> PAGE_SHIFT;
 	pidx = (read_start / PAGE_SIZE) % subbuf_pages;
 	poff = read_start & ~PAGE_MASK;
+	nr_pages = min_t(unsigned int, subbuf_pages, PIPE_BUFFERS);
 
-	for (total_len = 0; spd.nr_pages < subbuf_pages; spd.nr_pages++) {
+	for (total_len = 0; spd.nr_pages < nr_pages; spd.nr_pages++) {
 		unsigned int this_len, this_end, private;
 		unsigned int cur_pos = read_start + total_len;
 
#95 lore raw

PATCH 75/76 BLUETOOTH: Fix bugs in previous conn add/del workqueue changes.

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Dave Young <[email protected]>

Jens Axboe noticed that we were queueing &conn->work on both btaddconn and keventd_wq.

---
 net/bluetooth/hci_sysfs.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
net/bluetooth/hci_sysfs.c +6 -2
@@ -282,6 +282,7 @@ static void add_conn(struct work_struct 
 	int i;
 
 	flush_workqueue(btdelconn);
+
 	if (device_add(&conn->dev) < 0) {
 		BT_ERR("Failed to register connection device");
 		return;
@@ -317,7 +318,6 @@ void hci_conn_add_sysfs(struct hci_conn 
 	INIT_WORK(&conn->work, add_conn);
 
 	queue_work(btaddconn, &conn->work);
-	schedule_work(&conn->work);
 }
 
 static int __match_tty(struct device *dev, void *data)
@@ -354,7 +354,6 @@ void hci_conn_del_sysfs(struct hci_conn 
 	INIT_WORK(&conn->work, del_conn);
 
 	queue_work(btdelconn, &conn->work);
-	schedule_work(&conn->work);
 }
 
 int hci_register_sysfs(struct hci_dev *hdev)
@@ -408,6 +407,7 @@ int __init bt_sysfs_init(void)
 		err = -ENOMEM;
 		goto out;
 	}
+
 	btdelconn = create_singlethread_workqueue("btdelconn");
 	if (!btdelconn) {
 		err = -ENOMEM;
@@ -447,8 +447,12 @@ out:
 void bt_sysfs_cleanup(void)
 {
 	destroy_workqueue(btaddconn);
+
 	destroy_workqueue(btdelconn);
+
 	class_destroy(bt_class);
+
 	bus_unregister(&bt_bus);
+
 	platform_device_unregister(bt_platform);
 }
#85 lore raw

PATCH 65/76 sched_nr_migrate wrong mode bits

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Michal Schmidt <[email protected]>

sched_nr_migrate has strange permission bits:

 $ ls -l /proc/sys/kernel/sched_nr_migrate
 --w----r-T 1 root root 0 2008-03-17 23:31 /proc/sys/kernel/sched_nr_migrate

The bug is an obvious decimal/octal confusion.

Fixed (collaterally) in Linus's tree by Peter Zijlstra with commit fa85ae241 "sched: rt time limit" (in 2.6.25-rc1).

---
 kernel/sysctl.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sysctl.c +1 -1
@@ -306,7 +306,7 @@ static struct ctl_table kern_table[] = {
 		.procname	= "sched_nr_migrate",
 		.data		= &sysctl_sched_nr_migrate,
 		.maxlen		= sizeof(unsigned int),
-		.mode		= 644,
+		.mode		= 0644,
 		.proc_handler	= &proc_dointvec,
 	},
 #endif
#59 lore raw

PATCH 39/76 NETFILTER: Fix incorrect use of skb_make_writable

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Patrick McHardy <[email protected]>

Upstream commit eb1197bc0:

http://bugzilla.kernel.org/show_bug.cgi?id=9920
The function skb_make_writable returns true or false.

---

 net/bridge/netfilter/ebt_dnat.c     |    2 +-
 net/bridge/netfilter/ebt_redirect.c |    2 +-
 net/bridge/netfilter/ebt_snat.c     |    2 +-
 net/ipv4/netfilter/arpt_mangle.c    |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
net/bridge/netfilter/ebt_dnat.c +1 -1
@@ -20,7 +20,7 @@ static int ebt_target_dnat(struct sk_buf
 {
 	struct ebt_nat_info *info = (struct ebt_nat_info *)data;
 
-	if (skb_make_writable(skb, 0))
+	if (!skb_make_writable(skb, 0))
 		return NF_DROP;
 
 	memcpy(eth_hdr(skb)->h_dest, info->mac, ETH_ALEN);
net/bridge/netfilter/ebt_redirect.c +1 -1
@@ -21,7 +21,7 @@ static int ebt_target_redirect(struct sk
 {
 	struct ebt_redirect_info *info = (struct ebt_redirect_info *)data;
 
-	if (skb_make_writable(skb, 0))
+	if (!skb_make_writable(skb, 0))
 		return NF_DROP;
 
 	if (hooknr != NF_BR_BROUTING)
net/bridge/netfilter/ebt_snat.c +1 -1
@@ -22,7 +22,7 @@ static int ebt_target_snat(struct sk_buf
 {
 	struct ebt_nat_info *info = (struct ebt_nat_info *) data;
 
-	if (skb_make_writable(skb, 0))
+	if (!skb_make_writable(skb, 0))
 		return NF_DROP;
 
 	memcpy(eth_hdr(skb)->h_source, info->mac, ETH_ALEN);
net/ipv4/netfilter/arpt_mangle.c +1 -1
@@ -19,7 +19,7 @@ target(struct sk_buff *skb,
 	unsigned char *arpptr;
 	int pln, hln;
 
-	if (skb_make_writable(skb, skb->len))
+	if (!skb_make_writable(skb, skb->len))
 		return NF_DROP;
 
 	arp = arp_hdr(skb);
#58 lore raw

PATCH 38/76 NETFILTER: nfnetlink_queue: fix SKB_LINEAR_ASSERT when mangling packet data

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Patrick McHardy <[email protected]>

Upstream commit e2b58a67:

As reported by Tomas Simonaitis <[email protected]>, inserting new data in skbs queued over {ip,ip6,nfnetlink}_queue triggers a SKB_LINEAR_ASSERT in skb_put().

Going back through the git history, it seems this bug is present since at least 2.6.12-rc2, probably even since the removal of skb_linearize() for netfilter.

Linearize non-linear skbs through skb_copy_expand() when enlarging them. Tested by Thomas, fixes bugzilla #9933.

---
Patrick, which part of commit log did you want to drop?

 net/ipv4/netfilter/ip_queue.c   |   12 +++++++-----
 net/ipv6/netfilter/ip6_queue.c  |   10 ++++++----
 net/netfilter/nfnetlink_queue.c |   10 ++++++----
 3 files changed, 19 insertions(+), 13 deletions(-)
net/ipv4/netfilter/ip_queue.c +7 -5
@@ -336,8 +336,8 @@ static int
 ipq_mangle_ipv4(ipq_verdict_msg_t *v, struct ipq_queue_entry *e)
 {
 	int diff;
-	int err;
 	struct iphdr *user_iph = (struct iphdr *)v->payload;
+	struct sk_buff *nskb;
 
 	if (v->data_len < sizeof(*user_iph))
 		return 0;
@@ -349,14 +349,16 @@ ipq_mangle_ipv4(ipq_verdict_msg_t *v, st
 		if (v->data_len > 0xFFFF)
 			return -EINVAL;
 		if (diff > skb_tailroom(e->skb)) {
-			err = pskb_expand_head(e->skb, 0,
+			nskb = skb_copy_expand(e->skb, 0,
 					       diff - skb_tailroom(e->skb),
 					       GFP_ATOMIC);
-			if (err) {
+			if (!nskb) {
 				printk(KERN_WARNING "ip_queue: error "
-				      "in mangle, dropping packet: %d\n", -err);
-				return err;
+				      "in mangle, dropping packet\n");
+				return -ENOMEM;
 			}
+			kfree_skb(e->skb);
+			e->skb = nskb;
 		}
 		skb_put(e->skb, diff);
 	}
net/ipv6/netfilter/ip6_queue.c +6 -4
@@ -333,8 +333,8 @@ static int
 ipq_mangle_ipv6(ipq_verdict_msg_t *v, struct ipq_queue_entry *e)
 {
 	int diff;
-	int err;
 	struct ipv6hdr *user_iph = (struct ipv6hdr *)v->payload;
+	struct sk_buff *nskb;
 
 	if (v->data_len < sizeof(*user_iph))
 		return 0;
@@ -346,14 +346,16 @@ ipq_mangle_ipv6(ipq_verdict_msg_t *v, st
 		if (v->data_len > 0xFFFF)
 			return -EINVAL;
 		if (diff > skb_tailroom(e->skb)) {
-			err = pskb_expand_head(e->skb, 0,
+			nskb = skb_copy_expand(e->skb, 0,
 					       diff - skb_tailroom(e->skb),
 					       GFP_ATOMIC);
-			if (err) {
+			if (!nskb) {
 				printk(KERN_WARNING "ip6_queue: OOM "
 				      "in mangle, dropping packet\n");
-				return err;
+				return -ENOMEM;
 			}
+			kfree_skb(e->skb);
+			e->skb = nskb;
 		}
 		skb_put(e->skb, diff);
 	}
net/netfilter/nfnetlink_queue.c +6 -4
@@ -616,8 +616,8 @@ err_out_put:
 static int
 nfqnl_mangle(void *data, int data_len, struct nfqnl_queue_entry *e)
 {
+	struct sk_buff *nskb;
 	int diff;
-	int err;
 
 	diff = data_len - e->skb->len;
 	if (diff < 0) {
@@ -627,14 +627,16 @@ nfqnl_mangle(void *data, int data_len, s
 		if (data_len > 0xFFFF)
 			return -EINVAL;
 		if (diff > skb_tailroom(e->skb)) {
-			err = pskb_expand_head(e->skb, 0,
+			nskb = skb_copy_expand(e->skb, 0,
 					       diff - skb_tailroom(e->skb),
 					       GFP_ATOMIC);
-			if (err) {
+			if (!nskb) {
 				printk(KERN_WARNING "nf_queue: OOM "
 				      "in mangle, dropping packet\n");
-				return err;
+				return -ENOMEM;
 			}
+			kfree_skb(e->skb);
+			e->skb = nskb;
 		}
 		skb_put(e->skb, diff);
 	}
#92 lore raw

PATCH 72/76 aio: bad AIO race in aio_complete() leads to process hang

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Quentin Barnes <[email protected]>

My group ran into a AIO process hang on a 2.6.24 kernel with the process sleeping indefinitely in io_getevents(2) waiting for the last wakeup to come and it never would.

We ran the tests on x86_64 SMP. The hang only occurred on a Xeon box ("Clovertown") but not a Core2Duo ("Conroe"). On the Xeon, the L2 cache isn't shared between all eight processors, but is L2 is shared between between all two processors on the Core2Duo we use.

My analysis of the hang is if you go down to the second while-loop in read_events(), what happens on processor #1:
1) add_wait_queue_exclusive() adds thread to ctx->wait
2) aio_read_evt() to check tail
3) if aio_read_evt() returned 0, call [io_]schedule() and sleep

In aio_complete() with processor #2:

	A) info->tail = tail;
	B) waitqueue_active(&ctx->wait)
	C) if waitqueue_active() returned non-0, call wake_up()

The way the code is written, step 1 must be seen by all other processors before processor 1 checks for pending events in step 2 (that were recorded by step A) and step A by processor 2 must be seen by all other processors (checked in step 2) before step B is done.

The race I believed I was seeing is that steps 1 and 2 were effectively swapped due to the __list_add() being delayed by the L2 cache not shared by some of the other processors. Imagine:
proc 2: just before step A
proc 1, step 1: adds to ctx->wait, but is not visible by other processors yet proc 1, step 2: checks tail and sees no pending events
proc 2, step A: updates tail
proc 1, step 3: calls [io_]schedule() and sleeps
proc 2, step B: checks ctx->wait, but sees no one waiting, skips wakeup
so proc 1 sleeps indefinitely

My patch adds a memory barrier between steps A and B. It ensures that the update in step 1 gets seen on processor 2 before continuing. If processor 1 was just before step 1, the memory barrier makes sure that step A (update tail) gets seen by the time processor 1 makes it to step 2 (check tail).

Before the patch our AIO process would hang virtually 100% of the time. After the patch, we have yet to see the process ever hang.

[ We should probably disallow that "if (waitqueue_active()) wake_up()"
coding pattern, because it's so often buggy wrt memory ordering ]

---
 fs/aio.c |    8 ++++++++
 1 file changed, 8 insertions(+)
fs/aio.c +8 -0
@@ -997,6 +997,14 @@ put_rq:
 	/* everything turned out well, dispose of the aiocb. */
 	ret = __aio_put_req(ctx, iocb);
 
+	/*
+	 * We have to order our ring_info tail store above and test
+	 * of the wait list below outside the wait lock.  This is
+	 * like in wake_up_bit() where clearing a bit has to be
+	 * ordered with the unlocked test.
+	 */
+	smp_mb();
+
 	if (waitqueue_active(&ctx->wait))
 		wake_up(&ctx->wait);
 
#60 lore raw

PATCH 40/76 NETFILTER: fix ebtable targets return

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Patrick McHardy <[email protected]>

Upstream commit 1b04ab459:

The function ebt_do_table doesn't take NF_DROP as a verdict from the targets.

---

 net/bridge/netfilter/ebt_dnat.c     |    2 +-
 net/bridge/netfilter/ebt_redirect.c |    2 +-
 net/bridge/netfilter/ebt_snat.c     |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
net/bridge/netfilter/ebt_dnat.c +1 -1
@@ -21,7 +21,7 @@ static int ebt_target_dnat(struct sk_buf
 	struct ebt_nat_info *info = (struct ebt_nat_info *)data;
 
 	if (!skb_make_writable(skb, 0))
-		return NF_DROP;
+		return EBT_DROP;
 
 	memcpy(eth_hdr(skb)->h_dest, info->mac, ETH_ALEN);
 	return info->target;
net/bridge/netfilter/ebt_redirect.c +1 -1
@@ -22,7 +22,7 @@ static int ebt_target_redirect(struct sk
 	struct ebt_redirect_info *info = (struct ebt_redirect_info *)data;
 
 	if (!skb_make_writable(skb, 0))
-		return NF_DROP;
+		return EBT_DROP;
 
 	if (hooknr != NF_BR_BROUTING)
 		memcpy(eth_hdr(skb)->h_dest,
net/bridge/netfilter/ebt_snat.c +1 -1
@@ -23,7 +23,7 @@ static int ebt_target_snat(struct sk_buf
 	struct ebt_nat_info *info = (struct ebt_nat_info *) data;
 
 	if (!skb_make_writable(skb, 0))
-		return NF_DROP;
+		return EBT_DROP;
 
 	memcpy(eth_hdr(skb)->h_source, info->mac, ETH_ALEN);
 	if (!(info->target & NAT_ARP_BIT) &&
#94 lore raw

PATCH 74/76 SCSI advansys: Fix bug in AdvLoadMicrocode

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Matthew Wilcox <[email protected]>

buf[i] can be up to 0xfd, so doubling it and assigning the result to an unsigned char truncates the value. Just use an unsigned int instead; it's only a temporary.

---
 drivers/scsi/advansys.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/advansys.c +1 -1
@@ -6439,7 +6439,7 @@ static int AdvLoadMicrocode(AdvPortAddr 
 			i += 2;
 			len += 2;
 		} else {
-			unsigned char off = buf[i] * 2;
+			unsigned int off = buf[i] * 2;
 			unsigned short word = (buf[off + 1] << 8) | buf[off];
 			AdvWriteWordAutoIncLram(iop_base, word);
 			len += 2;
#84 lore raw

PATCH 64/76 nfsd: fix oops on access from high-numbered ports

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: J. Bruce Fields <[email protected]>

This bug was always here, but before my commit 6fa02839bf9412e18e77 ("recheck for secure ports in fh_verify"), it could only be triggered by failure of a kmalloc(). After that commit it could be triggered by a client making a request from a non-reserved port for access to an export marked "secure". (Exports are "secure" by default.)

The result is a struct svc_export with a reference count one too low, resulting in likely oopses next time the export is accessed.

The reference counting here is not straightforward; a later patch will clean up fh_verify().

Thanks to Lukas Hejtmanek for the bug report and followup.

---
 fs/nfsd/nfsfh.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfsd/nfsfh.c +2 -2
@@ -231,6 +231,7 @@ fh_verify(struct svc_rqst *rqstp, struct
 		fhp->fh_dentry = dentry;
 		fhp->fh_export = exp;
 		nfsd_nr_verified++;
+		cache_get(&exp->h);
 	} else {
 		/*
 		 * just rechecking permissions
@@ -240,6 +241,7 @@ fh_verify(struct svc_rqst *rqstp, struct
 		dprintk("nfsd: fh_verify - just checking\n");
 		dentry = fhp->fh_dentry;
 		exp = fhp->fh_export;
+		cache_get(&exp->h);
 		/*
 		 * Set user creds for this exportpoint; necessary even
 		 * in the "just checking" case because this may be a
@@ -251,8 +253,6 @@ fh_verify(struct svc_rqst *rqstp, struct
 		if (error)
 			goto out;
 	}
-	cache_get(&exp->h);
-
 
 	error = nfsd_mode_check(rqstp, dentry->d_inode->i_mode, type);
 	if (error)
#91 lore raw

PATCH 71/76 jbd: correctly unescape journal data blocks

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Duane Griffin <[email protected]>

Fix a long-standing typo (predating git) that will cause data corruption if a journal data block needs unescaping. At the moment the wrong buffer head's data is being unescaped.

To test this case mount a filesystem with data=journal, start creating and deleting a bunch of files containing only JFS_MAGIC_NUMBER (0xc03b3998), then pull the plug on the device. Without this patch the files will contain zeros instead of the correct data after recovery.

---
 fs/jbd/recovery.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/jbd/recovery.c +1 -1
@@ -478,7 +478,7 @@ static int do_one_pass(journal_t *journa
 					memcpy(nbh->b_data, obh->b_data,
 							journal->j_blocksize);
 					if (flags & JFS_FLAG_ESCAPE) {
-						*((__be32 *)bh->b_data) =
+						*((__be32 *)nbh->b_data) =
 						cpu_to_be32(JFS_MAGIC_NUMBER);
 					}
 
#86 lore raw

PATCH 66/76 NETFILTER: xt_time: fix failure to match on Sundays

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Jan Engelhardt <[email protected]>

Upstream commit 4f4c9430:

xt_time_match() in net/netfilter/xt_time.c in kernel 2.6.24 never matches on Sundays. On my host I have a rule like

iptables -A OUTPUT -m time --weekdays Sun -j REJECT

and it never matches. The problem is in localtime_2(), which uses

    r->weekday = (4 + r->dse) % 7;

to map the epoch day onto a weekday in {0,...,6}. In particular this gives 0 for Sundays. But 0 has to be wrong; a weekday of 0 can never match. xt_time_match() has

    if (!(info->weekdays_match & (1 << current_time.weekday)))
        return false;

and when current_time.weekday = 0, the result of the & is always zero, even when info->weekdays_match = XT_TIME_ALL_WEEKDAYS = 0xFE.

---

 net/netfilter/xt_time.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
net/netfilter/xt_time.c +5 -2
@@ -95,8 +95,11 @@ static inline void localtime_2(struct xt
 	 */
 	r->dse = time / 86400;
 
-	/* 1970-01-01 (w=0) was a Thursday (4). */
-	r->weekday = (4 + r->dse) % 7;
+	/*
+	 * 1970-01-01 (w=0) was a Thursday (4).
+	 * -1 and +1 map Sunday properly onto 7.
+	 */
+	r->weekday = (4 + r->dse - 1) % 7 + 1;
 }
 
 static void localtime_3(struct xtm *r, time_t time)
#90 lore raw

PATCH 70/76 jbd2: correctly unescape journal data blocks

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Duane Griffin <[email protected]>

Fix a long-standing typo (predating git) that will cause data corruption if a journal data block needs unescaping. At the moment the wrong buffer head's data is being unescaped.

To test this case mount a filesystem with data=journal, start creating and deleting a bunch of files containing only JBD2_MAGIC_NUMBER (0xc03b3998), then pull the plug on the device. Without this patch the files will contain zeros instead of the correct data after recovery.

---
 fs/jbd2/recovery.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/jbd2/recovery.c +1 -1
@@ -488,7 +488,7 @@ static int do_one_pass(journal_t *journa
 					memcpy(nbh->b_data, obh->b_data,
 							journal->j_blocksize);
 					if (flags & JBD2_FLAG_ESCAPE) {
-						*((__be32 *)bh->b_data) =
+						*((__be32 *)nbh->b_data) =
 						cpu_to_be32(JBD2_MAGIC_NUMBER);
 					}
 
#38 lore raw

PATCH 23/76 CRYPTO xcbc: Fix crash with IPsec

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Joy Latten <[email protected]>

[ Upstream commit: 2f40a178e70030c4712fe63807c883f34c3645eb ]

When using aes-xcbc-mac for authentication in IPsec, the kernel crashes. It seems this algorithm doesn't account for the space IPsec may make in scatterlist for authtag. Thus when crypto_xcbc_digest_update2() gets called, nbytes may be less than sg[i].length.
Since nbytes is an unsigned number, it wraps
at the end of the loop allowing us to go back
into loop and causing crash in memcpy.

I used update function in digest.c to model this fix. Please let me know if it looks ok.

---
 crypto/xcbc.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
crypto/xcbc.c +5 -1
@@ -124,6 +124,11 @@ static int crypto_xcbc_digest_update2(st
 		unsigned int offset = sg[i].offset;
 		unsigned int slen = sg[i].length;
 
+		if (unlikely(slen > nbytes))
+			slen = nbytes;
+
+		nbytes -= slen;
+
 		while (slen > 0) {
 			unsigned int len = min(slen, ((unsigned int)(PAGE_SIZE)) - offset);
 			char *p = crypto_kmap(pg, 0) + offset;
@@ -177,7 +182,6 @@ static int crypto_xcbc_digest_update2(st
 			offset = 0;
 			pg++;
 		}
-		nbytes-=sg[i].length;
 		i++;
 	} while (nbytes>0);
 
#67 lore raw

PATCH 47/76 b43: Backport bcm4311 fix

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Michael Buesch <[email protected]>

This is a backport of upstream commit 013978b6 ("b43: Changes to enable BCM4311 rev 02 with wireless core revision 13") and the changes include the following:

(1) Add the 802.11 rev 13 device to the ssb_device_id table to load b43.
(2) Add PHY revision 9 to the supported list.
(3) Change the 2-bit routing code for address extensions to 0b10 rather than the 0b01 used for the 32-bit case.
(4) Remove some magic numbers in the DMA setup.

The DMA implementation for this chip supports full 64-bit addressing with one exception. Whenever the Descriptor Ring Buffer is in high memory, a fatal DMA error occurs. This problem was not present in 2.6.24-rc2 due to code to "Bias the placement of kernel pages at lower PFNs". When commit 44048d70 reverted that code, the DMA error appeared. As a "fix", use the GFP_DMA flag when allocating the buffer for 64-bit DMA. At present, this problem is thought to arise from a hardware error.

---
 drivers/net/wireless/b43/dma.c  |   30 ++++++++++++++++++++++--------
 drivers/net/wireless/b43/main.c |    3 ++-
 2 files changed, 24 insertions(+), 9 deletions(-)
drivers/net/wireless/b43/dma.c +22 -8
@@ -165,7 +165,7 @@ static void op64_fill_descriptor(struct 
 	addrhi = (((u64) dmaaddr >> 32) & ~SSB_DMA_TRANSLATION_MASK);
 	addrext = (((u64) dmaaddr >> 32) & SSB_DMA_TRANSLATION_MASK)
 	    >> SSB_DMA_TRANSLATION_SHIFT;
-	addrhi |= ssb_dma_translation(ring->dev->dev);
+	addrhi |= (ssb_dma_translation(ring->dev->dev) << 1);
 	if (slot == ring->nr_slots - 1)
 		ctl0 |= B43_DMA64_DCTL0_DTABLEEND;
 	if (start)
@@ -426,9 +426,21 @@ static inline
 static int alloc_ringmemory(struct b43_dmaring *ring)
 {
 	struct device *dev = ring->dev->dev->dev;
+	gfp_t flags = GFP_KERNEL;
 
+	/* The specs call for 4K buffers for 30- and 32-bit DMA with 4K
+	 * alignment and 8K buffers for 64-bit DMA with 8K alignment. Testing
+	 * has shown that 4K is sufficient for the latter as long as the buffer
+	 * does not cross an 8K boundary.
+	 *
+	 * For unknown reasons - possibly a hardware error - the BCM4311 rev
+	 * 02, which uses 64-bit DMA, needs the ring buffer in very low memory,
+	 * which accounts for the GFP_DMA flag below.
+	 */
+	if (ring->dma64)
+		flags |= GFP_DMA;
 	ring->descbase = dma_alloc_coherent(dev, B43_DMA_RINGMEMSIZE,
-					    &(ring->dmabase), GFP_KERNEL);
+					    &(ring->dmabase), flags);
 	if (!ring->descbase) {
 		b43err(ring->dev->wl, "DMA ringmemory allocation failed\n");
 		return -ENOMEM;
@@ -483,7 +495,7 @@ int b43_dmacontroller_rx_reset(struct b4
 	return 0;
 }
 
-/* Reset the RX DMA channel */
+/* Reset the TX DMA channel */
 int b43_dmacontroller_tx_reset(struct b43_wldev *dev, u16 mmio_base, int dma64)
 {
 	int i;
@@ -647,7 +659,7 @@ static int dmacontroller_setup(struct b4
 			b43_dma_write(ring, B43_DMA64_TXRINGHI,
 				      ((ringbase >> 32) &
 				       ~SSB_DMA_TRANSLATION_MASK)
-				      | trans);
+				      | (trans << 1));
 		} else {
 			u32 ringbase = (u32) (ring->dmabase);
 
@@ -680,8 +692,9 @@ static int dmacontroller_setup(struct b4
 			b43_dma_write(ring, B43_DMA64_RXRINGHI,
 				      ((ringbase >> 32) &
 				       ~SSB_DMA_TRANSLATION_MASK)
-				      | trans);
-			b43_dma_write(ring, B43_DMA64_RXINDEX, 200);
+				      | (trans << 1));
+			b43_dma_write(ring, B43_DMA64_RXINDEX, ring->nr_slots *
+				      sizeof(struct b43_dmadesc64));
 		} else {
 			u32 ringbase = (u32) (ring->dmabase);
 
@@ -695,11 +708,12 @@ static int dmacontroller_setup(struct b4
 			b43_dma_write(ring, B43_DMA32_RXRING,
 				      (ringbase & ~SSB_DMA_TRANSLATION_MASK)
 				      | trans);
-			b43_dma_write(ring, B43_DMA32_RXINDEX, 200);
+			b43_dma_write(ring, B43_DMA32_RXINDEX, ring->nr_slots *
+				      sizeof(struct b43_dmadesc32));
 		}
 	}
 
-      out:
+out:
 	return err;
 }
 
drivers/net/wireless/b43/main.c +2 -1
@@ -101,6 +101,7 @@ static const struct ssb_device_id b43_ss
 	SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 7),
 	SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 9),
 	SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 10),
+	SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 13),
 	SSB_DEVTABLE_END
 };
 
@@ -3079,7 +3080,7 @@ static int b43_phy_versioning(struct b43
 			unsupported = 1;
 		break;
 	case B43_PHYTYPE_G:
-		if (phy_rev > 8)
+		if (phy_rev > 9)
 			unsupported = 1;
 		break;
 	default:
#72 lore raw

PATCH 52/76 eCryptfs: make ecryptfs_prepare_write decrypt the page

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Michael Halcrow <[email protected]>

When the page is not up to date, ecryptfs_prepare_write() should be acting much like ecryptfs_readpage(). This includes the painfully obvious step of actually decrypting the page contents read from the lower encrypted file.

Note that this patch resolves a bug in eCryptfs in 2.6.24 that one can produce with these steps:

# mount -t ecryptfs /secret /secret
# echo "abc" > /secret/file.txt
# umount /secret
# mount -t ecryptfs /secret /secret
# echo "def" >> /secret/file.txt
# cat /secret/file.txt

Without this patch, the resulting data returned from cat is likely to be something other than "abc\ndef\n".

(Thanks to Benedikt Driessen for reporting this.)

---
 fs/ecryptfs/mmap.c |  102 +++++++++++++++++++++++++++++++++++++++--------------
 1 file changed, 76 insertions(+), 26 deletions(-)
fs/ecryptfs/mmap.c +76 -26
@@ -263,52 +263,102 @@ out:
 	return 0;
 }
 
-/* This function must zero any hole we create */
+/**
+ * ecryptfs_prepare_write
+ * @file: The eCryptfs file
+ * @page: The eCryptfs page
+ * @from: The start byte from which we will write
+ * @to: The end byte to which we will write
+ *
+ * This function must zero any hole we create
+ *
+ * Returns zero on success; non-zero otherwise
+ */
 static int ecryptfs_prepare_write(struct file *file, struct page *page,
 				  unsigned from, unsigned to)
 {
-	int rc = 0;
 	loff_t prev_page_end_size;
+	int rc = 0;
 
 	if (!PageUptodate(page)) {
-		rc = ecryptfs_read_lower_page_segment(page, page->index, 0,
-						      PAGE_CACHE_SIZE,
-						      page->mapping->host);
-		if (rc) {
-			printk(KERN_ERR "%s: Error attemping to read lower "
-			       "page segment; rc = [%d]\n", __FUNCTION__, rc);
-			ClearPageUptodate(page);
-			goto out;
-		} else
+		struct ecryptfs_crypt_stat *crypt_stat =
+			&ecryptfs_inode_to_private(
+				file->f_path.dentry->d_inode)->crypt_stat;
+
+		if (!(crypt_stat->flags & ECRYPTFS_ENCRYPTED)
+		    || (crypt_stat->flags & ECRYPTFS_NEW_FILE)) {
+			rc = ecryptfs_read_lower_page_segment(
+				page, page->index, 0, PAGE_CACHE_SIZE,
+				page->mapping->host);
+			if (rc) {
+				printk(KERN_ERR "%s: Error attemping to read "
+				       "lower page segment; rc = [%d]\n",
+				       __FUNCTION__, rc);
+				ClearPageUptodate(page);
+				goto out;
+			} else
+				SetPageUptodate(page);
+		} else if (crypt_stat->flags & ECRYPTFS_VIEW_AS_ENCRYPTED) {
+			if (crypt_stat->flags & ECRYPTFS_METADATA_IN_XATTR) {
+				rc = ecryptfs_copy_up_encrypted_with_header(
+					page, crypt_stat);
+				if (rc) {
+					printk(KERN_ERR "%s: Error attempting "
+					       "to copy the encrypted content "
+					       "from the lower file whilst "
+					       "inserting the metadata from "
+					       "the xattr into the header; rc "
+					       "= [%d]\n", __FUNCTION__, rc);
+					ClearPageUptodate(page);
+					goto out;
+				}
+				SetPageUptodate(page);
+			} else {
+				rc = ecryptfs_read_lower_page_segment(
+					page, page->index, 0, PAGE_CACHE_SIZE,
+					page->mapping->host);
+				if (rc) {
+					printk(KERN_ERR "%s: Error reading "
+					       "page; rc = [%d]\n",
+					       __FUNCTION__, rc);
+					ClearPageUptodate(page);
+					goto out;
+				}
+				SetPageUptodate(page);
+			}
+		} else {
+			rc = ecryptfs_decrypt_page(page);
+			if (rc) {
+				printk(KERN_ERR "%s: Error decrypting page "
+				       "at index [%ld]; rc = [%d]\n",
+				       __FUNCTION__, page->index, rc);
+				ClearPageUptodate(page);
+				goto out;
+			}
 			SetPageUptodate(page);
+		}
 	}
-
 	prev_page_end_size = ((loff_t)page->index << PAGE_CACHE_SHIFT);
-
-	/*
-	 * If creating a page or more of holes, zero them out via truncate.
-	 * Note, this will increase i_size.
-	 */
+	/* If creating a page or more of holes, zero them out via truncate.
+	 * Note, this will increase i_size. */
 	if (page->index != 0) {
 		if (prev_page_end_size > i_size_read(page->mapping->host)) {
 			rc = ecryptfs_truncate(file->f_path.dentry,
 					       prev_page_end_size);
 			if (rc) {
-				printk(KERN_ERR "Error on attempt to "
+				printk(KERN_ERR "%s: Error on attempt to "
 				       "truncate to (higher) offset [%lld];"
-				       " rc = [%d]\n", prev_page_end_size, rc);
+				       " rc = [%d]\n", __FUNCTION__,
+				       prev_page_end_size, rc);
 				goto out;
 			}
 		}
 	}
-	/*
-	 * Writing to a new page, and creating a small hole from start of page?
-	 * Zero it out.
-	 */
-	if ((i_size_read(page->mapping->host) == prev_page_end_size) &&
-	    (from != 0)) {
+	/* Writing to a new page, and creating a small hole from start
+	 * of page?  Zero it out. */
+	if ((i_size_read(page->mapping->host) == prev_page_end_size)
+	    && (from != 0))
 		zero_user_page(page, 0, PAGE_CACHE_SIZE, KM_USER0);
-	}
 out:
 	return rc;
 }
#30 lore raw

PATCH 15/76 IRQ_NOPROBE helper functions

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Ralf Baechle <[email protected]>

Probing non-ISA interrupts using the handle_percpu_irq as their handle_irq method may crash the system because handle_percpu_irq does not check IRQ_WAITING. This for example hits the MIPS Qemu configuration.

This patch provides two helper functions set_irq_noprobe and set_irq_probe to set rsp. clear the IRQ_NOPROBE flag. The only current caller is MIPS code but this really belongs into generic code.

As an aside, interrupt probing these days has become a mostly obsolete if not dangerous art. I think Linux interrupts should be changed to default to non-probing but that's subject of this patch.

---
 include/linux/irq.h |    3 +++
 kernel/irq/chip.c   |   36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+)
include/linux/irq.h +3 -0
@@ -367,6 +367,9 @@ set_irq_chained_handler(unsigned int irq
 	__set_irq_handler(irq, handle, 1, NULL);
 }
 
+extern void set_irq_noprobe(unsigned int irq);
+extern void set_irq_probe(unsigned int irq);
+
 /* Handle dynamic irq creation and destruction */
 extern int create_irq(void);
 extern void destroy_irq(unsigned int irq);
kernel/irq/chip.c +36 -0
@@ -607,3 +607,39 @@ set_irq_chip_and_handler_name(unsigned i
 	set_irq_chip(irq, chip);
 	__set_irq_handler(irq, handle, 0, name);
 }
+
+void __init set_irq_noprobe(unsigned int irq)
+{
+	struct irq_desc *desc;
+	unsigned long flags;
+
+	if (irq >= NR_IRQS) {
+		printk(KERN_ERR "Trying to mark IRQ%d non-probeable\n", irq);
+
+		return;
+	}
+
+	desc = irq_desc + irq;
+
+	spin_lock_irqsave(&desc->lock, flags);
+	desc->status |= IRQ_NOPROBE;
+	spin_unlock_irqrestore(&desc->lock, flags);
+}
+
+void __init set_irq_probe(unsigned int irq)
+{
+	struct irq_desc *desc;
+	unsigned long flags;
+
+	if (irq >= NR_IRQS) {
+		printk(KERN_ERR "Trying to mark IRQ%d probeable\n", irq);
+
+		return;
+	}
+
+	desc = irq_desc + irq;
+
+	spin_lock_irqsave(&desc->lock, flags);
+	desc->status &= ~IRQ_NOPROBE;
+	spin_unlock_irqrestore(&desc->lock, flags);
+}
#55 lore raw

PATCH 35/76 hugetlb: ensure we do not reference a surplus page after handing it to buddy

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Andy Whitcroft <[email protected]>

When we free a page via free_huge_page and we detect that we are in surplus the page will be returned to the buddy. After this we no longer own the page.

However at the end free_huge_page we clear out our mapping pointer from page private. Even where the page is not a surplus we free the page to the hugepage pool, drop the pool locks and then clear page private. In either case the page may have been reallocated. BAD.

Make sure we clear out page private before we free the page.

---
 mm/hugetlb.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/hugetlb.c +1 -1
@@ -119,6 +119,7 @@ static void free_huge_page(struct page *
 	struct address_space *mapping;
 
 	mapping = (struct address_space *) page_private(page);
+	set_page_private(page, 0);
 	BUG_ON(page_count(page));
 	INIT_LIST_HEAD(&page->lru);
 
@@ -133,7 +134,6 @@ static void free_huge_page(struct page *
 	spin_unlock(&hugetlb_lock);
 	if (mapping)
 		hugetlb_put_quota(mapping, 1);
-	set_page_private(page, 0);
 }
 
 /*
#62 lore raw

PATCH 42/76 pata_hpt*, pata_serverworks: fix UDMA masking

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Alan Cox <[email protected]>

[upstream commit: 6ddd6861]

When masking, mask out the modes that are unsupported not the ones that are supported. This makes life happier.

---
 drivers/ata/pata_hpt366.c      |    6 +++---
 drivers/ata/pata_hpt37x.c      |    6 +++---
 drivers/ata/pata_serverworks.c |    2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)
drivers/ata/pata_hpt366.c +3 -3
@@ -27,7 +27,7 @@
 #include <linux/libata.h>
 
 #define DRV_NAME	"pata_hpt366"
-#define DRV_VERSION	"0.6.1"
+#define DRV_VERSION	"0.6.2"
 
 struct hpt_clock {
 	u8	xfer_speed;
@@ -180,9 +180,9 @@ static unsigned long hpt366_filter(struc
 		if (hpt_dma_blacklisted(adev, "UDMA",  bad_ata33))
 			mask &= ~ATA_MASK_UDMA;
 		if (hpt_dma_blacklisted(adev, "UDMA3", bad_ata66_3))
-			mask &= ~(0x07 << ATA_SHIFT_UDMA);
+			mask &= ~(0xF8 << ATA_SHIFT_UDMA);
 		if (hpt_dma_blacklisted(adev, "UDMA4", bad_ata66_4))
-			mask &= ~(0x0F << ATA_SHIFT_UDMA);
+			mask &= ~(0xF0 << ATA_SHIFT_UDMA);
 	}
 	return ata_pci_default_filter(adev, mask);
 }
drivers/ata/pata_hpt37x.c +3 -3
@@ -24,7 +24,7 @@
 #include <linux/libata.h>
 
 #define DRV_NAME	"pata_hpt37x"
-#define DRV_VERSION	"0.6.9"
+#define DRV_VERSION	"0.6.11"
 
 struct hpt_clock {
 	u8	xfer_speed;
@@ -281,7 +281,7 @@ static unsigned long hpt370_filter(struc
 		if (hpt_dma_blacklisted(adev, "UDMA", bad_ata33))
 			mask &= ~ATA_MASK_UDMA;
 		if (hpt_dma_blacklisted(adev, "UDMA100", bad_ata100_5))
-			mask &= ~(0x1F << ATA_SHIFT_UDMA);
+			mask &= ~(0xE0 << ATA_SHIFT_UDMA);
 	}
 	return ata_pci_default_filter(adev, mask);
 }
@@ -297,7 +297,7 @@ static unsigned long hpt370a_filter(stru
 {
 	if (adev->class == ATA_DEV_ATA) {
 		if (hpt_dma_blacklisted(adev, "UDMA100", bad_ata100_5))
-			mask &= ~ (0x1F << ATA_SHIFT_UDMA);
+			mask &= ~(0xE0 << ATA_SHIFT_UDMA);
 	}
 	return ata_pci_default_filter(adev, mask);
 }
drivers/ata/pata_serverworks.c +1 -1
@@ -226,7 +226,7 @@ static unsigned long serverworks_csb_fil
 
 	for (i = 0; (p = csb_bad_ata100[i]) != NULL; i++) {
 		if (!strcmp(p, model_num))
-			mask &= ~(0x1F << ATA_SHIFT_UDMA);
+			mask &= ~(0xE0 << ATA_SHIFT_UDMA);
 	}
 	return ata_pci_default_filter(adev, mask);
 }
#33 lore raw

PATCH 18/76 x86: Clear DF before calling signal handler

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Aurelien Jarno <[email protected]>

x86: Clear DF before calling signal handler

The Linux kernel currently does not clear the direction flag before calling a signal handler, whereas the x86/x86-64 ABI requires that. This become a real problem with gcc version 4.3, which assumes that the direction flag is correctly cleared at the entry of a function.

This patches changes the setup_frame() functions to clear the direction before entering the signal handler.

This is a backport of patch e40cd10ccff3d9fbffd57b93780bee4b7b9bff51 ("x86: clear DF before calling signal handler") that has been applied in 2.6.25-rc.

---
 arch/x86/ia32/ia32_signal.c |    4 ++--
 arch/x86/kernel/signal_32.c |    4 ++--
 arch/x86/kernel/signal_64.c |    2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)
arch/x86/ia32/ia32_signal.c +2 -2
@@ -494,7 +494,7 @@ int ia32_setup_frame(int sig, struct k_s
 	regs->ss = __USER32_DS; 
 
 	set_fs(USER_DS);
-	regs->eflags &= ~TF_MASK;
+	regs->eflags &= ~(TF_MASK | X86_EFLAGS_DF);
 	if (test_thread_flag(TIF_SINGLESTEP))
 		ptrace_notify(SIGTRAP);
 
@@ -600,7 +600,7 @@ int ia32_setup_rt_frame(int sig, struct 
 	regs->ss = __USER32_DS; 
 
 	set_fs(USER_DS);
-	regs->eflags &= ~TF_MASK;
+	regs->eflags &= ~(TF_MASK | X86_EFLAGS_DF);
 	if (test_thread_flag(TIF_SINGLESTEP))
 		ptrace_notify(SIGTRAP);
 
arch/x86/kernel/signal_32.c +2 -2
@@ -396,7 +396,7 @@ static int setup_frame(int sig, struct k
 	 * The tracer may want to single-step inside the
 	 * handler too.
 	 */
-	regs->eflags &= ~TF_MASK;
+	regs->eflags &= ~(TF_MASK | X86_EFLAGS_DF);
 	if (test_thread_flag(TIF_SINGLESTEP))
 		ptrace_notify(SIGTRAP);
 
@@ -489,7 +489,7 @@ static int setup_rt_frame(int sig, struc
 	 * The tracer may want to single-step inside the
 	 * handler too.
 	 */
-	regs->eflags &= ~TF_MASK;
+	regs->eflags &= ~(TF_MASK | X86_EFLAGS_DF);
 	if (test_thread_flag(TIF_SINGLESTEP))
 		ptrace_notify(SIGTRAP);
 
arch/x86/kernel/signal_64.c +1 -1
@@ -295,7 +295,7 @@ static int setup_rt_frame(int sig, struc
 	   see include/asm-x86_64/uaccess.h for details. */
 	set_fs(USER_DS);
 
-	regs->eflags &= ~TF_MASK;
+	regs->eflags &= ~(TF_MASK | X86_EFLAGS_DF);
 	if (test_thread_flag(TIF_SINGLESTEP))
 		ptrace_notify(SIGTRAP);
 #ifdef DEBUG_SIG
#46 lore raw

PATCH 31/76 ARM pxa: fix clock lookup to find specific device clocks

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Russell King <[email protected]>

Ensure that the clock lookup always finds an entry for a specific device and ID before it falls back to finding just by ID. This fixes a problem reported by Holger Schurig where the BTUART was assigned the wrong clock.

Uli Luckas notes:

The patch fixes the otherwise unusable bluetooth uart on pxa25x. The patch is written by Russell King [1] who also gave his OK for stable inclusion [2]. The patch is also available as commit a0dd005d1d9f4c3beab52086f3844ef9342d1e67 to Linus' tree.

[1] http://marc.info/?l=linux-arm-kernel&m=120298366510315
[2] http://marc.info/?l=linux-arm-kernel&m=120384388411097

---
 arch/arm/mach-pxa/clock.c |   23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)
arch/arm/mach-pxa/clock.c +16 -7
@@ -23,18 +23,27 @@ static LIST_HEAD(clocks);
 static DEFINE_MUTEX(clocks_mutex);
 static DEFINE_SPINLOCK(clocks_lock);
 
+static struct clk *clk_lookup(struct device *dev, const char *id)
+{
+	struct clk *p;
+
+	list_for_each_entry(p, &clocks, node)
+		if (strcmp(id, p->name) == 0 && p->dev == dev)
+			return p;
+
+	return NULL;
+}
+
 struct clk *clk_get(struct device *dev, const char *id)
 {
 	struct clk *p, *clk = ERR_PTR(-ENOENT);
 
 	mutex_lock(&clocks_mutex);
-	list_for_each_entry(p, &clocks, node) {
-		if (strcmp(id, p->name) == 0 &&
-		    (p->dev == NULL || p->dev == dev)) {
-			clk = p;
-			break;
-		}
-	}
+	p = clk_lookup(dev, id);
+	if (!p)
+		p = clk_lookup(NULL, id);
+	if (p)
+		clk = p;
 	mutex_unlock(&clocks_mutex);
 
 	return clk;
#45 lore raw

PATCH 30/76 x86: replace LOCK_PREFIX in futex.h

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Thomas Gleixner <[email protected]>

The exception fixup for the futex macros __futex_atomic_op1/2 and futex_atomic_cmpxchg_inatomic() is missing an entry when the lock prefix is replaced by a NOP via SMP alternatives.

Chuck Ebert tracked this down from the information provided in:
https://bugzilla.redhat.com/show_bug.cgi?id=429412

A possible solution would be to add another fixup after the LOCK_PREFIX, so both the LOCK and NOP case have their own entry in the exception table, but it's not really worth the trouble.

Simply replace LOCK_PREFIX with lock and keep those untouched by SMP alternatives.

---
 include/asm-x86/futex_32.h |    6 +++---
 include/asm-x86/futex_64.h |    6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)
include/asm-x86/futex_32.h +3 -3
@@ -28,7 +28,7 @@
 "1:	movl	%2, %0\n\
 	movl	%0, %3\n"					\
 	insn "\n"						\
-"2:	" LOCK_PREFIX "cmpxchgl %3, %2\n\
+"2:	lock ; cmpxchgl %3, %2\n\
 	jnz	1b\n\
 3:	.section .fixup,\"ax\"\n\
 4:	mov	%5, %1\n\
@@ -68,7 +68,7 @@ futex_atomic_op_inuser (int encoded_op, 
 #endif
 		switch (op) {
 		case FUTEX_OP_ADD:
-			__futex_atomic_op1(LOCK_PREFIX "xaddl %0, %2", ret,
+			__futex_atomic_op1("lock ; xaddl %0, %2", ret,
 					   oldval, uaddr, oparg);
 			break;
 		case FUTEX_OP_OR:
@@ -111,7 +111,7 @@ futex_atomic_cmpxchg_inatomic(int __user
 		return -EFAULT;
 
 	__asm__ __volatile__(
-		"1:	" LOCK_PREFIX "cmpxchgl %3, %1		\n"
+		"1:	lock ; cmpxchgl %3, %1			\n"
 
 		"2:	.section .fixup, \"ax\"			\n"
 		"3:	mov     %2, %0				\n"
include/asm-x86/futex_64.h +3 -3
@@ -27,7 +27,7 @@
 "1:	movl	%2, %0\n\
 	movl	%0, %3\n"					\
 	insn "\n"						\
-"2:	" LOCK_PREFIX "cmpxchgl %3, %2\n\
+"2:	lock ; cmpxchgl %3, %2\n\
 	jnz	1b\n\
 3:	.section .fixup,\"ax\"\n\
 4:	mov	%5, %1\n\
@@ -62,7 +62,7 @@ futex_atomic_op_inuser (int encoded_op, 
 		__futex_atomic_op1("xchgl %0, %2", ret, oldval, uaddr, oparg);
 		break;
 	case FUTEX_OP_ADD:
-		__futex_atomic_op1(LOCK_PREFIX "xaddl %0, %2", ret, oldval,
+		__futex_atomic_op1("lock ; xaddl %0, %2", ret, oldval,
 				   uaddr, oparg);
 		break;
 	case FUTEX_OP_OR:
@@ -101,7 +101,7 @@ futex_atomic_cmpxchg_inatomic(int __user
 		return -EFAULT;
 
 	__asm__ __volatile__(
-		"1:	" LOCK_PREFIX "cmpxchgl %3, %1		\n"
+		"1:	lock ; cmpxchgl %3, %1			\n"
 
 		"2:	.section .fixup, \"ax\"			\n"
 		"3:	mov     %2, %0				\n"
#25 lore raw

PATCH 10/76 IPV6: Fix IPsec datagram fragmentation

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Herbert Xu <[email protected]>

Upstream commits: 28a89453b1e8de8d777ad96fa1eef27b5d1ce074

                  b5c15fc004ac83b7ad280acbe0fd4bbed7e2c8d4

This is a long-standing bug in the IPsec IPv6 code that breaks when we emit a IPsec tunnel-mode datagram packet. The problem is that the code the emits the packet assumes the IPv6 stack will fragment it later, but the IPv6 stack assumes that whoever is emitting the packet is going to pre-fragment the packet.

In the long term we need to fix both sides, e.g., to get the datagram code to pre-fragment as well as to get the IPv6 stack to fragment locally generated tunnel-mode packet.

For now this patch does the second part which should make it work for the IPsec host case.

---
 net/ipv6/ip6_output.c   |    6 +++++-
 net/ipv6/xfrm6_output.c |    2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)
net/ipv6/ip6_output.c +5 -1
@@ -593,7 +593,7 @@ static int ip6_fragment(struct sk_buff *
 	 * or if the skb it not generated by a local socket.  (This last
 	 * check should be redundant, but it's free.)
 	 */
-	if (!np || np->pmtudisc >= IPV6_PMTUDISC_DO) {
+	if (!skb->local_df) {
 		skb->dev = skb->dst->dev;
 		icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev);
 		IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_FRAGFAILS);
@@ -1389,6 +1389,10 @@ int ip6_push_pending_frames(struct sock 
 		tmp_skb->sk = NULL;
 	}
 
+	/* Allow local fragmentation. */
+	if (np->pmtudisc < IPV6_PMTUDISC_DO)
+		skb->local_df = 1;
+
 	ipv6_addr_copy(final_dst, &fl->fl6_dst);
 	__skb_pull(skb, skb_network_header_len(skb));
 	if (opt && opt->opt_flen)
net/ipv6/xfrm6_output.c +1 -1
@@ -34,7 +34,7 @@ static int xfrm6_tunnel_check_size(struc
 	if (mtu < IPV6_MIN_MTU)
 		mtu = IPV6_MIN_MTU;
 
-	if (skb->len > mtu) {
+	if (!skb->local_df && skb->len > mtu) {
 		skb->dev = dst->dev;
 		icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev);
 		ret = -EMSGSIZE;
#41 lore raw

PATCH 26/76 usb-storage: dont access beyond the end of the sg buffer

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Alan Stern <[email protected]>

This patch (as1038) fixes a bug in usb_stor_access_xfer_buf() and usb_stor_set_xfer_buf() (the bug was originally found by Boaz Harrosh): The routine must not attempt to write beyond the end of a scatter-gather list or beyond the number of bytes requested.

This is the minimal 2.6.24 equivalent to as1035 +
as1037 (7084191d53b224b953c8e1db525ea6c31aca5fc7 "USB:
usb-storage: don't access beyond the end of the sg buffer" + 6d512a80c26d87f8599057c86dc920fbfe0aa3aa "usb-storage: update earlier scatter-gather bug fix"). Mark Glines has confirmed that it fixes his problem.

---
 drivers/usb/storage/protocol.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/usb/storage/protocol.c +3 -2
@@ -194,7 +194,7 @@ unsigned int usb_stor_access_xfer_buf(un
 		 * and the starting offset within the page, and update
 		 * the *offset and *index values for the next loop. */
 		cnt = 0;
-		while (cnt < buflen) {
+		while (cnt < buflen && sg) {
 			struct page *page = sg_page(sg) +
 					((sg->offset + *offset) >> PAGE_SHIFT);
 			unsigned int poff =
@@ -249,7 +249,8 @@ void usb_stor_set_xfer_buf(unsigned char
 	unsigned int offset = 0;
 	struct scatterlist *sg = NULL;
 
-	usb_stor_access_xfer_buf(buffer, buflen, srb, &sg, &offset,
+	buflen = min(buflen, srb->request_bufflen);
+	buflen = usb_stor_access_xfer_buf(buffer, buflen, srb, &sg, &offset,
 			TO_XFER_BUF);
 	if (buflen < srb->request_bufflen)
 		srb->resid = srb->request_bufflen - buflen;
#88 lore raw

PATCH 68/76 NETFILTER: nfnetlink_log: fix computation of netlink skb size

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Eric Leblond <[email protected]>

Upstream commit 7000d38d:

This patch is similar to nfnetlink_queue fixes. It fixes the computation of skb size by using NLMSG_SPACE instead of NLMSG_ALIGN.

---

 net/netfilter/nfnetlink_log.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nfnetlink_log.c +1 -1
@@ -594,7 +594,7 @@ nfulnl_log_packet(unsigned int pf,
 	/* FIXME: do we want to make the size calculation conditional based on
 	 * what is actually present?  way more branches and checks, but more
 	 * memory efficient... */
-	size =    NLMSG_ALIGN(sizeof(struct nfgenmsg))
+	size =    NLMSG_SPACE(sizeof(struct nfgenmsg))
 		+ nla_total_size(sizeof(struct nfulnl_msg_packet_hdr))
 		+ nla_total_size(sizeof(u_int32_t))	/* ifindex */
 		+ nla_total_size(sizeof(u_int32_t))	/* ifindex */
#83 lore raw

PATCH 63/76 sched: fix race in schedule()

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Hiroshi Shimamoto <[email protected]>

Fix a hard to trigger crash seen in the -rt kernel that also affects the vanilla scheduler.

There is a race condition between schedule() and some dequeue/enqueue functions; rt_mutex_setprio(), __setscheduler() and sched_move_task().

When scheduling to idle, idle_balance() is called to pull tasks from other busy processor. It might drop the rq lock. It means that those 3 functions encounter on_rq=0 and running=1. The current task should be put when running.

Here is a possible scenario:

CPU0 CPU1

    |                              schedule()
    |                              ->deactivate_task()
    |                              ->idle_balance()
    |                              -->load_balance_newidle()

rt_mutex_setprio() |
| --->double_lock_balance()
*get lock *rel lock
* on_rq=0, ruuning=1 |
* sched_class is changed |
*rel lock *get lock
: |
:
->put_prev_task_rt() ->pick_next_task_fair()
=> panic

The current process of CPU1(P1) is scheduling. Deactivated P1, and the scheduler looks for another process on other CPU's runqueue because CPU1 will be idle. idle_balance(), load_balance_newidle() and double_lock_balance() are called and double_lock_balance() could drop the rq lock. On the other hand, CPU0 is trying to boost the priority of P1. The result of boosting only P1's prio and sched_class are changed to RT. The sched entities of P1 and P1's group are never put. It makes cfs_rq invalid, because the cfs_rq has curr and no leaf, but pick_next_task_fair() is called, then the kernel panics.

---
 kernel/sched.c |   36 ++++++++++++++++--------------------
 1 file changed, 16 insertions(+), 20 deletions(-)
kernel/sched.c +16 -20
@@ -4028,11 +4028,10 @@ void rt_mutex_setprio(struct task_struct
 	oldprio = p->prio;
 	on_rq = p->se.on_rq;
 	running = task_current(rq, p);
-	if (on_rq) {
+	if (on_rq)
 		dequeue_task(rq, p, 0);
-		if (running)
-			p->sched_class->put_prev_task(rq, p);
-	}
+	if (running)
+		p->sched_class->put_prev_task(rq, p);
 
 	if (rt_prio(prio))
 		p->sched_class = &rt_sched_class;
@@ -4041,9 +4040,9 @@ void rt_mutex_setprio(struct task_struct
 
 	p->prio = prio;
 
+	if (running)
+		p->sched_class->set_curr_task(rq);
 	if (on_rq) {
-		if (running)
-			p->sched_class->set_curr_task(rq);
 		enqueue_task(rq, p, 0);
 		/*
 		 * Reschedule if we are currently running on this runqueue and
@@ -4339,18 +4338,17 @@ recheck:
 	update_rq_clock(rq);
 	on_rq = p->se.on_rq;
 	running = task_current(rq, p);
-	if (on_rq) {
+	if (on_rq)
 		deactivate_task(rq, p, 0);
-		if (running)
-			p->sched_class->put_prev_task(rq, p);
-	}
+	if (running)
+		p->sched_class->put_prev_task(rq, p);
 
 	oldprio = p->prio;
 	__setscheduler(rq, p, policy, param->sched_priority);
 
+	if (running)
+		p->sched_class->set_curr_task(rq);
 	if (on_rq) {
-		if (running)
-			p->sched_class->set_curr_task(rq);
 		activate_task(rq, p, 0);
 		/*
 		 * Reschedule if we are currently running on this runqueue and
@@ -7110,19 +7108,17 @@ void sched_move_task(struct task_struct 
 	running = task_current(rq, tsk);
 	on_rq = tsk->se.on_rq;
 
-	if (on_rq) {
+	if (on_rq)
 		dequeue_task(rq, tsk, 0);
-		if (unlikely(running))
-			tsk->sched_class->put_prev_task(rq, tsk);
-	}
+	if (unlikely(running))
+		tsk->sched_class->put_prev_task(rq, tsk);
 
 	set_task_cfs_rq(tsk, task_cpu(tsk));
 
-	if (on_rq) {
-		if (unlikely(running))
-			tsk->sched_class->set_curr_task(rq);
+	if (unlikely(running))
+		tsk->sched_class->set_curr_task(rq);
+	if (on_rq)
 		enqueue_task(rq, tsk, 0);
-	}
 
 done:
 	task_rq_unlock(rq, &flags);
#39 lore raw

PATCH 24/76 CRYPTO xts: Use proper alignment

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Sebastian Siewior <[email protected]>

[ Upstream commit: 6212f2c7f70c591efb0d9f3d50ad29112392fee2 ]

The XTS blockmode uses a copy of the IV which is saved on the stack and may or may not be properly aligned. If it is not, it will break hardware cipher like the geode or padlock.
This patch encrypts the IV in place so we don't have to worry about alignment.

---
 crypto/xts.c |   13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
crypto/xts.c +6 -7
@@ -77,16 +77,16 @@ static int setkey(struct crypto_tfm *par
 }
 
 struct sinfo {
-	be128 t;
+	be128 *t;
 	struct crypto_tfm *tfm;
 	void (*fn)(struct crypto_tfm *, u8 *, const u8 *);
 };
 
 static inline void xts_round(struct sinfo *s, void *dst, const void *src)
 {
-	be128_xor(dst, &s->t, src);		/* PP <- T xor P */
+	be128_xor(dst, s->t, src);		/* PP <- T xor P */
 	s->fn(s->tfm, dst, dst);		/* CC <- E(Key1,PP) */
-	be128_xor(dst, dst, &s->t);		/* C <- T xor CC */
+	be128_xor(dst, dst, s->t);		/* C <- T xor CC */
 }
 
 static int crypt(struct blkcipher_desc *d,
@@ -101,7 +101,6 @@ static int crypt(struct blkcipher_desc *
 		.tfm = crypto_cipher_tfm(ctx->child),
 		.fn = fn
 	};
-	be128 *iv;
 	u8 *wsrc;
 	u8 *wdst;
 
@@ -109,20 +108,20 @@ static int crypt(struct blkcipher_desc *
 	if (!w->nbytes)
 		return err;
 
+	s.t = (be128 *)w->iv;
 	avail = w->nbytes;
 
 	wsrc = w->src.virt.addr;
 	wdst = w->dst.virt.addr;
 
 	/* calculate first value of T */
-	iv = (be128 *)w->iv;
-	tw(crypto_cipher_tfm(ctx->tweak), (void *)&s.t, w->iv);
+	tw(crypto_cipher_tfm(ctx->tweak), w->iv, w->iv);
 
 	goto first;
 
 	for (;;) {
 		do {
-			gf128mul_x_ble(&s.t, &s.t);
+			gf128mul_x_ble(s.t, s.t);
 
 first:
 			xts_round(&s, wdst, wsrc);
#0 lore raw

cover 2.6.24-stable review

This is the start of the stable review cycle for the 2.6.24.4 release. There are 76 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let us know. If anyone is a maintainer of the proper subsystem, and wants to add a Signed-off-by: line to the patch, please respond with it.

These patches are sent out with a number of different people on the
Cc: line. If you wish to be a reviewer, please email [email protected] to add your name to the list. If you want to be off the reviewer list, also email us.

Responses should be made by Sunday, Mar 21, 2008, 22:45:00 UTC Anything received after that time might be too late.

The whole patch series can be found in one patch at:

	kernel.org/pub/linux/kernel/v2.6/stable-review/patch-2.6.24.4-rc1.gz

and the diffstat can be found below.

thanks,

the -stable release team

---
 Makefile                             |    2 +-
 arch/arm/mach-pxa/clock.c            |   23 ++-
 arch/mips/kernel/i8259.c             |    4 +-
 arch/mips/kernel/irq.c               |    5 +
 arch/sparc/kernel/Makefile           |    5 +-
 arch/sparc/kernel/una_asm.S          |  153 ++++++++++++++++++++
 arch/sparc/kernel/unaligned.c        |  252 +++++++---------------------------
 arch/sparc64/mm/fault.c              |   14 +--
 arch/x86/ia32/ia32_signal.c          |    4 +-
 arch/x86/kernel/apic_32.c            |    2 +-
 arch/x86/kernel/apic_64.c            |    2 +-
 arch/x86/kernel/io_apic_32.c         |    4 +-
 arch/x86/kernel/io_apic_64.c         |    6 +-
 arch/x86/kernel/process_64.c         |    3 +-
 arch/x86/kernel/signal_32.c          |    4 +-
 arch/x86/kernel/signal_64.c          |    2 +-
 arch/x86/kernel/smpboot_32.c         |    2 +-
 arch/x86/kernel/smpboot_64.c         |    2 +-
 arch/x86/pci/mmconfig-shared.c       |   35 -----
 arch/x86/pci/mmconfig_32.c           |   22 ++--
 arch/x86/pci/mmconfig_64.c           |   22 ++--
 arch/x86/pci/pci.h                   |    7 -
 crypto/async_tx/async_xor.c          |    2 +-
 crypto/xcbc.c                        |    6 +-
 crypto/xts.c                         |   13 +-
 drivers/acorn/char/defkeymap-l7200.c |   68 +++++-----
 drivers/ata/pata_hpt366.c            |    6 +-
 drivers/ata/pata_hpt37x.c            |    6 +-
 drivers/ata/pata_serverworks.c       |    2 +-
 drivers/base/platform.c              |    2 +-
 drivers/block/ub.c                   |    2 +-
 drivers/char/defkeymap.c_shipped     |   68 +++++-----
 drivers/char/vt.c                    |    1 +
 drivers/dma/ioat_dma.c               |    2 +
 drivers/message/fusion/mptsas.c      |    5 +
 drivers/net/e1000e/netdev.c          |    6 +-
 drivers/net/macb.c                   |    2 +-
 drivers/net/niu.c                    |   20 ++-
 drivers/net/niu.h                    |    2 +-
 drivers/net/wireless/b43/dma.c       |   32 +++--
 drivers/net/wireless/b43/main.c      |    3 +-
 drivers/s390/char/defkeymap.c        |    4 +-
 drivers/scsi/advansys.c              |   15 ++-
 drivers/scsi/aic94xx/aic94xx_scb.c   |   14 ++-
 drivers/scsi/arcmsr/arcmsr_hba.c     |   20 ++--
 drivers/scsi/gdth.c                  |  112 ++++++----------
 drivers/scsi/gdth.h                  |    1 +
 drivers/scsi/gdth_proc.c             |    6 +-
 drivers/scsi/ips.c                   |   20 ++-
 drivers/scsi/scsi_lib.c              |    1 -
 drivers/spi/atmel_spi.c              |   10 ++
 drivers/spi/pxa2xx_spi.c             |   41 ++++--
 drivers/usb/host/ehci-q.c            |    2 +-
 drivers/usb/serial/ftdi_sio.c        |   25 ++++
 drivers/usb/serial/ftdi_sio.h        |    7 +
 drivers/usb/storage/protocol.c       |    5 +-
 fs/aio.c                             |    8 +
 fs/ecryptfs/mmap.c                   |  102 ++++++++++----
 fs/fuse/dir.c                        |    2 +-
 fs/isofs/compress.c                  |   11 ++
 fs/jbd/recovery.c                    |    2 +-
 fs/jbd2/recovery.c                   |    2 +-
 fs/nfsd/nfsfh.c                      |    4 +-
 fs/ufs/util.h                        |    2 +-
 include/asm-arm/arch-pxa/pxa-regs.h  |    1 +
 include/asm-x86/apic_32.h            |    2 +-
 include/asm-x86/futex_32.h           |    6 +-
 include/asm-x86/futex_64.h           |    6 +-
 include/asm-x86/io_apic_64.h         |    2 +-
 include/asm-x86/processor_32.h       |    5 +-
 include/linux/Kbuild                 |    1 -
 include/linux/futex.h                |    1 +
 include/linux/irq.h                  |    3 +
 include/linux/moduleparam.h          |   12 ++-
 include/net/inet_sock.h              |    3 +-
 kernel/futex.c                       |   50 ++++++--
 kernel/futex_compat.c                |    9 ++
 kernel/irq/chip.c                    |   36 +++++
 kernel/relay.c                       |    5 +-
 kernel/sched.c                       |   36 ++---
 kernel/sysctl.c                      |    2 +-
 mm/filemap.c                         |   22 ++--
 mm/hugetlb.c                         |    2 +-
 net/bluetooth/hci_sysfs.c            |    8 +-
 net/bridge/netfilter/ebt_dnat.c      |    4 +-
 net/bridge/netfilter/ebt_redirect.c  |    4 +-
 net/bridge/netfilter/ebt_snat.c      |    4 +-
 net/core/dev.c                       |    6 +-
 net/ipv4/ip_sockglue.c               |    5 -
 net/ipv4/ipcomp.c                    |    5 +-
 net/ipv4/ipconfig.c                  |    4 +-
 net/ipv4/netfilter/arpt_mangle.c     |    2 +-
 net/ipv4/netfilter/ip_queue.c        |   12 +-
 net/ipv6/ip6_output.c                |    6 +-
 net/ipv6/ip6_tunnel.c                |    1 +
 net/ipv6/ipcomp6.c                   |    2 +
 net/ipv6/netfilter/ip6_queue.c       |   10 +-
 net/ipv6/xfrm6_output.c              |    2 +-
 net/netfilter/nfnetlink_log.c        |    2 +-
 net/netfilter/nfnetlink_queue.c      |   12 +-
 net/netfilter/xt_time.c              |    7 +-
 security/commoncap.c                 |    2 +-
 102 files changed, 873 insertions(+), 668 deletions(-)
#61 lore raw

PATCH 41/76 SCSI advansys: fix overrun_buf aligned bug

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: FUJITA Tomonori <[email protected]>

commit 7d5d408c77cee95d1380511de46b7a4c8dc2211d

struct asc_dvc_var needs overrun buffer to be placed on an 8 byte boundary. advansys defines struct asc_dvc_var:

struct asc_dvc_var {
    ...
    uchar overrun_buf[ASC_OVERRUN_BSIZE] __aligned(8);

The problem is that struct asc_dvc_var is placed on shost->hostdata. So if the hostdata is not on an 8 byte boundary, the advansys crashes. The hostdata is placed on a sizeof(unsigned long) boundary so the 8 byte boundary is not garanteed with x86_32.

With 2.6.23 and 2.6.24, the hostdata is on an 8 byte boundary by chance, but with the current git, it's not.

This patch removes overrun_buf static array and use kzalloc.

FUJITA Tomonori notes:
We thought that 2.6.24 doesn't have this bug, however it does.

---
 drivers/scsi/advansys.c |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/scsi/advansys.c +11 -2
@@ -566,7 +566,7 @@ typedef struct asc_dvc_var {
 	ASC_SCSI_BIT_ID_TYPE unit_not_ready;
 	ASC_SCSI_BIT_ID_TYPE queue_full_or_busy;
 	ASC_SCSI_BIT_ID_TYPE start_motor;
-	uchar overrun_buf[ASC_OVERRUN_BSIZE] __aligned(8);
+	uchar *overrun_buf;
 	dma_addr_t overrun_dma;
 	uchar scsi_reset_wait;
 	uchar chip_no;
@@ -13833,6 +13833,12 @@ static int __devinit advansys_board_foun
 	 */
 	if (ASC_NARROW_BOARD(boardp)) {
 		ASC_DBG(2, "AscInitAsc1000Driver()\n");
+
+		asc_dvc_varp->overrun_buf = kzalloc(ASC_OVERRUN_BSIZE, GFP_KERNEL);
+		if (!asc_dvc_varp->overrun_buf) {
+			ret = -ENOMEM;
+			goto err_free_wide_mem;
+		}
 		warn_code = AscInitAsc1000Driver(asc_dvc_varp);
 
 		if (warn_code || asc_dvc_varp->err_code) {
@@ -13840,8 +13846,10 @@ static int __devinit advansys_board_foun
 					"warn 0x%x, error 0x%x\n",
 					asc_dvc_varp->init_state, warn_code,
 					asc_dvc_varp->err_code);
-			if (asc_dvc_varp->err_code)
+			if (asc_dvc_varp->err_code) {
 				ret = -ENODEV;
+				kfree(asc_dvc_varp->overrun_buf);
+			}
 		}
 	} else {
 		if (advansys_wide_init_chip(shost))
@@ -13894,6 +13902,7 @@ static int advansys_release(struct Scsi_
 		dma_unmap_single(board->dev,
 					board->dvc_var.asc_dvc_var.overrun_dma,
 					ASC_OVERRUN_BSIZE, DMA_FROM_DEVICE);
+		kfree(board->dvc_var.asc_dvc_var.overrun_buf);
 	} else {
 		iounmap(board->ioremap_addr);
 		advansys_wide_free_mem(board);
#1 lore raw

PATCH 1/76 Revert "NET: Add if_addrlabel.h to sanitized headers."

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Greg Kroah-Hartman <[email protected]>

This reverts commit 5fb7ba76544d95bfa05199f7394a442de5660be7.

It was incorrectly added to the .24.y stable tree and causes build breakages.

Cc Stephen Hemminger <[email protected]>
Cc David S. Miller <[email protected]>
---
 include/linux/Kbuild |    1 -
 1 file changed, 1 deletion(-)
include/linux/Kbuild +0 -1
@@ -217,7 +217,6 @@ unifdef-y += i2o-dev.h
 unifdef-y += icmp.h
 unifdef-y += icmpv6.h
 unifdef-y += if_addr.h
-unifdef-y += if_addrlabel.h
 unifdef-y += if_arp.h
 unifdef-y += if_bridge.h
 unifdef-y += if_ec.h
#29 lore raw

PATCH 14/76 IPCOMP: Disable BH on output when using shared tfm

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Herbert Xu <[email protected]>

Upstream commit: 21e43188f272c7fd9efc84b8244c0b1dfccaa105

Because we use shared tfm objects in order to conserve memory, (each tfm requires 128K of vmalloc memory), BH needs to be turned off on output as that can occur in process context.

Previously this was done implicitly by the xfrm output code. That was lost when it became lockless. So we need to add the BH disabling to IPComp directly.

---
 net/ipv4/ipcomp.c  |    5 ++++-
 net/ipv6/ipcomp6.c |    2 ++
 2 files changed, 6 insertions(+), 1 deletion(-)
net/ipv4/ipcomp.c +4 -1
@@ -108,8 +108,11 @@ static int ipcomp_compress(struct xfrm_s
 	const int cpu = get_cpu();
 	u8 *scratch = *per_cpu_ptr(ipcomp_scratches, cpu);
 	struct crypto_comp *tfm = *per_cpu_ptr(ipcd->tfms, cpu);
-	int err = crypto_comp_compress(tfm, start, plen, scratch, &dlen);
+	int err;
 
+	local_bh_disable();
+	err = crypto_comp_compress(tfm, start, plen, scratch, &dlen);
+	local_bh_enable();
 	if (err)
 		goto out;
 
net/ipv6/ipcomp6.c +2 -0
@@ -146,7 +146,9 @@ static int ipcomp6_output(struct xfrm_st
 	scratch = *per_cpu_ptr(ipcomp6_scratches, cpu);
 	tfm = *per_cpu_ptr(ipcd->tfms, cpu);
 
+	local_bh_disable();
 	err = crypto_comp_compress(tfm, start, plen, scratch, &dlen);
+	local_bh_enable();
 	if (err || (dlen + sizeof(*ipch)) >= plen) {
 		put_cpu();
 		goto out_ok;
#74 lore raw

PATCH 54/76 USB: ftdi_sio: Workaround for broken Matrix Orbital serial port

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Kevin Vance <[email protected]>

Workaround for the FT232RL-based, Matrix Orbital VK204-25-USB serial port added to the ftdi_sio driver.

The device has an invalid endpoint descriptor, which must be modified before it can be used.

[[email protected]: backport to 2.6.24.3 w/out ftdi_jtag_probe]
---
 drivers/usb/serial/ftdi_sio.c |   24 ++++++++++++++++++++++++
 drivers/usb/serial/ftdi_sio.h |    7 +++++++
 2 files changed, 31 insertions(+)
drivers/usb/serial/ftdi_sio.c +24 -0
@@ -310,6 +310,7 @@ struct ftdi_sio_quirk {
 };
 
 static int   ftdi_olimex_probe		(struct usb_serial *serial);
+static int   ftdi_mtxorb_hack_setup	(struct usb_serial *serial);
 static void  ftdi_USB_UIRT_setup	(struct ftdi_private *priv);
 static void  ftdi_HE_TIRA1_setup	(struct ftdi_private *priv);
 
@@ -317,6 +318,10 @@ static struct ftdi_sio_quirk ftdi_olimex
 	.probe	= ftdi_olimex_probe,
 };
 
+static struct ftdi_sio_quirk ftdi_mtxorb_hack_quirk = {
+	.probe  = ftdi_mtxorb_hack_setup,
+};
+
 static struct ftdi_sio_quirk ftdi_USB_UIRT_quirk = {
 	.port_probe = ftdi_USB_UIRT_setup,
 };
@@ -379,6 +384,8 @@ static struct usb_device_id id_table_com
 	{ USB_DEVICE(FTDI_VID, FTDI_MTXORB_4_PID) },
 	{ USB_DEVICE(FTDI_VID, FTDI_MTXORB_5_PID) },
 	{ USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) },
+	{ USB_DEVICE(MTXORB_VK_VID, MTXORB_VK_PID),
+		.driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk },
 	{ USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) },
 	{ USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) },
 	{ USB_DEVICE(FTDI_VID, FTDI_TNC_X_PID) },
@@ -1301,6 +1308,23 @@ static int ftdi_olimex_probe(struct usb_
 	return 0;
 }
 
+/*
+ * The Matrix Orbital VK204-25-USB has an invalid IN endpoint.
+ * We have to correct it if we want to read from it.
+ */
+static int ftdi_mtxorb_hack_setup(struct usb_serial *serial)
+{
+	struct usb_host_endpoint *ep = serial->dev->ep_in[1];
+	struct usb_endpoint_descriptor *ep_desc = &ep->desc;
+
+	if (ep->enabled && ep_desc->wMaxPacketSize == 0) {
+		ep_desc->wMaxPacketSize = 0x40;
+		info("Fixing invalid wMaxPacketSize on read pipe");
+	}
+
+	return 0;
+}
+
 /* ftdi_shutdown is called from usbserial:usb_serial_disconnect
  *   it is called when the usb device is disconnected
  *
drivers/usb/serial/ftdi_sio.h +7 -0
@@ -98,6 +98,13 @@
 #define FTDI_MTXORB_5_PID      0xFA05  /* Matrix Orbital Product Id */
 #define FTDI_MTXORB_6_PID      0xFA06  /* Matrix Orbital Product Id */
 
+/*
+ * The following are the values for the Matrix Orbital VK204-25-USB
+ * display, which use the FT232RL.
+ */
+#define MTXORB_VK_VID		0x1b3d
+#define MTXORB_VK_PID		0x0158
+
 /* Interbiometrics USB I/O Board */
 /* Developed for Interbiometrics by Rudolf Gugler */
 #define INTERBIOMETRICS_VID              0x1209
#47 lore raw

PATCH 32/76 futex: fix init order

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Thomas Gleixner <[email protected]>

When the futex init code fails to initialize the futex pseudo file system it returns early without initializing the hash queues. Should the boot succeed then a futex syscall which tries to enqueue a waiter on the hashqueue will crash due to the unitilialized plist heads.

Initialize the hash queues before the filesystem.

---
 kernel/futex.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
kernel/futex.c +7 -5
@@ -2123,8 +2123,14 @@ static struct file_system_type futex_fs_
 
 static int __init init(void)
 {
-	int i = register_filesystem(&futex_fs_type);
+	int i;
 
+	for (i = 0; i < ARRAY_SIZE(futex_queues); i++) {
+		plist_head_init(&futex_queues[i].chain, &futex_queues[i].lock);
+		spin_lock_init(&futex_queues[i].lock);
+	}
+
+	i = register_filesystem(&futex_fs_type);
 	if (i)
 		return i;
 
@@ -2134,10 +2140,6 @@ static int __init init(void)
 		return PTR_ERR(futex_mnt);
 	}
 
-	for (i = 0; i < ARRAY_SIZE(futex_queues); i++) {
-		plist_head_init(&futex_queues[i].chain, &futex_queues[i].lock);
-		spin_lock_init(&futex_queues[i].lock);
-	}
 	return 0;
 }
 __initcall(init);
#48 lore raw

PATCH 33/76 futex: runtime enable pi and robust functionality

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Thomas Gleixner <[email protected]>

Not all architectures implement futex_atomic_cmpxchg_inatomic(). The default implementation returns -ENOSYS, which is currently not handled inside of the futex guts.

Futex PI calls and robust list exits with a held futex result in an endless loop in the futex code on architectures which have no support.

Fixing up every place where futex_atomic_cmpxchg_inatomic() is called would add a fair amount of extra if/else constructs to the already complex code. It is also not possible to disable the robust feature before user space tries to register robust lists.

Compile time disabling is not a good idea either, as there are already architectures with runtime detection of futex_atomic_cmpxchg_inatomic support.

Detect the functionality at runtime instead by calling cmpxchg_futex_value_locked() with a NULL pointer from the futex initialization code. This is guaranteed to fail, but the call of futex_atomic_cmpxchg_inatomic() happens with pagefaults disabled.

On architectures, which use the asm-generic implementation or have a runtime CPU feature detection, a -ENOSYS return value disables the PI/robust features.

On architectures with a working implementation the call returns -EFAULT and the PI/robust features are enabled.

The relevant syscalls return -ENOSYS and the robust list exit code is blocked, when the detection fails.

Fixes http://lkml.org/lkml/2008/2/11/149
Originally reported by: Lennart Buytenhek

---
 include/linux/futex.h |    1 +
 kernel/futex.c        |   38 ++++++++++++++++++++++++++++++++++----
 kernel/futex_compat.c |    9 +++++++++
 3 files changed, 44 insertions(+), 4 deletions(-)
include/linux/futex.h +1 -0
@@ -153,6 +153,7 @@ union futex_key {
 #ifdef CONFIG_FUTEX
 extern void exit_robust_list(struct task_struct *curr);
 extern void exit_pi_state_list(struct task_struct *curr);
+extern int futex_cmpxchg_enabled;
 #else
 static inline void exit_robust_list(struct task_struct *curr)
 {
kernel/futex.c +34 -4
@@ -60,6 +60,8 @@
 
 #include "rtmutex_common.h"
 
+int __read_mostly futex_cmpxchg_enabled;
+
 #define FUTEX_HASHBITS (CONFIG_BASE_SMALL ? 4 : 8)
 
 /*
@@ -466,6 +468,8 @@ void exit_pi_state_list(struct task_stru
 	struct futex_hash_bucket *hb;
 	union futex_key key;
 
+	if (!futex_cmpxchg_enabled)
+		return;
 	/*
 	 * We are a ZOMBIE and nobody can enqueue itself on
 	 * pi_state_list anymore, but we have to be careful
@@ -1854,6 +1858,8 @@ asmlinkage long
 sys_set_robust_list(struct robust_list_head __user *head,
 		    size_t len)
 {
+	if (!futex_cmpxchg_enabled)
+		return -ENOSYS;
 	/*
 	 * The kernel knows only one size for now:
 	 */
@@ -1878,6 +1884,9 @@ sys_get_robust_list(int pid, struct robu
 	struct robust_list_head __user *head;
 	unsigned long ret;
 
+	if (!futex_cmpxchg_enabled)
+		return -ENOSYS;
+
 	if (!pid)
 		head = current->robust_list;
 	else {
@@ -1980,6 +1989,9 @@ void exit_robust_list(struct task_struct
 	unsigned long futex_offset;
 	int rc;
 
+	if (!futex_cmpxchg_enabled)
+		return;
+
 	/*
 	 * Fetch the list head (which was registered earlier, via
 	 * sys_set_robust_list()):
@@ -2034,7 +2046,7 @@ void exit_robust_list(struct task_struct
 long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,
 		u32 __user *uaddr2, u32 val2, u32 val3)
 {
-	int ret;
+	int ret = -ENOSYS;
 	int cmd = op & FUTEX_CMD_MASK;
 	struct rw_semaphore *fshared = NULL;
 
@@ -2062,13 +2074,16 @@ long do_futex(u32 __user *uaddr, int op,
 		ret = futex_wake_op(uaddr, fshared, uaddr2, val, val2, val3);
 		break;
 	case FUTEX_LOCK_PI:
-		ret = futex_lock_pi(uaddr, fshared, val, timeout, 0);
+		if (futex_cmpxchg_enabled)
+			ret = futex_lock_pi(uaddr, fshared, val, timeout, 0);
 		break;
 	case FUTEX_UNLOCK_PI:
-		ret = futex_unlock_pi(uaddr, fshared);
+		if (futex_cmpxchg_enabled)
+			ret = futex_unlock_pi(uaddr, fshared);
 		break;
 	case FUTEX_TRYLOCK_PI:
-		ret = futex_lock_pi(uaddr, fshared, 0, timeout, 1);
+		if (futex_cmpxchg_enabled)
+			ret = futex_lock_pi(uaddr, fshared, 0, timeout, 1);
 		break;
 	default:
 		ret = -ENOSYS;
@@ -2123,8 +2138,23 @@ static struct file_system_type futex_fs_
 
 static int __init init(void)
 {
+	u32 curval;
 	int i;
 
+	/*
+	 * This will fail and we want it. Some arch implementations do
+	 * runtime detection of the futex_atomic_cmpxchg_inatomic()
+	 * functionality. We want to know that before we call in any
+	 * of the complex code paths. Also we want to prevent
+	 * registration of robust lists in that case. NULL is
+	 * guaranteed to fault and we get -EFAULT on functional
+	 * implementation, the non functional ones will return
+	 * -ENOSYS.
+	 */
+	curval = cmpxchg_futex_value_locked(NULL, 0, 0);
+	if (curval == -EFAULT)
+		futex_cmpxchg_enabled = 1;
+
 	for (i = 0; i < ARRAY_SIZE(futex_queues); i++) {
 		plist_head_init(&futex_queues[i].chain, &futex_queues[i].lock);
 		spin_lock_init(&futex_queues[i].lock);
kernel/futex_compat.c +9 -0
@@ -54,6 +54,9 @@ void compat_exit_robust_list(struct task
 	compat_long_t futex_offset;
 	int rc;
 
+	if (!futex_cmpxchg_enabled)
+		return;
+
 	/*
 	 * Fetch the list head (which was registered earlier, via
 	 * sys_set_robust_list()):
@@ -115,6 +118,9 @@ asmlinkage long
 compat_sys_set_robust_list(struct compat_robust_list_head __user *head,
 			   compat_size_t len)
 {
+	if (!futex_cmpxchg_enabled)
+		return -ENOSYS;
+
 	if (unlikely(len != sizeof(*head)))
 		return -EINVAL;
 
@@ -130,6 +136,9 @@ compat_sys_get_robust_list(int pid, comp
 	struct compat_robust_list_head __user *head;
 	unsigned long ret;
 
+	if (!futex_cmpxchg_enabled)
+		return -ENOSYS;
+
 	if (!pid)
 		head = current->compat_robust_list;
 	else {
#66 lore raw

PATCH 46/76 arcmsr: fix IRQs disabled warning spew

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Mike Pagano <[email protected]>

As of 2.6.24, running the archttp passthrough daemon with the arcmsr driver produces an endless spew of dma_free_coherent warnings:

	WARNING: at arch/x86/kernel/pci-dma_64.c:169 dma_free_coherent()

It turns out that coherent memory is not needed, so commit 76d78300 by Nick Cheng <[email protected]> switched it to kmalloc (as well as making a lot of other changes which have not been included here).

James Bottomley pointed out that the new kmalloc usage was also wrong, I corrected this in commit 69e562c2.

This patch combines both of the above for the purpose of fixing 2.6.24. details in http://bugs.gentoo.org/208493.

---
 drivers/scsi/arcmsr/arcmsr_hba.c |   20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)
drivers/scsi/arcmsr/arcmsr_hba.c +9 -11
@@ -1380,17 +1380,16 @@ static int arcmsr_iop_message_xfer(struc
 	switch(controlcode) {
 
 	case ARCMSR_MESSAGE_READ_RQBUFFER: {
-		unsigned long *ver_addr;
-		dma_addr_t buf_handle;
+		unsigned char *ver_addr;
 		uint8_t *pQbuffer, *ptmpQbuffer;
 		int32_t allxfer_len = 0;
 
-		ver_addr = pci_alloc_consistent(acb->pdev, 1032, &buf_handle);
+		ver_addr = kmalloc(1032, GFP_ATOMIC);
 		if (!ver_addr) {
 			retvalue = ARCMSR_MESSAGE_FAIL;
 			goto message_out;
 		}
-		ptmpQbuffer = (uint8_t *) ver_addr;
+		ptmpQbuffer = ver_addr;
 		while ((acb->rqbuf_firstindex != acb->rqbuf_lastindex)
 			&& (allxfer_len < 1031)) {
 			pQbuffer = &acb->rqbuffer[acb->rqbuf_firstindex];
@@ -1419,25 +1418,24 @@ static int arcmsr_iop_message_xfer(struc
 			}
 			arcmsr_iop_message_read(acb);
 		}
-		memcpy(pcmdmessagefld->messagedatabuffer, (uint8_t *)ver_addr, allxfer_len);
+		memcpy(pcmdmessagefld->messagedatabuffer, ver_addr, allxfer_len);
 		pcmdmessagefld->cmdmessage.Length = allxfer_len;
 		pcmdmessagefld->cmdmessage.ReturnCode = ARCMSR_MESSAGE_RETURNCODE_OK;
-		pci_free_consistent(acb->pdev, 1032, ver_addr, buf_handle);
+		kfree(ver_addr);
 		}
 		break;
 
 	case ARCMSR_MESSAGE_WRITE_WQBUFFER: {
-		unsigned long *ver_addr;
-		dma_addr_t buf_handle;
+		unsigned char *ver_addr;
 		int32_t my_empty_len, user_len, wqbuf_firstindex, wqbuf_lastindex;
 		uint8_t *pQbuffer, *ptmpuserbuffer;
 
-		ver_addr = pci_alloc_consistent(acb->pdev, 1032, &buf_handle);
+		ver_addr = kmalloc(1032, GFP_ATOMIC);
 		if (!ver_addr) {
 			retvalue = ARCMSR_MESSAGE_FAIL;
 			goto message_out;
 		}
-		ptmpuserbuffer = (uint8_t *)ver_addr;
+		ptmpuserbuffer = ver_addr;
 		user_len = pcmdmessagefld->cmdmessage.Length;
 		memcpy(ptmpuserbuffer, pcmdmessagefld->messagedatabuffer, user_len);
 		wqbuf_lastindex = acb->wqbuf_lastindex;
@@ -1483,7 +1481,7 @@ static int arcmsr_iop_message_xfer(struc
 				retvalue = ARCMSR_MESSAGE_FAIL;
 			}
 			}
-			pci_free_consistent(acb->pdev, 1032, ver_addr, buf_handle);
+			kfree(ver_addr);
 		}
 		break;
 
#75 lore raw

PATCH 55/76 USB: ftdi_sio - really enable EM1010PC

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Sven Andersen <[email protected]>

[upstream commit: 4ae897df]

Add EM1010PC to ftdi_sio.c

---

 drivers/usb/serial/ftdi_sio.c |    1 +
 1 file changed, 1 insertion(+)
drivers/usb/serial/ftdi_sio.c +1 -0
@@ -499,6 +499,7 @@ static struct usb_device_id id_table_com
 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_FS20SIG_PID) },
 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_WS300PC_PID) },
 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_FHZ1300PC_PID) },
+	{ USB_DEVICE(FTDI_VID, FTDI_ELV_EM1010PC_PID) },
 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_WS500_PID) },
 	{ USB_DEVICE(FTDI_VID, LINX_SDMUSBQSS_PID) },
 	{ USB_DEVICE(FTDI_VID, LINX_MASTERDEVEL2_PID) },
#64 lore raw

PATCH 44/76 PCI x86: always use conf1 to access config space below 256 bytes

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Ivan Kokshaysky <[email protected]>

[upsteam commit: a0ca9909]

Thanks to Loic Prylli <[email protected]>, who originally proposed this idea.

Always using legacy configuration mechanism for the legacy config space and extended mechanism (mmconf) for the extended config space is a simple and very logical approach. It's supposed to resolve all known mmconf problems. It still allows per-device quirks (tweaking dev->cfg_size). It also allows to get rid of mmconf fallback code.

This patch fixes a boot hang on Intel Q35 chipset as detailed at:
http://bugs.gentoo.org/198810

---
 arch/x86/pci/mmconfig-shared.c |   35 -----------------------------------
 arch/x86/pci/mmconfig_32.c     |   22 +++++++++-------------
 arch/x86/pci/mmconfig_64.c     |   22 ++++++++++------------
 arch/x86/pci/pci.h             |    7 -------
 4 files changed, 19 insertions(+), 67 deletions(-)
arch/x86/pci/mmconfig-shared.c +0 -35
@@ -22,42 +22,9 @@
 #define MMCONFIG_APER_MIN	(2 * 1024*1024)
 #define MMCONFIG_APER_MAX	(256 * 1024*1024)
 
-DECLARE_BITMAP(pci_mmcfg_fallback_slots, 32*PCI_MMCFG_MAX_CHECK_BUS);
-
 /* Indicate if the mmcfg resources have been placed into the resource table. */
 static int __initdata pci_mmcfg_resources_inserted;
 
-/* K8 systems have some devices (typically in the builtin northbridge)
-   that are only accessible using type1
-   Normally this can be expressed in the MCFG by not listing them
-   and assigning suitable _SEGs, but this isn't implemented in some BIOS.
-   Instead try to discover all devices on bus 0 that are unreachable using MM
-   and fallback for them. */
-static void __init unreachable_devices(void)
-{
-	int i, bus;
-	/* Use the max bus number from ACPI here? */
-	for (bus = 0; bus < PCI_MMCFG_MAX_CHECK_BUS; bus++) {
-		for (i = 0; i < 32; i++) {
-			unsigned int devfn = PCI_DEVFN(i, 0);
-			u32 val1, val2;
-
-			pci_conf1_read(0, bus, devfn, 0, 4, &val1);
-			if (val1 == 0xffffffff)
-				continue;
-
-			if (pci_mmcfg_arch_reachable(0, bus, devfn)) {
-				raw_pci_ops->read(0, bus, devfn, 0, 4, &val2);
-				if (val1 == val2)
-					continue;
-			}
-			set_bit(i + 32 * bus, pci_mmcfg_fallback_slots);
-			printk(KERN_NOTICE "PCI: No mmconfig possible on device"
-			       " %02x:%02x\n", bus, i);
-		}
-	}
-}
-
 static const char __init *pci_mmcfg_e7520(void)
 {
 	u32 win;
@@ -270,8 +237,6 @@ void __init pci_mmcfg_init(int type)
 		return;
 
 	if (pci_mmcfg_arch_init()) {
-		if (type == 1)
-			unreachable_devices();
 		if (known_bridge)
 			pci_mmcfg_insert_resources(IORESOURCE_BUSY);
 		pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF;
arch/x86/pci/mmconfig_32.c +9 -13
@@ -30,10 +30,6 @@ static u32 get_base_addr(unsigned int se
 	struct acpi_mcfg_allocation *cfg;
 	int cfg_num;
 
-	if (seg == 0 && bus < PCI_MMCFG_MAX_CHECK_BUS &&
-	    test_bit(PCI_SLOT(devfn) + 32*bus, pci_mmcfg_fallback_slots))
-		return 0;
-
 	for (cfg_num = 0; cfg_num < pci_mmcfg_config_num; cfg_num++) {
 		cfg = &pci_mmcfg_config[cfg_num];
 		if (cfg->pci_segment == seg &&
@@ -68,13 +64,16 @@ static int pci_mmcfg_read(unsigned int s
 	u32 base;
 
 	if ((bus > 255) || (devfn > 255) || (reg > 4095)) {
-		*value = -1;
+err:		*value = -1;
 		return -EINVAL;
 	}
 
+	if (reg < 256)
+		return pci_conf1_read(seg,bus,devfn,reg,len,value);
+
 	base = get_base_addr(seg, bus, devfn);
 	if (!base)
-		return pci_conf1_read(seg,bus,devfn,reg,len,value);
+		goto err;
 
 	spin_lock_irqsave(&pci_config_lock, flags);
 
@@ -105,9 +104,12 @@ static int pci_mmcfg_write(unsigned int 
 	if ((bus > 255) || (devfn > 255) || (reg > 4095))
 		return -EINVAL;
 
+	if (reg < 256)
+		return pci_conf1_write(seg,bus,devfn,reg,len,value);
+
 	base = get_base_addr(seg, bus, devfn);
 	if (!base)
-		return pci_conf1_write(seg,bus,devfn,reg,len,value);
+		return -EINVAL;
 
 	spin_lock_irqsave(&pci_config_lock, flags);
 
@@ -134,12 +136,6 @@ static struct pci_raw_ops pci_mmcfg = {
 	.write =	pci_mmcfg_write,
 };
 
-int __init pci_mmcfg_arch_reachable(unsigned int seg, unsigned int bus,
-				    unsigned int devfn)
-{
-	return get_base_addr(seg, bus, devfn) != 0;
-}
-
 int __init pci_mmcfg_arch_init(void)
 {
 	printk(KERN_INFO "PCI: Using MMCONFIG\n");
arch/x86/pci/mmconfig_64.c +10 -12
@@ -40,9 +40,7 @@ static char __iomem *get_virt(unsigned i
 static char __iomem *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn)
 {
 	char __iomem *addr;
-	if (seg == 0 && bus < PCI_MMCFG_MAX_CHECK_BUS &&
-		test_bit(32*bus + PCI_SLOT(devfn), pci_mmcfg_fallback_slots))
-		return NULL;
+
 	addr = get_virt(seg, bus);
 	if (!addr)
 		return NULL;
@@ -56,13 +54,16 @@ static int pci_mmcfg_read(unsigned int s
 
 	/* Why do we have this when nobody checks it. How about a BUG()!? -AK */
 	if (unlikely((bus > 255) || (devfn > 255) || (reg > 4095))) {
-		*value = -1;
+err:		*value = -1;
 		return -EINVAL;
 	}
 
+	if (reg < 256)
+		return pci_conf1_read(seg,bus,devfn,reg,len,value);
+
 	addr = pci_dev_base(seg, bus, devfn);
 	if (!addr)
-		return pci_conf1_read(seg,bus,devfn,reg,len,value);
+		goto err;
 
 	switch (len) {
 	case 1:
@@ -88,9 +89,12 @@ static int pci_mmcfg_write(unsigned int 
 	if (unlikely((bus > 255) || (devfn > 255) || (reg > 4095)))
 		return -EINVAL;
 
+	if (reg < 256)
+		return pci_conf1_write(seg,bus,devfn,reg,len,value);
+
 	addr = pci_dev_base(seg, bus, devfn);
 	if (!addr)
-		return pci_conf1_write(seg,bus,devfn,reg,len,value);
+		return -EINVAL;
 
 	switch (len) {
 	case 1:
@@ -126,12 +130,6 @@ static void __iomem * __init mcfg_iorema
 	return addr;
 }
 
-int __init pci_mmcfg_arch_reachable(unsigned int seg, unsigned int bus,
-				    unsigned int devfn)
-{
-	return pci_dev_base(seg, bus, devfn) != NULL;
-}
-
 int __init pci_mmcfg_arch_init(void)
 {
 	int i;
arch/x86/pci/pci.h +0 -7
@@ -98,13 +98,6 @@ extern void pcibios_sort(void);
 
 /* pci-mmconfig.c */
 
-/* Verify the first 16 busses. We assume that systems with more busses
-   get MCFG right. */
-#define PCI_MMCFG_MAX_CHECK_BUS 16
-extern DECLARE_BITMAP(pci_mmcfg_fallback_slots, 32*PCI_MMCFG_MAX_CHECK_BUS);
-
-extern int __init pci_mmcfg_arch_reachable(unsigned int seg, unsigned int bus,
-					   unsigned int devfn);
 extern int __init pci_mmcfg_arch_init(void);
 
 /*
#71 lore raw

PATCH 51/76 ioat: fix ack handling, driver must ensure that ack is zero

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Dan Williams <[email protected]>

Initialize 'ack' to zero in case the descriptor has been recycled.

Prevents "kernel BUG at crypto/async_tx/async_xor.c:185!"

---

 drivers/dma/ioat_dma.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/dma/ioat_dma.c +2 -0
@@ -726,6 +726,7 @@ static struct dma_async_tx_descriptor *i
 
 	if (new) {
 		new->len = len;
+		new->async_tx.ack = 0;
 		return &new->async_tx;
 	} else
 		return NULL;
@@ -749,6 +750,7 @@ static struct dma_async_tx_descriptor *i
 
 	if (new) {
 		new->len = len;
+		new->async_tx.ack = 0;
 		return &new->async_tx;
 	} else
 		return NULL;
#70 lore raw

PATCH 50/76 macb: Fix speed setting

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Atsushi Nemoto <[email protected]>

Fix NCFGR.SPD setting on 10Mbps. This bug was introduced by conversion to generic PHY layer in kernel 2.6.23.

---

 drivers/net/macb.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/macb.c +1 -1
@@ -148,7 +148,7 @@ static void macb_handle_link_change(stru
 
 			if (phydev->duplex)
 				reg |= MACB_BIT(FD);
-			if (phydev->speed)
+			if (phydev->speed == SPEED_100)
 				reg |= MACB_BIT(SPD);
 
 			macb_writel(bp, NCFGR, reg);
#81 lore raw

PATCH 61/76 SCSI: gdth: fix to internal commands execution

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Boaz Harrosh <[email protected]>

The recent patch named:
[SCSI] gdth: !use_sg cleanup and use of scsi accessors

has done a bad job in handling internal commands issued by gdth_execute().

Internal commands are issued with device gdth_cmd_str ready made directly to the card, without any mapping or translations of scsi commands. So here I added a gdth_cmd_str pointer to the gdth_cmndinfo private structure which is then copied directly to host.

following this patch is a cleanup that removes the home cooked accessors and reverts them to regular scsi_cmnd accessors. Since they are not used anymore. After review maybe the 2 patches should be squashed together.

FIXME: There is still a problem with gdth_get_info(). as reported there
is a WARN_ON trigerd in dma_free_coherent() when doing:

   $ cat /proc/sys/gdth/0
---
 drivers/scsi/gdth.c |   30 ++++++++++++------------------
 drivers/scsi/gdth.h |    1 +
 2 files changed, 13 insertions(+), 18 deletions(-)
drivers/scsi/gdth.c +12 -18
@@ -160,7 +160,7 @@ static void gdth_readapp_event(gdth_ha_s
 static void gdth_clear_events(void);
 
 static void gdth_copy_internal_data(gdth_ha_str *ha, Scsi_Cmnd *scp,
-                                    char *buffer, ushort count, int to_buffer);
+                                    char *buffer, ushort count);
 static int gdth_internal_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp);
 static int gdth_fill_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, ushort hdrive);
 
@@ -439,8 +439,8 @@ static struct gdth_cmndinfo *gdth_get_cm
 	for (i=0; i<GDTH_MAXCMDS; ++i) {
 		if (ha->cmndinfo[i].index == 0) {
 			priv = &ha->cmndinfo[i];
-			priv->index = i+1;
 			memset(priv, 0, sizeof(*priv));
+			priv->index = i+1;
 			break;
 		}
 	}
@@ -487,7 +487,6 @@ int __gdth_execute(struct scsi_device *s
     gdth_ha_str *ha = shost_priv(sdev->host);
     Scsi_Cmnd *scp;
     struct gdth_cmndinfo cmndinfo;
-    struct scatterlist one_sg;
     DECLARE_COMPLETION_ONSTACK(wait);
     int rval;
 
@@ -501,13 +500,10 @@ int __gdth_execute(struct scsi_device *s
     /* use request field to save the ptr. to completion struct. */
     scp->request = (struct request *)&wait;
     scp->timeout_per_command = timeout*HZ;
-    sg_init_one(&one_sg, gdtcmd, sizeof(*gdtcmd));
-    gdth_set_sglist(scp, &one_sg);
-    gdth_set_sg_count(scp, 1);
-    gdth_set_bufflen(scp, sizeof(*gdtcmd));
     scp->cmd_len = 12;
     memcpy(scp->cmnd, cmnd, 12);
     cmndinfo.priority = IOCTL_PRI;
+    cmndinfo.internal_cmd_str = gdtcmd;
     cmndinfo.internal_command = 1;
 
     TRACE(("__gdth_execute() cmd 0x%x\n", scp->cmnd[0]));
@@ -2348,7 +2344,7 @@ static void gdth_next(gdth_ha_str *ha)
  * buffers, kmap_atomic() as needed.
  */
 static void gdth_copy_internal_data(gdth_ha_str *ha, Scsi_Cmnd *scp,
-                                    char *buffer, ushort count, int to_buffer)
+                                    char *buffer, ushort count)
 {
     ushort cpcount,i, max_sg = gdth_sg_count(scp);
     ushort cpsum,cpnow;
@@ -2374,10 +2370,7 @@ static void gdth_copy_internal_data(gdth
             }
             local_irq_save(flags);
             address = kmap_atomic(sg_page(sl), KM_BIO_SRC_IRQ) + sl->offset;
-            if (to_buffer)
-                memcpy(buffer, address, cpnow);
-            else
-                memcpy(address, buffer, cpnow);
+            memcpy(address, buffer, cpnow);
             flush_dcache_page(sg_page(sl));
             kunmap_atomic(address, KM_BIO_SRC_IRQ);
             local_irq_restore(flags);
@@ -2431,7 +2424,7 @@ static int gdth_internal_cache_cmd(gdth_
         strcpy(inq.vendor,ha->oem_name);
         sprintf(inq.product,"Host Drive  #%02d",t);
         strcpy(inq.revision,"   ");
-        gdth_copy_internal_data(ha, scp, (char*)&inq, sizeof(gdth_inq_data), 0);
+        gdth_copy_internal_data(ha, scp, (char*)&inq, sizeof(gdth_inq_data));
         break;
 
       case REQUEST_SENSE:
@@ -2441,7 +2434,7 @@ static int gdth_internal_cache_cmd(gdth_
         sd.key       = NO_SENSE;
         sd.info      = 0;
         sd.add_length= 0;
-        gdth_copy_internal_data(ha, scp, (char*)&sd, sizeof(gdth_sense_data), 0);
+        gdth_copy_internal_data(ha, scp, (char*)&sd, sizeof(gdth_sense_data));
         break;
 
       case MODE_SENSE:
@@ -2453,7 +2446,7 @@ static int gdth_internal_cache_cmd(gdth_
         mpd.bd.block_length[0] = (SECTOR_SIZE & 0x00ff0000) >> 16;
         mpd.bd.block_length[1] = (SECTOR_SIZE & 0x0000ff00) >> 8;
         mpd.bd.block_length[2] = (SECTOR_SIZE & 0x000000ff);
-        gdth_copy_internal_data(ha, scp, (char*)&mpd, sizeof(gdth_modep_data), 0);
+        gdth_copy_internal_data(ha, scp, (char*)&mpd, sizeof(gdth_modep_data));
         break;
 
       case READ_CAPACITY:
@@ -2463,7 +2456,7 @@ static int gdth_internal_cache_cmd(gdth_
         else
             rdc.last_block_no = cpu_to_be32(ha->hdr[t].size-1);
         rdc.block_length  = cpu_to_be32(SECTOR_SIZE);
-        gdth_copy_internal_data(ha, scp, (char*)&rdc, sizeof(gdth_rdcap_data), 0);
+        gdth_copy_internal_data(ha, scp, (char*)&rdc, sizeof(gdth_rdcap_data));
         break;
 
       case SERVICE_ACTION_IN:
@@ -2475,7 +2468,7 @@ static int gdth_internal_cache_cmd(gdth_
             rdc16.last_block_no = cpu_to_be64(ha->hdr[t].size-1);
             rdc16.block_length  = cpu_to_be32(SECTOR_SIZE);
             gdth_copy_internal_data(ha, scp, (char*)&rdc16,
-                                                 sizeof(gdth_rdcap16_data), 0);
+                                                 sizeof(gdth_rdcap16_data));
         } else { 
             scp->result = DID_ABORT << 16;
         }
@@ -2845,6 +2838,7 @@ static int gdth_fill_raw_cmd(gdth_ha_str
 static int gdth_special_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp)
 {
     register gdth_cmd_str *cmdp;
+    struct gdth_cmndinfo *cmndinfo = gdth_cmnd_priv(scp);
     int cmd_index;
 
     cmdp= ha->pccb;
@@ -2853,7 +2847,7 @@ static int gdth_special_cmd(gdth_ha_str 
     if (ha->type==GDT_EISA && ha->cmd_cnt>0) 
         return 0;
 
-    gdth_copy_internal_data(ha, scp, (char *)cmdp, sizeof(gdth_cmd_str), 1);
+    *cmdp = *cmndinfo->internal_cmd_str;
     cmdp->RequestBuffer = scp;
 
     /* search free command index */
drivers/scsi/gdth.h +1 -0
@@ -915,6 +915,7 @@ typedef struct {
     struct gdth_cmndinfo {                      /* per-command private info */
         int index;
         int internal_command;                   /* don't call scsi_done */
+        gdth_cmd_str *internal_cmd_str;         /* crier for internal messages*/
         dma_addr_t sense_paddr;                 /* sense dma-addr */
         unchar priority;
         int timeout;
#89 lore raw

PATCH 69/76 zisofs: fix readpage() outside i_size

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Dave Young <[email protected]>

A read request outside i_size will be handled in do_generic_file_read(). So we just return 0 to avoid getting -EIO as normal reading, let do_generic_file_read do the rest.

At the same time we need unlock the page to avoid system stuck.

Fixes http://bugzilla.kernel.org/show_bug.cgi?id=10227

---
 fs/isofs/compress.c |   11 +++++++++++
 1 file changed, 11 insertions(+)
fs/isofs/compress.c +11 -0
@@ -72,6 +72,17 @@ static int zisofs_readpage(struct file *
 	offset = index & ~zisofs_block_page_mask;
 	blockindex = offset >> zisofs_block_page_shift;
 	maxpage = (inode->i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
+
+	/*
+	 * If this page is wholly outside i_size we just return zero;
+	 * do_generic_file_read() will handle this for us
+	 */
+	if (page->index >= maxpage) {
+		SetPageUptodate(page);
+		unlock_page(page);
+		return 0;
+	}
+
 	maxpage = min(zisofs_block_pages, maxpage-offset);
 
 	for ( i = 0 ; i < maxpage ; i++, offset++ ) {
#65 lore raw

PATCH 45/76 e1000e: Fix CRC stripping in hardware context bug

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Auke Kok <[email protected]>

CRC stripping was only correctly enabled for packet split recieves which is used when receiving jumbo frames. Correctly enable SECRC also for normal buffer packet receives.

Tested by Andy Gospodarek and Johan Andersson, see bugzilla #9940.

---
 drivers/net/e1000e/netdev.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/e1000e/netdev.c +3 -3
@@ -1686,6 +1686,9 @@ static void e1000_setup_rctl(struct e100
 	else
 		rctl |= E1000_RCTL_LPE;
 
+	/* Enable hardware CRC frame stripping */
+	rctl |= E1000_RCTL_SECRC;
+
 	/* Setup buffer sizes */
 	rctl &= ~E1000_RCTL_SZ_4096;
 	rctl |= E1000_RCTL_BSEX;
@@ -1751,9 +1754,6 @@ static void e1000_setup_rctl(struct e100
 
 		/* Enable Packet split descriptors */
 		rctl |= E1000_RCTL_DTYP_PS;
-		
-		/* Enable hardware CRC frame stripping */
-		rctl |= E1000_RCTL_SECRC;
 
 		psrctl |= adapter->rx_ps_bsize0 >>
 			E1000_PSRCTL_BSIZE0_SHIFT;
#80 lore raw

PATCH 60/76 SCSI: gdth: bugfix for the at-exit problems

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Boaz Harrosh <[email protected]>

gdth_exit would first remove all cards then stop the timer and would not sync with the timer function. This caused a crash in gdth_timer() when module was unloaded.
So del_timer_sync the timer before we delete the cards.

also the reboot notifier function would crash. So clean that up and fix the crashes.

---
 drivers/scsi/gdth.c |   82 +++++++++++++++++-----------------------------------
 1 file changed, 28 insertions(+), 54 deletions(-)
drivers/scsi/gdth.c +28 -54
@@ -183,7 +183,6 @@ static int gdth_ioctl(struct inode *inod
                       unsigned int cmd, unsigned long arg);
 
 static void gdth_flush(gdth_ha_str *ha);
-static int gdth_halt(struct notifier_block *nb, ulong event, void *buf);
 static int gdth_queuecommand(Scsi_Cmnd *scp,void (*done)(Scsi_Cmnd *));
 static int __gdth_queuecommand(gdth_ha_str *ha, struct scsi_cmnd *scp,
 				struct gdth_cmndinfo *cmndinfo);
@@ -418,12 +417,6 @@ static inline void gdth_set_sglist(struc
 #include "gdth_proc.h"
 #include "gdth_proc.c"
 
-/* notifier block to get a notify on system shutdown/halt/reboot */
-static struct notifier_block gdth_notifier = {
-    gdth_halt, NULL, 0
-};
-static int notifier_disabled = 0;
-
 static gdth_ha_str *gdth_find_ha(int hanum)
 {
 	gdth_ha_str *ha;
@@ -3793,6 +3786,8 @@ static void gdth_timeout(ulong data)
     gdth_ha_str *ha;
     ulong flags;
 
+    BUG_ON(list_empty(&gdth_instances));
+
     ha = list_first_entry(&gdth_instances, gdth_ha_str, list);
     spin_lock_irqsave(&ha->smp_lock, flags);
 
@@ -4668,45 +4663,6 @@ static void gdth_flush(gdth_ha_str *ha)
     }
 }
 
-/* shutdown routine */
-static int gdth_halt(struct notifier_block *nb, ulong event, void *buf)
-{
-    gdth_ha_str *ha;
-#ifndef __alpha__
-    gdth_cmd_str    gdtcmd;
-    char            cmnd[MAX_COMMAND_SIZE];   
-#endif
-
-    if (notifier_disabled)
-        return NOTIFY_OK;
-
-    TRACE2(("gdth_halt() event %d\n",(int)event));
-    if (event != SYS_RESTART && event != SYS_HALT && event != SYS_POWER_OFF)
-        return NOTIFY_DONE;
-
-    notifier_disabled = 1;
-    printk("GDT-HA: Flushing all host drives .. ");
-    list_for_each_entry(ha, &gdth_instances, list) {
-        gdth_flush(ha);
-
-#ifndef __alpha__
-        /* controller reset */
-        memset(cmnd, 0xff, MAX_COMMAND_SIZE);
-        gdtcmd.BoardNode = LOCALBOARD;
-        gdtcmd.Service = CACHESERVICE;
-        gdtcmd.OpCode = GDT_RESET;
-        TRACE2(("gdth_halt(): reset controller %d\n", ha->hanum));
-        gdth_execute(ha->shost, &gdtcmd, cmnd, 10, NULL);
-#endif
-    }
-    printk("Done.\n");
-
-#ifdef GDTH_STATISTICS
-    del_timer(&gdth_timer);
-#endif
-    return NOTIFY_OK;
-}
-
 /* configure lun */
 static int gdth_slave_configure(struct scsi_device *sdev)
 {
@@ -5141,13 +5097,13 @@ static void gdth_remove_one(gdth_ha_str 
 
 	scsi_remove_host(shp);
 
+	gdth_flush(ha);
+
 	if (ha->sdev) {
 		scsi_free_host_dev(ha->sdev);
 		ha->sdev = NULL;
 	}
 
-	gdth_flush(ha);
-
 	if (shp->irq)
 		free_irq(shp->irq,ha);
 
@@ -5173,6 +5129,24 @@ static void gdth_remove_one(gdth_ha_str 
 	scsi_host_put(shp);
 }
 
+static int gdth_halt(struct notifier_block *nb, ulong event, void *buf)
+{
+	gdth_ha_str *ha;
+
+	TRACE2(("gdth_halt() event %d\n", (int)event));
+	if (event != SYS_RESTART && event != SYS_HALT && event != SYS_POWER_OFF)
+		return NOTIFY_DONE;
+
+	list_for_each_entry(ha, &gdth_instances, list)
+		gdth_flush(ha);
+
+	return NOTIFY_OK;
+}
+
+static struct notifier_block gdth_notifier = {
+    gdth_halt, NULL, 0
+};
+
 static int __init gdth_init(void)
 {
 	if (disable) {
@@ -5235,7 +5209,6 @@ static int __init gdth_init(void)
 	add_timer(&gdth_timer);
 #endif
 	major = register_chrdev(0,"gdth", &gdth_fops);
-	notifier_disabled = 0;
 	register_reboot_notifier(&gdth_notifier);
 	gdth_polling = FALSE;
 	return 0;
@@ -5245,14 +5218,15 @@ static void __exit gdth_exit(void)
 {
 	gdth_ha_str *ha;
 
-	list_for_each_entry(ha, &gdth_instances, list)
-		gdth_remove_one(ha);
+	unregister_chrdev(major, "gdth");
+	unregister_reboot_notifier(&gdth_notifier);
 
 #ifdef GDTH_STATISTICS
-	del_timer(&gdth_timer);
+	del_timer_sync(&gdth_timer);
 #endif
-	unregister_chrdev(major,"gdth");
-	unregister_reboot_notifier(&gdth_notifier);
+
+	list_for_each_entry(ha, &gdth_instances, list)
+		gdth_remove_one(ha);
 }
 
 module_init(gdth_init);
#73 lore raw

PATCH 53/76 VT notifier fix for VT switch

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Samuel Thibault <[email protected]>

VT notifier callbacks need to be aware of console switches. This is already partially done from console_callback(), but at that time fg_console, cursor positions, etc. are not yet updated and hence screen readers fetch the old values.

This adds an update notify after all of the values are updated in redraw_screen(vc, 1).

---
 drivers/char/vt.c |    1 +
 1 file changed, 1 insertion(+)
drivers/char/vt.c +1 -0
@@ -702,6 +702,7 @@ void redraw_screen(struct vc_data *vc, i
 	if (is_switch) {
 		set_leds();
 		compute_shiftstate();
+		notify_update(vc);
 	}
 }
 
#76 lore raw

PATCH 56/76 USB: ehci: handle large bulk URBs correctly (again)

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Misha Zhilin <[email protected]>

When use of urb->status in the EHCI driver was reworked last August (commit 14c04c0f88f228fee1f412be91d6edcb935c78aa), a bug was inserted in the handling of early completion for bulk transactions that need more than one qTD (e.g. more than 20KB in one URB).

This patch resolves that problem by ensuring that the early completion status is preserved until the URB is handed back to its submitter, instead of resetting it after each qTD.

---
 drivers/usb/host/ehci-q.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/ehci-q.c +1 -1
@@ -315,10 +315,10 @@ qh_completions (struct ehci_hcd *ehci, s
 			if (likely (last->urb != urb)) {
 				ehci_urb_done(ehci, last->urb, last_status);
 				count++;
+				last_status = -EINPROGRESS;
 			}
 			ehci_qtd_free (ehci, last);
 			last = NULL;
-			last_status = -EINPROGRESS;
 		}
 
 		/* ignore urbs submitted during completions we reported */
#77 lore raw

PATCH 57/76 SCSI: fix BUG when sum(scatterlist) > bufflen

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Tony Battersby <[email protected]>

When sending a SCSI command to a tape drive via the SCSI Generic (sg) driver, if the command has a data transfer length more than scatter_elem_sz (32 KB default) and not a multiple of 512, then I either hit BUG_ON(!valid_dma_direction(direction)) in dma_unmap_sg() or else the command never completes (depending on the LLDD).

When constructing scatterlists, the sg driver rounds up the scatterlist element sizes to be a multiple of 512. This can result in sum(scatterlist lengths) > bufflen. In this case, scsi_req_map_sg() incorrectly sets bio->bi_size to sum(scatterlist lengths) rather than to bufflen. When the command completes, req_bio_endio() detects that bio->bi_size != 0, and so it doesn't call bio_endio(). This causes the command to be resubmitted, resulting in BUG_ON or the command never completing.

This patch makes scsi_req_map_sg() set bio->bi_size to bufflen rather than to sum(scatterlist lengths), which fixes the problem.

---
 drivers/scsi/scsi_lib.c |    1 -
 1 file changed, 1 deletion(-)
drivers/scsi/scsi_lib.c +0 -1
@@ -298,7 +298,6 @@ static int scsi_req_map_sg(struct reques
 		page = sg_page(sg);
 		off = sg->offset;
 		len = sg->length;
- 		data_len += len;
 
 		while (len > 0 && data_len > 0) {
 			/*
#69 lore raw

PATCH 49/76 x86: move out tick_nohz_stop_sched_tick() call from the loop

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Hiroshi Shimamoto <[email protected]>

[upstream commit: 3d97775a]

Move out tick_nohz_stop_sched_tick() call from the loop in cpu_idle same as 32-bit version.

---
 arch/x86/kernel/process_64.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/kernel/process_64.c +1 -2
@@ -212,14 +212,13 @@ void cpu_idle (void)
 	current_thread_info()->status |= TS_POLLING;
 	/* endless idle loop with no priority at all */
 	while (1) {
+		tick_nohz_stop_sched_tick();
 		while (!need_resched()) {
 			void (*idle)(void);
 
 			if (__get_cpu_var(cpu_idle_state))
 				__get_cpu_var(cpu_idle_state) = 0;
 
-			tick_nohz_stop_sched_tick();
-
 			rmb();
 			idle = pm_idle;
 			if (!idle)
#82 lore raw

PATCH 62/76 SCSI: mpt fusion: dont oops if NumPhys==0

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Krzysztof Oledzki <[email protected]>

Don't oops if NumPhys==0, instead return -ENODEV.
This patch fixes http://bugzilla.kernel.org/show_bug.cgi?id=9909

---
 drivers/message/fusion/mptsas.c |    5 +++++
 1 file changed, 5 insertions(+)
drivers/message/fusion/mptsas.c +5 -0
@@ -1699,6 +1699,11 @@ mptsas_sas_expander_pg0(MPT_ADAPTER *ioc
 	if (error)
 		goto out_free_consistent;
 
+	if (!buffer->NumPhys) {
+		error = -ENODEV;
+		goto out_free_consistent;
+	}
+
 	/* save config data */
 	port_info->num_phys = buffer->NumPhys;
 	port_info->phy_info = kcalloc(port_info->num_phys,
#78 lore raw

PATCH 58/76 x86: dont use P6_NOPs if compiling with CONFIG_X86_GENERIC

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: H. Peter Anvin <[email protected]>

x86: don't use P6_NOPs if compiling with CONFIG_X86_GENERIC

P6_NOPs are definitely not supported on some VIA CPUs, and possibly (unverified) on AMD K7s. It is also the only thing that prevents a 686 kernel from running on Transmeta TM3x00/5x00 (Crusoe) series.

The performance benefit over generic NOPs is very small, so when building for generic consumption, avoid using them.

---

 include/asm-x86/processor_32.h |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
include/asm-x86/processor_32.h +3 -2
@@ -712,9 +712,10 @@ static inline unsigned int cpuid_edx(uns
 #define ASM_NOP6 K7_NOP6
 #define ASM_NOP7 K7_NOP7
 #define ASM_NOP8 K7_NOP8
-#elif defined(CONFIG_M686) || defined(CONFIG_MPENTIUMII) || \
+#elif (defined(CONFIG_M686) || defined(CONFIG_MPENTIUMII) || \
       defined(CONFIG_MPENTIUMIII) || defined(CONFIG_MPENTIUMM) || \
-      defined(CONFIG_MCORE2) || defined(CONFIG_PENTIUM4)
+      defined(CONFIG_MCORE2) || defined(CONFIG_PENTIUM4)) && \
+      !defined(CONFIG_X86_GENERIC)
 #define ASM_NOP1 P6_NOP1
 #define ASM_NOP2 P6_NOP2
 #define ASM_NOP3 P6_NOP3
#79 lore raw

PATCH 59/76 Fix default compose table initialization

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Samuel Thibault <[email protected]>

Oddly enough, unsigned int c = '\300'; puts a "negative" value in c, not 0300... This fixes the default unicode compose table by using integers instead of character constants.

Fold in upstream commit 10a7f3135ac4937a3dc8ed11614a2b70cbd44728 (Build fix for drivers/s390/char/defkeymap.c) from Tony Breeds.

Commit 5ce2087ed0eb424e0889bdc9102727f65d2ecdde (Fix default compose table initialization) left a trailing quote.

CC drivers/s390/char/defkeymap.o
drivers/s390/char/defkeymap.c:155: error: missing terminating ' character drivers/s390/char/defkeymap.c:156: error: syntax error before ';' token make[3]: *** [drivers/s390/char/defkeymap.o] Error 1

Fix that.

---
 drivers/acorn/char/defkeymap-l7200.c |   68 +++++++++++++++++------------------
 drivers/char/defkeymap.c_shipped     |   68 +++++++++++++++++------------------
 drivers/s390/char/defkeymap.c        |    4 +-
 3 files changed, 70 insertions(+), 70 deletions(-)
drivers/acorn/char/defkeymap-l7200.c +34 -34
@@ -347,40 +347,40 @@ char *func_table[MAX_NR_FUNC] = {
 };
 
 struct kbdiacruc accent_table[MAX_DIACR] = {
-	{'`', 'A', '\300'},	{'`', 'a', '\340'},
-	{'\'', 'A', '\301'},	{'\'', 'a', '\341'},
-	{'^', 'A', '\302'},	{'^', 'a', '\342'},
-	{'~', 'A', '\303'},	{'~', 'a', '\343'},
-	{'"', 'A', '\304'},	{'"', 'a', '\344'},
-	{'O', 'A', '\305'},	{'o', 'a', '\345'},
-	{'0', 'A', '\305'},	{'0', 'a', '\345'},
-	{'A', 'A', '\305'},	{'a', 'a', '\345'},
-	{'A', 'E', '\306'},	{'a', 'e', '\346'},
-	{',', 'C', '\307'},	{',', 'c', '\347'},
-	{'`', 'E', '\310'},	{'`', 'e', '\350'},
-	{'\'', 'E', '\311'},	{'\'', 'e', '\351'},
-	{'^', 'E', '\312'},	{'^', 'e', '\352'},
-	{'"', 'E', '\313'},	{'"', 'e', '\353'},
-	{'`', 'I', '\314'},	{'`', 'i', '\354'},
-	{'\'', 'I', '\315'},	{'\'', 'i', '\355'},
-	{'^', 'I', '\316'},	{'^', 'i', '\356'},
-	{'"', 'I', '\317'},	{'"', 'i', '\357'},
-	{'-', 'D', '\320'},	{'-', 'd', '\360'},
-	{'~', 'N', '\321'},	{'~', 'n', '\361'},
-	{'`', 'O', '\322'},	{'`', 'o', '\362'},
-	{'\'', 'O', '\323'},	{'\'', 'o', '\363'},
-	{'^', 'O', '\324'},	{'^', 'o', '\364'},
-	{'~', 'O', '\325'},	{'~', 'o', '\365'},
-	{'"', 'O', '\326'},	{'"', 'o', '\366'},
-	{'/', 'O', '\330'},	{'/', 'o', '\370'},
-	{'`', 'U', '\331'},	{'`', 'u', '\371'},
-	{'\'', 'U', '\332'},	{'\'', 'u', '\372'},
-	{'^', 'U', '\333'},	{'^', 'u', '\373'},
-	{'"', 'U', '\334'},	{'"', 'u', '\374'},
-	{'\'', 'Y', '\335'},	{'\'', 'y', '\375'},
-	{'T', 'H', '\336'},	{'t', 'h', '\376'},
-	{'s', 's', '\337'},	{'"', 'y', '\377'},
-	{'s', 'z', '\337'},	{'i', 'j', '\377'},
+	{'`', 'A', 0300},	{'`', 'a', 0340},
+	{'\'', 'A', 0301},	{'\'', 'a', 0341},
+	{'^', 'A', 0302},	{'^', 'a', 0342},
+	{'~', 'A', 0303},	{'~', 'a', 0343},
+	{'"', 'A', 0304},	{'"', 'a', 0344},
+	{'O', 'A', 0305},	{'o', 'a', 0345},
+	{'0', 'A', 0305},	{'0', 'a', 0345},
+	{'A', 'A', 0305},	{'a', 'a', 0345},
+	{'A', 'E', 0306},	{'a', 'e', 0346},
+	{',', 'C', 0307},	{',', 'c', 0347},
+	{'`', 'E', 0310},	{'`', 'e', 0350},
+	{'\'', 'E', 0311},	{'\'', 'e', 0351},
+	{'^', 'E', 0312},	{'^', 'e', 0352},
+	{'"', 'E', 0313},	{'"', 'e', 0353},
+	{'`', 'I', 0314},	{'`', 'i', 0354},
+	{'\'', 'I', 0315},	{'\'', 'i', 0355},
+	{'^', 'I', 0316},	{'^', 'i', 0356},
+	{'"', 'I', 0317},	{'"', 'i', 0357},
+	{'-', 'D', 0320},	{'-', 'd', 0360},
+	{'~', 'N', 0321},	{'~', 'n', 0361},
+	{'`', 'O', 0322},	{'`', 'o', 0362},
+	{'\'', 'O', 0323},	{'\'', 'o', 0363},
+	{'^', 'O', 0324},	{'^', 'o', 0364},
+	{'~', 'O', 0325},	{'~', 'o', 0365},
+	{'"', 'O', 0326},	{'"', 'o', 0366},
+	{'/', 'O', 0330},	{'/', 'o', 0370},
+	{'`', 'U', 0331},	{'`', 'u', 0371},
+	{'\'', 'U', 0332},	{'\'', 'u', 0372},
+	{'^', 'U', 0333},	{'^', 'u', 0373},
+	{'"', 'U', 0334},	{'"', 'u', 0374},
+	{'\'', 'Y', 0335},	{'\'', 'y', 0375},
+	{'T', 'H', 0336},	{'t', 'h', 0376},
+	{'s', 's', 0337},	{'"', 'y', 0377},
+	{'s', 'z', 0337},	{'i', 'j', 0377},
 };
 
 unsigned int accent_table_size = 68;
drivers/char/defkeymap.c_shipped +34 -34

74 lines not on this page · raw message

drivers/s390/char/defkeymap.c +2 -2
@@ -151,8 +151,8 @@ char *func_table[MAX_NR_FUNC] = {
 };
 
 struct kbdiacruc accent_table[MAX_DIACR] = {
-	{'^', 'c', '\003'},	{'^', 'd', '\004'},
-	{'^', 'z', '\032'},	{'^', '\012', '\000'},
+	{'^', 'c', 0003},	{'^', 'd', 0004},
+	{'^', 'z', 0032},	{'^', 0012, 0000},
 };
 
 unsigned int accent_table_size = 4;
#40 lore raw

PATCH 25/76 fuse: fix permission checking

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Miklos Szeredi <[email protected]>

[upstream commit 1a823ac9ff09cbdf39201df37b7ede1f9395de83]

I added a nasty local variable shadowing bug to fuse in 2.6.24, with the result, that the 'default_permissions' mount option is basically ignored.

How did this happen?

- old err declaration in inner scope
- new err getting declared in outer scope
- 'return err' from inner scope getting removed
- old declaration not being noticed

-Wshadow would have saved us, but it doesn't seem practical for the kernel :(

More testing would have also saved us :((

---
 fs/fuse/dir.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/fuse/dir.c +1 -1
@@ -905,7 +905,7 @@ static int fuse_permission(struct inode 
 	}
 
 	if (fc->flags & FUSE_DEFAULT_PERMISSIONS) {
-		int err = generic_permission(inode, mask, NULL);
+		err = generic_permission(inode, mask, NULL);
 
 		/* If permission is denied, try to refresh file
 		   attributes.  This is also needed, because the root
#63 lore raw

PATCH 43/76 moduleparam: fix alpha, ia64 and ppc64 compile failures

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Ivan Kokshaysky <[email protected]>

[upstream commit: 91d35dd9]

On alpha, ia64 and ppc64 only relocations to local data can go into read-only sections. The vast majority of module parameters use the global generic param_set_*/param_get_* functions, so the 'const' attribute for struct kernel_param is not only useless, but it also causes compile failures due to 'section type conflict' in those rare cases where param_set/get are local functions.

This fixes http://bugzilla.kernel.org/show_bug.cgi?id=8964

Cc Richard Henderson <[email protected]>
Cc Tony Luck <[email protected]>
Cc Anton Blanchard <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Adrian Bunk <[email protected]>
Cc Kamalesh Babulal <[email protected]>
Cc Rusty Russell <[email protected]>
Cc Mike Pagano <[email protected]>
[[email protected]: backport to 2.6.24.3]
---
 include/linux/moduleparam.h |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
include/linux/moduleparam.h +11 -1
@@ -62,6 +62,16 @@ struct kparam_array
 	void *elem;
 };
 
+/* On alpha, ia64 and ppc64 relocations to global data cannot go into
+   read-only sections (which is part of respective UNIX ABI on these
+   platforms). So 'const' makes no sense and even causes compile failures
+   with some compilers. */
+#if defined(CONFIG_ALPHA) || defined(CONFIG_IA64) || defined(CONFIG_PPC64)
+#define __moduleparam_const
+#else
+#define __moduleparam_const const
+#endif
+
 /* This is the fundamental function for registering boot/module
    parameters.  perm sets the visibility in sysfs: 000 means it's
    not there, read bits mean it's readable, write bits mean it's
@@ -71,7 +81,7 @@ struct kparam_array
 	static int __param_perm_check_##name __attribute__((unused)) =	\
 	BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2));	\
 	static const char __param_str_##name[] = prefix #name;		\
-	static struct kernel_param const __param_##name			\
+	static struct kernel_param __moduleparam_const __param_##name	\
 	__attribute_used__						\
     __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
 	= { __param_str_##name, perm, set, get, { arg } }
#44 lore raw

PATCH 29/76 SCSI aic94xx: fix REQ_TASK_ABORT and REQ_DEVICE_RESET

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: James Bottomley <[email protected]>

This driver has been failing under heavy load with

aic94xx: escb_tasklet_complete: REQ_TASK_ABORT, reason=0x6
aic94xx: escb_tasklet_complete: Can't find task (tc=4) to abort!

The second message is because the driver fails to identify the task it's being asked to abort. On closer inpection, there's a thinko in the for each task loop over pending tasks in both the REQ_TASK_ABORT and REQ_DEVICE_RESET cases where it doesn't look at the task on the pending list but at the one on the ESCB (which is always NULL).

Fix by looking at the right task. Also add a print for the case where the pending SCB doesn't have a task attached.

Not sure if this will fix all the problems, but it's a definite first step.

---
 drivers/scsi/aic94xx/aic94xx_scb.c |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/scsi/aic94xx/aic94xx_scb.c +10 -4
@@ -458,13 +458,19 @@ static void escb_tasklet_complete(struct
 		tc_abort = le16_to_cpu(tc_abort);
 
 		list_for_each_entry_safe(a, b, &asd_ha->seq.pend_q, list) {
-			struct sas_task *task = ascb->uldd_task;
+			struct sas_task *task = a->uldd_task;
+
+			if (a->tc_index != tc_abort)
+				continue;
 
-			if (task && a->tc_index == tc_abort) {
+			if (task) {
 				failed_dev = task->dev;
 				sas_task_abort(task);
-				break;
+			} else {
+				ASD_DPRINTK("R_T_A for non TASK scb 0x%x\n",
+					    a->scb->header.opcode);
 			}
+			break;
 		}
 
 		if (!failed_dev) {
@@ -478,7 +484,7 @@ static void escb_tasklet_complete(struct
 		 * that the EH will wake up and do something.
 		 */
 		list_for_each_entry_safe(a, b, &asd_ha->seq.pend_q, list) {
-			struct sas_task *task = ascb->uldd_task;
+			struct sas_task *task = a->uldd_task;
 
 			if (task &&
 			    task->dev == failed_dev &&
#27 lore raw

PATCH 12/76 IPV4: Remove IP_TOS setting privilege checks.

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: David S. Miller <[email protected]>

Upstream commit: e4f8b5d4edc1edb0709531bd1a342655d5e8b98e

Various RFCs have all sorts of things to say about the CS field of the DSCP value. In particular they try to make the distinction between values that should be used by "user applications" and things like routing daemons.

This seems to have influenced the CAP_NET_ADMIN check which exists for IP_TOS socket option settings, but in fact it has an off-by-one error so it wasn't allowing CS5 which is meant for "user applications" as well.

Further adding to the inconsistency and brokenness here, IPV6 does not validate the DSCP values specified for the IPV6_TCLASS socket option.

The real actual uses of these TOS values are system specific in the final analysis, and these RFC recommendations are just that, "a recommendation". In fact the standards very purposefully use "SHOULD" and "SHOULD NOT" when describing how these values can be used.

In the final analysis the only clean way to provide consistency here is to remove the CAP_NET_ADMIN check. The alternatives just don't work out:

1) If we add the CAP_NET_ADMIN check to ipv6, this can break existing setups.

2) If we just fix the off-by-one error in the class comparison in IPV4, certain DSCP values can be used in IPV6 but not IPV4 by default. So people will just ask for a sysctl asking to override that.

I checked several other freely available kernel trees and they do not make any privilege checks in this area like we do. For the BSD stacks, this goes back all the way to Stevens Volume 2 and beyond.

---
 net/ipv4/ip_sockglue.c |    5 -----
 1 file changed, 5 deletions(-)
net/ipv4/ip_sockglue.c +0 -5
@@ -514,11 +514,6 @@ static int do_ip_setsockopt(struct sock 
 			val &= ~3;
 			val |= inet->tos & 3;
 		}
-		if (IPTOS_PREC(val) >= IPTOS_PREC_CRITIC_ECP &&
-		    !capable(CAP_NET_ADMIN)) {
-			err = -EPERM;
-			break;
-		}
 		if (inet->tos != val) {
 			inet->tos = val;
 			sk->sk_priority = rt_tos2priority(val);
#28 lore raw

PATCH 13/76 IPCONFIG: The kernel gets no IP from some DHCP servers

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Stephen Hemminger <[email protected]>

Upstream commit: dea75bdfa57f75a7a7ec2961ec28db506c18e5db

From: Stephen Hemminger <[email protected]>

Based upon a patch by Marcel Wappler:

This patch fixes a DHCP issue of the kernel: some DHCP servers (i.e. in the Linksys WRT54Gv5) are very strict about the contents of the DHCPDISCOVER packet they receive from clients.

Table 5 in RFC2131 page 36 requests the fields 'ciaddr' and 'siaddr' MUST be set to '0'. These DHCP servers ignore Linux kernel's DHCP discovery packets with these two fields set to '255.255.255.255' (in contrast to popular DHCP clients, such as 'dhclient' or 'udhcpc'). This leads to a not booting system.

---
 net/ipv4/ipconfig.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv4/ipconfig.c +2 -2
@@ -739,9 +739,9 @@ static void __init ic_bootp_send_if(stru
 		printk("Unknown ARP type 0x%04x for device %s\n", dev->type, dev->name);
 		b->htype = dev->type; /* can cause undefined behavior */
 	}
+
+	/* server_ip and your_ip address are both already zero per RFC2131 */
 	b->hlen = dev->addr_len;
-	b->your_ip = NONE;
-	b->server_ip = NONE;
 	memcpy(b->hw_addr, dev->dev_addr, dev->addr_len);
 	b->secs = htons(jiffies_diff / HZ);
 	b->xid = d->xid;
#7 lore raw

PATCH 7/76 NIU: Bump driver version and release date.

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: David S. Miller <[email protected]>

Upstream commit: a442585952f137bd4cdb1f2f3166e4157d383b82

---
 drivers/net/niu.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/niu.c +2 -2
@@ -33,8 +33,8 @@
 
 #define DRV_MODULE_NAME		"niu"
 #define PFX DRV_MODULE_NAME	": "
-#define DRV_MODULE_VERSION	"0.6"
-#define DRV_MODULE_RELDATE	"January 5, 2008"
+#define DRV_MODULE_VERSION	"0.7"
+#define DRV_MODULE_RELDATE	"February 18, 2008"
 
 static char version[] __devinitdata =
 	DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
#26 lore raw

PATCH 11/76 IPV6: dst_entry leak in ip4ip6_err.

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Denis V. Lunev <[email protected]>

Upstream commit: 9937ded8e44de8865cba1509d24eea9d350cebf0

The result of the ip_route_output is not assigned to skb. This means that
- it is leaked
- possible OOPS below dereferrencing skb->dst
- no ICMP message for this case

---
 net/ipv6/ip6_tunnel.c |    1 +
 1 file changed, 1 insertion(+)
net/ipv6/ip6_tunnel.c +1 -0
@@ -550,6 +550,7 @@ ip4ip6_err(struct sk_buff *skb, struct i
 			ip_rt_put(rt);
 			goto out;
 		}
+		skb2->dst = (struct dst_entry *)rt;
 	} else {
 		ip_rt_put(rt);
 		if (ip_route_input(skb2, eiph->daddr, eiph->saddr, eiph->tos,
#23 lore raw

PATCH 8/76 NET: Messed multicast lists after dev_mc_sync/unsync

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Jorge Boncompte [DTI2] <[email protected]>

Upstream commit: 12aa343add3eced38a44bdb612b35fdf634d918c

Commit a0a400d79e3dd7843e7e81baa3ef2957bdc292d0 ("[NET]: dev_mcast:
add multicast list synchronization helpers") from you introduced a new field "da_synced" to struct dev_addr_list that is not properly initialized to 0. So when any of the current users (8021q, macvlan, mac80211) calls dev_mc_sync/unsync they mess the address list for both devices.

The attached patch fixed it for me and avoid future problems.

---
 net/core/dev.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/dev.c +1 -1
@@ -2906,7 +2906,7 @@ int __dev_addr_add(struct dev_addr_list 
 		}
 	}
 
-	da = kmalloc(sizeof(*da), GFP_ATOMIC);
+	da = kzalloc(sizeof(*da), GFP_ATOMIC);
 	if (da == NULL)
 		return -ENOMEM;
 	memcpy(da->da_addr, addr, alen);
#4 lore raw

PATCH 4/76 TCP: Improve ipv4 established hash function.

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: David S. Miller <[email protected]>

Upstream commit: 7adc3830f90df04a13366914d80a3ed407db5381

If all of the entropy is in the local and foreign addresses, but xor'ing together would cancel out that entropy, the current hash performs poorly.

Suggested by Cosmin Ratiu:

Basically, the situation is as follows: There is a client machine and a server machine. Both create 15000 virtual interfaces, open up a socket for each pair of interfaces and do SIP traffic. By profiling I noticed that there is a lot of time spent walking the established hash chains with this particular setup.

The addresses were distributed like this: client interfaces were 198.18.0.1/16 with increments of 1 and server interfaces were 198.18.128.1/16 with increments of 1. As I said, there were 15000 interfaces. Source and destination ports were 5060 for each connection. So in this case, ports don't matter for hashing purposes, and the bits from the address pairs used cancel each other, meaning there are no differences in the whole lot of pairs, so they all end up in the same hash chain.

---
 include/net/inet_sock.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/net/inet_sock.h +2 -1
@@ -175,7 +175,8 @@ extern void build_ehash_secret(void);
 static inline unsigned int inet_ehashfn(const __be32 laddr, const __u16 lport,
 					const __be32 faddr, const __be16 fport)
 {
-	return jhash_2words((__force __u32) laddr ^ (__force __u32) faddr,
+	return jhash_3words((__force __u32) laddr,
+			    (__force __u32) faddr,
 			    ((__u32) lport) << 16 | (__force __u32)fport,
 			    inet_ehash_secret);
 }
#6 lore raw

PATCH 6/76 NIU: Fix BMAC alternate MAC address indexing.

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Matheos Worku <[email protected]>

Upstream commit: 3b5bcedeeb755b6e813537fcf4c32f010b490aef

BMAC port alternate MAC address index needs to start at 1. Index 0 is used for the main MAC address.

---
 drivers/net/niu.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/niu.c +6 -1
@@ -5148,7 +5148,12 @@ static void niu_set_rx_mode(struct net_d
 			index++;
 		}
 	} else {
-		for (i = 0; i < niu_num_alt_addr(np); i++) {
+		int alt_start;
+		if (np->flags & NIU_FLAGS_XMAC)
+			alt_start = 0;
+		else
+			alt_start = 1;
+		for (i = alt_start; i < niu_num_alt_addr(np); i++) {
 			err = niu_enable_alt_mac(np, i, 0);
 			if (err)
 				printk(KERN_WARNING PFX "%s: Error %d "
#24 lore raw

PATCH 9/76 NET: Fix race in dev_close(). (Bug 9750)

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Matti Linnanvuori <[email protected]>

Upstream commit: d8b2a4d21e0b37b9669b202867bfef19f68f786a

There is a race in Linux kernel file net/core/dev.c, function dev_close. The function calls function dev_deactivate, which calls function dev_watchdog_down that deletes the watchdog timer. However, after that, a driver can call netif_carrier_ok, which calls function __netdev_watchdog_up that can add the watchdog timer again. Function unregister_netdevice calls function dev_shutdown that traps the bug !timer_pending(&dev->watchdog_timer). Moving dev_deactivate after netif_running() has been cleared prevents function netif_carrier_on from calling __netdev_watchdog_up and adding the watchdog timer again.

---
 net/core/dev.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/core/dev.c +2 -2
@@ -1068,8 +1068,6 @@ int dev_close(struct net_device *dev)
 	 */
 	call_netdevice_notifiers(NETDEV_GOING_DOWN, dev);
 
-	dev_deactivate(dev);
-
 	clear_bit(__LINK_STATE_START, &dev->state);
 
 	/* Synchronize to scheduled poll. We cannot touch poll list,
@@ -1080,6 +1078,8 @@ int dev_close(struct net_device *dev)
 	 */
 	smp_mb__after_clear_bit(); /* Commit netif_running(). */
 
+	dev_deactivate(dev);
+
 	/*
 	 *	Call the device specific close. This cannot fail.
 	 *	Only if device is UP
#5 lore raw

PATCH 5/76 NIU: More BMAC alt MAC address fixes.

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Matheos Worku <[email protected]>

Upstream commit: fa907895b7b776208a1406efe5ba7ffe0f49f507

From: Matheos Worku <[email protected]>

1) niu_enable_alt_mac() needs to be adjusted so that the mask is computed properly for the BMAC case.

2) BMAC has 6 alt MAC addresses available, not 7.

---
 drivers/net/niu.c |    9 +++++----
 drivers/net/niu.h |    2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)
drivers/net/niu.c +5 -4
@@ -1616,12 +1616,13 @@ static int niu_enable_alt_mac(struct niu
 	if (index >= niu_num_alt_addr(np))
 		return -EINVAL;
 
-	if (np->flags & NIU_FLAGS_XMAC)
+	if (np->flags & NIU_FLAGS_XMAC) {
 		reg = XMAC_ADDR_CMPEN;
-	else
+		mask = 1 << index;
+	} else {
 		reg = BMAC_ADDR_CMPEN;
-
-	mask = 1 << index;
+		mask = 1 << (index + 1);
+	}
 
 	val = nr64_mac(reg);
 	if (on)
drivers/net/niu.h +1 -1
@@ -499,7 +499,7 @@
 #define BMAC_ADDR2			0x00110UL
 #define  BMAC_ADDR2_ADDR2		0x000000000000ffffULL
 
-#define BMAC_NUM_ALT_ADDR		7
+#define BMAC_NUM_ALT_ADDR		6
 
 #define BMAC_ALT_ADDR0(NUM)		(0x00118UL + (NUM)*0x18UL)
 #define  BMAC_ALT_ADDR0_ADDR0		0x000000000000ffffULL
#36 lore raw

PATCH 21/76 x86: adjust enable_NMI_through_LVT0()

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Jan Beulich <[email protected]>

commit e94271017f0933b29362a3c9dea5a6b9d04d98e1

Its previous use in a call to on_each_cpu() was pointless, as at the time that code gets executed only one CPU is online. Further, the function can be __cpuinit, and for this to work without CONFIG_HOTPLUG_CPU setup_nmi() must also get an attribute (this one can even be __init; on 64-bits check_timer() also was lacking that attribute).

---
 arch/x86/kernel/apic_32.c    |    2 +-
 arch/x86/kernel/apic_64.c    |    2 +-
 arch/x86/kernel/io_apic_32.c |    4 ++--
 arch/x86/kernel/io_apic_64.c |    6 +++---
 arch/x86/kernel/smpboot_32.c |    2 +-
 arch/x86/kernel/smpboot_64.c |    2 +-
 include/asm-x86/apic_32.h    |    2 +-
 include/asm-x86/io_apic_64.h |    2 +-
 8 files changed, 11 insertions(+), 11 deletions(-)
arch/x86/kernel/apic_32.c +1 -1
@@ -154,7 +154,7 @@ unsigned long safe_apic_wait_icr_idle(vo
 /**
  * enable_NMI_through_LVT0 - enable NMI through local vector table 0
  */
-void enable_NMI_through_LVT0 (void * dummy)
+void __cpuinit enable_NMI_through_LVT0(void)
 {
 	unsigned int v = APIC_DM_NMI;
 
arch/x86/kernel/apic_64.c +1 -1
@@ -151,7 +151,7 @@ unsigned int safe_apic_wait_icr_idle(voi
 	return send_status;
 }
 
-void enable_NMI_through_LVT0 (void * dummy)
+void enable_NMI_through_LVT0(void)
 {
 	unsigned int v;
 
arch/x86/kernel/io_apic_32.c +2 -2
@@ -2080,7 +2080,7 @@ static struct irq_chip lapic_chip __read
 	.eoi		= ack_apic,
 };
 
-static void setup_nmi (void)
+static void __init setup_nmi(void)
 {
 	/*
  	 * Dirty trick to enable the NMI watchdog ...
@@ -2093,7 +2093,7 @@ static void setup_nmi (void)
 	 */ 
 	apic_printk(APIC_VERBOSE, KERN_INFO "activating NMI Watchdog ...");
 
-	on_each_cpu(enable_NMI_through_LVT0, NULL, 1, 1);
+	enable_NMI_through_LVT0();
 
 	apic_printk(APIC_VERBOSE, " done.\n");
 }
arch/x86/kernel/io_apic_64.c +3 -3
@@ -1565,7 +1565,7 @@ static struct hw_interrupt_type lapic_ir
 	.end = end_lapic_irq,
 };
 
-static void setup_nmi (void)
+static void __init setup_nmi(void)
 {
 	/*
  	 * Dirty trick to enable the NMI watchdog ...
@@ -1578,7 +1578,7 @@ static void setup_nmi (void)
 	 */ 
 	printk(KERN_INFO "activating NMI Watchdog ...");
 
-	enable_NMI_through_LVT0(NULL);
+	enable_NMI_through_LVT0();
 
 	printk(" done.\n");
 }
@@ -1654,7 +1654,7 @@ static inline void unlock_ExtINT_logic(v
  *
  * FIXME: really need to revamp this for modern platforms only.
  */
-static inline void check_timer(void)
+static inline void __init check_timer(void)
 {
 	struct irq_cfg *cfg = irq_cfg + 0;
 	int apic1, pin1, apic2, pin2;
arch/x86/kernel/smpboot_32.c +1 -1
@@ -405,7 +405,7 @@ static void __cpuinit start_secondary(vo
 	setup_secondary_clock();
 	if (nmi_watchdog == NMI_IO_APIC) {
 		disable_8259A_irq(0);
-		enable_NMI_through_LVT0(NULL);
+		enable_NMI_through_LVT0();
 		enable_8259A_irq(0);
 	}
 	/*
arch/x86/kernel/smpboot_64.c +1 -1
@@ -338,7 +338,7 @@ void __cpuinit start_secondary(void)
 
 	if (nmi_watchdog == NMI_IO_APIC) {
 		disable_8259A_irq(0);
-		enable_NMI_through_LVT0(NULL);
+		enable_NMI_through_LVT0();
 		enable_8259A_irq(0);
 	}
 
include/asm-x86/apic_32.h +1 -1
@@ -109,7 +109,7 @@ extern void setup_boot_APIC_clock (void)
 extern void setup_secondary_APIC_clock (void);
 extern int APIC_init_uniprocessor (void);
 
-extern void enable_NMI_through_LVT0 (void * dummy);
+extern void enable_NMI_through_LVT0(void);
 
 #define ARCH_APICTIMER_STOPS_ON_C3	1
 
include/asm-x86/io_apic_64.h +1 -1
@@ -129,7 +129,7 @@ extern int io_apic_set_pci_routing (int 
 
 extern int sis_apic_bug; /* dummy */ 
 
-void enable_NMI_through_LVT0 (void * dummy);
+void enable_NMI_through_LVT0(void);
 
 extern spinlock_t i8259A_lock;
 
#34 lore raw

PATCH 19/76 iov_iter_advance() fix

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Nick Piggin <[email protected]>

iov_iter_advance() skips over zero-length iovecs, however it does not properly terminate at the end of the iovec array. Fix this by checking against i->count before we skip a zero-length iov.

The bug was reproduced with a test program that continually randomly creates iovs to writev. The fix was also verified with the same program and also it could verify that the correct data was contained in the file after each writev.

---
 mm/filemap.c |   22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)
mm/filemap.c +10 -12
@@ -1725,21 +1725,27 @@ size_t iov_iter_copy_from_user(struct pa
 }
 EXPORT_SYMBOL(iov_iter_copy_from_user);
 
-static void __iov_iter_advance_iov(struct iov_iter *i, size_t bytes)
+void iov_iter_advance(struct iov_iter *i, size_t bytes)
 {
+	BUG_ON(i->count < bytes);
+
 	if (likely(i->nr_segs == 1)) {
 		i->iov_offset += bytes;
+		i->count -= bytes;
 	} else {
 		const struct iovec *iov = i->iov;
 		size_t base = i->iov_offset;
 
 		/*
 		 * The !iov->iov_len check ensures we skip over unlikely
-		 * zero-length segments.
+		 * zero-length segments (without overruning the iovec).
 		 */
-		while (bytes || !iov->iov_len) {
-			int copy = min(bytes, iov->iov_len - base);
+		while (bytes || unlikely(!iov->iov_len && i->count)) {
+			int copy;
 
+			copy = min(bytes, iov->iov_len - base);
+			BUG_ON(!i->count || i->count < copy);
+			i->count -= copy;
 			bytes -= copy;
 			base += copy;
 			if (iov->iov_len == base) {
@@ -1751,14 +1757,6 @@ static void __iov_iter_advance_iov(struc
 		i->iov_offset = base;
 	}
 }
-
-void iov_iter_advance(struct iov_iter *i, size_t bytes)
-{
-	BUG_ON(i->count < bytes);
-
-	__iov_iter_advance_iov(i, bytes);
-	i->count -= bytes;
-}
 EXPORT_SYMBOL(iov_iter_advance);
 
 /*
#57 lore raw

PATCH 37/76 spi: pxa2xx_spi clock polarity fix

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Ned Forrester <[email protected]>

Fixes a sequencing bug in spi driver pxa2xx_spi.c in which the chip select for a transfer may be asserted before the clock polarity is set on the interface. As a result of this bug, the clock signal may have the wrong polarity at transfer start, so it may need to make an extra half transition before the intended clock/data signals begin. (This probably means all transfers are one bit out of sequence.)

This only occurs on the first transfer following a change in clock polarity in systems using more than one more than one such polarity. The fix assures that the clock mode is properly set before asserting chip select.

This bug was introduced in a patch merged on 2006/12/10, kernel 2.6.20. The patch defines an additional bit in: include/asm-arm/arch-pxa/regs-ssp.h for 2.6.25 and newer kernels but this addition must be made in:
include/asm-arm/arch-pxa/pxa-regs.h for kernels between 2.6.20 and 2.6.24, inclusive

---
 drivers/spi/pxa2xx_spi.c            |   41 +++++++++++++++++++++++-------------
 include/asm-arm/arch-pxa/pxa-regs.h |    1 
 2 files changed, 28 insertions(+), 14 deletions(-)
drivers/spi/pxa2xx_spi.c +27 -14
@@ -48,13 +48,19 @@ MODULE_LICENSE("GPL");
 #define RESET_DMA_CHANNEL (DCSR_NODESC | DMA_INT_MASK)
 #define IS_DMA_ALIGNED(x) (((u32)(x)&0x07)==0)
 
-/* for testing SSCR1 changes that require SSP restart, basically
- * everything except the service and interrupt enables */
-#define SSCR1_CHANGE_MASK (SSCR1_TTELP | SSCR1_TTE | SSCR1_EBCEI | SSCR1_SCFR \
+/*
+ * for testing SSCR1 changes that require SSP restart, basically
+ * everything except the service and interrupt enables, the pxa270 developer
+ * manual says only SSCR1_SCFR, SSCR1_SPH, SSCR1_SPO need to be in this
+ * list, but the PXA255 dev man says all bits without really meaning the
+ * service and interrupt enables
+ */
+#define SSCR1_CHANGE_MASK (SSCR1_TTELP | SSCR1_TTE | SSCR1_SCFR \
 				| SSCR1_ECRA | SSCR1_ECRB | SSCR1_SCLKDIR \
-				| SSCR1_RWOT | SSCR1_TRAIL | SSCR1_PINTE \
-				| SSCR1_STRF | SSCR1_EFWR |SSCR1_RFT \
-				| SSCR1_TFT | SSCR1_SPH | SSCR1_SPO | SSCR1_LBM)
+				| SSCR1_SFRMDIR | SSCR1_RWOT | SSCR1_TRAIL \
+				| SSCR1_IFS | SSCR1_STRF | SSCR1_EFWR \
+				| SSCR1_RFT | SSCR1_TFT | SSCR1_MWDS \
+				| SSCR1_SPH | SSCR1_SPO | SSCR1_LBM)
 
 #define DEFINE_SSP_REG(reg, off) \
 static inline u32 read_##reg(void *p) { return __raw_readl(p + (off)); } \
@@ -961,9 +967,6 @@ static void pump_transfers(unsigned long
 		if (drv_data->ssp_type == PXA25x_SSP)
 			DCMD(drv_data->tx_channel) |= DCMD_ENDIRQEN;
 
-		/* Fix me, need to handle cs polarity */
-		drv_data->cs_control(PXA2XX_CS_ASSERT);
-
 		/* Clear status and start DMA engine */
 		cr1 = chip->cr1 | dma_thresh | drv_data->dma_cr1;
 		write_SSSR(drv_data->clear_sr, reg);
@@ -973,9 +976,6 @@ static void pump_transfers(unsigned long
 		/* Ensure we have the correct interrupt handler	*/
 		drv_data->transfer_handler = interrupt_transfer;
 
-		/* Fix me, need to handle cs polarity */
-		drv_data->cs_control(PXA2XX_CS_ASSERT);
-
 		/* Clear status  */
 		cr1 = chip->cr1 | chip->threshold | drv_data->int_cr1;
 		write_SSSR(drv_data->clear_sr, reg);
@@ -986,16 +986,29 @@ static void pump_transfers(unsigned long
 		|| (read_SSCR1(reg) & SSCR1_CHANGE_MASK) !=
 			(cr1 & SSCR1_CHANGE_MASK)) {
 
+		/* stop the SSP, and update the other bits */
 		write_SSCR0(cr0 & ~SSCR0_SSE, reg);
 		if (drv_data->ssp_type != PXA25x_SSP)
 			write_SSTO(chip->timeout, reg);
-		write_SSCR1(cr1, reg);
+		/* first set CR1 without interrupt and service enables */
+		write_SSCR1(cr1 & SSCR1_CHANGE_MASK, reg);
+		/* restart the SSP */
 		write_SSCR0(cr0, reg);
+
 	} else {
 		if (drv_data->ssp_type != PXA25x_SSP)
 			write_SSTO(chip->timeout, reg);
-		write_SSCR1(cr1, reg);
 	}
+
+	/* FIXME, need to handle cs polarity,
+	 * this driver uses struct pxa2xx_spi_chip.cs_control to
+	 * specify a CS handling function, and it ignores most
+	 * struct spi_device.mode[s], including SPI_CS_HIGH */
+	drv_data->cs_control(PXA2XX_CS_ASSERT);
+
+	/* after chip select, release the data by enabling service
+	 * requests and interrupts, without changing any mode bits */
+	write_SSCR1(cr1, reg);
 }
 
 static void pump_messages(struct work_struct *work)
include/asm-arm/arch-pxa/pxa-regs.h +1 -0
@@ -1669,6 +1669,7 @@
 #define SSCR1_RSRE		(1 << 20)	/* Receive Service Request Enable */
 #define SSCR1_TINTE		(1 << 19)	/* Receiver Time-out Interrupt enable */
 #define SSCR1_PINTE		(1 << 18)	/* Peripheral Trailing Byte Interupt Enable */
+#define SSCR1_IFS		(1 << 16)	/* Invert Frame Signal */
 #define SSCR1_STRF		(1 << 15)	/* Select FIFO or EFWR */
 #define SSCR1_EFWR		(1 << 14)	/* Enable FIFO Write/Read */
 
#54 lore raw

PATCH 34/76 file capabilities: simplify signal check

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Serge E. Hallyn <[email protected]>

Simplify the uid equivalence check in cap_task_kill(). Anyone can kill a process owned by the same uid.

Without this patch wireshark is reported to fail.

---
 security/commoncap.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
security/commoncap.c +1 -1
@@ -539,7 +539,7 @@ int cap_task_kill(struct task_struct *p,
 	 * allowed.
 	 * We must preserve legacy signal behavior in this case.
 	 */
-	if (p->euid == 0 && p->uid == current->uid)
+	if (p->uid == current->uid)
 		return 0;
 
 	/* sigcont is permitted within same session */
#68 lore raw

PATCH 48/76 atmel_spi: fix clock polarity

In reply to Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Atsushi Nemoto <[email protected]>

The atmel_spi driver does not initialize clock polarity correctly (except for at91rm9200 CS0 channel) in some case.

The atmel_spi driver uses gpio-controlled chipselect. OTOH spi clock signal is controlled by CSRn.CPOL bit, but this register controls clock signal correctly only in 'real transfer' duration. At the time of cs_activate() call, CSRn.CPOL will be initialized correctly, but the controller do not know which channel is to be used next, so clock signal will stay at the inactive state of last transfer. If clock polarity of new transfer and last transfer was differ, new transfer will start with wrong clock signal state.

For example, if you started SPI MODE 2 or 3 transfer after SPI MODE 0 or 1 transfer, the clock signal state at the assertion of chipselect will be low. Of course this will violates SPI transfer.

This patch is short term solution for this problem. It makes all CSRn.CPOL match for the transfer before activating chipselect. For longer term, the best fix might be to let NPCS0 stay selected permanently in MR and overwrite CSR0 with to the new slave's settings before asserting CS.

---

 drivers/spi/atmel_spi.c |   10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/spi/atmel_spi.c +10 -0
@@ -85,6 +85,16 @@ static void cs_activate(struct atmel_spi
 	unsigned gpio = (unsigned) spi->controller_data;
 	unsigned active = spi->mode & SPI_CS_HIGH;
 	u32 mr;
+	int i;
+	u32 csr;
+	u32 cpol = (spi->mode & SPI_CPOL) ? SPI_BIT(CPOL) : 0;
+
+	/* Make sure clock polarity is correct */
+	for (i = 0; i < spi->master->num_chipselect; i++) {
+		csr = spi_readl(as, CSR0 + 4 * i);
+		if ((csr ^ cpol) & SPI_BIT(CPOL))
+			spi_writel(as, CSR0 + 4 * i, csr ^ SPI_BIT(CPOL));
+	}
 
 	mr = spi_readl(as, MR);
 	mr = SPI_BFINS(PCS, ~(1 << spi->chip_select), mr);
#8 lore raw

Re: [patch 07/76] NIU: Bump driver version and release date.

In reply to Chris Wright
Quoted 3 lines · Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

I don't see how this one fits this criteria from
Documentation/stable_kernel_rules.txt :

...
- It must fix a real bug that bothers people (not a, "This could be a problem..." type thing).
...

As I see it, this patch is quite trivial and does not fix any "real problem". How come this is suitable for -stable?

I have no objections to the patch "as such", I just don't think it makes sense for -stable.

Quoted 26 lines

From: David S. Miller <[email protected]>

Upstream commit: a442585952f137bd4cdb1f2f3166e4157d383b82

---

  drivers/net/niu.c |    4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -33,8 +33,8 @@

#define DRV_MODULE_NAME "niu"

  #define PFX DRV_MODULE_NAME    ": "
 -#define DRV_MODULE_VERSION     "0.6"
 -#define DRV_MODULE_RELDATE     "January 5, 2008"
 +#define DRV_MODULE_VERSION     "0.7"
 +#define DRV_MODULE_RELDATE     "February 18, 2008"
  static char version[] __devinitdata =
        DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
Signature · 3 lines
Jesper Juhl <[email protected]>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html
maintainer
#9 lore raw

Re: [patch 07/76] NIU: Bump driver version and release date.

From: "Jesper Juhl" <[email protected]>
Date: Sat, 22 Mar 2008 01:10:40 +0100

Quoted 5 lines

As I see it, this patch is quite trivial and does not fix any "real problem". How come this is suitable for -stable?

I have no objections to the patch "as such", I just don't think it makes sense for -stable.

It makes a difference for driver maintainers when users report bugs and we ask them for the version printed by the driver so that we know which fixes have been applied.

You know, if people are going to be jerky about this, I'll just include the version bump in the actual bug fixes which I sometimes do anyways.

Thanks for bringing this up, it's a useful use of everyone's time :-/

#10 lore raw

Re: [patch 07/76] NIU: Bump driver version and release date.

Quoted 7 lines · David Miller

From: "Jesper Juhl" <[email protected]>
Date: Sat, 22 Mar 2008 01:10:40 +0100

Quoted 3 lines

As I see it, this patch is quite trivial and does not fix any "real problem". How come this is suitable for -stable?

Quoted 9 lines
Quoted 2 lines

I have no objections to the patch "as such", I just don't think it makes sense for -stable.

It makes a difference for driver maintainers when users
report bugs and we ask them for the version printed by the driver so that we know which fixes have been applied.

Ok, fair enough.

Quoted 7 lines

You know, if people are going to be jerky about this, I'll just include the version bump in the actual bug fixes which I sometimes do anyways.

Thanks for bringing this up, it's a useful use of everyone's time :-/

Excuse me for reading patches, trying to spot problems and thinking about where they are applied and what rules apply etc.

Signature · 3 lines
Jesper Juhl <[email protected]>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html
#97 lore raw
In reply to Chris Wright
Quoted 1 line · Chris Wright

This is the start of the stable review cycle for the 2.6.24.4 release.

Hi Chris,
The below is also a candidate for 2.6.24.4. It should apply cleanly. Joe

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6d2144d355d2a532e5cc3fc12a6ba2a8d4ef15e4
Commit:     6d2144d355d2a532e5cc3fc12a6ba2a8d4ef15e4
Parent:     b6210386787728b84db25adc4f1eba70440a4c73
Author:     Joe Korty <[email protected]>
AuthorDate: Wed Mar 5 15:04:59 2008 -0800
Committer:  Christoph Lameter <[email protected]>
CommitDate: Thu Mar 6 16:21:50 2008 -0800

slab: NUMA slab allocator migration bugfix

NUMA slab allocator cpu migration bugfix

The NUMA slab allocator (specifically, cache_alloc_refill) is not refreshing its local copies of what cpu and what numa node it is on, when it drops and reacquires the irq block that it inherited from its caller. As a result those values become invalid if an attempt to migrate the process to another numa node occured while the irq block had been dropped.

The solution is to make cache_alloc_refill reload these variables whenever it drops and reacquires the irq block.

The error is very difficult to hit. When it does occur, one gets the following oops + stack traceback bits in check_spinlock_acquired:

kernel BUG at mm/slab.c:2417
cache_alloc_refill+0xe6
kmem_cache_alloc+0xd0
...

This patch was developed against 2.6.23, ported to and compiled-tested only against 2.6.25-rc4.

---
 mm/slab.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
mm/slab.c +2 -3
index f7faff7..e6c698f 100644
@@ -2964,11 +2964,10 @@ static void *cache_alloc_refill(struct kmem_cache *cachep, gfp_t flags)
 	struct array_cache *ac;
 	int node;
 
-	node = numa_node_id();
-
+retry:
 	check_irq_off();
+	node = numa_node_id();
 	ac = cpu_cache_get(cachep);
-retry:
 	batchcount = ac->batchcount;
 	if (!ac->touched && batchcount > BATCHREFILL_LIMIT) {
 		/*
#12 lore raw

Re: [patch 07/76] NIU: Bump driver version and release date.

In reply to David Miller
Quoted 4 lines

It makes a difference for driver maintainers when users report bugs and we ask them for the version printed by the driver so that we know which fixes have been applied.

I'm not sure if this series of patches really accomplishes that... you're leaving out some patches such as "[NIU]: Fix 1G PHY link state handling." that are in the real 0.7. So the 2.6.24.stable version 0.7 has a different set of fixes than the 2.6.25 version 0.7.

- R.

maintainer
#13 lore raw

Re: [patch 07/76] NIU: Bump driver version and release date.

From: Roland Dreier <[email protected]>
Date: Fri, 21 Mar 2008 19:35:40 -0700

Quoted 9 lines
Quoted 4 lines

It makes a difference for driver maintainers when users report bugs and we ask them for the version printed by the driver so that we know which fixes have been applied.

I'm not sure if this series of patches really accomplishes that... you're leaving out some patches such as "[NIU]: Fix 1G PHY link state handling." that are in the real 0.7. So the 2.6.24.stable version 0.7 has a different set of fixes than the 2.6.25 version 0.7.

That was an oversight and not intentional, thanks for for catching that.

#49 lore raw

Re: [patch 33/76] futex: runtime enable pi and robust functionality

In reply to Chris Wright
Quoted 2 lines · Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

For this one you need the S390 fixes:

504e75d0ed3389747e40a4aaa4b1f4e569576665

Author: Heiko Carstens <[email protected]>
Date:   Thu Mar 20 17:33:38 2008 +0100

[S390] futex: let futex_atomic_cmpxchg_pt survive early functional tests.

commit d5b02b3ff1d9a2e1074f559c84ed378cfa6fc3c0

Author: Heiko Carstens <[email protected]>
Date:   Tue Feb 19 15:29:34 2008 +0100

[S390] Fix futex_atomic_cmpxchg_std inline assembly.

Thanks,

tglx

#50 lore raw

Re: [patch 33/76] futex: runtime enable pi and robust functionality

Quoted 5 lines · Thomas Gleixner
Quoted 2 lines · Chris Wright

-stable review patch. If anyone has any objections, please let us know.
---------------------

Quoted 7 lines

For this one you need the S390 fixes:

504e75d0ed3389747e40a4aaa4b1f4e569576665

Author: Heiko Carstens <[email protected]>
Date:   Thu Mar 20 17:33:38 2008 +0100

[S390] futex: let futex_atomic_cmpxchg_pt survive early functional tests.

Yes, forgot to add -stable to the cc list. Sorry.

Quoted 5 lines

commit d5b02b3ff1d9a2e1074f559c84ed378cfa6fc3c0

Author: Heiko Carstens <[email protected]>
Date:   Tue Feb 19 15:29:34 2008 +0100

[S390] Fix futex_atomic_cmpxchg_std inline assembly.

This one is already in 2.6.24.3.

#98 lore raw
In reply to Joe Korty
Quoted 11 lines · * Joe Korty ([email protected]) wrote:

The below is also a candidate for 2.6.24.4. It should apply cleanly.

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6d2144d355d2a532e5cc3fc12a6ba2a8d4ef15e4
Commit:     6d2144d355d2a532e5cc3fc12a6ba2a8d4ef15e4
Parent:     b6210386787728b84db25adc4f1eba70440a4c73
Author:     Joe Korty <[email protected]>
AuthorDate: Wed Mar 5 15:04:59 2008 -0800
Committer:  Christoph Lameter <[email protected]>
CommitDate: Thu Mar 6 16:21:50 2008 -0800

slab: NUMA slab allocator migration bugfix

Got it, thanks.
-chris

#99 lore raw
In reply to Chris Wright
Quoted 2 lines · * Chris Wright ([email protected]) wrote:

The whole patch series can be found in one patch at:

	kernel.org/pub/linux/kernel/v2.6/stable-review/patch-2.6.24.4-rc1.gz

Updated with couple late comers from Joe and Heiko to:

	kernel.org/pub/linux/kernel/v2.6/stable-review/patch-2.6.24.4-rc3.gz

thanks,
-chris

#51 lore raw

Re: [patch 33/76] futex: runtime enable pi and robust functionality

In reply to Heiko Carstens
Quoted 7 lines · * Heiko Carstens ([email protected]) wrote:
Quoted 5 lines

504e75d0ed3389747e40a4aaa4b1f4e569576665

Author: Heiko Carstens <[email protected]>
Date:   Thu Mar 20 17:33:38 2008 +0100

[S390] futex: let futex_atomic_cmpxchg_pt survive early functional tests.

Yes, forgot to add -stable to the cc list. Sorry.

Got it, thanks.
-chris

maintainer
#52 lore raw

Re: [patch 33/76] futex: runtime enable pi and robust functionality

In reply to Thomas Gleixner

From: Thomas Gleixner <[email protected]>
Date: Sat, 22 Mar 2008 08:37:07 +0100 (CET)

Quoted 6 lines · Chris Wright
Quoted 3 lines

-stable review patch. If anyone has any objections, please let us know.
---------------------

For this one you need the S390 fixes:

And sparc64 needed similar fixes, but they did get submitted in time thankfully.

I think this futex change should have gotten more exposure, and proper coordination with arch maintainers so that it didn't go into -stable unless the necessary arch level fixups were known to go in at the same time.

maintainer
#14 lore raw

Re: [patch 07/76] NIU: Bump driver version and release date.

In reply to David Miller

From: David Miller <[email protected]>
Date: Fri, 21 Mar 2008 22:21:25 -0700 (PDT)

Quoted 8 lines

From: Roland Dreier <[email protected]>
Date: Fri, 21 Mar 2008 19:35:40 -0700

Quoted 5 lines
Quoted 4 lines

It makes a difference for driver maintainers when users report bugs and we ask them for the version printed by the driver so that we know which fixes have been applied.

Quoted 7 lines
Quoted 4 lines

I'm not sure if this series of patches really accomplishes that... you're leaving out some patches such as "[NIU]: Fix 1G PHY link state handling." that are in the real 0.7. So the 2.6.24.stable version 0.7 has a different set of fixes than the 2.6.25 version 0.7.

That was an oversight and not intentional, thanks for for catching that.

Actually Roland, that 1G fix you mention was put in during the 2.6.23 development series.

If you ask git for all the NIU driver changes since 2.6.24 you get:

davem@sunset:~/src/GIT/linux-2.6$ git log v2.6.24.. drivers/net/niu.[ch]
commit fa907895b7b776208a1406efe5ba7ffe0f49f507
Author: Matheos Worku <[email protected]>
Date:   Wed Feb 20 00:18:09 2008 -0800

[NIU]: More BMAC alt MAC address fixes.

From: Matheos Worku <[email protected]>

1) niu_enable_alt_mac() needs to be adjusted so that the mask is computed properly for the BMAC case.

2) BMAC has 6 alt MAC addresses available, not 7.

commit a442585952f137bd4cdb1f2f3166e4157d383b82

Author: David S. Miller <[email protected]>
Date:   Mon Feb 18 21:30:48 2008 -0800

[NIU]: Bump driver version and release date.

commit 3b5bcedeeb755b6e813537fcf4c32f010b490aef

Author: Matheos Worku <[email protected]>
Date:   Mon Feb 18 21:30:03 2008 -0800

[NIU]: Fix BMAC alternate MAC address indexing.

BMAC port alternate MAC address index needs to start at 1. Index 0 is used for the main MAC address.

commit 2caf62f6cae46e36b1c4a1b0f2d9ef82af89cad2

Author: Joe Perches <[email protected]>
Date:   Thu Dec 20 04:07:35 2007 -0800

[NIU]: Use print_mac

davem@sunset:~/src/GIT/linux-2.6$

Since using print_mac is a one-liner cleanup rather than a bug fix, it's reasonable to leave it out for 2.6.24-stable

What's left is exactly what I submitted for -stable.

#16 lore raw

Re: [patch 07/76] NIU: Bump driver version and release date.

In reply to David Miller

Hi David,

Quoted 11 lines · David Miller

It makes a difference for driver maintainers when users report bugs and we ask them for the version printed by the driver so that we know which fixes have been applied.

You know, if people are going to be jerky about this, I'll just include the version bump in the actual bug fixes which I sometimes do anyways.

Thanks for bringing this up, it's a useful use of everyone's time :-/

Uhm, Jesper was asking a relevant question and definitely not being "jerky". As you probably know, many of us are dropping explicit driver versions from the code for the exact reason why you're trying to patch the stable tree now. They get out of sync real easy and the kernel version already provides the same information so why bother.

Furthermore, I honestly don't see how your patch meets the (rather strict) requirements of stable series either. So it would be nice if one of the stable maintainers stepped up to say that these kind of patches are okay to set a precedent for others as well.

Pekka

maintainer
#17 lore raw

Re: [patch 07/76] NIU: Bump driver version and release date.

From: "Pekka Enberg" <[email protected]>
Date: Sun, 23 Mar 2008 00:57:29 +0200

Quoted 2 lines

Furthermore, I honestly don't see how your patch meets the (rather strict) requirements of stable series either.

Show how changing a version string can cause a regression for a user.

Then I'll stop being angry about all the time that is being wasted on this topic.

#20 lore raw

Re: [patch 07/76] NIU: Bump driver version and release date.

In reply to Pekka Enberg
Quoted 4 lines · Pekka Enberg

Furthermore, I honestly don't see how your patch meets the (rather strict) requirements of stable series either. So it would be nice if one of the stable maintainers stepped up to say that these kind of patches are okay to set a precedent for others as well.

These kind of patches are perfectly fine. We trust the maintainers of drivers and subsystems to tell the -stable maintainers what they want added to the tree, and if that includes a version number update to make their lives easier, who are we to say no to that.

Becides, it's not the first time patches like this have been accepted.

thanks,

greg k-h

#15 lore raw

Re: [patch 07/76] NIU: Bump driver version and release date.

In reply to David Miller
Quoted 5 lines

Actually Roland, that 1G fix you mention was put in during the 2.6.23 development series.

If you ask git for all the NIU driver changes since 2.6.24 you get:

Sorry for the noise... I did

    git log cb77df3e..a4425859 drivers/net/niu.c

to get all the niu changes between when you bumped the version to 0.6 and when you bumped it to 0.7. I didn't think to check which post-0.6 changes were already in 2.6.24.

As long as the version helps you out, I guess it's all good.

- R.

#21 lore raw

Re: [patch 07/76] NIU: Bump driver version and release date.

In reply to Greg KH
Quoted 10 lines · * Greg KH ([email protected]) wrote:
Quoted 4 lines · Pekka Enberg

Furthermore, I honestly don't see how your patch meets the (rather strict) requirements of stable series either. So it would be nice if one of the stable maintainers stepped up to say that these kind of patches are okay to set a precedent for others as well.

These kind of patches are perfectly fine. We trust the maintainers of drivers and subsystems to tell the -stable maintainers what they want added to the tree, and if that includes a version number update to make their lives easier, who are we to say no to that.

I completely agree. The -stable rules are guidelines, primarily to help us say no. When it's submitted by a maintainer as something that helps them support their code (esp a no risk change like version bump to keep things in line), there's little reason to reject. Consider the version bump part of the bug fixes.

thanks,
-chris

#18 lore raw

Re: [patch 07/76] NIU: Bump driver version and release date.

In reply to David Miller

Hi David,

Quoted 2 lines · David Miller

Show how changing a version string can cause a regression for a user.

It obviously can't but then again, we don't put comment or documentation fixes in the stable tree either just because. But agreed this is pointless now as Chris and Greg have explicitly said they're ok.

Pekka

maintainer
#19 lore raw

Re: [patch 07/76] NIU: Bump driver version and release date.

From: "Pekka Enberg" <[email protected]>
Date: Sun, 23 Mar 2008 10:42:46 +0200

Quoted 4 lines

It obviously can't but then again, we don't put comment or documentation fixes in the stable tree either just because. But agreed this is pointless now as Chris and Greg have explicitly said they're ok.

Thus, thanks for continuing to waste everyone's time.

#22 lore raw

Re: [patch 07/76] NIU: Bump driver version and release date.

In reply to Pekka Enberg
Quoted 15 lines · Pekka Enberg

Hi David,

Quoted 11 lines · David Miller

It makes a difference for driver maintainers when users report bugs and we ask them for the version printed by the driver so that we know which fixes have been applied.

You know, if people are going to be jerky about this, I'll just include the version bump in the actual bug fixes which I sometimes do anyways.

Thanks for bringing this up, it's a useful use of everyone's time :-/

Quoted 6 lines

Uhm, Jesper was asking a relevant question and definitely not being "jerky". As you probably know, many of us are dropping explicit driver versions from the code for the exact reason why you're trying to patch the stable tree now. They get out of sync real easy and the kernel version already provides the same information so why bother.
...

There are two completely different cases one mustn't confuse:

Quoted 1 line

90% of all version numbers, cvs tags,... in the kernel haven't been

updated for ages and should be removed.

But there are some drivers and ALSA that have an active maintainer, an actively maintained version number, and tend to often be backported into distribution kernels.

Quoted 1 line

Pekka

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#11 lore raw

Re: [patch 07/76] NIU: Bump driver version and release date.

In reply to Jesper Juhl

David,

When I made the reply below I was rather tired and edgy. I would like to explain why I commented as I did and offer an appology for wasting your time and/or annoying you - that was never my intention.

I try to participate constructively where and when I can and one of the ways I try to do so is by reading patches that people submit. Most of the time I'm not qualified to comment on them and I try not to. In this specific case I felt I knew the -stable rules well enough and could understand the patch well enough to offer up a constructive comment, so I did.
My Intention was simply to point out that the patch *seemed* to fall outside what the -stable rules allowed, and my understanding was that the rules were there for a reason - to keep -stable patches to the very minimum required to fix bugs and only that.

When you replied the way you did I got rather irritated by the fact that you chose to see it as an attempt to waste peoples time rather than see it how I intended it; as an attempt to help out by reviewing patches and point out any oddities/guideline-deviation I observed.

I should have waited to respond and certainly not written my response while still being annoyed.

I realize now that patches like this are acceptable for -stable, so I'll refrain from commenting on them in the future.

I hope you can accept an appology and see that I did not intend to waste anyones time.

Kind regards,
Jesper Juhl

Quoted 40 lines · Jesper Juhl
Quoted 7 lines · David Miller

From: "Jesper Juhl" <[email protected]>
Date: Sat, 22 Mar 2008 01:10:40 +0100

Quoted 3 lines

As I see it, this patch is quite trivial and does not fix any "real problem". How come this is suitable for -stable?

Quoted 9 lines
Quoted 2 lines

I have no objections to the patch "as such", I just don't think it makes sense for -stable.

It makes a difference for driver maintainers when users
report bugs and we ask them for the version printed by the driver so that we know which fixes have been applied.

Ok, fair enough.

Quoted 7 lines

You know, if people are going to be jerky about this, I'll just include the version bump in the actual bug fixes which I sometimes do anyways.

Thanks for bringing this up, it's a useful use of everyone's time :-/

Excuse me for reading patches, trying to spot problems and thinking
about where they are applied and what rules apply etc.

--

Jesper Juhl <[email protected]>

Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html

Signature · 3 lines
Jesper Juhl <[email protected]>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html
#53 lore raw

Re: [patch 33/76] futex: runtime enable pi and robust functionality

In reply to Chris Wright
Quoted 10 lines · Chris Wright

plain text document attachment (futex-runtime-enable-pi-and-robust-functionality.patch) -stable review patch. If anyone has any objections, please let us know.
---------------------

From: Thomas Gleixner <[email protected]>

Not all architectures implement futex_atomic_cmpxchg_inatomic(). The default implementation returns -ENOSYS, which is currently not handled inside of the futex guts.

I think that breaks some embedded PowerPC platforms. It's also very fishy... So early, we haven't activated an mm yet, it's like trying to access user memory from a kernel thread... might happen to give you -EFAULT on x86 but you are making pretty big assumptions on how low level mm works in architectures...

Ben.

Quoted 187 lines

Futex PI calls and robust list exits with a held futex result in an endless loop in the futex code on architectures which have no support.

Fixing up every place where futex_atomic_cmpxchg_inatomic() is called would add a fair amount of extra if/else constructs to the already complex code. It is also not possible to disable the robust feature before user space tries to register robust lists.

Compile time disabling is not a good idea either, as there are already architectures with runtime detection of futex_atomic_cmpxchg_inatomic support.

Detect the functionality at runtime instead by calling cmpxchg_futex_value_locked() with a NULL pointer from the futex initialization code. This is guaranteed to fail, but the call of futex_atomic_cmpxchg_inatomic() happens with pagefaults disabled.

On architectures, which use the asm-generic implementation or have a runtime CPU feature detection, a -ENOSYS return value disables the PI/robust features.

On architectures with a working implementation the call returns -EFAULT and the PI/robust features are enabled.

The relevant syscalls return -ENOSYS and the robust list exit code is blocked, when the detection fails.

Fixes http://lkml.org/lkml/2008/2/11/149
Originally reported by: Lennart Buytenhek

---
 include/linux/futex.h |    1 +
 kernel/futex.c        |   38 ++++++++++++++++++++++++++++++++++----
 kernel/futex_compat.c |    9 +++++++++
 3 files changed, 44 insertions(+), 4 deletions(-)
include/linux/futex.h +1 -0
@@ -153,6 +153,7 @@ union futex_key {
 #ifdef CONFIG_FUTEX
 extern void exit_robust_list(struct task_struct *curr);
 extern void exit_pi_state_list(struct task_struct *curr);
+extern int futex_cmpxchg_enabled;
 #else
 static inline void exit_robust_list(struct task_struct *curr)
 {
kernel/futex.c +34 -4
@@ -60,6 +60,8 @@
 
 #include "rtmutex_common.h"
 
+int __read_mostly futex_cmpxchg_enabled;
+
 #define FUTEX_HASHBITS (CONFIG_BASE_SMALL ? 4 : 8)
 
 /*
@@ -466,6 +468,8 @@ void exit_pi_state_list(struct task_stru
 	struct futex_hash_bucket *hb;
 	union futex_key key;
 
+	if (!futex_cmpxchg_enabled)
+		return;
 	/*
 	 * We are a ZOMBIE and nobody can enqueue itself on
 	 * pi_state_list anymore, but we have to be careful
@@ -1854,6 +1858,8 @@ asmlinkage long
 sys_set_robust_list(struct robust_list_head __user *head,
 		    size_t len)
 {
+	if (!futex_cmpxchg_enabled)
+		return -ENOSYS;
 	/*
 	 * The kernel knows only one size for now:
 	 */
@@ -1878,6 +1884,9 @@ sys_get_robust_list(int pid, struct robu
 	struct robust_list_head __user *head;
 	unsigned long ret;
 
+	if (!futex_cmpxchg_enabled)
+		return -ENOSYS;
+
 	if (!pid)
 		head = current->robust_list;
 	else {
@@ -1980,6 +1989,9 @@ void exit_robust_list(struct task_struct
 	unsigned long futex_offset;
 	int rc;
 
+	if (!futex_cmpxchg_enabled)
+		return;
+
 	/*
 	 * Fetch the list head (which was registered earlier, via
 	 * sys_set_robust_list()):
@@ -2034,7 +2046,7 @@ void exit_robust_list(struct task_struct
 long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,
 		u32 __user *uaddr2, u32 val2, u32 val3)
 {
-	int ret;
+	int ret = -ENOSYS;
 	int cmd = op & FUTEX_CMD_MASK;
 	struct rw_semaphore *fshared = NULL;
 
@@ -2062,13 +2074,16 @@ long do_futex(u32 __user *uaddr, int op,
 		ret = futex_wake_op(uaddr, fshared, uaddr2, val, val2, val3);
 		break;
 	case FUTEX_LOCK_PI:
-		ret = futex_lock_pi(uaddr, fshared, val, timeout, 0);
+		if (futex_cmpxchg_enabled)
+			ret = futex_lock_pi(uaddr, fshared, val, timeout, 0);
 		break;
 	case FUTEX_UNLOCK_PI:
-		ret = futex_unlock_pi(uaddr, fshared);
+		if (futex_cmpxchg_enabled)
+			ret = futex_unlock_pi(uaddr, fshared);
 		break;
 	case FUTEX_TRYLOCK_PI:
-		ret = futex_lock_pi(uaddr, fshared, 0, timeout, 1);
+		if (futex_cmpxchg_enabled)
+			ret = futex_lock_pi(uaddr, fshared, 0, timeout, 1);
 		break;
 	default:
 		ret = -ENOSYS;
@@ -2123,8 +2138,23 @@ static struct file_system_type futex_fs_
 
 static int __init init(void)
 {
+	u32 curval;
 	int i;
 
+	/*
+	 * This will fail and we want it. Some arch implementations do
+	 * runtime detection of the futex_atomic_cmpxchg_inatomic()
+	 * functionality. We want to know that before we call in any
+	 * of the complex code paths. Also we want to prevent
+	 * registration of robust lists in that case. NULL is
+	 * guaranteed to fault and we get -EFAULT on functional
+	 * implementation, the non functional ones will return
+	 * -ENOSYS.
+	 */
+	curval = cmpxchg_futex_value_locked(NULL, 0, 0);
+	if (curval == -EFAULT)
+		futex_cmpxchg_enabled = 1;
+
 	for (i = 0; i < ARRAY_SIZE(futex_queues); i++) {
 		plist_head_init(&futex_queues[i].chain, &futex_queues[i].lock);
 		spin_lock_init(&futex_queues[i].lock);
kernel/futex_compat.c +9 -0
@@ -54,6 +54,9 @@ void compat_exit_robust_list(struct task
 	compat_long_t futex_offset;
 	int rc;
 
+	if (!futex_cmpxchg_enabled)
+		return;
+
 	/*
 	 * Fetch the list head (which was registered earlier, via
 	 * sys_set_robust_list()):
@@ -115,6 +118,9 @@ asmlinkage long
 compat_sys_set_robust_list(struct compat_robust_list_head __user *head,
 			   compat_size_t len)
 {
+	if (!futex_cmpxchg_enabled)
+		return -ENOSYS;
+
 	if (unlikely(len != sizeof(*head)))
 		return -EINVAL;
 
@@ -130,6 +136,9 @@ compat_sys_get_robust_list(int pid, comp
 	struct compat_robust_list_head __user *head;
 	unsigned long ret;
 
+	if (!futex_cmpxchg_enabled)
+		return -ENOSYS;
+
 	if (!pid)
 		head = current->compat_robust_list;
 	else {