summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTilman Schmidt <tilman@imap.cc>2013-01-21 11:57:21 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-02-14 10:48:13 -0800
commitfdab75e4f3b49683ab917717ea5183c6dbce708d (patch)
treea44ae83b9a9febcb32c9d3f445e401f4479488c3
parent0e3fd03bdeb3cc0ce601723d2406be53b829be25 (diff)
isdn/gigaset: fix zero size border case in debug dump
[ Upstream commit d721a1752ba544df8d7d36959038b26bc92bdf80 ] 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> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/isdn/gigaset/capi.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/isdn/gigaset/capi.c b/drivers/isdn/gigaset/capi.c
index 68452b768da2..03a0a01a4054 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;