All of lore.kernel.org
 help / color / mirror / Atom feed
* [BUG] jffs2: possible null-pointer dereference in jffs2_scan_dirty_space()
@ 2021-07-31  4:05 ` Li Tuo
  0 siblings, 0 replies; 2+ messages in thread
From: Li Tuo @ 2021-07-31  4:05 UTC (permalink / raw)
  To: dwmw2, richard; +Cc: linux-mtd, linux-kernel, baijiaju1990

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [BUG] jffs2: possible null-pointer dereference in jffs2_scan_dirty_space()
@ 2021-07-31  4:05 ` Li Tuo
  0 siblings, 0 replies; 2+ messages in thread
From: Li Tuo @ 2021-07-31  4:05 UTC (permalink / raw)
  To: dwmw2, richard; +Cc: linux-mtd, linux-kernel, baijiaju1990

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

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-31  4:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-31  4:05 [BUG] jffs2: possible null-pointer dereference in jffs2_scan_dirty_space() Li Tuo
2021-07-31  4:05 ` Li Tuo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.