lkml.org 
[lkml]   [2021]   [Jul]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subject[BUG] jffs2: possible null-pointer dereference in jffs2_scan_dirty_space()
Date
Hello,

Our static analysis tool finds a possible null-pointer dereference in
the jffs2 driver in Linux 5.14.0-rc3:

The variable jeb->last_node is checked in:
673:    if (jeb->last_node && ref_obsolete(jeb->last_node))

This indicates that jeb->last_node can be NULL.
If so, the function jffs2_link_node_ref() is called with the argument jeb:
685:    jffs2_link_node_ref(c, jeb, ofs, size, NULL);

In the called function, jeb->last_node is assigned to the pointer ref,
which means ref is also NULL.
However, the possible NULL pointer ref is dereferenced in some
statements such as:
597:    dbg_noderef("Last node at %p is (%08x,%p)\n", ref,
ref->flash_offset, ref->next_in_ino);
600:    while (ref->flash_offset != REF_EMPTY_NODE)

I am not quite sure whether this possible null-pointer dereference is
real and how to fix it if it is real.
Any feedback would be appreciated, thanks!

Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>

Best wishes,
Tuo Li

\
 
 \ /
  Last update: 2021-07-31 06:07    [W:0.256 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site