Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'netconsole-fix-potential-race-condition-and-improve-code-clarity'

Breno Leitao says:

====================
netconsole: improve code clarity

These changes aim to enhance the reliability of netconsole by
eliminating the potential race condition and improve maintainability
by making the code more straightforward to understand and modify.
====================

Link: https://patch.msgid.link/20240709144403.544099-1-leitao@debian.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+2 -3
+2 -3
drivers/net/netconsole.c
··· 344 344 goto out_unlock; 345 345 346 346 err = -EINVAL; 347 - if ((bool)enabled == nt->enabled) { 347 + if (enabled == nt->enabled) { 348 348 pr_info("network logging has already %s\n", 349 349 nt->enabled ? "started" : "stopped"); 350 350 goto out_unlock; ··· 369 369 if (err) 370 370 goto out_unlock; 371 371 372 + nt->enabled = true; 372 373 pr_info("network logging started\n"); 373 374 } else { /* false */ 374 375 /* We need to disable the netconsole before cleaning it up ··· 381 380 spin_unlock_irqrestore(&target_list_lock, flags); 382 381 netpoll_cleanup(&nt->np); 383 382 } 384 - 385 - nt->enabled = enabled; 386 383 387 384 mutex_unlock(&dynamic_netconsole_mutex); 388 385 return strnlen(buf, count);