[PATCH -stable 3.18, backport] ipmr: fix possible race resulting from improper usage of IP_INC_STATS_BH() in preemptible context.

2015-11-02 Thread Ani Sinha
[ Upstream commit 44f49dd8b5a606870a1f2 ] 

Fixes the following kernel BUG :

BUG: using __this_cpu_add() in preemptible [] code: bash/2758
caller is __this_cpu_preempt_check+0x13/0x15
CPU: 0 PID: 2758 Comm: bash Tainted: P   O   3.18.19 #2
 8170eaca 880110d1b788 81482b2a 
  880110d1b7b8 812010ae 880007cab800
 88001a060800 88013a899108 880108b84240 880110d1b7c8
Call Trace:
[] dump_stack+0x52/0x80
[] check_preemption_disabled+0xce/0xe1
[] __this_cpu_preempt_check+0x13/0x15
[] ipmr_queue_xmit+0x647/0x70c
[] ip_mr_forward+0x32f/0x34e
[] ip_mroute_setsockopt+0xe03/0x108c
[] ? get_parent_ip+0x11/0x42
[] ? pollwake+0x4d/0x51
[] ? default_wake_function+0x0/0xf
[] ? get_parent_ip+0x11/0x42
[] ? __wake_up_common+0x45/0x77
[] ? _raw_spin_unlock_irqrestore+0x1d/0x32
[] ? __wake_up_sync_key+0x4a/0x53
[] ? sock_def_readable+0x71/0x75
[] do_ip_setsockopt+0x9d/0xb55
[] ? unix_seqpacket_sendmsg+0x3f/0x41
[] ? sock_sendmsg+0x6d/0x86
[] ? sockfd_lookup_light+0x12/0x5d
[] ? SyS_sendto+0xf3/0x11b
[] ? new_sync_read+0x82/0xaa
[] compat_ip_setsockopt+0x3b/0x99
[] compat_raw_setsockopt+0x11/0x32
[] compat_sock_common_setsockopt+0x18/0x1f
[] compat_SyS_setsockopt+0x1a9/0x1cf
[] compat_SyS_socketcall+0x180/0x1e3
[] cstar_dispatch+0x7/0x1e

Signed-off-by: Ani Sinha 
---
 net/ipv4/ipmr.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index c803458..a1fc97a 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -1674,8 +1674,8 @@ static inline int ipmr_forward_finish(struct sk_buff *skb)
 {
struct ip_options *opt = &(IPCB(skb)->opt);
 
-   IP_INC_STATS_BH(dev_net(skb_dst(skb)->dev), 
IPSTATS_MIB_OUTFORWDATAGRAMS);
-   IP_ADD_STATS_BH(dev_net(skb_dst(skb)->dev), IPSTATS_MIB_OUTOCTETS, 
skb->len);
+   IP_INC_STATS(dev_net(skb_dst(skb)->dev), IPSTATS_MIB_OUTFORWDATAGRAMS);
+   IP_ADD_STATS(dev_net(skb_dst(skb)->dev), IPSTATS_MIB_OUTOCTETS, 
skb->len);
 
if (unlikely(opt->optlen))
ip_forward_options(skb);
@@ -1737,7 +1737,7 @@ static void ipmr_queue_xmit(struct net *net, struct 
mr_table *mrt,
 * to blackhole.
 */
 
-   IP_INC_STATS_BH(dev_net(dev), IPSTATS_MIB_FRAGFAILS);
+   IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGFAILS);
ip_rt_put(rt);
goto out_free;
}
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH -stable 3.18, backport] ipmr: fix possible race resulting from improper usage of IP_INC_STATS_BH() in preemptible context.

2015-11-02 Thread Eric Dumazet
On Mon, 2015-11-02 at 16:40 -0800, Ani Sinha wrote:
> [ Upstream commit 44f49dd8b5a606870a1f2 ] 

Please carefully read Documentation/networking/netdev-FAQ.txt

A: Normally Greg Kroah-Hartman collects stable commits himself, but
   for networking, Dave collects up patches he deems critical for the
   networking subsystem, and then hands them off to Greg.

   There is a patchworks queue that you can see here:
http://patchwork.ozlabs.org/bundle/davem/stable/?state=*

   It contains the patches which Dave has selected, but not yet handed
   off to Greg.  If Greg already has the patch, then it will be here:
http://git.kernel.org/cgit/linux/kernel/git/stable/stable-queue.git

   A quick way to find whether the patch is in this stable-queue is
   to simply clone the repo, and then git grep the mainline commit ID, e.g.

stable-queue$ git grep -l 284041ef21fdf2e
releases/3.0.84/ipv6-fix-possible-crashes-in-ip6_cork_release.patch
releases/3.4.51/ipv6-fix-possible-crashes-in-ip6_cork_release.patch
releases/3.9.8/ipv6-fix-possible-crashes-in-ip6_cork_release.patch
stable/stable-queue$



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH -stable 3.18, backport] ipmr: fix possible race resulting from improper usage of IP_INC_STATS_BH() in preemptible context.

2015-11-02 Thread Ani Sinha
On Mon, Nov 2, 2015 at 4:50 PM, Eric Dumazet  wrote:
> On Mon, 2015-11-02 at 16:40 -0800, Ani Sinha wrote:
>> [ Upstream commit 44f49dd8b5a606870a1f2 ]
>
> Please carefully read Documentation/networking/netdev-FAQ.txt
>
> A: Normally Greg Kroah-Hartman collects stable commits himself, but
>for networking, Dave collects up patches he deems critical for the
>networking subsystem, and then hands them off to Greg.
>
>There is a patchworks queue that you can see here:
> http://patchwork.ozlabs.org/bundle/davem/stable/?state=*
>
>It contains the patches which Dave has selected, but not yet handed
>off to Greg.  If Greg already has the patch, then it will be here:
> http://git.kernel.org/cgit/linux/kernel/git/stable/stable-queue.git
>
>A quick way to find whether the patch is in this stable-queue is
>to simply clone the repo, and then git grep the mainline commit ID, e.g.
>
> stable-queue$ git grep -l 284041ef21fdf2e
> releases/3.0.84/ipv6-fix-possible-crashes-in-ip6_cork_release.patch
> releases/3.4.51/ipv6-fix-possible-crashes-in-ip6_cork_release.patch
> releases/3.9.8/ipv6-fix-possible-crashes-in-ip6_cork_release.patch
> stable/stable-queue$

Ah cool! Thanks for the pointer. Seems its already queued up for other
stable kernel version trains  :-)
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH -stable 3.18, backport] ipmr: fix possible race resulting from improper usage of IP_INC_STATS_BH() in preemptible context.

2015-11-02 Thread Sasha Levin
On 11/02/2015 10:32 PM, Ani Sinha wrote:
> On Mon, Nov 2, 2015 at 4:50 PM, Eric Dumazet  wrote:
>> > On Mon, 2015-11-02 at 16:40 -0800, Ani Sinha wrote:
>>> >> [ Upstream commit 44f49dd8b5a606870a1f2 ]
>> >
>> > Please carefully read Documentation/networking/netdev-FAQ.txt
> I don't see any recent releases of 3.18 version series in Greg KH's
> tree. Is the 3.18 stable train being maintained by Sasha here?
> 
> http://git.kernel.org/cgit/linux/kernel/git/sashal/linux-stable.git/
> 
> If that is the case, should 3.18 specific backport patches be sent
> directly to him ?

The documentation is a bit lacking here. I follow the same procedure
as Greg: Dave sends us backports for patches he picks for -stable and
I apply them.

The only difference is that my (currently empty) queue is located elsewhere:
https://git.kernel.org/cgit/linux/kernel/git/sashal/linux-stable.git/log/?h=linux-3.18.y-queue

To sum it up, no need to send anything regarding -stable  net/ to anyone,
Dave does all the heavy lifting there (thanks Dave!).


Thanks,
Sasha
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH -stable 3.18, backport] ipmr: fix possible race resulting from improper usage of IP_INC_STATS_BH() in preemptible context.

2015-11-02 Thread Ani Sinha
On Mon, Nov 2, 2015 at 4:50 PM, Eric Dumazet  wrote:
> On Mon, 2015-11-02 at 16:40 -0800, Ani Sinha wrote:
>> [ Upstream commit 44f49dd8b5a606870a1f2 ]
>
> Please carefully read Documentation/networking/netdev-FAQ.txt

I don't see any recent releases of 3.18 version series in Greg KH's
tree. Is the 3.18 stable train being maintained by Sasha here?

http://git.kernel.org/cgit/linux/kernel/git/sashal/linux-stable.git/

If that is the case, should 3.18 specific backport patches be sent
directly to him ?

>
> A: Normally Greg Kroah-Hartman collects stable commits himself, but
>for networking, Dave collects up patches he deems critical for the
>networking subsystem, and then hands them off to Greg.
>
>There is a patchworks queue that you can see here:
> http://patchwork.ozlabs.org/bundle/davem/stable/?state=*
>
>It contains the patches which Dave has selected, but not yet handed
>off to Greg.  If Greg already has the patch, then it will be here:
> http://git.kernel.org/cgit/linux/kernel/git/stable/stable-queue.git
>
>A quick way to find whether the patch is in this stable-queue is
>to simply clone the repo, and then git grep the mainline commit ID, e.g.
>
> stable-queue$ git grep -l 284041ef21fdf2e
> releases/3.0.84/ipv6-fix-possible-crashes-in-ip6_cork_release.patch
> releases/3.4.51/ipv6-fix-possible-crashes-in-ip6_cork_release.patch
> releases/3.9.8/ipv6-fix-possible-crashes-in-ip6_cork_release.patch
> stable/stable-queue$
>
>
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html