From: Petr Vorel <hidden> Date: 2017-03-13 12:47:37
commit 7489bdadb7d1 (r8152: check rx after napi is enabled) causes null
pointer dereference when using device as under root:
# rmmod r8152 # or lsusb -v
NOHZ: local_softirq_pending 08
BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
IP: r8152_poll+0x125/0x570 [r8152]
PGD 89b4cf067
PUD 898ff2067
PMD 0
Oops: 0002 [#1] PREEMPT SMP
Signed-off-by: Petr Vorel <redacted>
---
NOTE: This is just a workaround, I suppose, there is better way how to fix that
(which allows keeping scheduling the napi for rx after napi_enable()).
---
drivers/net/usb/r8152.c | 2 --
1 file changed, 2 deletions(-)
From: Eric Dumazet <hidden> Date: 2017-03-13 13:18:06
On Mon, 2017-03-13 at 13:47 +0100, Petr Vorel wrote:
quoted hunk
commit 7489bdadb7d1 (r8152: check rx after napi is enabled) causes null
pointer dereference when using device as under root:
# rmmod r8152 # or lsusb -v
NOHZ: local_softirq_pending 08
BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
IP: r8152_poll+0x125/0x570 [r8152]
PGD 89b4cf067
PUD 898ff2067
PMD 0
Oops: 0002 [#1] PREEMPT SMP
Signed-off-by: Petr Vorel <redacted>
---
NOTE: This is just a workaround, I suppose, there is better way how to fix that
(which allows keeping scheduling the napi for rx after napi_enable()).
---
drivers/net/usb/r8152.c | 2 --
1 file changed, 2 deletions(-)
From: Eric Dumazet <hidden> Date: 2017-03-13 13:26:06
On Mon, 2017-03-13 at 06:18 -0700, Eric Dumazet wrote:
On Mon, 2017-03-13 at 13:47 +0100, Petr Vorel wrote:
quoted
commit 7489bdadb7d1 (r8152: check rx after napi is enabled) causes null
pointer dereference when using device as under root:
# rmmod r8152 # or lsusb -v
NOHZ: local_softirq_pending 08
BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
IP: r8152_poll+0x125/0x570 [r8152]
PGD 89b4cf067
PUD 898ff2067
PMD 0
Oops: 0002 [#1] PREEMPT SMP
Signed-off-by: Petr Vorel <redacted>
---
NOTE: This is just a workaround, I suppose, there is better way how to fix that
(which allows keeping scheduling the napi for rx after napi_enable()).
---
drivers/net/usb/r8152.c | 2 --
1 file changed, 2 deletions(-)
@@ -3703,8 +3703,10 @@ static int rtl8152_resume(struct usb_interface *intf)napi_enable(&tp->napi);clear_bit(SELECTIVE_SUSPEND,&tp->flags);smp_mb__after_atomic();+local_bh_disable();if(!list_empty(&tp->rx_done))napi_schedule(&tp->napi);+local_bh_enable();
Unfortunately this doesn't work. Code in r8152.c doesn't use local_bh_enable()/local_bh_disable(). I tried to lock it with spin_lock_bh()/spin_unlock_bh() and with mutex_lock()/mutex_unlock() but neither work.
Kind regards,
Petr
@@ -3703,8 +3703,10 @@ static int rtl8152_resume(struct usb_interface *intf)napi_enable(&tp->napi);clear_bit(SELECTIVE_SUSPEND,&tp->flags);smp_mb__after_atomic();+local_bh_disable();if(!list_empty(&tp->rx_done))napi_schedule(&tp->napi);+local_bh_enable();
Unfortunately this doesn't work. Code in r8152.c doesn't use
local_bh_enable()/local_bh_disable(). I tried to lock it with
spin_lock_bh()/spin_unlock_bh() and with mutex_lock()/mutex_unlock()
but neither work.
@@ -3703,8 +3703,10 @@ static int rtl8152_resume(struct usb_interface *intf)napi_enable(&tp->napi);clear_bit(SELECTIVE_SUSPEND,&tp->flags);smp_mb__after_atomic();+local_bh_disable();if(!list_empty(&tp->rx_done))napi_schedule(&tp->napi);+local_bh_enable();
Unfortunately this doesn't work. Code in r8152.c doesn't use
local_bh_enable()/local_bh_disable(). I tried to lock it with
spin_lock_bh()/spin_unlock_bh() and with mutex_lock()/mutex_unlock()
but neither work.
From: Petr Vorel <hidden> Date: 2017-03-13 21:57:18
quoted
quoted
Unfortunately this doesn't work. Code in r8152.c doesn't use
local_bh_enable()/local_bh_disable(). I tried to lock it with
spin_lock_bh()/spin_unlock_bh() and with mutex_lock()/mutex_unlock()
but neither work.
quoted
The local_bh_disable() / local_bh_enable() definitely is the right
answer to the issue you described.
quoted
It does not matter what code in r8152.c currently does.
From: Hayes Wang <hidden> Date: 2017-03-14 06:17:16
The list rx_done would be initialized when the linking on occurs.
Therefore, if a napi is scheduled without any linking on before,
the following kernel panic would happen.
BUG: unable to handle kernel NULL pointer dereference at 000000000000008
IP: [<ffffffffc085efde>] r8152_poll+0xe1e/0x1210 [r8152]
PGD 0
Oops: 0002 [#1] SMP
Signed-off-by: Hayes Wang <redacted>
---
drivers/net/usb/r8152.c | 1 +
1 file changed, 1 insertion(+)
From: Petr Vorel <hidden> Date: 2017-03-14 08:53:40
Hi Hayes,
The list rx_done would be initialized when the linking on occurs.
Therefore, if a napi is scheduled without any linking on before,
the following kernel panic would happen.
BUG: unable to handle kernel NULL pointer dereference at 000000000000008
IP: [<ffffffffc085efde>] r8152_poll+0xe1e/0x1210 [r8152]
PGD 0
Oops: 0002 [#1] SMP
From: David Miller <davem@davemloft.net> Date: 2017-03-21 21:46:45
From: Hayes Wang <redacted>
Date: Tue, 14 Mar 2017 14:15:20 +0800
The list rx_done would be initialized when the linking on occurs.
Therefore, if a napi is scheduled without any linking on before,
the following kernel panic would happen.
BUG: unable to handle kernel NULL pointer dereference at 000000000000008
IP: [<ffffffffc085efde>] r8152_poll+0xe1e/0x1210 [r8152]
PGD 0
Oops: 0002 [#1] SMP
Signed-off-by: Hayes Wang <redacted>