From: Tilman Schmidt <tilman@imap.cc>
To: Karsten Keil <isdn@linux-pingi.de>, David Miller <davem@davemloft.net>
Cc: Hansjoerg Lipp <hjlipp@web.de>, Karsten Keil <keil@b1-systems.de>,
i4ldeveloper@listserv.isdn4linux.de, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 6/6] isdn/gigaset: fix zero size border case in debug dump
Date: Mon, 21 Jan 2013 22:57:21 +0100 (CET) [thread overview]
Message-ID: <20130121-patch-isdn-06.tilman@imap.cc> (raw)
In-Reply-To: <20130121-patch-isdn-00.tilman@imap.cc>
If subtracting 12 from l leaves zero we'd do a zero size allocation,
leading to an oops later when we try to set the NUL terminator.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Tilman Schmidt <tilman@imap.cc>
CC: stable <stable@kernel.org>
---
drivers/isdn/gigaset/capi.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/isdn/gigaset/capi.c b/drivers/isdn/gigaset/capi.c
index 68452b7..03a0a01 100644
--- a/drivers/isdn/gigaset/capi.c
+++ b/drivers/isdn/gigaset/capi.c
@@ -248,6 +248,8 @@ static inline void dump_rawmsg(enum debuglevel level, const char *tag,
CAPIMSG_APPID(data), CAPIMSG_MSGID(data), l,
CAPIMSG_CONTROL(data));
l -= 12;
+ if (l <= 0)
+ return;
dbgline = kmalloc(3 * l, GFP_ATOMIC);
if (!dbgline)
return;
--
1.7.3.4
next prev parent reply other threads:[~2013-01-21 21:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-21 21:57 [PATCH 0/6] ISDN patches for net-next Tilman Schmidt
2013-01-21 21:57 ` [PATCH 2/6] isdn/gigaset: leave DLE mode before hanging up Tilman Schmidt
2013-01-21 21:57 ` [PATCH 3/6] isdn/gigaset: beautify interface.c Tilman Schmidt
2013-01-21 21:57 ` [PATCH 1/6] isdn/divert: fix readability damage Tilman Schmidt
2013-01-21 21:57 ` [PATCH 5/6] isdn/gigaset: beautify ev-layer.c Tilman Schmidt
2013-01-21 21:57 ` Tilman Schmidt [this message]
2013-01-21 21:57 ` [PATCH 4/6] isdn/gigaset: beautify common.c Tilman Schmidt
2013-01-21 22:38 ` [PATCH 0/6] ISDN patches for net-next David Miller
2013-01-22 8:23 ` Tilman Schmidt
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=20130121-patch-isdn-06.tilman@imap.cc \
--to=tilman@imap.cc \
--cc=davem@davemloft.net \
--cc=hjlipp@web.de \
--cc=i4ldeveloper@listserv.isdn4linux.de \
--cc=isdn@linux-pingi.de \
--cc=keil@b1-systems.de \
--cc=linux-kernel@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).