]> git.baikalelectronics.ru Git - kernel.git/commit
hamradio: Fix wrong assignment of 'bbc->cfg.loopback'
authorMeng Tang <tangmeng@uniontech.com>
Tue, 15 Mar 2022 07:48:51 +0000 (15:48 +0800)
committerJakub Kicinski <kuba@kernel.org>
Thu, 17 Mar 2022 02:17:49 +0000 (19:17 -0700)
commit5f80b26254a9fd603f36ea95d99d074636711515
tree1c1f4320f9044fb7bcd3b3cfa863bcde8461b924
parent46c5ae9ab35e7dd47cf5247ca6e5abdbe6289f09
hamradio: Fix wrong assignment of 'bbc->cfg.loopback'

In file hamradio/baycom_epp.c, the baycom_setmode interface, there
is a problem with improper use of strstr.

Suppose that when modestr="noloopback", both conditions which are
'strstr(modestr,"noloopback")' and 'strstr(modestr,"loopback")'
will be true(not NULL), this lead the bc->cfg.loopback variable
will be first assigned to 0, and then reassigned to 1.

This will cause 'bc->cfg.loopback = 0' will never take effect. That
obviously violates the logic of the code, so adjust the order of
their execution to solve the problem.

Signed-off-by: Meng Tang <tangmeng@uniontech.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20220315074851.6456-1-tangmeng@uniontech.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/hamradio/baycom_epp.c