All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
To: "David S. Miller" <davem@davemloft.net>,
	Patrick Caulfield <patrick@tykepenguin.com>
Cc: linux-decnet-user@lists.sourceforge.net,
	Networking Team <netdev@oss.sgi.com>
Subject: [PATCH 2/9] decnet: Don't use sk_protinfo + private sock slab cache
Date: Thu, 20 Jan 2005 00:04:10 -0200	[thread overview]
Message-ID: <41EF119A.5040803@conectiva.com.br> (raw)

[-- Attachment #1: Type: text/plain, Size: 83 bytes --]

Hi David, Patrick,

	The log has the reason for this patch.

Regards,

- Arnaldo



[-- Attachment #2: decnet.patch --]
[-- Type: text/plain, Size: 2365 bytes --]

===================================================================


ChangeSet@1.2338, 2005-01-19 23:02:32-02:00, acme@toy.ghostprotocols.net
  [DECNET] Don't use sk_protinfo + private sock slab cache
  
  DecNET already uses a private sock slab cache, but initializes sk->sk_protinfo,
  pointing to (sk + 1), this is wrong because at sk_free time we call
  sk->sk_destruct, that by default points to sock_def_destruct, that does a kfree
  on sk->sk_protinfo, since it was initialized at net_proto_family->create() time
  (dn_create), but in decnet sk_protinfo was not kmalloced, it was allocated
  piggybacked to struct sock.
  
  This doesn't causes problems because decnet sets sk->sk_destruct to a custom
  function that doesn't calls kfree(sk->sk_protinfo), but to reach a long time
  goal of killing sk_protinfo lets just make DN_SK return sk + 1.
  
  I left merging dn_scp with dn_sock for later, as the current state suits my
  needs to introduce connection_sock.
  
  Signed-off-by: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
  Signed-off-by: David S. Miller <davem@davemloft.net>


 include/net/dn.h       |    6 +++++-
 net/decnet/af_decnet.c |    3 +--
 2 files changed, 6 insertions(+), 3 deletions(-)


diff -Nru a/include/net/dn.h b/include/net/dn.h
--- a/include/net/dn.h	2005-01-19 23:18:06 -02:00
+++ b/include/net/dn.h	2005-01-19 23:18:06 -02:00
@@ -2,6 +2,7 @@
 #define _NET_DN_H
 
 #include <linux/dn.h>
+#include <net/sock.h>
 #include <asm/byteorder.h>
 
 typedef unsigned short dn_address;
@@ -133,7 +134,10 @@
 
 };
 
-#define DN_SK(__sk) ((struct dn_scp *)(__sk)->sk_protinfo)
+static inline struct dn_scp *DN_SK(struct sock *sk)
+{
+	return (struct dn_scp *)(sk + 1);
+}
 
 /*
  * src,dst : Source and Destination DECnet addresses
diff -Nru a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
--- a/net/decnet/af_decnet.c	2005-01-19 23:18:06 -02:00
+++ b/net/decnet/af_decnet.c	2005-01-19 23:18:06 -02:00
@@ -456,8 +456,6 @@
 	if  (!sk)
 		goto out;
 
-	sk->sk_protinfo = scp = (struct dn_scp *)(sk + 1);
-
 	if (sock)
 		sock->ops = &dn_proto_ops;
 	sock_init_data(sock, sk);
@@ -471,6 +469,7 @@
 	sk->sk_allocation  = gfp;
 
 	/* Initialization of DECnet Session Control Port		*/
+	scp = DN_SK(sk);
 	scp->state	= DN_O;		/* Open			*/
 	scp->numdat	= 1;		/* Next data seg to tx	*/
 	scp->numoth	= 1;		/* Next oth data to tx  */




                 reply	other threads:[~2005-01-20  2:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41EF119A.5040803@conectiva.com.br \
    --to=acme@conectiva.com.br \
    --cc=davem@davemloft.net \
    --cc=linux-decnet-user@lists.sourceforge.net \
    --cc=netdev@oss.sgi.com \
    --cc=patrick@tykepenguin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.