Roman Mashak
37f1c63e3e
net sched actions: do not overwrite status of action creation.
nla_memdup_cookie was overwriting err value, declared at function
scope and earlier initialized with result of ->init(). At success
nla_memdup_cookie() returns 0, and thus module refcnt decremented,
although the action was installed.
$ sudo tc actions add action pass index 1 cookie 1234
$ sudo tc actions ls action gact
action order 0: gact action pass
random type none pass val 0
index 1 ref 1 bind 0
$
$ lsmod
Module Size Used by
act_gact 16384 0
...
$
$ sudo rmmod act_gact
[ 52.310283] ------------[ cut here ]------------
[ 52.312551] WARNING: CPU: 1 PID: 455 at kernel/module.c:1113
module_put+0x99/0xa0
[ 52.316278] Modules linked in: act_gact(-) crct10dif_pclmul crc32_pclmul
ghash_clmulni_intel psmouse pcbc evbug aesni_intel aes_x86_64 crypto_simd
serio_raw glue_helper pcspkr cryptd
[ 52.322285] CPU: 1 PID: 455 Comm: rmmod Not tainted 4.10.0+ #11
[ 52.324261] Call Trace:
[ 52.325132] dump_stack+0x63/0x87
[ 52.326236] __warn+0xd1/0xf0
[ 52.326260] warn_slowpath_null+0x1d/0x20
[ 52.326260] module_put+0x99/0xa0
[ 52.326260] tcf_hashinfo_destroy+0x7f/0x90
[ 52.326260] gact_exit_net+0x27/0x40 [act_gact]
[ 52.326260] ops_exit_list.isra.6+0x38/0x60
[ 52.326260] unregister_pernet_operations+0x90/0xe0
[ 52.326260] unregister_pernet_subsys+0x21/0x30
[ 52.326260] tcf_unregister_action+0x68/0xa0
[ 52.326260] gact_cleanup_module+0x17/0xa0f [act_gact]
[ 52.326260] SyS_delete_module+0x1ba/0x220
[ 52.326260] entry_SYSCALL_64_fastpath+0x1e/0xad
[ 52.326260] RIP: 0033:0x7f527ffae367
[ 52.326260] RSP: 002b:00007ffeb402a598 EFLAGS: 00000202 ORIG_RAX:
00000000000000b0
[ 52.326260] RAX: ffffffffffffffda RBX: 0000559b069912a0 RCX: 00007f527ffae367
[ 52.326260] RDX: 000000000000000a RSI: 0000000000000800 RDI: 0000559b06991308
[ 52.326260] RBP: 0000000000000003 R08: 00007f5280264420 R09: 00007ffeb4029511
[ 52.326260] R10: 000000000000087b R11: 0000000000000202 R12: 00007ffeb4029580
[ 52.326260] R13: 0000000000000000 R14: 0000000000000000 R15: 0000559b069912a0
[ 52.354856] ---[ end trace 90d89401542b0db6 ]---
$
With the fix:
$ sudo modprobe act_gact
$ lsmod
Module Size Used by
act_gact 16384 0
...
$ sudo tc actions add action pass index 1 cookie 1234
$ sudo tc actions ls action gact
action order 0: gact action pass
random type none pass val 0
index 1 ref 1 bind 0
$
$ lsmod
Module Size Used by
act_gact 16384 1
...
$ sudo rmmod act_gact
rmmod: ERROR: Module act_gact is in use
$
$ sudo /home/mrv/bin/tc actions del action gact index 1
$ sudo rmmod act_gact
$ lsmod
Module Size Used by
$
Fixes: 1045ba77a ("net sched actions: Add support for user cookies")
Signed-off-by: Roman Mashak <mrv@mojatatu.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-02-26 21:31:32 -05:00
..
2017-01-22 16:46:13 -05:00
2016-09-23 13:47:44 -04:00
2016-12-24 11:46:01 -08:00
2017-02-06 11:25:57 -05:00
2016-09-10 21:19:10 -07:00
2016-12-28 15:11:32 -05:00
2017-01-16 14:39:58 -05:00
2017-01-29 19:21:26 -05:00
2017-02-22 10:15:09 -08:00
2017-02-17 13:56:56 -05:00
2017-01-19 11:45:21 -05:00
2017-01-30 11:05:04 +01:00
2017-02-20 13:23:30 -08:00
2017-02-23 13:53:42 -05:00
2016-12-03 23:54:25 -05:00
2017-02-22 16:14:07 -05:00
2016-12-24 11:46:01 -08:00
2017-02-11 02:31:11 -05:00
2017-02-16 21:25:49 -05:00
2017-02-21 13:25:22 -05:00
2016-12-16 00:13:43 +02:00
2017-02-03 15:16:45 -05:00
2017-02-26 11:03:38 -05:00
2017-02-26 21:25:46 -05:00
2016-12-25 17:21:22 +01:00
2017-02-17 16:19:39 -05:00
2017-01-10 21:08:29 -05:00
2017-02-14 13:06:37 -05:00
2016-11-18 10:59:15 -05:00
2017-02-22 15:59:53 -05:00
2016-09-10 23:12:53 -07:00
2016-12-24 11:46:01 -08:00
2017-02-12 22:14:49 -05:00
2017-02-10 14:31:51 -05:00
2016-12-25 17:21:22 +01:00
2017-02-20 11:13:37 -05:00
2016-10-20 11:23:08 -04:00
2017-02-23 10:59:15 -05:00
2017-01-06 22:20:45 -05:00
2017-01-27 12:03:29 -05:00
2016-10-27 16:16:09 -04:00
2017-02-20 10:18:43 -05:00
2017-02-19 11:18:46 -05:00
2016-11-18 10:59:15 -05:00
2017-01-24 13:44:28 -05:00
2017-01-10 20:45:04 -05:00
2017-02-24 14:13:14 -05:00
2017-01-24 11:07:35 +01:00
2016-12-24 11:46:01 -08:00
2017-02-26 21:30:12 -05:00
2017-02-26 21:31:32 -05:00
2017-02-26 21:24:05 -05:00
2017-01-30 16:37:55 -05:00
2016-10-12 01:51:49 -04:00
2017-02-22 10:15:09 -08:00
2016-10-30 12:42:58 -04:00
2017-02-24 11:42:54 -05:00
2017-02-02 21:58:02 -05:00
2016-12-17 20:17:04 -08:00
2016-10-27 16:16:09 -04:00
2017-02-10 14:31:51 -05:00
2016-12-24 11:46:01 -08:00
2017-02-16 21:25:49 -05:00
2017-02-22 10:15:09 -08:00
2017-02-17 13:40:05 -05:00
2017-02-03 15:16:45 -05:00
2017-02-21 13:35:25 -05:00
2016-10-06 09:52:23 -07:00