diff -druN linux-libre-3.2.12-gnu/arch/powerpc/platforms/powermac/smp.c linux-libre-3.2.13-gnu/arch/powerpc/platforms/powermac/smp.c
--- linux-libre-3.2.12-gnu/arch/powerpc/platforms/powermac/smp.c	2012-03-19 12:03:17.000000000 -0400
+++ linux-libre-3.2.13-gnu/arch/powerpc/platforms/powermac/smp.c	2012-03-23 16:54:45.000000000 -0400
@@ -414,7 +414,7 @@
 
 static void __init smp_psurge_setup_cpu(int cpu_nr)
 {
-	if (cpu_nr != 0)
+	if (cpu_nr != 0 || !psurge_start)
 		return;
 
 	/* reset the entry point so if we get another intr we won't
diff -druN linux-libre-3.2.12-gnu/drivers/net/wireless/iwlegacy/iwl3945-base.c linux-libre-3.2.13-gnu/drivers/net/wireless/iwlegacy/iwl3945-base.c
--- linux-libre-3.2.12-gnu/drivers/net/wireless/iwlegacy/iwl3945-base.c	2012-03-20 01:23:08.000000000 -0400
+++ linux-libre-3.2.13-gnu/drivers/net/wireless/iwlegacy/iwl3945-base.c	2012-03-23 19:42:29.000000000 -0400
@@ -2513,7 +2513,7 @@
 	    container_of(data, struct iwl_priv, alive_start.work);
 
 	mutex_lock(&priv->mutex);
-	if (test_bit(STATUS_EXIT_PENDING, &priv->status))
+	if (test_bit(STATUS_EXIT_PENDING, &priv->status) || priv->txq == NULL)
 		goto out;
 
 	iwl3945_alive_start(priv);
diff -druN linux-libre-3.2.12-gnu/drivers/net/wireless/iwlegacy/iwl-3945.c linux-libre-3.2.13-gnu/drivers/net/wireless/iwlegacy/iwl-3945.c
--- linux-libre-3.2.12-gnu/drivers/net/wireless/iwlegacy/iwl-3945.c	2012-03-19 12:03:17.000000000 -0400
+++ linux-libre-3.2.13-gnu/drivers/net/wireless/iwlegacy/iwl-3945.c	2012-03-23 16:54:45.000000000 -0400
@@ -1870,11 +1870,12 @@
 	struct iwl_priv *priv = container_of(work, struct iwl_priv,
 					     _3945.thermal_periodic.work);
 
-	if (test_bit(STATUS_EXIT_PENDING, &priv->status))
-		return;
-
 	mutex_lock(&priv->mutex);
+	if (test_bit(STATUS_EXIT_PENDING, &priv->status) || priv->txq == NULL)
+		goto out;
+
 	iwl3945_reg_txpower_periodic(priv);
+out:
 	mutex_unlock(&priv->mutex);
 }
 
diff -druN linux-libre-3.2.12-gnu/fs/afs/internal.h linux-libre-3.2.13-gnu/fs/afs/internal.h
--- linux-libre-3.2.12-gnu/fs/afs/internal.h	2012-03-19 12:03:17.000000000 -0400
+++ linux-libre-3.2.13-gnu/fs/afs/internal.h	2012-03-23 16:54:45.000000000 -0400
@@ -109,7 +109,7 @@
 	unsigned		reply_size;	/* current size of reply */
 	unsigned		first_offset;	/* offset into mapping[first] */
 	unsigned		last_to;	/* amount of mapping[last] */
-	unsigned short		offset;		/* offset into received data store */
+	unsigned		offset;		/* offset into received data store */
 	unsigned char		unmarshall;	/* unmarshalling phase */
 	bool			incoming;	/* T if incoming call */
 	bool			send_pages;	/* T if data from mapping should be sent */
diff -druN linux-libre-3.2.12-gnu/fs/afs/rxrpc.c linux-libre-3.2.13-gnu/fs/afs/rxrpc.c
--- linux-libre-3.2.12-gnu/fs/afs/rxrpc.c	2012-03-19 12:03:17.000000000 -0400
+++ linux-libre-3.2.13-gnu/fs/afs/rxrpc.c	2012-03-23 16:54:45.000000000 -0400
@@ -314,6 +314,7 @@
 	struct msghdr msg;
 	struct kvec iov[1];
 	int ret;
+	struct sk_buff *skb;
 
 	_enter("%x,{%d},", addr->s_addr, ntohs(call->port));
 
@@ -380,6 +381,8 @@
 
 error_do_abort:
 	rxrpc_kernel_abort_call(rxcall, RX_USER_ABORT);
+	while ((skb = skb_dequeue(&call->rx_queue)))
+		afs_free_skb(skb);
 	rxrpc_kernel_end_call(rxcall);
 	call->rxcall = NULL;
 error_kill_call:
diff -druN linux-libre-3.2.12-gnu/fs/nilfs2/the_nilfs.c linux-libre-3.2.13-gnu/fs/nilfs2/the_nilfs.c
--- linux-libre-3.2.12-gnu/fs/nilfs2/the_nilfs.c	2012-03-19 12:03:17.000000000 -0400
+++ linux-libre-3.2.13-gnu/fs/nilfs2/the_nilfs.c	2012-03-23 16:54:45.000000000 -0400
@@ -515,6 +515,7 @@
 		brelse(sbh[1]);
 		sbh[1] = NULL;
 		sbp[1] = NULL;
+		valid[1] = 0;
 		swp = 0;
 	}
 	if (!valid[swp]) {
diff -druN linux-libre-3.2.12-gnu/Makefile linux-libre-3.2.13-gnu/Makefile
--- linux-libre-3.2.12-gnu/Makefile	2012-03-20 01:08:11.000000000 -0400
+++ linux-libre-3.2.13-gnu/Makefile	2012-03-23 19:31:18.000000000 -0400
@@ -1,6 +1,6 @@
 VERSION = 3
 PATCHLEVEL = 2
-SUBLEVEL = 12
+SUBLEVEL = 13
 EXTRAVERSION =-gnu
 NAME = Saber-toothed Squirrel
 
diff -druN linux-libre-3.2.12-gnu/net/ipv4/syncookies.c linux-libre-3.2.13-gnu/net/ipv4/syncookies.c
--- linux-libre-3.2.12-gnu/net/ipv4/syncookies.c	2012-03-19 12:03:17.000000000 -0400
+++ linux-libre-3.2.13-gnu/net/ipv4/syncookies.c	2012-03-23 16:54:45.000000000 -0400
@@ -278,6 +278,7 @@
 	struct rtable *rt;
 	__u8 rcv_wscale;
 	bool ecn_ok = false;
+	struct flowi4 fl4;
 
 	if (!sysctl_tcp_syncookies || !th->ack || th->rst)
 		goto out;
@@ -346,20 +347,16 @@
 	 * hasn't changed since we received the original syn, but I see
 	 * no easy way to do this.
 	 */
-	{
-		struct flowi4 fl4;
-
-		flowi4_init_output(&fl4, 0, sk->sk_mark, RT_CONN_FLAGS(sk),
-				   RT_SCOPE_UNIVERSE, IPPROTO_TCP,
-				   inet_sk_flowi_flags(sk),
-				   (opt && opt->srr) ? opt->faddr : ireq->rmt_addr,
-				   ireq->loc_addr, th->source, th->dest);
-		security_req_classify_flow(req, flowi4_to_flowi(&fl4));
-		rt = ip_route_output_key(sock_net(sk), &fl4);
-		if (IS_ERR(rt)) {
-			reqsk_free(req);
-			goto out;
-		}
+	flowi4_init_output(&fl4, 0, sk->sk_mark, RT_CONN_FLAGS(sk),
+			   RT_SCOPE_UNIVERSE, IPPROTO_TCP,
+			   inet_sk_flowi_flags(sk),
+			   (opt && opt->srr) ? opt->faddr : ireq->rmt_addr,
+			   ireq->loc_addr, th->source, th->dest);
+	security_req_classify_flow(req, flowi4_to_flowi(&fl4));
+	rt = ip_route_output_key(sock_net(sk), &fl4);
+	if (IS_ERR(rt)) {
+		reqsk_free(req);
+		goto out;
 	}
 
 	/* Try to redo what tcp_v4_send_synack did. */
@@ -373,5 +370,10 @@
 	ireq->rcv_wscale  = rcv_wscale;
 
 	ret = get_cookie_sock(sk, skb, req, &rt->dst);
+	/* ip_queue_xmit() depends on our flow being setup
+	 * Normal sockets get it right from inet_csk_route_child_sock()
+	 */
+	if (ret)
+		inet_sk(ret)->cork.fl.u.ip4 = fl4;
 out:	return ret;
 }
diff -druN linux-libre-3.2.12-gnu/net/ipv4/tcp_ipv4.c linux-libre-3.2.13-gnu/net/ipv4/tcp_ipv4.c
--- linux-libre-3.2.12-gnu/net/ipv4/tcp_ipv4.c	2012-03-19 12:03:17.000000000 -0400
+++ linux-libre-3.2.13-gnu/net/ipv4/tcp_ipv4.c	2012-03-23 16:54:45.000000000 -0400
@@ -1465,9 +1465,13 @@
 		inet_csk(newsk)->icsk_ext_hdr_len = inet_opt->opt.optlen;
 	newinet->inet_id = newtp->write_seq ^ jiffies;
 
-	if (!dst && (dst = inet_csk_route_child_sock(sk, newsk, req)) == NULL)
-		goto put_and_exit;
-
+	if (!dst) {
+		dst = inet_csk_route_child_sock(sk, newsk, req);
+		if (!dst)
+			goto put_and_exit;
+	} else {
+		/* syncookie case : see end of cookie_v4_check() */
+	}
 	sk_setup_caps(newsk, dst);
 
 	tcp_mtup_init(newsk);
diff -druN linux-libre-3.2.12-gnu/net/ipv6/mcast.c linux-libre-3.2.13-gnu/net/ipv6/mcast.c
--- linux-libre-3.2.12-gnu/net/ipv6/mcast.c	2012-03-19 12:03:17.000000000 -0400
+++ linux-libre-3.2.13-gnu/net/ipv6/mcast.c	2012-03-23 16:54:45.000000000 -0400
@@ -257,7 +257,6 @@
 
 		if (rt) {
 			dev = rt->rt6i_dev;
-			dev_hold(dev);
 			dst_release(&rt->dst);
 		}
 	} else
diff -druN linux-libre-3.2.12-gnu/tools/perf/arch/powerpc/util/header.c linux-libre-3.2.13-gnu/tools/perf/arch/powerpc/util/header.c
--- linux-libre-3.2.12-gnu/tools/perf/arch/powerpc/util/header.c	2012-03-19 12:03:17.000000000 -0400
+++ linux-libre-3.2.13-gnu/tools/perf/arch/powerpc/util/header.c	2012-03-23 16:54:45.000000000 -0400
@@ -25,7 +25,7 @@
 
 	pvr = mfspr(SPRN_PVR);
 
-	nb = snprintf(buffer, sz, "%lu,%lu$", PVR_VER(pvr), PVR_REV(pvr));
+	nb = scnprintf(buffer, sz, "%lu,%lu$", PVR_VER(pvr), PVR_REV(pvr));
 
 	/* look for end marker to ensure the entire data fit */
 	if (strchr(buffer, '$')) {
diff -druN linux-libre-3.2.12-gnu/tools/perf/arch/x86/util/header.c linux-libre-3.2.13-gnu/tools/perf/arch/x86/util/header.c
--- linux-libre-3.2.12-gnu/tools/perf/arch/x86/util/header.c	2012-03-19 12:03:17.000000000 -0400
+++ linux-libre-3.2.13-gnu/tools/perf/arch/x86/util/header.c	2012-03-23 16:54:45.000000000 -0400
@@ -48,7 +48,7 @@
 		if (family >= 0x6)
 			model += ((a >> 16) & 0xf) << 4;
 	}
-	nb = snprintf(buffer, sz, "%s,%u,%u,%u$", vendor, family, model, step);
+	nb = scnprintf(buffer, sz, "%s,%u,%u,%u$", vendor, family, model, step);
 
 	/* look for end marker to ensure the entire data fit */
 	if (strchr(buffer, '$')) {
diff -druN linux-libre-3.2.12-gnu/tools/perf/util/color.c linux-libre-3.2.13-gnu/tools/perf/util/color.c
--- linux-libre-3.2.12-gnu/tools/perf/util/color.c	2012-03-19 12:03:17.000000000 -0400
+++ linux-libre-3.2.13-gnu/tools/perf/util/color.c	2012-03-23 16:54:45.000000000 -0400
@@ -1,3 +1,4 @@
+#include <linux/kernel.h>
 #include "cache.h"
 #include "color.h"
 
@@ -182,12 +183,12 @@
 	}
 
 	if (perf_use_color_default && *color)
-		r += snprintf(bf, size, "%s", color);
-	r += vsnprintf(bf + r, size - r, fmt, args);
+		r += scnprintf(bf, size, "%s", color);
+	r += vscnprintf(bf + r, size - r, fmt, args);
 	if (perf_use_color_default && *color)
-		r += snprintf(bf + r, size - r, "%s", PERF_COLOR_RESET);
+		r += scnprintf(bf + r, size - r, "%s", PERF_COLOR_RESET);
 	if (trail)
-		r += snprintf(bf + r, size - r, "%s", trail);
+		r += scnprintf(bf + r, size - r, "%s", trail);
 	return r;
 }
 
diff -druN linux-libre-3.2.12-gnu/tools/perf/util/header.c linux-libre-3.2.13-gnu/tools/perf/util/header.c
--- linux-libre-3.2.12-gnu/tools/perf/util/header.c	2012-03-19 12:03:17.000000000 -0400
+++ linux-libre-3.2.13-gnu/tools/perf/util/header.c	2012-03-23 16:54:45.000000000 -0400
@@ -1227,7 +1227,7 @@
 	if (realname == NULL || filename == NULL || linkname == NULL)
 		goto out_free;
 
-	len = snprintf(filename, size, "%s%s%s",
+	len = scnprintf(filename, size, "%s%s%s",
 		       debugdir, is_kallsyms ? "/" : "", realname);
 	if (mkdir_p(filename, 0755))
 		goto out_free;
@@ -1242,7 +1242,7 @@
 			goto out_free;
 	}
 
-	len = snprintf(linkname, size, "%s/.build-id/%.2s",
+	len = scnprintf(linkname, size, "%s/.build-id/%.2s",
 		       debugdir, sbuild_id);
 
 	if (access(linkname, X_OK) && mkdir_p(linkname, 0755))
diff -druN linux-libre-3.2.12-gnu/tools/perf/util/hist.c linux-libre-3.2.13-gnu/tools/perf/util/hist.c
--- linux-libre-3.2.12-gnu/tools/perf/util/hist.c	2012-03-19 12:03:17.000000000 -0400
+++ linux-libre-3.2.13-gnu/tools/perf/util/hist.c	2012-03-23 16:54:45.000000000 -0400
@@ -767,7 +767,7 @@
 						     sep ? "%.2f" : "   %6.2f%%",
 						     (period * 100.0) / total);
 		else
-			ret = snprintf(s, size, sep ? "%.2f" : "   %6.2f%%",
+			ret = scnprintf(s, size, sep ? "%.2f" : "   %6.2f%%",
 				       (period * 100.0) / total);
 		if (symbol_conf.show_cpu_utilization) {
 			ret += percent_color_snprintf(s + ret, size - ret,
@@ -790,20 +790,20 @@
 			}
 		}
 	} else
-		ret = snprintf(s, size, sep ? "%" PRIu64 : "%12" PRIu64 " ", period);
+		ret = scnprintf(s, size, sep ? "%" PRIu64 : "%12" PRIu64 " ", period);
 
 	if (symbol_conf.show_nr_samples) {
 		if (sep)
-			ret += snprintf(s + ret, size - ret, "%c%" PRIu64, *sep, nr_events);
+			ret += scnprintf(s + ret, size - ret, "%c%" PRIu64, *sep, nr_events);
 		else
-			ret += snprintf(s + ret, size - ret, "%11" PRIu64, nr_events);
+			ret += scnprintf(s + ret, size - ret, "%11" PRIu64, nr_events);
 	}
 
 	if (symbol_conf.show_total_period) {
 		if (sep)
-			ret += snprintf(s + ret, size - ret, "%c%" PRIu64, *sep, period);
+			ret += scnprintf(s + ret, size - ret, "%c%" PRIu64, *sep, period);
 		else
-			ret += snprintf(s + ret, size - ret, " %12" PRIu64, period);
+			ret += scnprintf(s + ret, size - ret, " %12" PRIu64, period);
 	}
 
 	if (pair_hists) {
@@ -818,25 +818,25 @@
 		diff = new_percent - old_percent;
 
 		if (fabs(diff) >= 0.01)
-			snprintf(bf, sizeof(bf), "%+4.2F%%", diff);
+			ret += scnprintf(bf, sizeof(bf), "%+4.2F%%", diff);
 		else
-			snprintf(bf, sizeof(bf), " ");
+			ret += scnprintf(bf, sizeof(bf), " ");
 
 		if (sep)
-			ret += snprintf(s + ret, size - ret, "%c%s", *sep, bf);
+			ret += scnprintf(s + ret, size - ret, "%c%s", *sep, bf);
 		else
-			ret += snprintf(s + ret, size - ret, "%11.11s", bf);
+			ret += scnprintf(s + ret, size - ret, "%11.11s", bf);
 
 		if (show_displacement) {
 			if (displacement)
-				snprintf(bf, sizeof(bf), "%+4ld", displacement);
+				ret += scnprintf(bf, sizeof(bf), "%+4ld", displacement);
 			else
-				snprintf(bf, sizeof(bf), " ");
+				ret += scnprintf(bf, sizeof(bf), " ");
 
 			if (sep)
-				ret += snprintf(s + ret, size - ret, "%c%s", *sep, bf);
+				ret += scnprintf(s + ret, size - ret, "%c%s", *sep, bf);
 			else
-				ret += snprintf(s + ret, size - ret, "%6.6s", bf);
+				ret += scnprintf(s + ret, size - ret, "%6.6s", bf);
 		}
 	}
 
@@ -854,7 +854,7 @@
 		if (se->elide)
 			continue;
 
-		ret += snprintf(s + ret, size - ret, "%s", sep ?: "  ");
+		ret += scnprintf(s + ret, size - ret, "%s", sep ?: "  ");
 		ret += se->se_snprintf(he, s + ret, size - ret,
 				       hists__col_len(hists, se->se_width_idx));
 	}
diff -druN linux-libre-3.2.12-gnu/tools/perf/util/sort.c linux-libre-3.2.13-gnu/tools/perf/util/sort.c
--- linux-libre-3.2.12-gnu/tools/perf/util/sort.c	2012-03-19 12:03:17.000000000 -0400
+++ linux-libre-3.2.13-gnu/tools/perf/util/sort.c	2012-03-23 16:54:45.000000000 -0400
@@ -33,6 +33,9 @@
 		}
 	}
 	va_end(ap);
+
+	if (n >= (int)size)
+		return size - 1;
 	return n;
 }
 
diff -druN linux-libre-3.2.12-gnu/tools/perf/util/strbuf.c linux-libre-3.2.13-gnu/tools/perf/util/strbuf.c
--- linux-libre-3.2.12-gnu/tools/perf/util/strbuf.c	2012-03-19 12:03:17.000000000 -0400
+++ linux-libre-3.2.13-gnu/tools/perf/util/strbuf.c	2012-03-23 16:54:45.000000000 -0400
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include <linux/kernel.h>
 
 int prefixcmp(const char *str, const char *prefix)
 {
@@ -89,14 +90,14 @@
 	if (!strbuf_avail(sb))
 		strbuf_grow(sb, 64);
 	va_start(ap, fmt);
-	len = vsnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap);
+	len = vscnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap);
 	va_end(ap);
 	if (len < 0)
-		die("your vsnprintf is broken");
+		die("your vscnprintf is broken");
 	if (len > strbuf_avail(sb)) {
 		strbuf_grow(sb, len);
 		va_start(ap, fmt);
-		len = vsnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap);
+		len = vscnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap);
 		va_end(ap);
 		if (len > strbuf_avail(sb)) {
 			die("this should not happen, your snprintf is broken");
diff -druN linux-libre-3.2.12-gnu/tools/perf/util/ui/browsers/hists.c linux-libre-3.2.13-gnu/tools/perf/util/ui/browsers/hists.c
--- linux-libre-3.2.12-gnu/tools/perf/util/ui/browsers/hists.c	2012-03-19 12:03:17.000000000 -0400
+++ linux-libre-3.2.13-gnu/tools/perf/util/ui/browsers/hists.c	2012-03-23 16:54:45.000000000 -0400
@@ -839,15 +839,15 @@
 	unsigned long nr_events = self->stats.nr_events[PERF_RECORD_SAMPLE];
 
 	nr_events = convert_unit(nr_events, &unit);
-	printed = snprintf(bf, size, "Events: %lu%c %s", nr_events, unit, ev_name);
+	printed = scnprintf(bf, size, "Events: %lu%c %s", nr_events, unit, ev_name);
 
 	if (thread)
-		printed += snprintf(bf + printed, size - printed,
+		printed += scnprintf(bf + printed, size - printed,
 				    ", Thread: %s(%d)",
 				    (thread->comm_set ? thread->comm : ""),
 				    thread->pid);
 	if (dso)
-		printed += snprintf(bf + printed, size - printed,
+		printed += scnprintf(bf + printed, size - printed,
 				    ", DSO: %s", dso->short_name);
 	return printed;
 }
@@ -1097,7 +1097,7 @@
 						       HE_COLORSET_NORMAL);
 
 	nr_events = convert_unit(nr_events, &unit);
-	printed = snprintf(bf, sizeof(bf), "%lu%c%s%s", nr_events,
+	printed = scnprintf(bf, sizeof(bf), "%lu%c%s%s", nr_events,
 			   unit, unit == ' ' ? "" : " ", ev_name);
 	slsmg_printf("%s", bf);
 
@@ -1107,8 +1107,8 @@
 		if (!current_entry)
 			ui_browser__set_color(browser, HE_COLORSET_TOP);
 		nr_events = convert_unit(nr_events, &unit);
-		snprintf(bf, sizeof(bf), ": %ld%c%schunks LOST!", nr_events,
-			 unit, unit == ' ' ? "" : " ");
+		printed += scnprintf(bf, sizeof(bf), ": %ld%c%schunks LOST!",
+				     nr_events, unit, unit == ' ' ? "" : " ");
 		warn = bf;
 	}
 
diff -druN linux-libre-3.2.12-gnu/tools/perf/util/ui/helpline.c linux-libre-3.2.13-gnu/tools/perf/util/ui/helpline.c
--- linux-libre-3.2.12-gnu/tools/perf/util/ui/helpline.c	2012-03-19 12:03:17.000000000 -0400
+++ linux-libre-3.2.13-gnu/tools/perf/util/ui/helpline.c	2012-03-23 16:54:45.000000000 -0400
@@ -65,7 +65,7 @@
 	static int backlog;
 
 	pthread_mutex_lock(&ui__lock);
-	ret = vsnprintf(ui_helpline__last_msg + backlog,
+	ret = vscnprintf(ui_helpline__last_msg + backlog,
 			sizeof(ui_helpline__last_msg) - backlog, format, ap);
 	backlog += ret;
 
