Skip to content

Commit 093d804

Browse files
Ken Millsgregkh
authored andcommitted
n_gsm: gsm_data_alloc buffer allocation could fail and it is not being 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 <[email protected]> Signed-off-by: Alan Cox <[email protected]> Cc: [email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent be7a741 commit 093d804

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/tty/n_gsm.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -968,6 +968,8 @@ static void gsm_control_reply(struct gsm_mux *gsm, int cmd, u8 *data,
968968
{
969969
struct gsm_msg *msg;
970970
msg = gsm_data_alloc(gsm, 0, dlen + 2, gsm->ftype);
971+
if (msg == NULL)
972+
return;
971973
msg->data[0] = (cmd & 0xFE) << 1 | EA; /* Clear C/R */
972974
msg->data[1] = (dlen << 1) | EA;
973975
memcpy(msg->data + 2, data, dlen);

0 commit comments

Comments
 (0)