7eef18c047
commit 0c71437dd50dd687c15d8ca80b3b68f10bb21d63 upstream.
The j1939_session_deactivate() is decrementing the session ref-count and
potentially can free() the session. This would cause use-after-free
situation.
However, the code calling j1939_session_deactivate() does always hold
another reference to the session, so that it would not be free()ed in
this code path.
This patch adds a comment to make this clear and a WARN_ON, to ensure
that future changes will not violate this requirement. Further this
patch avoids dereferencing the session pointer as a precaution to avoid
use-after-free if the session is actually free()ed.
Fixes:
|
||
---|---|---|
.. | ||
j1939 | ||
af_can.c | ||
af_can.h | ||
bcm.c | ||
gw.c | ||
Kconfig | ||
Makefile | ||
proc.c | ||
raw.c |