netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gerrit Renker <gerrit@erg.abdn.ac.uk>
To: davem@davemloft.net
Cc: dccp@vger.kernel.org, netdev@vger.kernel.org,
	Gerrit Renker <gerrit@erg.abdn.ac.uk>
Subject: [PATCH 01/86] dccp: fix bug in cache allocation
Date: Mon,  1 Feb 2010 07:18:06 +0100	[thread overview]
Message-ID: <1265005087-5549-2-git-send-email-gerrit@erg.abdn.ac.uk> (raw)
In-Reply-To: <1265005087-5549-1-git-send-email-gerrit@erg.abdn.ac.uk>

This fixes a bug introduced in commit de4ef86cfce60d2250111f34f8a084e769f23b16
("dccp: fix dccp rmmod when kernel configured to use slub", 17 Jan): the
vsnprintf used sizeof(slab_name_fmt), which became truncated to 4 bytes, since
slab_name_fmt is now a 4-byte pointer and no longer a 32-character array.

This lead to error messages such as
 FATAL: Error inserting dccp: No buffer space available

 >> kernel: [ 1456.341501] kmem_cache_create: duplicate cache cci
generated due to the truncation after the 3rrdc character.

Fixed for the moment by introducing a symbolic constant. Tested to fix the bug.

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
---
 net/dccp/ccid.c |    2 +-
 net/dccp/ccid.h |    8 +++++---
 2 files changed, 6 insertions(+), 4 deletions(-)

--- a/net/dccp/ccid.c
+++ b/net/dccp/ccid.c
@@ -83,7 +83,7 @@ static struct kmem_cache *ccid_kmem_cache_create(int obj_size, char *slab_name_f
 	va_list args;
 
 	va_start(args, fmt);
-	vsnprintf(slab_name_fmt, sizeof(slab_name_fmt), fmt, args);
+	vsnprintf(slab_name_fmt, CCID_SLAB_NAME_LENGTH, fmt, args);
 	va_end(args);
 
 	slab = kmem_cache_create(slab_name_fmt, sizeof(struct ccid) + obj_size, 0,
--- a/net/dccp/ccid.h
+++ b/net/dccp/ccid.h
@@ -19,7 +19,9 @@
 #include <linux/list.h>
 #include <linux/module.h>
 
-#define CCID_MAX 255
+/* maximum value for a CCID (RFC 4340, 19.5) */
+#define CCID_MAX		255
+#define CCID_SLAB_NAME_LENGTH	32
 
 struct tcp_info;
 
@@ -49,8 +51,8 @@ struct ccid_operations {
 	const char		*ccid_name;
 	struct kmem_cache	*ccid_hc_rx_slab,
 				*ccid_hc_tx_slab;
-	char			ccid_hc_rx_slab_name[32];
-	char			ccid_hc_tx_slab_name[32];
+	char			ccid_hc_rx_slab_name[CCID_SLAB_NAME_LENGTH];
+	char			ccid_hc_tx_slab_name[CCID_SLAB_NAME_LENGTH];
 	__u32			ccid_hc_rx_obj_size,
 				ccid_hc_tx_obj_size;
 	/* Interface Routines */

  reply	other threads:[~2010-02-01  6:30 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <recent-dccp-bug-fixes-jan-2010>
2010-02-01  6:18 ` [BUG-FIX][PATCH 0/2]: recent dccp fixes Gerrit Renker
2010-02-01  6:18   ` Gerrit Renker [this message]
2010-02-01  6:18     ` [PATCH 02/86] dccp: revert buggy auto-loading of dccp module Gerrit Renker
2010-02-01 12:21       ` Neil Horman
2010-02-01 18:38         ` Neil Horman
2010-02-02 15:06         ` gerrit
2010-02-02 15:39           ` Neil Horman
2010-02-03  6:16             ` [PATCH v2 1/1] dccp: fix auto-loading of dccp(_probe) Gerrit Renker
2010-02-03 11:58               ` Neil Horman
2010-02-04  3:01                 ` David Miller
2010-02-01 11:56     ` [PATCH 01/86] dccp: fix bug in cache allocation Neil Horman
2010-02-01 12:08       ` Gerrit Renker
2010-02-01 12:12         ` [BUG-FIX v2][PATCH 0/2]: recent dccp fixes Gerrit Renker
2010-02-01 12:12           ` [Bug-Fix][PATCH 1/2] dccp: fix bug in cache allocation Gerrit Renker
2010-02-01 12:12             ` [Bug-Fix][PATCH 2/2] dccp: revert buggy auto-loading of dccp module Gerrit Renker
2010-02-04  3:01       ` [PATCH 01/86] dccp: fix bug in cache allocation David Miller
2010-02-01  7:17   ` [BUG-FIX][PATCH 0/2]: recent dccp fixes David Miller

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=1265005087-5549-2-git-send-email-gerrit@erg.abdn.ac.uk \
    --to=gerrit@erg.abdn.ac.uk \
    --cc=davem@davemloft.net \
    --cc=dccp@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).