mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Francois Romieu <romieu@cogenit.fr>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] cli()/sti() fix for drivers/net/depca.c
Date: Wed, 2 Oct 2002 22:40:59 +0200	[thread overview]
Message-ID: <20021002224059.A18518@fafner.intra.cogenit.fr> (raw)
In-Reply-To: <200210022005.g92K5Fp31816@Port.imtp.ilyichevsk.odessa.ua>; from vda@port.imtp.ilyichevsk.odessa.ua on Wed, Oct 02, 2002 at 10:58:50PM -0200

Denis Vlasenko <vda@port.imtp.ilyichevsk.odessa.ua> :
> diff -u --recursive linux-2.5.38orig/drivers/net/depca.c linux-2.5.38/drivers/net/depca.c
> --- linux-2.5.38orig/drivers/net/depca.c	Sun Sep 22 04:25:10 2002
> +++ linux-2.5.38/drivers/net/depca.c	Wed Oct  2 01:16:57 2002
[...]
> @@ -1999,18 +2000,19 @@
>      break;
> 
>    case DEPCA_GET_STATS:              /* Get the driver statistics */
> -    cli();
> +
> +    spin_lock_irqsave(&lp->lock, flags);
>      ioc->len = sizeof(lp->pktStats);
>      if (copy_to_user(ioc->data, &lp->pktStats, ioc->len))
>        status = -EFAULT;
> -    sti();
> +    spin_unlock_irqrestore(&lp->lock, flags);

- copy_to_user() may sleep. Sleeping with spinlock held hurts badly.
- on SMP, pktStat can be updated while the copy progresses, see depca_rx().

-- 
Ueimor

  reply	other threads:[~2002-10-02 20:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-03  0:58 Denis Vlasenko
2002-10-02 20:40 ` Francois Romieu [this message]
2002-10-03  2:26   ` Denis Vlasenko
2002-10-02 22:12     ` Francois Romieu
2002-10-03 12:37       ` Denis Vlasenko
2002-10-03 16:40         ` Francois Romieu
2002-10-03 12:55       ` Denis Vlasenko

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=20021002224059.A18518@fafner.intra.cogenit.fr \
    --to=romieu@cogenit.fr \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®