From: Eric Dumazet <eric.dumazet@gmail.com>
To: Petr Vorel <petr.vorel@gmail.com>
Cc: netdev@vger.kernel.org, hayeswang@realtek.com, davem@davemloft.net
Subject: Re: [PATCH 1/1] r8152: fix NULL pointer dereference in r8152_poll
Date: Mon, 13 Mar 2017 06:18:04 -0700 [thread overview]
Message-ID: <1489411084.28631.78.camel@edumazet-glaptop3.roam.corp.google.com> (raw)
In-Reply-To: <20170313124727.4681-1-petr.vorel@gmail.com>
On Mon, 2017-03-13 at 13:47 +0100, Petr Vorel wrote:
> 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 <petr.vorel@gmail.com>
> ---
> 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(-)
>
> diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
> index 986243c932cc..79c665a89a47 100644
> --- a/drivers/net/usb/r8152.c
> +++ b/drivers/net/usb/r8152.c
> @@ -3703,8 +3703,6 @@ static int rtl8152_resume(struct usb_interface *intf)
> napi_enable(&tp->napi);
> clear_bit(SELECTIVE_SUSPEND, &tp->flags);
> smp_mb__after_atomic();
> - if (!list_empty(&tp->rx_done))
> - napi_schedule(&tp->napi);
> } else {
> tp->rtl_ops.up(tp);
> netif_carrier_off(tp->netdev);
The proper work around is to enclose the napi_schedule() in a
local_bh_enable()/local_bh_disable() pair.
next prev parent reply other threads:[~2017-03-13 13:18 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-13 12:47 [PATCH 1/1] r8152: fix NULL pointer dereference in r8152_poll Petr Vorel
2017-03-13 13:18 ` Eric Dumazet [this message]
2017-03-13 13:19 ` Eric Dumazet
2017-03-13 15:37 ` Petr Vorel
2017-03-13 15:44 ` Eric Dumazet
2017-03-13 15:46 ` Eric Dumazet
2017-03-13 21:57 ` Petr Vorel
2017-03-14 6:15 ` [PATCH net] r8152: fix the list rx_done may be used without initialization Hayes Wang
2017-03-14 8:53 ` Petr Vorel
2017-03-14 9:17 ` Hayes Wang
2017-03-21 21:37 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1489411084.28631.78.camel@edumazet-glaptop3.roam.corp.google.com \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=hayeswang@realtek.com \
--cc=netdev@vger.kernel.org \
--cc=petr.vorel@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.