]> git.baikalelectronics.ru Git - kernel.git/commit
l2tp: don't BUG_ON seqfile checks in l2tp_ppp
authorTom Parkin <tparkin@katalix.com>
Fri, 24 Jul 2020 15:31:54 +0000 (16:31 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sat, 25 Jul 2020 00:19:14 +0000 (17:19 -0700)
commit1691d281670ed044c05bb47173e8a98534bd8940
treefaf2aed0728aa374a0781e0672640cb3ed4e682a
parent39a0dd3b29e09f30ada4282226ba036e2f3cb993
l2tp: don't BUG_ON seqfile checks in l2tp_ppp

checkpatch advises that WARN_ON and recovery code are preferred over
BUG_ON which crashes the kernel.

l2tp_ppp has a BUG_ON check of struct seq_file's private pointer in
pppol2tp_seq_start prior to accessing data through that pointer.

Rather than crashing, we can simply bail out early and return NULL in
order to terminate the seq file processing in much the same way as we do
when reaching the end of tunnel/session instances to render.

Retain a WARN_ON to help trace possible bugs in this area.

Signed-off-by: Tom Parkin <tparkin@katalix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/l2tp/l2tp_ppp.c