2.5.27 fix potential spinlocking race.

2.5.27 fix potential spinlocking race.

Post by Trond Myklebus » Thu, 25 Jul 2002 05:40:15



In case of socket transmission errors etc. kfree_skb(), and hence
xprt_write_space() can potentially get called outside of a bh-safe
context.

Cheers,
  Trond

diff -u --recursive --new-file linux-2.5.27/net/sunrpc/xprt.c linux-2.5.27-fix_wspace/net/sunrpc/xprt.c
--- linux-2.5.27/net/sunrpc/xprt.c      Sat Jul 20 21:11:08 2002

                return;

        if (!xprt_test_and_set_wspace(xprt)) {
-               spin_lock(&xprt->sock_lock);
+               spin_lock_bh(&xprt->sock_lock);
                if (xprt->snd_task && xprt->snd_task->tk_rpcwait == &xprt->pending)
                        rpc_wake_up_task(xprt->snd_task);
-               spin_unlock(&xprt->sock_lock);
+               spin_unlock_bh(&xprt->sock_lock);
        }

        if (test_bit(SOCK_NOSPACE, &sock->flags)) {
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

2.5.27 fix potential spinlocking race.

Post by David S. Mille » Thu, 25 Jul 2002 11:30:05


   In case of socket transmission errors etc. kfree_skb(), and hence
   xprt_write_space() can potentially get called outside of a bh-safe
   context.

kfree_skb must occur within a BH context or better context.

When HW interrupt handlers free packets they use kfree_skb_irq() which
schedules a software interrupt to really perform the kfree_skb work.

Therefore kfree_skb must always be invoked in BH or better context.

I think we need to reevaluate this situation before we apply this
patch :-)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

2.5.27 fix potential spinlocking race.

Post by Linus Torvald » Thu, 25 Jul 2002 11:30:09



>    In case of socket transmission errors etc. kfree_skb(), and hence
>    xprt_write_space() can potentially get called outside of a bh-safe
>    context.

> kfree_skb must occur within a BH context or better context.

I think you're talking past each other.

Trond noticed that kfree_skb() can be called from a _non_ bh context, ie
process context. So it needs to protect itself against other bh's on this
CPU (which it wouldn't need to do if it was only called from a bh
context).

So it's exactly your "better context" that is at stake here.

                Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

2.5.27 fix potential spinlocking race.

Post by Trond Myklebus » Thu, 25 Jul 2002 22:10:10


     > Trond noticed that kfree_skb() can be called from a _non_ bh
     > context, ie process context. So it needs to protect itself
     > against other bh's on this CPU (which it wouldn't need to do if
     > it was only called from a bh context).

     > So it's exactly your "better context" that is at stake here.

Precisely. Not coming from a computer science background, the jargon
sometimes gets the better of me ;-)

I was playing around with ip_build_xmit_slow() looking at alternatives
for fixing the MSG_DONTWAIT fragmentation bug mentioned on this list a
couple of weeks ago, when I noticed that it can call kfree_skb() from
a process context. This again means that write_space() can get called
without being wrapped in a local_bh_disable()/local_bh_enable() -
style protection against softirqs.

Cheers,
  Trond
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

1. PATCH: 2.5.27 fix abusers of set_bit

Neither epca nor specialix actually -care- what the event flag size is so
switching to unsigned long makes life happy and maybe makes it work 64bit
bigendian.

diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.27/drivers/char/epca.h linux-2.5.27-ac1/drivers/char/epca.h
--- linux-2.5.27/drivers/char/epca.h    Sat Jul 20 20:11:23 2002

        int    close_delay;
        int    count;
        int    blocked_open;
-       int    event;
+       ulong  event;
        int    asyncflags;
        uint   dev;
        long   session;
diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.27/drivers/char/specialix_io8.h linux-2.5.27-ac1/drivers/char/specialix_io8.h
--- linux-2.5.27/drivers/char/specialix_io8.h   Sat Jul 20 20:11:04 2002

        struct tty_struct       * tty;
        int                     count;
        int                     blocked_open;
-       int                     event;
+       ulong                   event;
        int                     timeout;
        int                     close_delay;
        long                    session;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

2. Modem setup for Solaris 2.6 x86?

3. PATCH: 2.5.27 - Fix up the atp870u scsi driver

4. Can't get X working

5. PATCH: 2.5.27 Fix dump non compile in ad1848 audio

6. Why only 3 virtual servers work?

7. context-switching & LDT fixes, 2.5.27

8. mysql

9. 2.5.27: s390 fixes.

10. 2.5.27 Logitech Busmouse new driver FIX

11. PATCH: 2.5.27 correct headers so miropcm-rds builds

12. irqlock patch 2.5.27-H4

13. 2.5.27 uhci-hcd not so bad with Speedtouch