* [BUG] net: huawei: hinic: a possible sleep-in-atomic-context bug in hinic_get_stats64 [not found] <e69f8fe7-6bb9-56b4-7053-9766b3a0f3da@gmail.com> @ 2019-01-11 2:11 ` Jia-Ju Bai 2019-01-11 2:11 ` Jia-Ju Bai 2019-01-11 2:18 ` Jia-Ju Bai 1 sibling, 1 reply; 4+ messages in thread From: Jia-Ju Bai @ 2019-01-11 2:11 UTC (permalink / raw) To: aviad.krawczyk; +Cc: netdev, Linux Kernel Mailing List The driver may sleep while holding a RCU lock. The function call path (from bottom to top) in Linux-4.17 is: [FUNC] down drivers/net/.../hinic/hinic_main.c, 775: down in hinic_get_stats64 net/core/dev.c, 8278: [FUNC_PTR]hinic_get_stats64 in dev_get_stats net/core/net-sysfs.c, 568: dev_get_stats in netstat_show net/core/net-sysfs.c, 565: _raw_read_lock in netstat_show Note that [FUNC_PTR] means a function pointer call. This bug is found by my static analysis tool (DSAC-2) and checked by my manual code review. I do not know how to correctly fix this bug, so I just report it. A possible way may be to replace up() and down() with spin_lock() and spin_unlock(). Best wishes, Jia-Ju Bai ^ permalink raw reply [flat|nested] 4+ messages in thread
* [BUG] net: huawei: hinic: a possible sleep-in-atomic-context bug in hinic_get_stats64 2019-01-11 2:11 ` [BUG] net: huawei: hinic: a possible sleep-in-atomic-context bug in hinic_get_stats64 Jia-Ju Bai @ 2019-01-11 2:11 ` Jia-Ju Bai 0 siblings, 0 replies; 4+ messages in thread From: Jia-Ju Bai @ 2019-01-11 2:11 UTC (permalink / raw) To: aviad.krawczyk; +Cc: netdev, Linux Kernel Mailing List The driver may sleep while holding a RCU lock. The function call path (from bottom to top) in Linux-4.17 is: [FUNC] down drivers/net/.../hinic/hinic_main.c, 775: down in hinic_get_stats64 net/core/dev.c, 8278: [FUNC_PTR]hinic_get_stats64 in dev_get_stats net/core/net-sysfs.c, 568: dev_get_stats in netstat_show net/core/net-sysfs.c, 565: _raw_read_lock in netstat_show Note that [FUNC_PTR] means a function pointer call. This bug is found by my static analysis tool (DSAC-2) and checked by my manual code review. I do not know how to correctly fix this bug, so I just report it. A possible way may be to replace up() and down() with spin_lock() and spin_unlock(). Best wishes, Jia-Ju Bai ^ permalink raw reply [flat|nested] 4+ messages in thread
* [BUG] net: huawei: hinic: a possible sleep-in-atomic-context bug in hinic_get_stats64 [not found] <e69f8fe7-6bb9-56b4-7053-9766b3a0f3da@gmail.com> 2019-01-11 2:11 ` [BUG] net: huawei: hinic: a possible sleep-in-atomic-context bug in hinic_get_stats64 Jia-Ju Bai @ 2019-01-11 2:18 ` Jia-Ju Bai 2019-01-11 2:18 ` Jia-Ju Bai 1 sibling, 1 reply; 4+ messages in thread From: Jia-Ju Bai @ 2019-01-11 2:18 UTC (permalink / raw) To: aviad.krawczyk, netdev, Linux Kernel Mailing List The driver may sleep while holding a RCU lock. The function call path (from bottom to top) in Linux-4.17 is: [FUNC] down drivers/net/.../hinic/hinic_main.c, 775: down in hinic_get_stats64 net/core/dev.c, 8278: [FUNC_PTR]hinic_get_stats64 in dev_get_stats net/core/net-sysfs.c, 568: dev_get_stats in netstat_show net/core/net-sysfs.c, 565: _raw_read_lock in netstat_show Note that [FUNC_PTR] means a function pointer call. This bug is found by my static analysis tool (DSAC-2) and checked by my manual code review. I do not know how to correctly fix this bug, so I just report it. A possible way may be to replace up() and down() with spin_lock() and spin_unlock(). Best wishes, Jia-Ju Bai ^ permalink raw reply [flat|nested] 4+ messages in thread
* [BUG] net: huawei: hinic: a possible sleep-in-atomic-context bug in hinic_get_stats64 2019-01-11 2:18 ` Jia-Ju Bai @ 2019-01-11 2:18 ` Jia-Ju Bai 0 siblings, 0 replies; 4+ messages in thread From: Jia-Ju Bai @ 2019-01-11 2:18 UTC (permalink / raw) To: aviad.krawczyk, netdev, Linux Kernel Mailing List The driver may sleep while holding a RCU lock. The function call path (from bottom to top) in Linux-4.17 is: [FUNC] down drivers/net/.../hinic/hinic_main.c, 775: down in hinic_get_stats64 net/core/dev.c, 8278: [FUNC_PTR]hinic_get_stats64 in dev_get_stats net/core/net-sysfs.c, 568: dev_get_stats in netstat_show net/core/net-sysfs.c, 565: _raw_read_lock in netstat_show Note that [FUNC_PTR] means a function pointer call. This bug is found by my static analysis tool (DSAC-2) and checked by my manual code review. I do not know how to correctly fix this bug, so I just report it. A possible way may be to replace up() and down() with spin_lock() and spin_unlock(). Best wishes, Jia-Ju Bai ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-01-11 2:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <e69f8fe7-6bb9-56b4-7053-9766b3a0f3da@gmail.com>
2019-01-11 2:11 ` [BUG] net: huawei: hinic: a possible sleep-in-atomic-context bug in hinic_get_stats64 Jia-Ju Bai
2019-01-11 2:11 ` Jia-Ju Bai
2019-01-11 2:18 ` Jia-Ju Bai
2019-01-11 2:18 ` Jia-Ju Bai
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox