Skip to content

Commit

Permalink
tty: n_gsm: Debug output allocation must use GFP_ATOMIC
Browse files Browse the repository at this point in the history
Dan Carpenter <[email protected]> reported the following Smatch
warning:

drivers/tty/n_gsm.c:720 gsm_data_kick()
warn: sleeping in atomic context

This is because gsm_control_message() is holding a spin lock so
gsm_hex_dump_bytes() needs to use GFP_ATOMIC instead of GFP_KERNEL.

Fixes: 925ea0f ("tty: n_gsm: Fix packet data hex dump output")
Cc: stable <[email protected]>
Reported-by: Dan Carpenter <[email protected]>
Reviewed-by: Gregory CLEMENT <[email protected]>
Signed-off-by: Tony Lindgren <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
tmlind authored and gregkh committed Jun 10, 2022
1 parent f2906aa commit e74024b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/tty/n_gsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ static void gsm_hex_dump_bytes(const char *fname, const u8 *data,
return;
}

prefix = kasprintf(GFP_KERNEL, "%s: ", fname);
prefix = kasprintf(GFP_ATOMIC, "%s: ", fname);
if (!prefix)
return;
print_hex_dump(KERN_INFO, prefix, DUMP_PREFIX_OFFSET, 16, 1, data, len,
Expand Down

0 comments on commit e74024b

Please sign in to comment.