summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Mills <ken.k.mills@intel.com>2010-12-13 15:28:03 +0000
committerAK <andi@firstfloor.org>2011-02-06 11:03:46 -0800
commitaf98113010e7815aaa0f4281f6a54bfe0c7bed3d (patch)
tree8c85436ef6d50ec10bf6a1d8cd8812ba144e9372
parent1298db626792287d5c66ba71ae802cfd1db72d3f (diff)
n_gsm: gsm_data_alloc buffer allocation could fail and it is not being checked
commit 093d804611b9a38fe59753b37c29f840518406a9 upstream. gsm_data_alloc buffer allocation could fail and it is not being checked. Add check for allocated buffer and return if the buffer allocation fails. Signed-off-by: Ken Mills <ken.k.mills@intel.com> Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Andi Kleen <ak@linux.intel.com>
-rw-r--r--drivers/char/n_gsm.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/char/n_gsm.c b/drivers/char/n_gsm.c
index 3bf479284c35..a5eeacdd7a53 100644
--- a/drivers/char/n_gsm.c
+++ b/drivers/char/n_gsm.c
@@ -969,6 +969,8 @@ static void gsm_control_reply(struct gsm_mux *gsm, int cmd, u8 *data,
{
struct gsm_msg *msg;
msg = gsm_data_alloc(gsm, 0, dlen + 2, gsm->ftype);
+ if (msg == NULL)
+ return;
msg->data[0] = (cmd & 0xFE) << 1 | EA; /* Clear C/R */
msg->data[1] = (dlen << 1) | EA;
memcpy(msg->data + 2, data, dlen);