Netdev List
 help / color / mirror / Atom feed
* Re: [announce] new rt2800 drivers for Ralink wireless & project tree
From: Pavel Machek @ 2009-11-06  7:46 UTC (permalink / raw)
  To: Ivo van Doorn
  Cc: Ingo Molnar, Bartlomiej Zolnierkiewicz,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA, Randy Dunlap, Luis Correia,
	John W. Linville, Johannes Berg, Jarek Poplawski, Pekka Enberg,
	David Miller
In-Reply-To: <200911042251.23506.IvDoorn-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>


> > Look at the diffstat of Bart's driver:
> > 
> >    15 files changed, 4036 insertions(+), 7158 deletions(-)
> > 
> > He reduced your 5.2 KLOC non-working driver into a 1.8 KLOC _working_ 
> > driver.
> 
> Bullshit, read the mails again.

This was uncalled for, right?

...
> Some people actually require sleep during the night, perhaps that you don't need
> that and can hence review 41 patches which changes thousands of lines on the
> same day the patches were submitted.

If you lack time, "Really start reading my mails" sentence you used at
the start of email is *not* user-friendly way to say that.

> > And _still_ your complaint about Bart's series is that he updated the 
> > MAINTAINERS entry and added an entry for rt2800? Heck _sure_ he should 
> > update it, he is the one doing the hard work of trying to bring it to 
> > users, trying to clean up a messy driver space, trying to turn crap into 
> > gold.
> 
> So if I want to focus on something different in the kernel, I just send 1 patch,
> and a second to claim the maintainership of it even though there is an active
> maintainer available?

What about listing yourself as a maintainer for a start?

> > The thing is, if you dont have the time or interest to listen to and act 
> > upon review feedback, be constructive about it and fix (obvious) 
> > structural problems in your rt2800 code, you should just step aside and 
> > let Bart maintain what he is apparently more capable of maintaining than 
> > you are.
> >
> > What you are doing here is a thinly veiled land-grab: you did a minimal 
> > token driver for rt2800 that doesnt work, kept it in your private tree 
> > for _1.5 years_, and the moment someone _else_ came along and did 
> > something better and more functional in drivers/staging/, you discovered 
> > your sudden interest for it and moved the crappy driver upstream at 
> > lightning's speed (it is already in net-next AFAICS, despite negative 
> > test and review feedback) - ignoring and throwing away all the work that 
> > Bart has done.
> 
> Get your facts straight, the bullshit level in your mail is staggering.
> 
> You have no fucking clue who wrote the rt2800 driver which is in
> drivers/staging/,

Perhaps you should not be a maintainer if you can't behave yourself?

> 	Because a lot of people prefer looking from the sideline,
> contributing _nothing_

Given your behaviour, I'm not suprised people are not too eager to
work with you.

> As for "throwing away that work" I ACKED 10 of his patches, and said I would review
> the rest later! But like I said, apparently it is a bad habit for people to sleep during
> the night.

Read your email again. It was quite far from 'acked 10, asked for
time'. You flamed him first.
									Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH net-next-2.6] net: sock_bindtodevice() RCU-ification
From: David Miller @ 2009-11-06  8:17 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev
In-Reply-To: <4AF3CB8B.2090206@gmail.com>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Fri, 06 Nov 2009 08:08:59 +0100

> Thanks David, which gcc version are you using ?

I'm using "gcc-4.2.4 (Ubuntu 4.2.4-1ubuntu3)" on sparc.




^ permalink raw reply

* Re: [atl1-devel] [Bugme-new] [Bug 14431] New: atl1 eth0 link continuously down up
From: Luca Tettamanti @ 2009-11-06  8:26 UTC (permalink / raw)
  To: johan vdp; +Cc: jcliburn, atl1-devel, netdev
In-Reply-To: <SNT116-W4337ADB53BF93D60518EFD90AF0@phx.gbl>

On Fri, Nov 6, 2009 at 1:02 AM, johan vdp <johan_vdp@hotmail.com> wrote:
> As a workaround I have added an Intel e1000 PCI card.
> And it is showing the same messages in the logs...
> To me this shows that the atl1 driver can be excluded as the cause. No need
> to reply again to the atl1 mailing list.
>
> I am tempted to buy a new 1Gbps switch. But I can not believe that my old
> dusty hub is broken in the same way that my switch is.

I've seen this behaviour with a broken cable...

L

^ permalink raw reply

* Re: [PATCH] be2net: Fix CQE_STATUS_EXTD_SHIFT define
From: David Miller @ 2009-11-06  8:31 UTC (permalink / raw)
  To: sathyap; +Cc: netdev
In-Reply-To: <20091106071746.GA27296@serverengines.com>

From: Sathya Perla <sathyap@serverengines.com>
Date: Fri, 6 Nov 2009 12:47:46 +0530

> 
> Signed-off-by: Sathya Perla <sathyap@serverengines.com>

Applied to net-2.6, thanks.

^ permalink raw reply

* Re: [PATCH net-next]atl1c:change atl1c_buffer struct and restructure clean atl1c_buffer procedure
From: David Miller @ 2009-11-06  8:32 UTC (permalink / raw)
  To: jie.yang; +Cc: netdev, linux-kernel
In-Reply-To: <12574319533672-git-send-email-jie.yang@atheros.com>

From: <jie.yang@atheros.com>
Date: Thu, 5 Nov 2009 22:39:13 +0800

> change atl1c_buffer struct, use "u16 flags" instead of "u16 state"
> to store more infomation for atl1c_buffer, and restructure clean
> atl1c_buffer procedure, add common api atl1c_clean_buffer.
> 
> Signed-off-by: Jie Yang <jie.yang@atheros.com>

Applied, thanks.

^ permalink raw reply

* Re: [PATCH 1/2] udp: cleanup __udp4_lib_mcast_deliver
From: David Miller @ 2009-11-06  8:42 UTC (permalink / raw)
  To: lgrijincu; +Cc: netdev, opurdila
In-Reply-To: <200911052033.21964.lgrijincu@ixiacom.com>

From: Lucian Adrian Grijincu <lgrijincu@ixiacom.com>
Date: Thu, 5 Nov 2009 20:33:21 +0200

> 
> __udp4_lib_mcast_deliver always returned 0.
> It's caller can return 0 explicitly to make things clearer.
> 
> Also, we don't need the spin_lock() on the hslot to free the skb.
> 
> Signed-off-by: Lucian Adrian Grijincu <lgrijincu@ixiacom.com>

I think the current code is much easier to understand than
your version.

Getting rid of the useless return value is fine, but the
new do{}while() loop et al. is less readable to me.

I'm not applying these two patches, sorry.

^ permalink raw reply

* Re: netfilter 01/02: nf_nat: fix NAT issue in 2.6.30.4+
From: David Miller @ 2009-11-06  8:43 UTC (permalink / raw)
  To: kaber; +Cc: netfilter-devel, netdev
In-Reply-To: <4AF31832.1070701@trash.net>

From: Patrick McHardy <kaber@trash.net>
Date: Thu, 05 Nov 2009 19:23:46 +0100

>     netfilter: nf_nat: fix NAT issue in 2.6.30.4+
 ...
>     Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
>     Signed-off-by: Patrick McHardy <kaber@trash.net>

Applied to net-2.6

^ permalink raw reply

* [PATCH] decnet: netdevice refcount leak
From: Eric Dumazet @ 2009-11-06  8:43 UTC (permalink / raw)
  To: David S. Miller; +Cc: Linux Netdev List

David, if you accept the following patch for net-2.6, it would help me
if you also can pull it in net-next-2.6

Thanks

[PATCH] decnet: netdevice refcount leak

While working on device refcount stuff, I found a device refcount leak
through DECNET.
This nasty bug can be used to hold refcounts on any !DECNET netdevice.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
 net/decnet/sysctl_net_decnet.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/net/decnet/sysctl_net_decnet.c b/net/decnet/sysctl_net_decnet.c
index 26b0ab1..2036568 100644
--- a/net/decnet/sysctl_net_decnet.c
+++ b/net/decnet/sysctl_net_decnet.c
@@ -263,11 +263,10 @@ static int dn_def_dev_strategy(ctl_table *table,
 			return -ENODEV;
 
 		rv = -ENODEV;
-		if (dev->dn_ptr != NULL) {
+		if (dev->dn_ptr != NULL)
 			rv = dn_dev_set_default(dev, 1);
-			if (rv)
-				dev_put(dev);
-		}
+		if (rv)
+			dev_put(dev);
 	}
 
 	return rv;

^ permalink raw reply related

* Re: [PATCH net-next-2.6] mac80211: Speedup ieee80211_remove_interfaces()
From: David Miller @ 2009-11-06  8:44 UTC (permalink / raw)
  To: johannes; +Cc: eric.dumazet, netdev, linville
In-Reply-To: <1257446408.29454.4.camel@johannes.local>

From: Johannes Berg <johannes@sipsolutions.net>
Date: Thu, 05 Nov 2009 19:40:07 +0100

> On Thu, 2009-11-05 at 11:06 +0100, Eric Dumazet wrote:
>> Speedup ieee80211_remove_interfaces() by factorizing synchronize_rcu() calls
> 
> Jouni will be pleased for his testing... :)
> 
> Looks good to me. Nice simplification too.
> 
> Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
> 

I'll leave it to John to integrate this, thanks guys.

^ permalink raw reply

* Re: netfilter 02/02: xt_connlimit: fix regression caused by zero family value
From: David Miller @ 2009-11-06  8:44 UTC (permalink / raw)
  To: jengelh; +Cc: kaber, netfilter-devel, netdev
In-Reply-To: <alpine.LSU.2.00.0911051943130.25147@obet.zrqbmnf.qr>

From: Jan Engelhardt <jengelh@medozas.de>
Date: Thu, 5 Nov 2009 19:45:25 +0100 (CET)

> On Thursday 2009-11-05 19:23, Patrick McHardy wrote:
>>
>>    netfilter: xt_connlimit: fix regression caused by zero family value
>>    
>>    Commit v2.6.28-rc1~7172~1092~2 was slightly incomplete; not all
>>    instances of par->match->family were changed to par->family.
>>    
>>    Netfilter bugzilla #610.
> 
> Hold it.
> git would never output ~7172~1092~2 because ~8266 would be much simpler.
> 
> I originally wrote "Commit v2.6.28-rc1~717^2~109^2~2", but one of your 
> programs seems to eat commit messages or more.

Guys, please sort this out so I can add this fix to net-2.6

Thanks.

^ permalink raw reply

* Re: WARNING: at net/ipv4/af_inet.c:154 inet_sock_destruct
From: Francis Moreau @ 2009-11-06  8:45 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Linux Kernel Mailing List, Linux Netdev List, David S. Miller
In-Reply-To: <4AEB0059.1050400@gmail.com>

On Fri, Oct 30, 2009 at 4:03 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:

[...]

>
> [PATCH take2] net: fix sk_forward_alloc corruption
>

With this patch applied 4 days ago, I haven't got any oops so far.
-- 
Francis

^ permalink raw reply

* Re: WARNING: at net/ipv4/af_inet.c:154 inet_sock_destruct
From: Eric Dumazet @ 2009-11-06  8:47 UTC (permalink / raw)
  To: Francis Moreau
  Cc: Linux Kernel Mailing List, Linux Netdev List, David S. Miller
In-Reply-To: <38b2ab8a0911060045hb6ebab8p43bf8aa838eabfd3@mail.gmail.com>

Francis Moreau a écrit :
> On Fri, Oct 30, 2009 at 4:03 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> 
> [...]
> 
>> [PATCH take2] net: fix sk_forward_alloc corruption
>>
> 
> With this patch applied 4 days ago, I haven't got any oops so far.

Thanks a lot for testing and report Francis, I believe David will push it for stable
(if not already done)



^ permalink raw reply

* Re: PATCH: Network Device Naming mechanism and policy
From: Marco d'Itri @ 2009-11-06  8:49 UTC (permalink / raw)
  To: Narendra_K
  Cc: bryan, dannf, bhutchings, netdev, linux-hotplug, Matt_Domsch,
	Jordan_Hargrave, Charles_Rose, Sandeep_K_Shandilya
In-Reply-To: <EDA0A4495861324DA2618B4C45DCB3EE5896D2@blrx3m08.blr.amer.dell.com>

On Nov 04, Narendra_K@Dell.com wrote:

> SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*",
> ATTR{smbios_name}=="Embedded_NIC_1", ATTR{type}=="1", KERNEL=="eth*",
> NAME="eth0".
As a distribution developer I highly value solutions like this which do
not require patching every application which deals with interface names
and then teaching users about aliases which only work in some places and
are unknown to the kernel.

-- 
ciao,
Marco

^ permalink raw reply

* Re: [RFC] netlink: add socket destruction notification
From: Johannes Berg @ 2009-11-06  8:55 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, j, tgraf
In-Reply-To: <20091105.210806.40981707.davem@davemloft.net>

[-- Attachment #1: Type: text/plain, Size: 939 bytes --]

On Thu, 2009-11-05 at 21:08 -0800, David Miller wrote:

> > When we want to keep track of resources associated with applications, we
> > need to know when an app is going away. Add a notification function to
> > netlink that tells us that, and also hook it up to generic netlink so
> > generic netlink can notify the families. Due to the way generic netlink
> > works though, we need to notify all families and they have to sort out
> > whatever resources some commands associated with the socket themselves.

> No fundamental objections.

:)

> However, as a followup, netlink_kernel_create() is becomming
> function_that_takes_too_many_arguments().
> 
> At this point it's better to just pass two arguments, the network
> namespace pointer, and a pointer to a "const struct netlink_kern_info"
> that holds the rest of the parameters.
> 
> Could you make that change too?

Yeah, I agree -- will change.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply

* Re: WARNING: at net/ipv4/af_inet.c:154 inet_sock_destruct
From: David Miller @ 2009-11-06  8:58 UTC (permalink / raw)
  To: eric.dumazet; +Cc: francis.moro, linux-kernel, netdev
In-Reply-To: <4AF3E2A9.2020601@gmail.com>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Fri, 06 Nov 2009 09:47:37 +0100

> Francis Moreau a écrit :
>> On Fri, Oct 30, 2009 at 4:03 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>> 
>> [...]
>> 
>>> [PATCH take2] net: fix sk_forward_alloc corruption
>>>
>> 
>> With this patch applied 4 days ago, I haven't got any oops so far.
>
> Thanks a lot for testing and report Francis, I believe David will
> push it for stable (if not already done)

I'm pretty sure it's already in Greg's current batch, but if it
doesn't show up in his next -stable release I'll make sure to
submit it.

^ permalink raw reply

* Re: [PATCH] decnet: netdevice refcount leak
From: David Miller @ 2009-11-06  9:07 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev
In-Reply-To: <4AF3E1B3.8070204@gmail.com>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Fri, 06 Nov 2009 09:43:31 +0100

> David, if you accept the following patch for net-2.6, it would help me
> if you also can pull it in net-next-2.6

Applied to net-2.6, and net-2.6 is now merged into net-next-2.6,
thanks.

^ permalink raw reply

* [PATCH 1/1] NET: cassini, fix lock imbalance
From: Jiri Slaby @ 2009-11-06  9:14 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-kernel, Jiri Slaby

Stanse found that one error path in cas_open omits to unlock pm_mutex.
Fix that.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
 drivers/net/cassini.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
index 05916aa..f857afe 100644
--- a/drivers/net/cassini.c
+++ b/drivers/net/cassini.c
@@ -4342,11 +4342,11 @@ static int cas_open(struct net_device *dev)
 		cas_unlock_all_restore(cp, flags);
 	}
 
+	err = -ENOMEM;
 	if (cas_tx_tiny_alloc(cp) < 0)
-		return -ENOMEM;
+		goto err_unlock;
 
 	/* alloc rx descriptors */
-	err = -ENOMEM;
 	if (cas_alloc_rxds(cp) < 0)
 		goto err_tx_tiny;
 
@@ -4386,6 +4386,7 @@ err_spare:
 	cas_free_rxds(cp);
 err_tx_tiny:
 	cas_tx_tiny_free(cp);
+err_unlock:
 	mutex_unlock(&cp->pm_mutex);
 	return err;
 }
-- 
1.6.4.2


^ permalink raw reply related

* Re: [PATCH 0/5] Candidate fix for increased number of GFP_ATOMIC failures V2
From: Mel Gorman @ 2009-11-06  9:24 UTC (permalink / raw)
  To: Tobias Diedrich, Frans Pop, Jiri Kosina, Sven Geggus,
	Karol Lewandowski <karol.k.lewand
In-Reply-To: <20091106060323.GA5528@yumi.tdiedrich.de>

On Fri, Nov 06, 2009 at 07:03:23AM +0100, Tobias Diedrich wrote:
> Mel Gorman wrote:
> > [No BZ ID] Kernel crash on 2.6.31.x (kcryptd: page allocation failure..)
> > 	This apparently is easily reproducible, particular in comparison to
> > 	the other reports. The point of greatest interest is that this is
> > 	order-0 GFP_ATOMIC failures. Sven, I'm hoping that you in particular
> > 	will be able to follow the tests below as you are the most likely
> > 	person to have an easily reproducible situation.
> 
> I've also seen order-0 failures on 2.6.31.5:
> Note that this is with a one process hogging and mlocking memory and
> min_free_kbytes reduced to 100 to reproduce the problem more easily.
> 

Is that a vanilla, with patches 1-3 applied or both?

> I tried bisecting the issue, but in the end without memory pressure
> I can't reproduce it reliably and with the above mentioned pressure
> I get allocation failures even on 2.6.30.o
> 

To be honest, it's not entirely unexpected with min_free_kbytes set that
low. The system should cope with a certain amount of pressure but with
pressure and a low min_free_kbytes, the system will simply be reacting
too late to free memory in the non-atomic paths.

-- 
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab

^ permalink raw reply

* Re: [RFC] move dma_head/dma_maps out of skb_shared_info and into sk_buff
From: David Miller @ 2009-11-06  9:58 UTC (permalink / raw)
  To: alexander.duyck; +Cc: alexander.h.duyck, netdev
In-Reply-To: <1257476452.14523.10.camel@localhost>

From: Alexander Duyck <alexander.duyck@gmail.com>
Date: Thu, 05 Nov 2009 19:00:52 -0800

> Would there be any complaint if I were to submit a patch that removed
> skb_dma_map/unmap?

I'm still thinking about exactly what to do here.  In the meantime
feel free to toss this skb_dma_{map,unmap}() removal patch together.

Thanks.

^ permalink raw reply

* Re: netfilter 02/02: xt_connlimit: fix regression caused by zero family value
From: Jan Engelhardt @ 2009-11-06 10:17 UTC (permalink / raw)
  To: David Miller; +Cc: kaber, netfilter-devel, netdev
In-Reply-To: <20091106.004418.54906158.davem@davemloft.net>


On Friday 2009-11-06 09:44, David Miller wrote:

>From: Jan Engelhardt <jengelh@medozas.de>
>Date: Thu, 5 Nov 2009 19:45:25 +0100 (CET)
>
>> On Thursday 2009-11-05 19:23, Patrick McHardy wrote:
>>>
>>>    netfilter: xt_connlimit: fix regression caused by zero family value
>>>    
>>>    Commit v2.6.28-rc1~7172~1092~2 was slightly incomplete; not all
>>>    instances of par->match->family were changed to par->family.
>>>    
>>>    Netfilter bugzilla #610.
>> 
>> Hold it.
>> git would never output ~7172~1092~2 because ~8266 would be much simpler.
>> 
>> I originally wrote "Commit v2.6.28-rc1~717^2~109^2~2", but one of your 
>> programs seems to eat commit messages or more.
>
>Guys, please sort this out so I can add this fix to net-2.6
>
>Thanks.

This should.


commit ffffffffffffffffffffffffffffffffffffffff
Author: Jan Engelhardt <jengelh@medozas.de>
Date:   Wed Nov 4 14:27:30 2009 +0100

netfilter: xt_connlimit: fix regression caused by zero family value
Commit v2.6.28-rc1~717^2~109^2~2 was slightly incomplete; not all
instances of par->match->family were changed to par->family.

References: http://bugzilla.netfilter.org/show_bug.cgi?id=610
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>
---
 net/netfilter/xt_connlimit.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/net/netfilter/xt_connlimit.c b/net/netfilter/xt_connlimit.c
index 6809809..38f03f7 100644
--- a/net/netfilter/xt_connlimit.c
+++ b/net/netfilter/xt_connlimit.c
@@ -103,7 +103,7 @@ static int count_them(struct xt_connlimit_data *data,
 		      const struct nf_conntrack_tuple *tuple,
 		      const union nf_inet_addr *addr,
 		      const union nf_inet_addr *mask,
-		      const struct xt_match *match)
+		      u_int8_t family)
 {
 	const struct nf_conntrack_tuple_hash *found;
 	struct xt_connlimit_conn *conn;
@@ -113,8 +113,7 @@ static int count_them(struct xt_connlimit_data *data,
 	bool addit = true;
 	int matches = 0;
 
-
-	if (match->family == NFPROTO_IPV6)
+	if (family == NFPROTO_IPV6)
 		hash = &data->iphash[connlimit_iphash6(addr, mask)];
 	else
 		hash = &data->iphash[connlimit_iphash(addr->ip & mask->ip)];
@@ -157,8 +156,7 @@ static int count_them(struct xt_connlimit_data *data,
 			continue;
 		}
 
-		if (same_source_net(addr, mask, &conn->tuple.src.u3,
-		    match->family))
+		if (same_source_net(addr, mask, &conn->tuple.src.u3, family))
 			/* same source network -> be counted! */
 			++matches;
 		nf_ct_put(found_ct);
@@ -207,7 +205,7 @@ connlimit_mt(const struct sk_buff *skb, const struct xt_match_param *par)
 
 	spin_lock_bh(&info->data->lock);
 	connections = count_them(info->data, tuple_ptr, &addr,
-	                         &info->mask, par->match);
+	                         &info->mask, par->family);
 	spin_unlock_bh(&info->data->lock);
 
 	if (connections < 0) {
-- 
# Created with git-export-patch

^ permalink raw reply related

* [PATCH] can: should not use __dev_get_by_index() without locks
From: Eric Dumazet @ 2009-11-06 10:23 UTC (permalink / raw)
  To: David S. Miller; +Cc: Linux Netdev List

David

A more elegant patch will be possible for 2.6.33, but for 2.6.32,
I think following patch is needed (Please note I did not test it)

(More elegant : use RCU lookups ;) , I'll wait for net-next-2.6 
 upgrade as well)

Thanks

[PATCH] can: should not use __dev_get_by_index() without locks

bcm_proc_getifname() is called with RTNL and dev_base_lock
not held. It calls __dev_get_by_index() without locks, and
this is illegal (might crash)

Close the race by holding dev_base_lock and copying dev->name
in the protected section.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
 net/can/bcm.c |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/net/can/bcm.c b/net/can/bcm.c
index 597da4f..e8d58f3 100644
--- a/net/can/bcm.c
+++ b/net/can/bcm.c
@@ -132,23 +132,27 @@ static inline struct bcm_sock *bcm_sk(const struct sock *sk)
 /*
  * procfs functions
  */
-static char *bcm_proc_getifname(int ifindex)
+static char *bcm_proc_getifname(char *result, int ifindex)
 {
 	struct net_device *dev;
 
 	if (!ifindex)
 		return "any";
 
-	/* no usage counting */
+	read_lock(&dev_base_lock);
 	dev = __dev_get_by_index(&init_net, ifindex);
 	if (dev)
-		return dev->name;
+		strcpy(result, dev->name);
+	else
+		strcpy(result, "???");
+	read_unlock(&dev_base_lock);
 
-	return "???";
+	return result;
 }
 
 static int bcm_proc_show(struct seq_file *m, void *v)
 {
+	char ifname[IFNAMSIZ];
 	struct sock *sk = (struct sock *)m->private;
 	struct bcm_sock *bo = bcm_sk(sk);
 	struct bcm_op *op;
@@ -157,7 +161,7 @@ static int bcm_proc_show(struct seq_file *m, void *v)
 	seq_printf(m, " / sk %p", sk);
 	seq_printf(m, " / bo %p", bo);
 	seq_printf(m, " / dropped %lu", bo->dropped_usr_msgs);
-	seq_printf(m, " / bound %s", bcm_proc_getifname(bo->ifindex));
+	seq_printf(m, " / bound %s", bcm_proc_getifname(ifname, bo->ifindex));
 	seq_printf(m, " <<<\n");
 
 	list_for_each_entry(op, &bo->rx_ops, list) {
@@ -169,7 +173,7 @@ static int bcm_proc_show(struct seq_file *m, void *v)
 			continue;
 
 		seq_printf(m, "rx_op: %03X %-5s ",
-				op->can_id, bcm_proc_getifname(op->ifindex));
+				op->can_id, bcm_proc_getifname(ifname, op->ifindex));
 		seq_printf(m, "[%d]%c ", op->nframes,
 				(op->flags & RX_CHECK_DLC)?'d':' ');
 		if (op->kt_ival1.tv64)
@@ -194,7 +198,8 @@ static int bcm_proc_show(struct seq_file *m, void *v)
 	list_for_each_entry(op, &bo->tx_ops, list) {
 
 		seq_printf(m, "tx_op: %03X %s [%d] ",
-				op->can_id, bcm_proc_getifname(op->ifindex),
+				op->can_id,
+				bcm_proc_getifname(ifname, op->ifindex),
 				op->nframes);
 
 		if (op->kt_ival1.tv64)

^ permalink raw reply related

* [PATCH net-next2.6] ipv6: avoid dev_hold()/dev_put() in rawv6_bind()
From: Eric Dumazet @ 2009-11-06 10:53 UTC (permalink / raw)
  To: David S. Miller; +Cc: Linux Netdev List

Using RCU helps not touching device refcount in rawv6_bind()

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
 net/ipv6/raw.c |   23 +++++++++++------------
 1 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 818ef21..80f356a 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -249,7 +249,7 @@ static int rawv6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
 
 	/* Raw sockets are IPv6 only */
 	if (addr_type == IPV6_ADDR_MAPPED)
-		return(-EADDRNOTAVAIL);
+		return -EADDRNOTAVAIL;
 
 	lock_sock(sk);
 
@@ -257,6 +257,7 @@ static int rawv6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
 	if (sk->sk_state != TCP_CLOSE)
 		goto out;
 
+	rcu_read_unlock();
 	/* Check if the address belongs to the host. */
 	if (addr_type != IPV6_ADDR_ANY) {
 		struct net_device *dev = NULL;
@@ -272,13 +273,13 @@ static int rawv6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
 
 			/* Binding to link-local address requires an interface */
 			if (!sk->sk_bound_dev_if)
-				goto out;
+				goto out_unlock;
 
-			dev = dev_get_by_index(sock_net(sk), sk->sk_bound_dev_if);
-			if (!dev) {
-				err = -ENODEV;
-				goto out;
-			}
+			err = -ENODEV;
+			dev = dev_get_by_index_rcu(sock_net(sk),
+						   sk->sk_bound_dev_if);
+			if (!dev)
+				goto out_unlock;
 		}
 
 		/* ipv4 addr of the socket is invalid.  Only the
@@ -289,13 +290,9 @@ static int rawv6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
 			err = -EADDRNOTAVAIL;
 			if (!ipv6_chk_addr(sock_net(sk), &addr->sin6_addr,
 					   dev, 0)) {
-				if (dev)
-					dev_put(dev);
-				goto out;
+				goto out_unlock;
 			}
 		}
-		if (dev)
-			dev_put(dev);
 	}
 
 	inet->inet_rcv_saddr = inet->inet_saddr = v4addr;
@@ -303,6 +300,8 @@ static int rawv6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
 	if (!(addr_type & IPV6_ADDR_MULTICAST))
 		ipv6_addr_copy(&np->saddr, &addr->sin6_addr);
 	err = 0;
+out_unlock:
+	rcu_read_unlock();
 out:
 	release_sock(sk);
 	return err;

^ permalink raw reply related

* [PATCH v2] arpd/ifstat/nstat/rtacct: use daemon()
From: Mike Frysinger @ 2009-11-06 11:04 UTC (permalink / raw)
  To: stephen.hemminger, netdev
In-Reply-To: <1257344795-8665-3-git-send-email-vapier@gentoo.org>

A bunch of misc utils basically reimplement the daemon() function (the
whole fork/close/chdir/etc...).  Rather than do that, use daemon() as
that will work under nommu Linux systems that lack fork().

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 misc/arpd.c   |   24 +++---------------------
 misc/ifstat.c |    8 ++++----
 misc/nstat.c  |    8 ++++----
 misc/rtacct.c |    8 ++++----
 4 files changed, 15 insertions(+), 33 deletions(-)

diff --git a/misc/arpd.c b/misc/arpd.c
index 71cd082..128c49d 100644
--- a/misc/arpd.c
+++ b/misc/arpd.c
@@ -775,27 +775,9 @@ int main(int argc, char **argv)
 
 	load_initial_table();
 
-	if (1) {
-		int fd;
-		pid_t pid = fork();
-
-		if (pid > 0)
-			_exit(0);
-		if (pid < 0) {
-			perror("arpd: fork");
-			goto do_abort;
-		}
-
-		chdir("/");
-		fd = open("/dev/null", O_RDWR);
-		if (fd >= 0) {
-			dup2(fd, 0);
-			dup2(fd, 1);
-			dup2(fd, 2);
-			if (fd > 2)
-				close(fd);
-		}
-		setsid();
+	if (daemon(0, 0)) {
+		perror("arpd: daemon");
+		goto do_abort;
 	}
 
 	openlog("arpd", LOG_PID | LOG_CONS, LOG_DAEMON);
diff --git a/misc/ifstat.c b/misc/ifstat.c
index 68dfdee..0ce8c92 100644
--- a/misc/ifstat.c
+++ b/misc/ifstat.c
@@ -663,10 +663,10 @@ int main(int argc, char *argv[])
 			perror("ifstat: listen");
 			exit(-1);
 		}
-		if (fork())
-			exit(0);
-		chdir("/");
-		close(0); close(1); close(2); setsid();
+		if (daemon(0, 0)) {
+			perror("ifstat: daemon");
+			exit(-1);
+		}
 		signal(SIGPIPE, SIG_IGN);
 		signal(SIGCHLD, sigchild);
 		server_loop(fd);
diff --git a/misc/nstat.c b/misc/nstat.c
index 80e695f..2e44ed2 100644
--- a/misc/nstat.c
+++ b/misc/nstat.c
@@ -513,10 +513,10 @@ int main(int argc, char *argv[])
 			perror("nstat: listen");
 			exit(-1);
 		}
-		if (fork())
-			exit(0);
-		chdir("/");
-		close(0); close(1); close(2); setsid();
+		if (daemon(0, 0)) {
+			perror("nstat: daemon");
+			exit(-1);
+		}
 		signal(SIGPIPE, SIG_IGN);
 		signal(SIGCHLD, sigchild);
 		server_loop(fd);
diff --git a/misc/rtacct.c b/misc/rtacct.c
index eb3ea9e..a247dfd 100644
--- a/misc/rtacct.c
+++ b/misc/rtacct.c
@@ -524,10 +524,10 @@ int main(int argc, char *argv[])
 			perror("rtacct: listen");
 			exit(-1);
 		}
-		if (fork())
-			exit(0);
-		chdir("/");
-		close(0); close(1); close(2); setsid();
+		if (daemon(0, 0)) {
+			perror("rtacct: daemon");
+			exit(-1);
+		}
 		signal(SIGPIPE, SIG_IGN);
 		signal(SIGCHLD, sigchild);
 		server_loop(fd);
-- 
1.6.5.1


^ permalink raw reply related

* Re: [PATCH] can: should not use __dev_get_by_index() without locks
From: Oliver Hartkopp @ 2009-11-06 11:04 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David S. Miller, Linux Netdev List
In-Reply-To: <4AF3F905.4030608@gmail.com>

Eric Dumazet wrote:
> David
> 
> A more elegant patch will be possible for 2.6.33, but for 2.6.32,
> I think following patch is needed (Please note I did not test it)
> 
> (More elegant : use RCU lookups ;) , I'll wait for net-next-2.6 
>  upgrade as well)
> 
> Thanks
> 
> [PATCH] can: should not use __dev_get_by_index() without locks
> 
> bcm_proc_getifname() is called with RTNL and dev_base_lock
> not held. It calls __dev_get_by_index() without locks, and
> this is illegal (might crash)
> 
> Close the race by holding dev_base_lock and copying dev->name
> in the protected section.
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>

Thanks for pointing this out.
This is a quite old code section which is not used very often at runtime - and
usually the netdevice is not removed at that time ;-)

Btw. this is no excuse for that missing locking, sorry.

Thanks for the fix!

Compiled and tested successfully.

Signed-off-by: Oliver Hartkopp <oliver@hartkopp.net>



^ permalink raw reply

* [PATCH] support static-only systems
From: Mike Frysinger @ 2009-11-06 11:09 UTC (permalink / raw)
  To: stephen.hemminger, netdev

The iptables code supports a "no shared libs" mode where it can be used
without requiring dlfcn related functionality.  This adds similar support
to iproute2 so that it can easily be used on systems like nommu Linux (but
obviously with a few limitations -- no dynamic plugins).

Rather than modify every location that uses dlfcn.h, I hooked the dlfcn.h
header with stub functions when shared library support is disabled.  Then
symbol lookup is done via a local static lookup table (which is generated
automatically at build time) so that internal symbols can be found.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 .gitignore         |    1 +
 Makefile           |    5 +++++
 genl/Makefile      |   15 +++++++++++++++
 genl/static-syms.c |    6 ++++++
 include/dlfcn.h    |   39 +++++++++++++++++++++++++++++++++++++++
 ip/Makefile        |   16 +++++++++++++++-
 ip/static-syms.c   |    6 ++++++
 tc/Makefile        |   23 +++++++++++++++++++----
 tc/m_ipt.c         |    4 ++++
 tc/static-syms.c   |    6 ++++++
 10 files changed, 116 insertions(+), 5 deletions(-)
 create mode 100644 genl/static-syms.c
 create mode 100644 include/dlfcn.h
 create mode 100644 ip/static-syms.c
 create mode 100644 tc/static-syms.c

diff --git a/.gitignore b/.gitignore
index 5a3d20f..390ffb1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
 Config
+static-syms.h
 .gdbinit
 .gdb_history
 *.o
diff --git a/Makefile b/Makefile
index 74e9d62..77a85c6 100644
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,12 @@ ARPDDIR=/var/lib/arpd
 # Path to db_185.h include
 DBM_INCLUDE:=$(ROOTDIR)/usr/include
 
+SHARED_LIBS = y
+
 DEFINES= -DRESOLVE_HOSTNAMES -DLIBDIR=\"$(LIBDIR)\"
+ifneq ($(SHARED_LIBS),y)
+DEFINES+= -DNO_SHARED_LIBS
+endif
 
 #options if you have a bind>=4.9.4 libresolv (or, maybe, glibc)
 LDLIBS=-lresolv
diff --git a/genl/Makefile b/genl/Makefile
index 6435875..44bb83c 100644
--- a/genl/Makefile
+++ b/genl/Makefile
@@ -1,6 +1,7 @@
 GENLOBJ=genl.o
 
 include ../Config
+SHARED_LIBS ?= y
 
 GENLMODULES :=
 GENLMODULES += ctrl.o
@@ -9,8 +10,10 @@ GENLOBJ += $(GENLMODULES)
 
 GENLLIB :=
 
+ifeq ($(SHARED_LIBS),y)
 LDFLAGS += -Wl,-export-dynamic
 LDLIBS  += -lm -ldl
+endif
 
 all: genl
 
@@ -21,3 +24,15 @@ install: all
 
 clean:
 	rm -f $(GENLOBJ) $(GENLLIB) genl
+
+ifneq ($(SHARED_LIBS),y)
+
+genl: static-syms.o
+static-syms.o: static-syms.h
+static-syms.h: $(wildcard *.c)
+	files="$^" ; \
+	for s in `grep -B 3 '\<dlsym' $$files | sed -n '/snprintf/{s:.*"\([^"]*\)".*:\1:;s:%s::;p}'` ; do \
+		sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $$files ; \
+	done > $@
+
+endif
diff --git a/genl/static-syms.c b/genl/static-syms.c
new file mode 100644
index 0000000..1ed3a8a
--- /dev/null
+++ b/genl/static-syms.c
@@ -0,0 +1,6 @@
+#include <string.h>
+void *_dlsym(const char *sym)
+{
+#include "static-syms.h"
+	return NULL;
+}
diff --git a/include/dlfcn.h b/include/dlfcn.h
new file mode 100644
index 0000000..b0be5a0
--- /dev/null
+++ b/include/dlfcn.h
@@ -0,0 +1,39 @@
+/*
+ * Stub dlfcn implementation for systems that lack shared library support
+ * but obviously can still reference compiled-in symbols.
+ */
+
+#ifndef NO_SHARED_LIBS
+#include_next <dlfcn.h>
+#else
+
+#define RTLD_LAZY 0
+#define _FAKE_DLFCN_HDL (void *)0xbeefcafe
+
+static inline void *dlopen(const char *file, int flag)
+{
+	if (file == NULL)
+		return _FAKE_DLFCN_HDL;
+	else
+		return NULL;
+}
+
+extern void *_dlsym(const char *sym);
+static inline void *dlsym(void *handle, const char *sym)
+{
+	if (handle != _FAKE_DLFCN_HDL)
+		return NULL;
+	return _dlsym(sym);
+}
+
+static inline char *dlerror(void)
+{
+	return NULL;
+}
+
+static inline int dlclose(void *handle)
+{
+	return (handle == _FAKE_DLFCN_HDL) ? 0 : 1;
+}
+
+#endif
diff --git a/ip/Makefile b/ip/Makefile
index 3c185cf..51914e8 100644
--- a/ip/Makefile
+++ b/ip/Makefile
@@ -23,6 +23,20 @@ install: all
 clean:
 	rm -f $(ALLOBJ) $(TARGETS)
 
-LDLIBS += -ldl
+SHARED_LIBS ?= y
+ifeq ($(SHARED_LIBS),y)
 
+LDLIBS += -ldl
 LDFLAGS += -Wl,-export-dynamic
+
+else
+
+ip: static-syms.o
+static-syms.o: static-syms.h
+static-syms.h: $(wildcard *.c)
+	files="$^" ; \
+	for s in `grep -B 3 '\<dlsym' $$files | sed -n '/snprintf/{s:.*"\([^"]*\)".*:\1:;s:%s::;p}'` ; do \
+		sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $$files ; \
+	done > $@
+
+endif
diff --git a/ip/static-syms.c b/ip/static-syms.c
new file mode 100644
index 0000000..1ed3a8a
--- /dev/null
+++ b/ip/static-syms.c
@@ -0,0 +1,6 @@
+#include <string.h>
+void *_dlsym(const char *sym)
+{
+#include "static-syms.h"
+	return NULL;
+}
diff --git a/tc/Makefile b/tc/Makefile
index 3ff2535..027055c 100644
--- a/tc/Makefile
+++ b/tc/Makefile
@@ -3,6 +3,7 @@ TCOBJ= tc.o tc_qdisc.o tc_class.o tc_filter.o tc_util.o \
        m_ematch.o emp_ematch.yacc.o emp_ematch.lex.o
 
 include ../Config
+SHARED_LIBS ?= y
 
 TCMODULES :=
 TCMODULES += q_fifo.o
@@ -57,7 +58,12 @@ else
 endif
 
 TCOBJ += $(TCMODULES)
-LDLIBS += -L. -ltc -lm -ldl
+LDLIBS += -L. -ltc -lm
+
+ifeq ($(SHARED_LIBS),y)
+LDLIBS += -ldl
+LDFLAGS += -Wl,-export-dynamic
+endif
 
 TCLIB := tc_core.o
 TCLIB += tc_red.o
@@ -72,9 +78,6 @@ ifeq ($(TC_CONFIG_ATM),y)
   TCSO += q_atm.so
 endif
 
-
-LDFLAGS += -Wl,-export-dynamic
-
 YACC := bison
 LEX := flex
 
@@ -108,3 +111,15 @@ q_atm.so: q_atm.c
 
 %.lex.c: %.l
 	$(LEX) $(LEXFLAGS) -o$@ $<
+
+ifneq ($(SHARED_LIBS),y)
+
+tc: static-syms.o
+static-syms.o: static-syms.h
+static-syms.h: $(wildcard *.c)
+	files="$^" ; \
+	for s in `grep -B 3 '\<dlsym' $$files | sed -n '/snprintf/{s:.*"\([^"]*\)".*:\1:;s:%s::;p}'` ; do \
+		sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $$files ; \
+	done > $@
+
+endif
diff --git a/tc/m_ipt.c b/tc/m_ipt.c
index d17d324..99d9965 100644
--- a/tc/m_ipt.c
+++ b/tc/m_ipt.c
@@ -226,6 +226,10 @@ get_target_name(const char *name)
 	struct iptables_target *m;
 	char path[strlen(lib_dir) + sizeof ("/libipt_.so") + strlen(name)];
 
+#ifdef NO_SHARED_LIBS
+	return NULL;
+#endif
+
 	new_name = malloc(strlen(name) + 1);
 	lname = malloc(strlen(name) + 1);
 	if (new_name)
diff --git a/tc/static-syms.c b/tc/static-syms.c
new file mode 100644
index 0000000..1ed3a8a
--- /dev/null
+++ b/tc/static-syms.c
@@ -0,0 +1,6 @@
+#include <string.h>
+void *_dlsym(const char *sym)
+{
+#include "static-syms.h"
+	return NULL;
+}
-- 
1.6.5.1


^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox