[kernel] r20205 - in dists/wheezy/linux/debian: . patches patches/bugfix/all

Ben Hutchings benh at alioth.debian.org
Sat Jun 8 16:24:47 UTC 2013


Author: benh
Date: Sat Jun  8 16:24:46 2013
New Revision: 20205

Log:
dlm: Do not allocate a fd for peeloff (Closes: #706010)

Added:
   dists/wheezy/linux/debian/patches/bugfix/all/dlm-Do-not-allocate-a-fd-for-peeloff.patch
   dists/wheezy/linux/debian/patches/bugfix/all/sctp-Export-sctp_do_peeloff.patch
Modified:
   dists/wheezy/linux/debian/changelog
   dists/wheezy/linux/debian/patches/series

Modified: dists/wheezy/linux/debian/changelog
==============================================================================
--- dists/wheezy/linux/debian/changelog	Sat Jun  8 15:21:40 2013	(r20204)
+++ dists/wheezy/linux/debian/changelog	Sat Jun  8 16:24:46 2013	(r20205)
@@ -188,6 +188,7 @@
   * [i386] cpufreq / Longhaul: Disable driver by default (Closes: #707047)
   * iscsi-target: fix heap buffer overflow on error (CVE-2013-2850)
   * ath9k: Disable PowerSave by default (Closes: #695968)
+  * dlm: Do not allocate a fd for peeloff (Closes: #706010)
 
  -- Ben Hutchings <ben at decadent.org.uk>  Wed, 27 Mar 2013 14:10:40 +0000
 

Added: dists/wheezy/linux/debian/patches/bugfix/all/dlm-Do-not-allocate-a-fd-for-peeloff.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/wheezy/linux/debian/patches/bugfix/all/dlm-Do-not-allocate-a-fd-for-peeloff.patch	Sat Jun  8 16:24:46 2013	(r20205)
@@ -0,0 +1,69 @@
+From: Benjamin Poirier <bpoirier at suse.de>
+Date: Thu, 8 Mar 2012 05:55:59 +0000
+Subject: dlm: Do not allocate a fd for peeloff
+
+commit 2f2d76cc3e938389feee671b46252dde6880b3b7 upstream.
+
+avoids allocating a fd that a) propagates to every kernel thread and
+usermodehelper b) is not properly released.
+
+References: http://article.gmane.org/gmane.linux.network.drbd/22529
+Signed-off-by: Benjamin Poirier <bpoirier at suse.de>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ fs/dlm/lowcomms.c |   22 ++++++++--------------
+ 1 file changed, 8 insertions(+), 14 deletions(-)
+
+diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
+index 0b3109e..ca0c59a 100644
+--- a/fs/dlm/lowcomms.c
++++ b/fs/dlm/lowcomms.c
+@@ -52,6 +52,7 @@
+ #include <linux/mutex.h>
+ #include <linux/sctp.h>
+ #include <linux/slab.h>
++#include <net/sctp/sctp.h>
+ #include <net/sctp/user.h>
+ #include <net/ipv6.h>
+ 
+@@ -474,9 +475,6 @@ static void process_sctp_notification(struct connection *con,
+ 			int prim_len, ret;
+ 			int addr_len;
+ 			struct connection *new_con;
+-			sctp_peeloff_arg_t parg;
+-			int parglen = sizeof(parg);
+-			int err;
+ 
+ 			/*
+ 			 * We get this before any data for an association.
+@@ -525,23 +523,19 @@ static void process_sctp_notification(struct connection *con,
+ 				return;
+ 
+ 			/* Peel off a new sock */
+-			parg.associd = sn->sn_assoc_change.sac_assoc_id;
+-			ret = kernel_getsockopt(con->sock, IPPROTO_SCTP,
+-						SCTP_SOCKOPT_PEELOFF,
+-						(void *)&parg, &parglen);
++			sctp_lock_sock(con->sock->sk);
++			ret = sctp_do_peeloff(con->sock->sk,
++				sn->sn_assoc_change.sac_assoc_id,
++				&new_con->sock);
++			sctp_release_sock(con->sock->sk);
+ 			if (ret < 0) {
+ 				log_print("Can't peel off a socket for "
+ 					  "connection %d to node %d: err=%d",
+-					  parg.associd, nodeid, ret);
+-				return;
+-			}
+-			new_con->sock = sockfd_lookup(parg.sd, &err);
+-			if (!new_con->sock) {
+-				log_print("sockfd_lookup error %d", err);
++					  (int)sn->sn_assoc_change.sac_assoc_id,
++					  nodeid, ret);
+ 				return;
+ 			}
+ 			add_sock(new_con->sock, new_con);
+-			sockfd_put(new_con->sock);
+ 
+ 			log_print("connecting to %d sctp association %d",
+ 				 nodeid, (int)sn->sn_assoc_change.sac_assoc_id);

Added: dists/wheezy/linux/debian/patches/bugfix/all/sctp-Export-sctp_do_peeloff.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/wheezy/linux/debian/patches/bugfix/all/sctp-Export-sctp_do_peeloff.patch	Sat Jun  8 16:24:46 2013	(r20205)
@@ -0,0 +1,92 @@
+From: Benjamin Poirier <bpoirier at suse.de>
+Date: Thu, 8 Mar 2012 05:55:58 +0000
+Subject: sctp: Export sctp_do_peeloff
+
+commit 0343c5543b1d3ffa08e6716d82afb62648b80eba upstream.
+
+lookup sctp_association within sctp_do_peeloff() to enable its use outside of
+the sctp code with minimal knowledge of the former.
+
+Signed-off-by: Benjamin Poirier <bpoirier at suse.de>
+Acked-by: Vlad Yasevich <vladislav.yasevich at hp.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ include/net/sctp/sctp.h |    1 +
+ net/sctp/socket.c       |   24 +++++++++---------------
+ 2 files changed, 10 insertions(+), 15 deletions(-)
+
+--- a/include/net/sctp/sctp.h
++++ b/include/net/sctp/sctp.h
+@@ -413,6 +413,7 @@ static inline sctp_assoc_t sctp_assoc2id
+ /* Look up the association by its id.  */
+ struct sctp_association *sctp_id2assoc(struct sock *sk, sctp_assoc_t id);
+ 
++int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp);
+ 
+ /* A macro to walk a list of skbs.  */
+ #define sctp_skb_for_each(pos, head, tmp) \
+--- a/net/sctp/socket.c
++++ b/net/sctp/socket.c
+@@ -4179,14 +4179,16 @@ static int sctp_getsockopt_autoclose(str
+ }
+ 
+ /* Helper routine to branch off an association to a new socket.  */
+-SCTP_STATIC int sctp_do_peeloff(struct sctp_association *asoc,
+-				struct socket **sockp)
++int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp)
+ {
+-	struct sock *sk = asoc->base.sk;
++	struct sctp_association *asoc = sctp_id2assoc(sk, id);
+ 	struct socket *sock;
+ 	struct sctp_af *af;
+ 	int err = 0;
+ 
++	if (!asoc)
++		return -EINVAL;
++
+ 	/* An association cannot be branched off from an already peeled-off
+ 	 * socket, nor is this supported for tcp style sockets.
+ 	 */
+@@ -4215,13 +4217,13 @@ SCTP_STATIC int sctp_do_peeloff(struct s
+ 
+ 	return err;
+ }
++EXPORT_SYMBOL(sctp_do_peeloff);
+ 
+ static int sctp_getsockopt_peeloff(struct sock *sk, int len, char __user *optval, int __user *optlen)
+ {
+ 	sctp_peeloff_arg_t peeloff;
+ 	struct socket *newsock;
+ 	int retval = 0;
+-	struct sctp_association *asoc;
+ 
+ 	if (len < sizeof(sctp_peeloff_arg_t))
+ 		return -EINVAL;
+@@ -4229,15 +4231,7 @@ static int sctp_getsockopt_peeloff(struc
+ 	if (copy_from_user(&peeloff, optval, len))
+ 		return -EFAULT;
+ 
+-	asoc = sctp_id2assoc(sk, peeloff.associd);
+-	if (!asoc) {
+-		retval = -EINVAL;
+-		goto out;
+-	}
+-
+-	SCTP_DEBUG_PRINTK("%s: sk: %p asoc: %p\n", __func__, sk, asoc);
+-
+-	retval = sctp_do_peeloff(asoc, &newsock);
++	retval = sctp_do_peeloff(sk, peeloff.associd, &newsock);
+ 	if (retval < 0)
+ 		goto out;
+ 
+@@ -4248,8 +4242,8 @@ static int sctp_getsockopt_peeloff(struc
+ 		goto out;
+ 	}
+ 
+-	SCTP_DEBUG_PRINTK("%s: sk: %p asoc: %p newsk: %p sd: %d\n",
+-			  __func__, sk, asoc, newsock->sk, retval);
++	SCTP_DEBUG_PRINTK("%s: sk: %p newsk: %p sd: %d\n",
++			  __func__, sk, newsock->sk, retval);
+ 
+ 	/* Return the fd mapped to the new socket.  */
+ 	peeloff.sd = retval;

Modified: dists/wheezy/linux/debian/patches/series
==============================================================================
--- dists/wheezy/linux/debian/patches/series	Sat Jun  8 15:21:40 2013	(r20204)
+++ dists/wheezy/linux/debian/patches/series	Sat Jun  8 16:24:46 2013	(r20205)
@@ -635,3 +635,5 @@
 bugfix/all/iscsi-target-fix-heap-buffer-overflow-on-error.patch
 debian/jbd2-avoid-ABI-change-in-3.2.45.patch
 bugfix/all/ath9k-Disable-PowerSave-by-default.patch
+bugfix/all/sctp-Export-sctp_do_peeloff.patch
+bugfix/all/dlm-Do-not-allocate-a-fd-for-peeloff.patch



More information about the Kernel-svn-changes mailing list