Skip to content

Commit 4ad9921

Browse files
jognesspmladek
authored andcommitted
printk: finalize records with trailing newlines
Any record with a trailing newline (LOG_NEWLINE flag) cannot be continued because the newline has been stripped and will not be visible if the message is appended. This was already handled correctly when committing in log_output() but was not handled correctly when committing in log_store(). Fixes: f5f022e ("printk: reimplement log_cont using record extension") Link: https://lore.kernel.org/r/[email protected] Reported-by: Kefeng Wang <[email protected]> Signed-off-by: John Ogness <[email protected]> Tested-by: Kefeng Wang <[email protected]> Reviewed-by: Petr Mladek <[email protected]> Signed-off-by: Petr Mladek <[email protected]>
1 parent 8119c43 commit 4ad9921

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/printk/printk.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -528,8 +528,8 @@ static int log_store(u32 caller_id, int facility, int level,
528528
if (dev_info)
529529
memcpy(&r.info->dev_info, dev_info, sizeof(r.info->dev_info));
530530

531-
/* insert message */
532-
if ((flags & LOG_CONT) || !(flags & LOG_NEWLINE))
531+
/* A message without a trailing newline can be continued. */
532+
if (!(flags & LOG_NEWLINE))
533533
prb_commit(&e);
534534
else
535535
prb_final_commit(&e);

0 commit comments

Comments
 (0)