Skip to content

Commit

Permalink
n_gsm: gsm_data_alloc buffer allocation could fail and it is not bein…
Browse files Browse the repository at this point in the history
…g checked

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>
Cc: stable@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Ken Mills authored and Greg Kroah-Hartman committed Dec 16, 2010
1 parent be7a741 commit 093d804
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/tty/n_gsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,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);
Expand Down

0 comments on commit 093d804

Please sign in to comment.