From: Greg Kroah-Hartman Date: Tue, 7 Jun 2022 16:47:23 +0000 (+0200) Subject: 5.17-stable patches X-Git-Tag: v5.10.121~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c05fc52c48101ff7c2bcbc578b24c7b394e52462;p=thirdparty%2Fkernel%2Fstable-queue.git 5.17-stable patches added patches: tty-n_gsm-fix-packet-data-hex-dump-output.patch --- diff --git a/queue-5.17/series b/queue-5.17/series index 649a3e04c5e..151e79df89c 100644 --- a/queue-5.17/series +++ b/queue-5.17/series @@ -769,3 +769,4 @@ fs-ntfs3-fix-invalid-free-in-log_replay.patch md-don-t-set-mddev-private-to-null-in-raid0-pers-free.patch md-fix-double-free-of-io_acct_set-bioset.patch md-bcache-check-the-return-value-of-kzalloc-in-detached_dev_do_request.patch +tty-n_gsm-fix-packet-data-hex-dump-output.patch diff --git a/queue-5.17/tty-n_gsm-fix-packet-data-hex-dump-output.patch b/queue-5.17/tty-n_gsm-fix-packet-data-hex-dump-output.patch new file mode 100644 index 00000000000..259ef1d8251 --- /dev/null +++ b/queue-5.17/tty-n_gsm-fix-packet-data-hex-dump-output.patch @@ -0,0 +1,96 @@ +From 925ea0fa5277c1e6bb9e51955ef34eea9736c3d7 Mon Sep 17 00:00:00 2001 +From: Tony Lindgren +Date: Thu, 12 May 2022 16:15:06 +0300 +Subject: tty: n_gsm: Fix packet data hex dump output + +From: Tony Lindgren + +commit 925ea0fa5277c1e6bb9e51955ef34eea9736c3d7 upstream. + +The module param debug for n_gsm uses KERN_INFO level, but the hexdump +now uses KERN_DEBUG level. This started after commit 091cb0994edd +("lib/hexdump: make print_hex_dump_bytes() a nop on !DEBUG builds"). +We now use dynamic_hex_dump() unless DEBUG is set. + +This causes no packets to be seen with modprobe n_gsm debug=0x1f unlike +earlier. Let's fix this by adding gsm_hex_dump_bytes() that calls +print_hex_dump() with KERN_INFO to match what n_gsm is doing with the +other debug related output. + +Fixes: 091cb0994edd ("lib/hexdump: make print_hex_dump_bytes() a nop on !DEBUG builds") +Cc: Stephen Boyd +Signed-off-by: Tony Lindgren +Link: https://lore.kernel.org/r/20220512131506.1216-1-tony@atomide.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/tty/n_gsm.c | 31 +++++++++++++++++++++++-------- + 1 file changed, 23 insertions(+), 8 deletions(-) + +--- a/drivers/tty/n_gsm.c ++++ b/drivers/tty/n_gsm.c +@@ -444,6 +444,25 @@ static u8 gsm_encode_modem(const struct + return modembits; + } + ++static void gsm_hex_dump_bytes(const char *fname, const u8 *data, ++ unsigned long len) ++{ ++ char *prefix; ++ ++ if (!fname) { ++ print_hex_dump(KERN_INFO, "", DUMP_PREFIX_NONE, 16, 1, data, len, ++ true); ++ return; ++ } ++ ++ prefix = kasprintf(GFP_KERNEL, "%s: ", fname); ++ if (!prefix) ++ return; ++ print_hex_dump(KERN_INFO, prefix, DUMP_PREFIX_OFFSET, 16, 1, data, len, ++ true); ++ kfree(prefix); ++} ++ + /** + * gsm_print_packet - display a frame for debug + * @hdr: header to print before decode +@@ -508,7 +527,7 @@ static void gsm_print_packet(const char + else + pr_cont("(F)"); + +- print_hex_dump_bytes("", DUMP_PREFIX_NONE, data, dlen); ++ gsm_hex_dump_bytes(NULL, data, dlen); + } + + +@@ -698,9 +717,7 @@ static void gsm_data_kick(struct gsm_mux + } + + if (debug & 4) +- print_hex_dump_bytes("gsm_data_kick: ", +- DUMP_PREFIX_OFFSET, +- gsm->txframe, len); ++ gsm_hex_dump_bytes(__func__, gsm->txframe, len); + if (gsmld_output(gsm, gsm->txframe, len) <= 0) + break; + /* FIXME: Can eliminate one SOF in many more cases */ +@@ -2448,8 +2465,7 @@ static int gsmld_output(struct gsm_mux * + return -ENOSPC; + } + if (debug & 4) +- print_hex_dump_bytes("gsmld_output: ", DUMP_PREFIX_OFFSET, +- data, len); ++ gsm_hex_dump_bytes(__func__, data, len); + return gsm->tty->ops->write(gsm->tty, data, len); + } + +@@ -2525,8 +2541,7 @@ static void gsmld_receive_buf(struct tty + char flags = TTY_NORMAL; + + if (debug & 4) +- print_hex_dump_bytes("gsmld_receive: ", DUMP_PREFIX_OFFSET, +- cp, count); ++ gsm_hex_dump_bytes(__func__, cp, count); + + for (; count; count--, cp++) { + if (fp)