Skip to content

Commit c85bf19

Browse files
gustavoldkuba-moo
authored andcommitted
netconsole: fix appending sysdata when sysdata_fields == SYSDATA_RELEASE
Before appending sysdata, prepare_extradata() checks if any feature is enabled in sysdata_fields (and exits early if none is enabled). When SYSDATA_RELEASE was introduced, we missed adding it to the list of features being checked against sysdata_fields in prepare_extradata(). The result was that, if only SYSDATA_RELEASE is enabled in sysdata_fields, we incorreclty exit early and fail to append the release. Instead of checking specific bits in sysdata_fields, check if sysdata_fields has ALL bit zeroed and exit early if true. This fixes case when only SYSDATA_RELEASE enabled and makes the code more general / less error prone in future feature implementation. Signed-off-by: Gustavo Luiz Duarte <[email protected]> Reviewed-by: Breno Leitao <[email protected]> Fixes: cfcc923 ("netconsole: append release to sysdata") Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 2660a54 commit c85bf19

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/net/netconsole.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,15 +1252,14 @@ static int sysdata_append_release(struct netconsole_target *nt, int offset)
12521252
*/
12531253
static int prepare_extradata(struct netconsole_target *nt)
12541254
{
1255-
u32 fields = SYSDATA_CPU_NR | SYSDATA_TASKNAME;
12561255
int extradata_len;
12571256

12581257
/* userdata was appended when configfs write helper was called
12591258
* by update_userdata().
12601259
*/
12611260
extradata_len = nt->userdata_length;
12621261

1263-
if (!(nt->sysdata_fields & fields))
1262+
if (!nt->sysdata_fields)
12641263
goto out;
12651264

12661265
if (nt->sysdata_fields & SYSDATA_CPU_NR)

0 commit comments

Comments
 (0)