* Re: inconsistent lock/deadlock crash, vanilla 3.3.4, 32bit, tcp
From: David Miller @ 2012-04-30 17:38 UTC (permalink / raw)
To: eric.dumazet
Cc: denys, netdev, jmorris, yoshfuji, kaber, linux-kernel, glommer
In-Reply-To: <1335691316.2900.100.camel@edumazet-glaptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Sun, 29 Apr 2012 11:21:56 +0200
> From: Eric Dumazet <edumazet@google.com>
>
> [PATCH] net: fix sk_sockets_allocated_read_positive
>
> Denys Fedoryshchenko reported frequent crashes on a proxy server and kindly
> provided a lockdep report that explains it all :
...
> Bug is that sk_sockets_allocated_read_positive() calls
> percpu_counter_sum_positive() without BH being disabled.
>
> This bug was added in commit 180d8cd942ce33
> (foundations of per-cgroup memory pressure controlling.), since previous
> code was using percpu_counter_read_positive() which is IRQ safe.
>
> In __sk_mem_schedule() we dont need the precise count of allocated
> sockets and can revert to previous behavior.
>
> Reported-by: Denys Fedoryshchenko <denys@visp.net.lb>
> Sined-off-by: Eric Dumazet <edumazet@google.com>
Applied, thanks.
^ permalink raw reply
* Re: [PATCH 00/10] atl1c: update hardware settings - v4
From: David Miller @ 2012-04-30 17:35 UTC (permalink / raw)
To: xiong; +Cc: netdev, linux-kernel, qca-linux-team, nic-devel
In-Reply-To: <1335578325-21326-1-git-send-email-xiong@qca.qualcomm.com>
Please address the feedback you've received and then repost this
entire series.
BTW, this is why you should submit as few patches at a time as
possible. Because the more patches you submit at once, the more of
them you have to submit all over again when changes are requested for
even just one of them.
^ permalink raw reply
* Re: [PATCH net-next] net/l2tp: fix build error in l2tp from missing ipv6 checksum include
From: David Miller @ 2012-04-30 17:31 UTC (permalink / raw)
To: bcrl; +Cc: sfr, netdev, linux-next, linux-kernel
In-Reply-To: <20120430172402.GL17021@kvack.org>
From: Benjamin LaHaise <bcrl@kvack.org>
Date: Mon, 30 Apr 2012 13:24:02 -0400
> Can you please verify if the patch below fixes the issue? Thanks.
I already checked a fix into the tree.
^ permalink raw reply
* Re: bridge: Fix fatal typo in setup of multicast_querier_expired
From: David Miller @ 2012-04-30 17:27 UTC (permalink / raw)
To: herbert; +Cc: netdev
In-Reply-To: <20120430102256.GA32587@gondor.apana.org.au>
From: Herbert Xu <herbert@gondor.hengli.com.au>
Date: Mon, 30 Apr 2012 20:22:56 +1000
> Unfortunately it seems that I didn't properly test the case of
> an expired external querier in the recent multicast bridge series.
>
> The setup of the timer in that case is completely broken and leads
> to a NULL-pointer dereference. This patch fixes it.
>
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
...
> - br_multicast_querier_expired, 0);
> + br_multicast_querier_expired, (unsigned long)br);
> setup_timer(&br->multicast_query_timer, br_multicast_query_expired,
> (unsigned long)br);
> }
>
> Sorry for the screw-up.
Please do not put comments after the patch, this made the second hunk
reject when I pulled it out of patchwork.
Anyways, fixed up and applied.
^ permalink raw reply
* [PATCH net-next] net/l2tp: fix build error in l2tp from missing ipv6 checksum include
From: Benjamin LaHaise @ 2012-04-30 17:24 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: David Miller, netdev, linux-next, linux-kernel
In-Reply-To: <20120430155836.44bcf3846c80cf686bb9cb77@canb.auug.org.au>
Hi Stephen,
Can you please verify if the patch below fixes the issue? Thanks.
-ben
----
net/l2tp: fix build error in l2tp from missing ipv6 checksum include
L2TP needs to ensure the IPv6 checksum helpers are included.
Signed-off-by: Benjamin LaHaise <bcrl@kvack.org>
---
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
index e91d559..0ca9bc3 100644
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -56,6 +56,7 @@
#include <net/inet6_connection_sock.h>
#include <net/inet_ecn.h>
#include <net/ip6_route.h>
+#include <net/ip6_checksum.h>
#include <asm/byteorder.h>
#include <linux/atomic.h>
^ permalink raw reply related
* Re: [PATCH 0/8] netfilter updates for 3.4-rc5
From: David Miller @ 2012-04-30 17:23 UTC (permalink / raw)
To: pablo; +Cc: netfilter-devel, netdev
In-Reply-To: <1335799015-2003-1-git-send-email-pablo@netfilter.org>
From: pablo@netfilter.org
Date: Mon, 30 Apr 2012 17:16:47 +0200
> This patchset contains the following fixes:
>
> * One fix in the initialization path of the IPVS modules spotted by
> the the trinity syscall fuzz testing tool from Sasha Levin.
>
> * Three patches to address more weak/buggy error handling in the
> initialization path of the IPVS modules from Hans Schillinstrom.
>
> * Fix a regression in the initialization path of ipvs_ctl (introduced in
> 2.6.39) due from Julian Anastasov.
>
> * A couple more initialization path robust error checkings from Julian
> Anastasov.
>
> * One silly fix for xt_CT target for the case in which the new
> cttimeout infrastructure is not used, eg. --helper or --notrack,
> by myself.
>
> You can pull these fixes from:
>
> git://1984.lsi.us.es/net master
Pulled, thanks Pablo.
^ permalink raw reply
* Re: linux-next: build failure after merge of the final tree (net-next tree related)
From: David Miller @ 2012-04-30 17:22 UTC (permalink / raw)
To: sfr; +Cc: netdev, linux-next, linux-kernel, bcrl
In-Reply-To: <20120430155836.44bcf3846c80cf686bb9cb77@canb.auug.org.au>
From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Mon, 30 Apr 2012 15:58:36 +1000
> Hi all,
>
> After merging the final tree, today's linux-next build (powerpc
> allyesconfig) failed like this:
>
> net/l2tp/l2tp_core.c: In function 'l2tp_verify_udp_checksum':
> net/l2tp/l2tp_core.c:464:7: error: implicit declaration of function 'csum_ipv6_magic' [-Werror=implicit-function-declaration]
>
> Caused by commit d2cf3361677e ("net/l2tp: add support for L2TP over IPv6
> UDP"). Include file missing.
>
> I have reverted that commit for today.
The fix is less work than the revert on this one isn't it? :-)
Pushed to net-next, thanks Stephen:
--------------------
l2tp: Add missing net/net/ip6_checksum.h include.
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
net/l2tp/l2tp_core.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
index e91d559..0ca9bc3 100644
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -56,6 +56,7 @@
#include <net/inet6_connection_sock.h>
#include <net/inet_ecn.h>
#include <net/ip6_route.h>
+#include <net/ip6_checksum.h>
#include <asm/byteorder.h>
#include <linux/atomic.h>
--
1.7.7.6
^ permalink raw reply related
* [PATCH] cxgb3: Don't call cxgb_vlan_mode until q locks are initialized
From: Roland Dreier @ 2012-04-30 17:15 UTC (permalink / raw)
To: Divy Le Ray, David S. Miller; +Cc: netdev, Roland Dreier
From: Roland Dreier <roland@purestorage.com>
The driver calls cxgb_vlan_mode() from init_one(). This calls into
synchronize_rx(), which locks all the q locks, but the q locks are not
initialized until cxgb_up() -> setup_sge_qsets(). So move the call to
cxgb_vlan_mode() into cxgb_up(), after the call to setup_sge_qsets().
We also move the body of these functions up higher to avoid having to
a forward declaration.
This was found because of the lockdep warning:
INFO: trying to register non-static key.
the code is fine but needs lockdep annotation.
turning off the locking correctness validator.
Pid: 323, comm: work_for_cpu Not tainted 3.4.0-rc5 #28
Call Trace:
[<ffffffff8106e767>] register_lock_class+0x108/0x2d0
[<ffffffff8106ff42>] __lock_acquire+0xd3/0xd06
[<ffffffff81070fd0>] lock_acquire+0xbf/0xfe
[<ffffffff813862a6>] _raw_spin_lock_irq+0x36/0x45
[<ffffffffa01e71aa>] cxgb_vlan_mode+0x96/0xcb [cxgb3]
[<ffffffffa01f90eb>] init_one+0x8c4/0x980 [cxgb3]
[<ffffffff811fcbf0>] local_pci_probe+0x3f/0x70
[<ffffffff81042206>] do_work_for_cpu+0x10/0x22
[<ffffffff810482de>] kthread+0xa1/0xa9
[<ffffffff8138e234>] kernel_thread_helper+0x4/0x10
Contrary to what lockdep says, the code is not fine: we are locking an
uninitialized spinlock.
Signed-off-by: Roland Dreier <roland@purestorage.com>
---
drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c | 92 +++++++++++------------
1 file changed, 46 insertions(+), 46 deletions(-)
diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
index 63bfdd1..abb6ce7 100644
--- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
@@ -1150,6 +1150,48 @@ release_tpsram:
}
/**
+ * t3_synchronize_rx - wait for current Rx processing on a port to complete
+ * @adap: the adapter
+ * @p: the port
+ *
+ * Ensures that current Rx processing on any of the queues associated with
+ * the given port completes before returning. We do this by acquiring and
+ * releasing the locks of the response queues associated with the port.
+ */
+static void t3_synchronize_rx(struct adapter *adap, const struct port_info *p)
+{
+ int i;
+
+ for (i = p->first_qset; i < p->first_qset + p->nqsets; i++) {
+ struct sge_rspq *q = &adap->sge.qs[i].rspq;
+
+ spin_lock_irq(&q->lock);
+ spin_unlock_irq(&q->lock);
+ }
+}
+
+static void cxgb_vlan_mode(struct net_device *dev, netdev_features_t features)
+{
+ struct port_info *pi = netdev_priv(dev);
+ struct adapter *adapter = pi->adapter;
+
+ if (adapter->params.rev > 0) {
+ t3_set_vlan_accel(adapter, 1 << pi->port_id,
+ features & NETIF_F_HW_VLAN_RX);
+ } else {
+ /* single control for all ports */
+ unsigned int i, have_vlans = features & NETIF_F_HW_VLAN_RX;
+
+ for_each_port(adapter, i)
+ have_vlans |=
+ adapter->port[i]->features & NETIF_F_HW_VLAN_RX;
+
+ t3_set_vlan_accel(adapter, 1, have_vlans);
+ }
+ t3_synchronize_rx(adapter, pi);
+}
+
+/**
* cxgb_up - enable the adapter
* @adapter: adapter being enabled
*
@@ -1161,7 +1203,7 @@ release_tpsram:
*/
static int cxgb_up(struct adapter *adap)
{
- int err;
+ int i, err;
if (!(adap->flags & FULL_INIT_DONE)) {
err = t3_check_fw_version(adap);
@@ -1198,6 +1240,9 @@ static int cxgb_up(struct adapter *adap)
if (err)
goto out;
+ for_each_port(adap, i)
+ cxgb_vlan_mode(adap->port[i], adap->port[i]->features);
+
setup_rss(adap);
if (!(adap->flags & NAPI_INIT))
init_napi(adap);
@@ -2508,48 +2553,6 @@ static int cxgb_set_mac_addr(struct net_device *dev, void *p)
return 0;
}
-/**
- * t3_synchronize_rx - wait for current Rx processing on a port to complete
- * @adap: the adapter
- * @p: the port
- *
- * Ensures that current Rx processing on any of the queues associated with
- * the given port completes before returning. We do this by acquiring and
- * releasing the locks of the response queues associated with the port.
- */
-static void t3_synchronize_rx(struct adapter *adap, const struct port_info *p)
-{
- int i;
-
- for (i = p->first_qset; i < p->first_qset + p->nqsets; i++) {
- struct sge_rspq *q = &adap->sge.qs[i].rspq;
-
- spin_lock_irq(&q->lock);
- spin_unlock_irq(&q->lock);
- }
-}
-
-static void cxgb_vlan_mode(struct net_device *dev, netdev_features_t features)
-{
- struct port_info *pi = netdev_priv(dev);
- struct adapter *adapter = pi->adapter;
-
- if (adapter->params.rev > 0) {
- t3_set_vlan_accel(adapter, 1 << pi->port_id,
- features & NETIF_F_HW_VLAN_RX);
- } else {
- /* single control for all ports */
- unsigned int i, have_vlans = features & NETIF_F_HW_VLAN_RX;
-
- for_each_port(adapter, i)
- have_vlans |=
- adapter->port[i]->features & NETIF_F_HW_VLAN_RX;
-
- t3_set_vlan_accel(adapter, 1, have_vlans);
- }
- t3_synchronize_rx(adapter, pi);
-}
-
static netdev_features_t cxgb_fix_features(struct net_device *dev,
netdev_features_t features)
{
@@ -3353,9 +3356,6 @@ static int __devinit init_one(struct pci_dev *pdev,
err = sysfs_create_group(&adapter->port[0]->dev.kobj,
&cxgb3_attr_group);
- for_each_port(adapter, i)
- cxgb_vlan_mode(adapter->port[i], adapter->port[i]->features);
-
print_port_info(adapter, ai);
return 0;
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH 06/15] batman-adv: Distributed ARP Table - add snooping functions for ARP messages
From: David Miller @ 2012-04-30 17:05 UTC (permalink / raw)
To: ordex-GaUfNO9RBHfsrOwW+9ziJQ
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r
In-Reply-To: <1335689867-8017-7-git-send-email-ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
From: Antonio Quartulli <ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
Date: Sun, 29 Apr 2012 10:57:38 +0200
> In case of an ARP message going in or out the soft_iface, it is intercepted and
> a special action is performed. In particular the DHT helper functions previously
> implemented are used to store all the ARP entries belonging to the network in
> order to provide a fast and unicast lookup instead of the classic broadcast
> flooding mechanism.
> Each node stores the entries it is responsible for (following the DHT rules) in
> its soft_iface ARP table. This makes it possible to reuse the kernel data
> structures and functions for ARP management.
>
> Signed-off-by: Antonio Quartulli <ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
Sorry, I'm not letting subsystems outside of net/ipv4/arp.c and related
code make changes to the ARP table.
I plan to make major surgery to the way neighbour table entries are
handled and therefore the less people who get their grubby paws
directly in there, the better.
Find a way to propagate the ARP packet into the properl ARP receive
path to cause the state update to occur, I'm not letting you trigger
it by hand in the batman-adv code.
Sorry.
^ permalink raw reply
* Re: getting host CPU utilization (was Re: [PATCH V7 2/4 net-next] skbuff: Add userspace zero-copy buffers in skb)
From: Rick Jones @ 2012-04-30 16:54 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: Shirley Ma, David Miller, eric.dumazet, avi, arnd, netdev, kvm,
linux-kernel
In-Reply-To: <20120430091246.GB5414@redhat.com>
On 04/30/2012 02:12 AM, Michael S. Tsirkin wrote:
> On Tue, Jun 28, 2011 at 10:19:48AM -0700, Rick Jones wrote:
>> one of these days I'll have to find a good way to get accurate
>> overall CPU utilization from within a guest and teach netperf about
>> it.
>
> I think the cleanest way would be to run another netperf server on the
> host. netperf would get a flag with host address and get cpu
> utilization info.
>
> This is what we currently do manually: run mpstat on the host.
>
> Thoughts?
I might be able to enhance the LOC_CPU/REM_CPU calibration tests to be
bona fide CPU utilization tests.
> By the way, could you point me to code used by netperf
> to measure CPU utilization on Linux? I'd like to figure
> out why isn't the result always consistent with e.g. mpstat.
That would be src/netcpu_procstat.c . That code is automagically
selected by the configure script when it determines the compilation is
happening under Linux. You can, if you wish, manually set it though I
suspect the only other mechanism known to netperf that would function
under Linux is the "looper" (aka CPU soaker) method.
rick
^ permalink raw reply
* Re: inconsistent lock/deadlock crash, vanilla 3.3.4, 32bit, tcp
From: David Miller @ 2012-04-30 16:49 UTC (permalink / raw)
To: glommer; +Cc: eric.dumazet, denys, netdev, jmorris, yoshfuji, kaber,
linux-kernel
In-Reply-To: <4F9E18E9.5010503@parallels.com>
From: Glauber Costa <glommer@parallels.com>
Date: Mon, 30 Apr 2012 01:45:29 -0300
> It wasn't my intent to change that, it was a mistake.
I very much regret succumbing to the unreasonable pressure to apply
your original patches.
We've come to learn that they were full of errors and that they needed
to cook for several more months before being included.
^ permalink raw reply
* [PATCH 2/2] [PATCH] sky2: fix receive length error in mixed non-VLAN/VLAN traffic
From: Stephen Hemminger @ 2012-04-30 16:47 UTC (permalink / raw)
To: Stephen Hemminger, Niccolò Belli, Mirko Lindner; +Cc: davem, netdev
In-Reply-To: <20120430154944.890709139@vyatta.com>
Bug: The VLAN bit of the MAC RX Status Word is unreliable in several older
supported chips. Sometimes the VLAN bit is not set for valid VLAN packets
and also sometimes the VLAN bit is set for non-VLAN packets that came after
a VLAN packet. This results in a receive length error when VLAN hardware
tagging is enabled.
Fix: Variation on original fix proposed by Mirko.
The VLAN information is decoded in the status loop, and can be
applied to the received SKB there. This eliminates the need for the
separate tag field in the interface data structure. The tag has to
be copied and cleared if packet is copied. This version checked out
with vlan and normal traffic.
Note: vlan_tx_tag_present should be renamed vlan_tag_present, but that
is outside scope of this.
Reported-by: Mirko Lindner <mlindner@marvell.com>
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/ethernet/marvell/sky2.c 2012-04-30 08:21:05.395136397 -0700
+++ b/drivers/net/ethernet/marvell/sky2.c 2012-04-30 08:22:27.328472831 -0700
@@ -2495,9 +2495,11 @@ static struct sk_buff *receive_copy(stru
skb->ip_summed = re->skb->ip_summed;
skb->csum = re->skb->csum;
skb->rxhash = re->skb->rxhash;
+ skb->vlan_tci = re->skb->vlan_tci;
pci_dma_sync_single_for_device(sky2->hw->pdev, re->data_addr,
length, PCI_DMA_FROMDEVICE);
+ re->skb->vlan_tci = 0;
re->skb->rxhash = 0;
re->skb->ip_summed = CHECKSUM_NONE;
skb_put(skb, length);
@@ -2583,9 +2585,6 @@ static struct sk_buff *sky2_receive(stru
struct sk_buff *skb = NULL;
u16 count = (status & GMR_FS_LEN) >> 16;
- if (status & GMR_FS_VLAN)
- count -= VLAN_HLEN; /* Account for vlan tag */
-
netif_printk(sky2, rx_status, KERN_DEBUG, dev,
"rx slot %u status 0x%x len %d\n",
sky2->rx_next, status, length);
@@ -2593,6 +2592,9 @@ static struct sk_buff *sky2_receive(stru
sky2->rx_next = (sky2->rx_next + 1) % sky2->rx_pending;
prefetch(sky2->rx_ring + sky2->rx_next);
+ if (vlan_tx_tag_present(re->skb))
+ count -= VLAN_HLEN; /* Account for vlan tag */
+
/* This chip has hardware problems that generates bogus status.
* So do only marginal checking and expect higher level protocols
* to handle crap frames.
@@ -2650,11 +2652,8 @@ static inline void sky2_tx_done(struct n
}
static inline void sky2_skb_rx(const struct sky2_port *sky2,
- u32 status, struct sk_buff *skb)
+ struct sk_buff *skb)
{
- if (status & GMR_FS_VLAN)
- __vlan_hwaccel_put_tag(skb, be16_to_cpu(sky2->rx_tag));
-
if (skb->ip_summed == CHECKSUM_NONE)
netif_receive_skb(skb);
else
@@ -2708,6 +2707,14 @@ static void sky2_rx_checksum(struct sky2
}
}
+static void sky2_rx_tag(struct sky2_port *sky2, u16 length)
+{
+ struct sk_buff *skb;
+
+ skb = sky2->rx_ring[sky2->rx_next].skb;
+ __vlan_hwaccel_put_tag(skb, be16_to_cpu(length));
+}
+
static void sky2_rx_hash(struct sky2_port *sky2, u32 status)
{
struct sk_buff *skb;
@@ -2766,8 +2773,7 @@ static int sky2_status_intr(struct sky2_
}
skb->protocol = eth_type_trans(skb, dev);
-
- sky2_skb_rx(sky2, status, skb);
+ sky2_skb_rx(sky2, skb);
/* Stop after net poll weight */
if (++work_done >= to_do)
@@ -2775,11 +2781,11 @@ static int sky2_status_intr(struct sky2_
break;
case OP_RXVLAN:
- sky2->rx_tag = length;
+ sky2_rx_tag(sky2, length);
break;
case OP_RXCHKSVLAN:
- sky2->rx_tag = length;
+ sky2_rx_tag(sky2, length);
/* fall through */
case OP_RXCHKS:
if (likely(dev->features & NETIF_F_RXCSUM))
--- a/drivers/net/ethernet/marvell/sky2.h 2012-04-30 08:19:56.000000000 -0700
+++ b/drivers/net/ethernet/marvell/sky2.h 2012-04-30 08:21:40.595714908 -0700
@@ -2241,7 +2241,6 @@ struct sky2_port {
u16 rx_pending;
u16 rx_data_size;
u16 rx_nfrags;
- u16 rx_tag;
struct {
unsigned long last;
^ permalink raw reply
* Re: [PATCH] netem: fix possible skb leak
From: Stephen Hemminger @ 2012-04-30 16:44 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David Miller, netdev, Stephen Hemminger
In-Reply-To: <1335804016.2296.5.camel@edumazet-glaptop>
On Mon, 30 Apr 2012 18:40:16 +0200
Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Mon, 2012-04-30 at 09:25 -0700, Stephen Hemminger wrote:
> > On Sun, 29 Apr 2012 21:08:22 +0200
> > Eric Dumazet <eric.dumazet@gmail.com> wrote:
> >
> > > From: Eric Dumazet <edumazet@google.com>
> > >
> > > skb_checksum_help(skb) can return an error, we must free skb in this
> > > case. qdisc_drop(skb, sch) can also be feeded with a NULL skb (if
> > > skb_unshare() failed), so lets use this generic helper.
> > >
> > > Signed-off-by: Eric Dumazet <edumazet@google.com>
> > > Cc: Stephen Hemminger <shemminger@osdl.org>
> > > ---
> > > net/sched/sch_netem.c | 6 ++----
> > > 1 file changed, 2 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
> > > index 5da548f..ebd2296 100644
> > > --- a/net/sched/sch_netem.c
> > > +++ b/net/sched/sch_netem.c
> > > @@ -408,10 +408,8 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
> > > if (q->corrupt && q->corrupt >= get_crandom(&q->corrupt_cor)) {
> > > if (!(skb = skb_unshare(skb, GFP_ATOMIC)) ||
> > > (skb->ip_summed == CHECKSUM_PARTIAL &&
> > > - skb_checksum_help(skb))) {
> > > - sch->qstats.drops++;
> > > - return NET_XMIT_DROP;
> > > - }
> > > + skb_checksum_help(skb)))
> > > + return qdisc_drop(skb, sch);
> > >
> > > skb->data[net_random() % skb_headlen(skb)] ^= 1<<(net_random() % 8);
> > > }
> > >
> > >
> >
> > This would crater if skb_unshare() returned NULL. I think the conditional
> > needs to be split into two paths.
>
> Maybe you can read the changelog where I explained this was safe ;)
Ok, I am surprised that qdisc_drop() is safe with NULL skb, but yes.
^ permalink raw reply
* Re: [PATCH] netem: fix possible skb leak
From: Eric Dumazet @ 2012-04-30 16:40 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: David Miller, netdev, Stephen Hemminger
In-Reply-To: <20120430092509.54b89ae6@nehalam.linuxnetplumber.net>
On Mon, 2012-04-30 at 09:25 -0700, Stephen Hemminger wrote:
> On Sun, 29 Apr 2012 21:08:22 +0200
> Eric Dumazet <eric.dumazet@gmail.com> wrote:
>
> > From: Eric Dumazet <edumazet@google.com>
> >
> > skb_checksum_help(skb) can return an error, we must free skb in this
> > case. qdisc_drop(skb, sch) can also be feeded with a NULL skb (if
> > skb_unshare() failed), so lets use this generic helper.
> >
> > Signed-off-by: Eric Dumazet <edumazet@google.com>
> > Cc: Stephen Hemminger <shemminger@osdl.org>
> > ---
> > net/sched/sch_netem.c | 6 ++----
> > 1 file changed, 2 insertions(+), 4 deletions(-)
> >
> > diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
> > index 5da548f..ebd2296 100644
> > --- a/net/sched/sch_netem.c
> > +++ b/net/sched/sch_netem.c
> > @@ -408,10 +408,8 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
> > if (q->corrupt && q->corrupt >= get_crandom(&q->corrupt_cor)) {
> > if (!(skb = skb_unshare(skb, GFP_ATOMIC)) ||
> > (skb->ip_summed == CHECKSUM_PARTIAL &&
> > - skb_checksum_help(skb))) {
> > - sch->qstats.drops++;
> > - return NET_XMIT_DROP;
> > - }
> > + skb_checksum_help(skb)))
> > + return qdisc_drop(skb, sch);
> >
> > skb->data[net_random() % skb_headlen(skb)] ^= 1<<(net_random() % 8);
> > }
> >
> >
>
> This would crater if skb_unshare() returned NULL. I think the conditional
> needs to be split into two paths.
Maybe you can read the changelog where I explained this was safe ;)
^ permalink raw reply
* Re: [PATCH v2] tcp: fix infinite cwnd in tcp_complete_cwr()
From: Neal Cardwell @ 2012-04-30 16:25 UTC (permalink / raw)
To: Yuchung Cheng; +Cc: davem, ilpo.jarvinen, nanditad, netdev
In-Reply-To: <1335801618-31498-1-git-send-email-ycheng@google.com>
On Mon, Apr 30, 2012 at 12:00 PM, Yuchung Cheng <ycheng@google.com> wrote:
> When the cwnd reduction is done, ssthresh may be infinite
> if TCP enters CWR via ECN or F-RTO. If cwnd is not undone, i.e.,
> undo_marker is set, tcp_complete_cwr() falsely set cwnd to the
> infinite ssthresh value. The correct operation is to keep cwnd
> intact because it has been updated in ECN or F-RTO.
>
> Signed-off-by: Yuchung Cheng <ycheng@google.com>
> ---
> ChangeLog since v1:
> - Add snd_cwnd_stamp timestamping in CWR mode
>
> net/ipv4/tcp_input.c | 9 ++++++---
> 1 files changed, 6 insertions(+), 3 deletions(-)
Acked-by: Neal Cardwell <ncardwell@google.com>
neal
^ permalink raw reply
* Re: [PATCH] netem: fix possible skb leak
From: Stephen Hemminger @ 2012-04-30 16:25 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David Miller, netdev, Stephen Hemminger
In-Reply-To: <1335726502.3897.8.camel@edumazet-glaptop>
On Sun, 29 Apr 2012 21:08:22 +0200
Eric Dumazet <eric.dumazet@gmail.com> wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> skb_checksum_help(skb) can return an error, we must free skb in this
> case. qdisc_drop(skb, sch) can also be feeded with a NULL skb (if
> skb_unshare() failed), so lets use this generic helper.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Stephen Hemminger <shemminger@osdl.org>
> ---
> net/sched/sch_netem.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
> index 5da548f..ebd2296 100644
> --- a/net/sched/sch_netem.c
> +++ b/net/sched/sch_netem.c
> @@ -408,10 +408,8 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
> if (q->corrupt && q->corrupt >= get_crandom(&q->corrupt_cor)) {
> if (!(skb = skb_unshare(skb, GFP_ATOMIC)) ||
> (skb->ip_summed == CHECKSUM_PARTIAL &&
> - skb_checksum_help(skb))) {
> - sch->qstats.drops++;
> - return NET_XMIT_DROP;
> - }
> + skb_checksum_help(skb)))
> + return qdisc_drop(skb, sch);
>
> skb->data[net_random() % skb_headlen(skb)] ^= 1<<(net_random() % 8);
> }
>
>
This would crater if skb_unshare() returned NULL. I think the conditional
needs to be split into two paths.
^ permalink raw reply
* Re: [RFT] sky2: fix status length check on older chips
From: Stephen Hemminger @ 2012-04-30 16:19 UTC (permalink / raw)
To: Niccolò Belli; +Cc: netdev
In-Reply-To: <4F9BC59D.80304@linuxsystems.it>
On Sat, 28 Apr 2012 12:25:33 +0200
Niccolò Belli <darkbasic@linuxsystems.it> wrote:
> Il 28/04/2012 04:46, Stephen Hemminger ha scritto:
> > Are you using VLAN's? the whole problem report only applies if using VLAN
> > on old hardware.
>
> No, I don't use VLANs. There are VLANs in my network but I simply
> connect to the default one from my laptop.
Still your laptop will receive vlan frames (even just broadcasts).
^ permalink raw reply
* Re: [PATCH] bridge: make brctl showstp display port id
From: Stephen Hemminger @ 2012-04-30 16:07 UTC (permalink / raw)
To: Joakim Tjernlund; +Cc: netdev@vger.kernel.org
In-Reply-To: <1335775148-5191-1-git-send-email-Joakim.Tjernlund@transmode.se>
On Mon, 30 Apr 2012 10:39:08 +0200
Joakim Tjernlund <Joakim.Tjernlund@transmode.se> wrote:
> My brctl showstp br0 always shows a 0 port id:
> eth2 (1)
> port id 0 state disabled
> designated root 8000.00069c00b2fb path cost 100
>
> because port id is printed as a hex number in sys fs. Change the
> two hex occurrences(port no and port id) to decimal, just like all
> the other numbers in this area.
>
> Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
> ---
> net/bridge/br_sysfs_if.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/bridge/br_sysfs_if.c b/net/bridge/br_sysfs_if.c
> index fd5799c..9c4c2eb 100644
> --- a/net/bridge/br_sysfs_if.c
> +++ b/net/bridge/br_sysfs_if.c
> @@ -86,13 +86,13 @@ static BRPORT_ATTR(designated_cost, S_IRUGO, show_designated_cost, NULL);
>
> static ssize_t show_port_id(struct net_bridge_port *p, char *buf)
> {
> - return sprintf(buf, "0x%x\n", p->port_id);
> + return sprintf(buf, "%d\n", p->port_id);
> }
> static BRPORT_ATTR(port_id, S_IRUGO, show_port_id, NULL);
>
> static ssize_t show_port_no(struct net_bridge_port *p, char *buf)
> {
> - return sprintf(buf, "0x%x\n", p->port_no);
> + return sprintf(buf, "%d\n", p->port_no);
> }
>
> static BRPORT_ATTR(port_no, S_IRUGO, show_port_no, NULL);
No. This would be a visible change to applications.
The bridge utilities should be fixed instead.
^ permalink raw reply
* Re: bridge: Fix fatal typo in setup of multicast_querier_expired
From: Stephen Hemminger @ 2012-04-30 16:04 UTC (permalink / raw)
To: Herbert Xu; +Cc: David S. Miller, netdev
In-Reply-To: <20120430102256.GA32587@gondor.apana.org.au>
On Mon, 30 Apr 2012 20:22:56 +1000
Herbert Xu <herbert@gondor.apana.org.au> wrote:
> Unfortunately it seems that I didn't properly test the case of
> an expired external querier in the recent multicast bridge series.
>
> The setup of the timer in that case is completely broken and leads
> to a NULL-pointer dereference. This patch fixes it.
>
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Acked-by: Stephen Hemminger <shemminger@vyatta.com>
^ permalink raw reply
* [PATCH v2] tcp: fix infinite cwnd in tcp_complete_cwr()
From: Yuchung Cheng @ 2012-04-30 16:00 UTC (permalink / raw)
To: davem, ilpo.jarvinen, ncardwell; +Cc: nanditad, netdev, Yuchung Cheng
When the cwnd reduction is done, ssthresh may be infinite
if TCP enters CWR via ECN or F-RTO. If cwnd is not undone, i.e.,
undo_marker is set, tcp_complete_cwr() falsely set cwnd to the
infinite ssthresh value. The correct operation is to keep cwnd
intact because it has been updated in ECN or F-RTO.
Signed-off-by: Yuchung Cheng <ycheng@google.com>
---
ChangeLog since v1:
- Add snd_cwnd_stamp timestamping in CWR mode
net/ipv4/tcp_input.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index c93b0cb..e0a9b89 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -2868,11 +2868,14 @@ static inline void tcp_complete_cwr(struct sock *sk)
/* Do not moderate cwnd if it's already undone in cwr or recovery. */
if (tp->undo_marker) {
- if (inet_csk(sk)->icsk_ca_state == TCP_CA_CWR)
+ if (inet_csk(sk)->icsk_ca_state == TCP_CA_CWR) {
tp->snd_cwnd = min(tp->snd_cwnd, tp->snd_ssthresh);
- else /* PRR */
+ tp->snd_cwnd_stamp = tcp_time_stamp;
+ } else if (tp->snd_ssthresh < TCP_INFINITE_SSTHRESH) {
+ /* PRR algorithm. */
tp->snd_cwnd = tp->snd_ssthresh;
- tp->snd_cwnd_stamp = tcp_time_stamp;
+ tp->snd_cwnd_stamp = tcp_time_stamp;
+ }
}
tcp_ca_event(sk, CA_EVENT_COMPLETE_CWR);
}
--
1.7.7.3
^ permalink raw reply related
* [PATCH 0/2] sky2 patches
From: Stephen Hemminger @ 2012-04-30 15:49 UTC (permalink / raw)
To: davem; +Cc: netdev
These are both patches against net-next but should be
applied to -net and stable as well.
^ permalink raw reply
* [PATCH 1/2] sky2: propogate rx hash when packet is copied
From: Stephen Hemminger @ 2012-04-30 15:49 UTC (permalink / raw)
To: davem; +Cc: netdev, Mirko Lindner
In-Reply-To: <20120430154944.890709139@vyatta.com>
[-- Attachment #1: sky2-rxhash.patch --]
[-- Type: text/plain, Size: 935 bytes --]
When a small packet is received, the driver copies it to a new skb to allow
reusing the full size Rx buffer. The copy was propogating the checksum offload
but not the receive hash information. The bug is impact was mostly harmless
and therefore not observed until reviewing this area of code.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/ethernet/marvell/sky2.c 2012-04-30 08:19:56.225976395 -0700
+++ b/drivers/net/ethernet/marvell/sky2.c 2012-04-30 08:21:05.395136397 -0700
@@ -2494,8 +2494,11 @@ static struct sk_buff *receive_copy(stru
skb_copy_from_linear_data(re->skb, skb->data, length);
skb->ip_summed = re->skb->ip_summed;
skb->csum = re->skb->csum;
+ skb->rxhash = re->skb->rxhash;
+
pci_dma_sync_single_for_device(sky2->hw->pdev, re->data_addr,
length, PCI_DMA_FROMDEVICE);
+ re->skb->rxhash = 0;
re->skb->ip_summed = CHECKSUM_NONE;
skb_put(skb, length);
}
^ permalink raw reply
* [PATCH 8/8] netfilter: xt_CT: fix wrong checking in the timeout assignment path
From: pablo @ 2012-04-30 15:16 UTC (permalink / raw)
To: netfilter-devel; +Cc: davem, netdev
In-Reply-To: <1335799015-2003-1-git-send-email-pablo@netfilter.org>
From: Pablo Neira Ayuso <pablo@netfilter.org>
The current checking always succeeded. We have to check the first
character of the string to check that it's empty, thus, skipping
the timeout path.
This fixes the use of the CT target without the timeout option.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/netfilter/xt_CT.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netfilter/xt_CT.c b/net/netfilter/xt_CT.c
index 59530e9..3746d8b 100644
--- a/net/netfilter/xt_CT.c
+++ b/net/netfilter/xt_CT.c
@@ -227,7 +227,7 @@ static int xt_ct_tg_check_v1(const struct xt_tgchk_param *par)
}
#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
- if (info->timeout) {
+ if (info->timeout[0]) {
typeof(nf_ct_timeout_find_get_hook) timeout_find_get;
struct nf_conn_timeout *timeout_ext;
--
1.7.9.5
^ permalink raw reply related
* [PATCH 7/8] ipvs: kernel oops - do_ip_vs_get_ctl
From: pablo @ 2012-04-30 15:16 UTC (permalink / raw)
To: netfilter-devel; +Cc: davem, netdev
In-Reply-To: <1335799015-2003-1-git-send-email-pablo@netfilter.org>
From: Hans Schillstrom <hans.schillstrom@ericsson.com>
Change order of init so netns init is ready
when register ioctl and netlink.
Ver2
Whitespace fixes and __init added.
Reported-by: "Ryan O'Hara" <rohara@redhat.com>
Signed-off-by: Hans Schillstrom <hans.schillstrom@ericsson.com>
Acked-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
include/net/ip_vs.h | 2 ++
net/netfilter/ipvs/ip_vs_core.c | 9 +++++++
net/netfilter/ipvs/ip_vs_ctl.c | 52 ++++++++++++++++++++++-----------------
3 files changed, 41 insertions(+), 22 deletions(-)
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 6d90dda..72522f0 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -1203,6 +1203,8 @@ ip_vs_lookup_real_service(struct net *net, int af, __u16 protocol,
extern int ip_vs_use_count_inc(void);
extern void ip_vs_use_count_dec(void);
+extern int ip_vs_register_nl_ioctl(void);
+extern void ip_vs_unregister_nl_ioctl(void);
extern int ip_vs_control_init(void);
extern void ip_vs_control_cleanup(void);
extern struct ip_vs_dest *
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
index 260b9ef..00bdb1d 100644
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -1995,10 +1995,18 @@ static int __init ip_vs_init(void)
goto cleanup_dev;
}
+ ret = ip_vs_register_nl_ioctl();
+ if (ret < 0) {
+ pr_err("can't register netlink/ioctl.\n");
+ goto cleanup_hooks;
+ }
+
pr_info("ipvs loaded.\n");
return ret;
+cleanup_hooks:
+ nf_unregister_hooks(ip_vs_ops, ARRAY_SIZE(ip_vs_ops));
cleanup_dev:
unregister_pernet_device(&ipvs_core_dev_ops);
cleanup_sub:
@@ -2014,6 +2022,7 @@ exit:
static void __exit ip_vs_cleanup(void)
{
+ ip_vs_unregister_nl_ioctl();
nf_unregister_hooks(ip_vs_ops, ARRAY_SIZE(ip_vs_ops));
unregister_pernet_device(&ipvs_core_dev_ops);
unregister_pernet_subsys(&ipvs_core_ops); /* free ip_vs struct */
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index 376d2b1..f558998 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -3750,21 +3750,10 @@ void __net_exit ip_vs_control_net_cleanup(struct net *net)
free_percpu(ipvs->tot_stats.cpustats);
}
-int __init ip_vs_control_init(void)
+int __init ip_vs_register_nl_ioctl(void)
{
- int idx;
int ret;
- EnterFunction(2);
-
- /* Initialize svc_table, ip_vs_svc_fwm_table, rs_table */
- for(idx = 0; idx < IP_VS_SVC_TAB_SIZE; idx++) {
- INIT_LIST_HEAD(&ip_vs_svc_table[idx]);
- INIT_LIST_HEAD(&ip_vs_svc_fwm_table[idx]);
- }
-
- smp_wmb(); /* Do we really need it now ? */
-
ret = nf_register_sockopt(&ip_vs_sockopts);
if (ret) {
pr_err("cannot register sockopt.\n");
@@ -3776,28 +3765,47 @@ int __init ip_vs_control_init(void)
pr_err("cannot register Generic Netlink interface.\n");
goto err_genl;
}
-
- ret = register_netdevice_notifier(&ip_vs_dst_notifier);
- if (ret < 0)
- goto err_notf;
-
- LeaveFunction(2);
return 0;
-err_notf:
- ip_vs_genl_unregister();
err_genl:
nf_unregister_sockopt(&ip_vs_sockopts);
err_sock:
return ret;
}
+void ip_vs_unregister_nl_ioctl(void)
+{
+ ip_vs_genl_unregister();
+ nf_unregister_sockopt(&ip_vs_sockopts);
+}
+
+int __init ip_vs_control_init(void)
+{
+ int idx;
+ int ret;
+
+ EnterFunction(2);
+
+ /* Initialize svc_table, ip_vs_svc_fwm_table, rs_table */
+ for (idx = 0; idx < IP_VS_SVC_TAB_SIZE; idx++) {
+ INIT_LIST_HEAD(&ip_vs_svc_table[idx]);
+ INIT_LIST_HEAD(&ip_vs_svc_fwm_table[idx]);
+ }
+
+ smp_wmb(); /* Do we really need it now ? */
+
+ ret = register_netdevice_notifier(&ip_vs_dst_notifier);
+ if (ret < 0)
+ return ret;
+
+ LeaveFunction(2);
+ return 0;
+}
+
void ip_vs_control_cleanup(void)
{
EnterFunction(2);
unregister_netdevice_notifier(&ip_vs_dst_notifier);
- ip_vs_genl_unregister();
- nf_unregister_sockopt(&ip_vs_sockopts);
LeaveFunction(2);
}
--
1.7.9.5
^ permalink raw reply related
* [PATCH 6/8] ipvs: take care of return value from protocol init_netns
From: pablo @ 2012-04-30 15:16 UTC (permalink / raw)
To: netfilter-devel; +Cc: davem, netdev
In-Reply-To: <1335799015-2003-1-git-send-email-pablo@netfilter.org>
From: Hans Schillstrom <hans.schillstrom@ericsson.com>
ip_vs_create_timeout_table() can return NULL
All functions protocol init_netns is affected of this patch.
Signed-off-by: Hans Schillstrom <hans.schillstrom@ericsson.com>
Acked-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
include/net/ip_vs.h | 2 +-
net/netfilter/ipvs/ip_vs_proto.c | 11 +++++++++--
net/netfilter/ipvs/ip_vs_proto_sctp.c | 5 ++++-
net/netfilter/ipvs/ip_vs_proto_tcp.c | 5 ++++-
net/netfilter/ipvs/ip_vs_proto_udp.c | 5 ++++-
5 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 2bdee51..6d90dda 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -393,7 +393,7 @@ struct ip_vs_protocol {
void (*exit)(struct ip_vs_protocol *pp);
- void (*init_netns)(struct net *net, struct ip_vs_proto_data *pd);
+ int (*init_netns)(struct net *net, struct ip_vs_proto_data *pd);
void (*exit_netns)(struct net *net, struct ip_vs_proto_data *pd);
diff --git a/net/netfilter/ipvs/ip_vs_proto.c b/net/netfilter/ipvs/ip_vs_proto.c
index a62360e..ed835e6 100644
--- a/net/netfilter/ipvs/ip_vs_proto.c
+++ b/net/netfilter/ipvs/ip_vs_proto.c
@@ -78,8 +78,15 @@ register_ip_vs_proto_netns(struct net *net, struct ip_vs_protocol *pp)
ipvs->proto_data_table[hash] = pd;
atomic_set(&pd->appcnt, 0); /* Init app counter */
- if (pp->init_netns != NULL)
- pp->init_netns(net, pd);
+ if (pp->init_netns != NULL) {
+ int ret = pp->init_netns(net, pd);
+ if (ret) {
+ /* unlink an free proto data */
+ ipvs->proto_data_table[hash] = pd->next;
+ kfree(pd);
+ return ret;
+ }
+ }
return 0;
}
diff --git a/net/netfilter/ipvs/ip_vs_proto_sctp.c b/net/netfilter/ipvs/ip_vs_proto_sctp.c
index 1fbf7a2..9f3fb75 100644
--- a/net/netfilter/ipvs/ip_vs_proto_sctp.c
+++ b/net/netfilter/ipvs/ip_vs_proto_sctp.c
@@ -1090,7 +1090,7 @@ out:
* timeouts is netns related now.
* ---------------------------------------------
*/
-static void __ip_vs_sctp_init(struct net *net, struct ip_vs_proto_data *pd)
+static int __ip_vs_sctp_init(struct net *net, struct ip_vs_proto_data *pd)
{
struct netns_ipvs *ipvs = net_ipvs(net);
@@ -1098,6 +1098,9 @@ static void __ip_vs_sctp_init(struct net *net, struct ip_vs_proto_data *pd)
spin_lock_init(&ipvs->sctp_app_lock);
pd->timeout_table = ip_vs_create_timeout_table((int *)sctp_timeouts,
sizeof(sctp_timeouts));
+ if (!pd->timeout_table)
+ return -ENOMEM;
+ return 0;
}
static void __ip_vs_sctp_exit(struct net *net, struct ip_vs_proto_data *pd)
diff --git a/net/netfilter/ipvs/ip_vs_proto_tcp.c b/net/netfilter/ipvs/ip_vs_proto_tcp.c
index ef8641f..cd609cc 100644
--- a/net/netfilter/ipvs/ip_vs_proto_tcp.c
+++ b/net/netfilter/ipvs/ip_vs_proto_tcp.c
@@ -677,7 +677,7 @@ void ip_vs_tcp_conn_listen(struct net *net, struct ip_vs_conn *cp)
* timeouts is netns related now.
* ---------------------------------------------
*/
-static void __ip_vs_tcp_init(struct net *net, struct ip_vs_proto_data *pd)
+static int __ip_vs_tcp_init(struct net *net, struct ip_vs_proto_data *pd)
{
struct netns_ipvs *ipvs = net_ipvs(net);
@@ -685,7 +685,10 @@ static void __ip_vs_tcp_init(struct net *net, struct ip_vs_proto_data *pd)
spin_lock_init(&ipvs->tcp_app_lock);
pd->timeout_table = ip_vs_create_timeout_table((int *)tcp_timeouts,
sizeof(tcp_timeouts));
+ if (!pd->timeout_table)
+ return -ENOMEM;
pd->tcp_state_table = tcp_states;
+ return 0;
}
static void __ip_vs_tcp_exit(struct net *net, struct ip_vs_proto_data *pd)
diff --git a/net/netfilter/ipvs/ip_vs_proto_udp.c b/net/netfilter/ipvs/ip_vs_proto_udp.c
index f4b7262..2fedb2d 100644
--- a/net/netfilter/ipvs/ip_vs_proto_udp.c
+++ b/net/netfilter/ipvs/ip_vs_proto_udp.c
@@ -467,7 +467,7 @@ udp_state_transition(struct ip_vs_conn *cp, int direction,
cp->timeout = pd->timeout_table[IP_VS_UDP_S_NORMAL];
}
-static void __udp_init(struct net *net, struct ip_vs_proto_data *pd)
+static int __udp_init(struct net *net, struct ip_vs_proto_data *pd)
{
struct netns_ipvs *ipvs = net_ipvs(net);
@@ -475,6 +475,9 @@ static void __udp_init(struct net *net, struct ip_vs_proto_data *pd)
spin_lock_init(&ipvs->udp_app_lock);
pd->timeout_table = ip_vs_create_timeout_table((int *)udp_timeouts,
sizeof(udp_timeouts));
+ if (!pd->timeout_table)
+ return -ENOMEM;
+ return 0;
}
static void __udp_exit(struct net *net, struct ip_vs_proto_data *pd)
--
1.7.9.5
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox