* Re: [net 0/2] Clean up netfilter cache on xmit-to-self.
From: Ben Greear @ 2010-08-05 19:29 UTC (permalink / raw)
To: David Miller; +Cc: netdev
In-Reply-To: <20100805.115850.58405719.davem@davemloft.net>
On 08/05/2010 11:58 AM, David Miller wrote:
> From: Ben Greear<greearb@candelatech.com>
> Date: Thu, 05 Aug 2010 11:43:37 -0700
>
>> On 07/25/2010 10:01 PM, David Miller wrote:
>>> From: David Miller<davem@davemloft.net>
>>> Date: Sun, 25 Jul 2010 21:59:12 -0700 (PDT)
>>>
>>>> From: Ben Greear<greearb@candelatech.com>
>>>> Date: Thu, 22 Jul 2010 12:54:46 -0700
>>>>
>>>>> These patches are against 2.6.34.1. The first one may be
>>>>> worth submitting to stable. The second one is less critical
>>>>> and should probably just go in the development tree.
>>>>
>>>> I'll apply the first one to net-2.6 and queue up for -stable
>>
>> As far as I can tell, this didn't make it into -stable yet?
>
> It's sitting in my queue, I will send it out once 2.6.35 has been out
> for about 1 week more just to double make sure there aren't any
> unwanted side effects.
>
> I never submit changes to -stable immediately unless the change is
> painfully obvious and has no possible unwanted side effects. I always
> wait a week or even more sometimes.
Ok, no problem. I just wanted to make sure it hadn't been lost.
Thanks,
Ben
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply
* Re: [PATCH] cfg80211: support sysfs namespaces
From: Eric W. Biederman @ 2010-08-05 19:46 UTC (permalink / raw)
To: Johannes Berg; +Cc: John Linville, linux-wireless, netdev
In-Reply-To: <1281023115.4058.11.camel@jlt3.sipsolutions.net>
Johannes Berg <johannes@sipsolutions.net> writes:
> From: Johannes Berg <johannes.berg@intel.com>
>
> Enable using network namespaces with
> wireless devices even when sysfs is
> enabled using the same infrastructure
> that was built for netdevs.
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
This looks reasonable. I assume you have tested this and it is
working now?
>
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> ---
> NB: This generates a harmless gcc warning, I submitted
> a patch to fix it here:
> http://thread.gmane.org/gmane.linux.kernel/1019330
>
> include/linux/netdevice.h | 2 ++
> net/core/net-sysfs.c | 3 ++-
> net/wireless/core.c | 7 ++++++-
> net/wireless/sysfs.c | 9 +++++++++
> 4 files changed, 19 insertions(+), 2 deletions(-)
>
> --- wireless-testing.orig/net/core/net-sysfs.c 2010-08-05 17:33:47.000000000 +0200
> +++ wireless-testing/net/core/net-sysfs.c 2010-08-05 17:38:27.000000000 +0200
> @@ -789,12 +789,13 @@ static const void *net_netlink_ns(struct
> return sock_net(sk);
> }
>
> -static struct kobj_ns_type_operations net_ns_type_operations = {
> +struct kobj_ns_type_operations net_ns_type_operations = {
> .type = KOBJ_NS_TYPE_NET,
> .current_ns = net_current_ns,
> .netlink_ns = net_netlink_ns,
> .initial_ns = net_initial_ns,
> };
> +EXPORT_SYMBOL_GPL(net_ns_type_operations);
>
> static void net_kobj_ns_exit(struct net *net)
> {
> --- wireless-testing.orig/net/wireless/sysfs.c 2010-08-05 17:33:47.000000000 +0200
> +++ wireless-testing/net/wireless/sysfs.c 2010-08-05 17:39:11.000000000 +0200
> @@ -110,6 +110,13 @@ static int wiphy_resume(struct device *d
> return ret;
> }
>
> +static const void *wiphy_namespace(struct device *d)
> +{
> + struct wiphy *wiphy = container_of(d, struct wiphy, dev);
> +
> + return wiphy_net(wiphy);
> +}
> +
> struct class ieee80211_class = {
> .name = "ieee80211",
> .owner = THIS_MODULE,
> @@ -120,6 +127,8 @@ struct class ieee80211_class = {
> #endif
> .suspend = wiphy_suspend,
> .resume = wiphy_resume,
> + .ns_type = &net_ns_type_operations,
> + .namespace = wiphy_namespace,
> };
>
> int wiphy_sysfs_init(void)
> --- wireless-testing.orig/net/wireless/core.c 2010-08-05 17:33:47.000000000 +0200
> +++ wireless-testing/net/wireless/core.c 2010-08-05 17:38:27.000000000 +0200
> @@ -253,11 +253,16 @@ int cfg80211_switch_netns(struct cfg8021
> WARN_ON(err);
> wdev->netdev->features |= NETIF_F_NETNS_LOCAL;
> }
> +
> + return err;
> }
>
> wiphy_net_set(&rdev->wiphy, net);
>
> - return err;
> + err = device_rename(&rdev->wiphy.dev, dev_name(&rdev->wiphy.dev));
> + WARN_ON(err);
> +
> + return 0;
> }
>
> static void cfg80211_rfkill_poll(struct rfkill *rfkill, void *data)
> --- wireless-testing.orig/include/linux/netdevice.h 2010-08-05 17:13:50.000000000 +0200
> +++ wireless-testing/include/linux/netdevice.h 2010-08-05 17:39:02.000000000 +0200
> @@ -2171,6 +2171,8 @@ extern void dev_seq_stop(struct seq_file
> extern int netdev_class_create_file(struct class_attribute *class_attr);
> extern void netdev_class_remove_file(struct class_attribute *class_attr);
>
> +extern struct kobj_ns_type_operations net_ns_type_operations;
> +
> extern char *netdev_drivername(const struct net_device *dev, char *buffer, int len);
>
> extern void linkwatch_run_queue(void);
^ permalink raw reply
* RE: [PATCH] [Bug 16494] NFS client over TCP hangs due to packet loss
From: Trond Myklebust @ 2010-08-05 19:50 UTC (permalink / raw)
To: Andy Chittenden
Cc: 'Andrew Morton', 'David Miller',
kuznet-v/Mj1YrvjDBInbfyfbPRSQ, pekkas-UjJjq++bwZ7HOG6cAo2yLw,
jmorris-gx6/JNMH7DfYtjvyW6yDsg, yoshfuji-VfPWfsRibaP+Ru+s062T9g,
kaber-dcUjhNyLwpNeoWH0uzbU5w, eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w,
William.Allen.Simpson-Re5JQEeQqe8AvxtiuMwx3w,
gilad-f4XOiQkOAtcdH0auuBZGHA,
ilpo.jarvinen-pxSi+dnQzZMxHbG02/KK1g,
netdev-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-nfs-u79uwXL29TY76Z2rM5mHXA, 'J. Bruce Fields',
'Neil Brown', 'Chuck Lever',
'Benny Halevy', 'Alexandros Batsakis',
'Joe Perches'
In-Reply-To: <4c5ad0d6.42ecd80a.47d7.0dfc-ATjtLOhZ0NVl57MIdRCFDg@public.gmane.org>
On Thu, 2010-08-05 at 15:55 +0100, Andy Chittenden wrote:
> > On 2010-08-03 10:11, Andrew Morton wrote:
> > > (cc linux-nfs)
> > >
> > > On Tue, 03 Aug 2010 01:21:44 -0700 (PDT) David
> > Miller<davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org> wrote:
> > >
> > >> From: "Andy Chittenden"<andyc.bluearc-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> > >> Date: Tue, 3 Aug 2010 09:14:31 +0100
> > >>
> > >>> I don't know whether this patch is the correct fix or not but it
> > enables the
> > >>> NFS client to recover.
> > >>>
> > >>> Kernel version: 2.6.34.1 and 2.6.32.
> > >>>
> > >>> Fixes<https://bugzilla.kernel.org/show_bug.cgi?id=16494>. It clears
> > down
> > >>> any previous shutdown attempts so that reconnects on a socket
> > that's been
> > >>> shutdown leave the socket in a usable state (otherwise
> > tcp_sendmsg() returns
> > >>> -EPIPE).
> > >>
> > >> If the SunRPC code wants to close a TCP socket then use it again,
> > >> it should disconnect by doing a connect() with sa_family ==
> > AF_UNSPEC
> >
> > There is code to do that in the SunRPC code in xs_abort_connection()
> > but
> > that's conditionally called from xs_tcp_reuse_connection():
> >
> > static void xs_tcp_reuse_connection(struct rpc_xprt *xprt, struct
> > sock_xprt *transport)
> > {
> > unsigned int state = transport->inet->sk_state;
> >
> > if (state == TCP_CLOSE && transport->sock->state ==
> > SS_UNCONNECTED)
> > return;
> > if ((1 << state) & (TCPF_ESTABLISHED|TCPF_SYN_SENT))
> > return;
> > xs_abort_connection(xprt, transport);
> > }
> >
> > That's changed since 2.6.26 where it unconditionally did the connect()
> > with sa_family == AF_UNSPEC. FWIW we cannot reproduce this problem with
> > 2.6.26.
>
> The problem is fixed with this patch which also prints out that sk_shutdown
> can be non-zero on entry to xs_tcp_reuse_connection:
>
> # diff -up /home/company/software/src/linux-2.6.34.2/net/sunrpc/xprtsock.c
> net/sunrpc/xprtsock.c
> --- /home/company/software/src/linux-2.6.34.2/net/sunrpc/xprtsock.c
> 2010-08-02 18:30:51.000000000 +0100
> +++ net/sunrpc/xprtsock.c 2010-08-05 12:21:11.000000000 +0100
> @@ -1322,10 +1322,11 @@ static void xs_tcp_state_change(struct s
> if (!(xprt = xprt_from_sock(sk)))
> goto out;
> dprintk("RPC: xs_tcp_state_change client %p...\n", xprt);
> - dprintk("RPC: state %x conn %d dead %d zapped %d\n",
> + dprintk("RPC: state %x conn %d dead %d zapped %d sk_shutdown
> %d\n",
> sk->sk_state, xprt_connected(xprt),
> sock_flag(sk, SOCK_DEAD),
> - sock_flag(sk, SOCK_ZAPPED));
> + sock_flag(sk, SOCK_ZAPPED),
> + sk->sk_shutdown);
>
> switch (sk->sk_state) {
> case TCP_ESTABLISHED:
> @@ -1796,10 +1797,18 @@ static void xs_tcp_reuse_connection(stru
> {
> unsigned int state = transport->inet->sk_state;
>
> - if (state == TCP_CLOSE && transport->sock->state == SS_UNCONNECTED)
> - return;
> - if ((1 << state) & (TCPF_ESTABLISHED|TCPF_SYN_SENT))
> - return;
> + if (state == TCP_CLOSE && transport->sock->state == SS_UNCONNECTED)
> {
> + if (transport->inet->sk_shutdown == 0)
> + return;
> + printk("%s: TCP_CLOSEd and sk_shutdown set to %d\n",
> + __func__, transport->inet->sk_shutdown);
> + }
> + if ((1 << state) & (TCPF_ESTABLISHED|TCPF_SYN_SENT)) {
> + if (transport->inet->sk_shutdown == 0)
> + return;
> + printk("%s: sk_shutdown set to %d\n",
> + __func__, transport->inet->sk_shutdown);
> + }
> xs_abort_connection(xprt, transport);
> }
>
> Signed-off-by: Andy Chittenden <andyc.bluearc-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>
> dmesg displays:
>
> [ 2840.896043] xs_tcp_reuse_connection: TCP_CLOSEd and sk_shutdown set to 2
>
> so previously the code was attempting to reuse the connection but wasn't
> aborting it and thus didn't clear down sk_shutdown.
Hi Andy,
I note that you are adding in two new printk()s. Why should they be
printk(), and not dprintk()? Are you trying to report an exception that
the user needs to be aware of, or is this only debugging info that we'll
want to turn off under normal operation?
Also, it might be useful to add a comment to the code here to remind us
what the 'sk_shutdown == 0' case corresponds to as far as the socket
state is concerned, so that the casual reader can see why we shouldn't
reset the connection.
Cheers
Trond
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" 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: NET_NS: unregister_netdevice: waiting for lo to become free (adding ipv6 address to interface)
From: Eric W. Biederman @ 2010-08-05 19:57 UTC (permalink / raw)
To: Michael Leun
Cc: Greg KH, netdev, davem, linux-kernel, Alexey Dobriyan,
Patrick McHardy
In-Reply-To: <20100805134707.0442a7b1@xenia.leun.net>
Michael Leun <lkml20100708@newton.leun.net> writes:
> On Thu, 05 Aug 2010 02:51:29 -0700
> ebiederm@xmission.com (Eric W. Biederman) wrote:
>
>> >> > Jul 10 20:02:36 doris kernel: unregister_netdevice: waiting for
>> >> > lo to become free. Usage count = 3 [repeated]
>> >>
>> >> How many times?
>> >
>> > Unfortunately looks like indefinitely. Never watched longer so far
>> > (rebooted soon), but I'm seeing this message now repeated every 10
>> > secs for ~10 minutes on a idle system.
>>
>> Ugh. A real bug then. These can be a pain to track down and fix. I
>> think the last one of these I tracked down took a couple of weeks. I
>> will start digging in when I get back from vacation.
>
> OK, fortunately (hopefully) you have not put to much time onto that so
> far - because everything I told about usage of tun and difference
> between ssh and openvpn is complete nonsense.
>
> I happen to have an script in that openvpn config, which puts an ipv6
> address on the vpn device.
>
> Putting an ipv6 address on a device seems to be the trigger:
>
> OrigNS > # ip link add type veth
> OrigNS > # ip link set dev veth0 up
> OrigNS > # unshare -n /bin/bash
> NewNS > # echo $$
> <SomePID>
> OrigNS > # ip link set dev veth1 netns <SomePID> # this, of course is on a different terminal
> NewNS > # ip link set dev veth1 up
> NewNS > # ip -6 addr add dev veth1 fd50:dead:beef::1/64
> NewNS > # exit
>
> Yields
>
> kernel: unregister_netdevice: waiting for veth1 to become free. Usage count = 3
>
> Oh - its veth1 this time, not lo - add an "ip link set up dev lo" in the above scenario just after the unshare, and you get the message with lo.
>
> One might ask, if
>
>> # unshare -n /bin/bash
>> # ip link set up dev lo
>> # ip -6 addr add dev veth1 fd50:dead:beef::1/64
>> # exit
>
> also does the trick, so I tried it - and it does NOT.
>
> In the above scenario, not setting veth0 and veth1 up also makes it not happen. Only setting veth1 up also is not enough (seems to need to be "really up" what as you shurely know with veth is only the case when both sides are up).
>
> I hope, this makes it somewhat easier to track that down.
What puzzles me is that on a slightly patched 2.6.32 (so sysfs works)
and I am doing very similar things (openvpn tunnels, ipv6 to the
network as a whole etc), and I am not seeing the infinite
unregister_netdevice: messages you are talking about.
When a network device is removed most references to it are redirected
to the loopback device so a normal network device should not see the
worst of the problems. That is why lo showed up.
In that context I'm a bit surprised you managed trigger a problem on veth1.
I wonder what has changed with ipv6 recently.
Eric
^ permalink raw reply
* Re: [PATCH] cfg80211: support sysfs namespaces
From: Johannes Berg @ 2010-08-05 20:05 UTC (permalink / raw)
To: Eric W. Biederman; +Cc: John Linville, linux-wireless, netdev
In-Reply-To: <m1wrs47shi.fsf-+imSwln9KH6u2/kzUuoCbdi2O/JbrIOy@public.gmane.org>
On Thu, 2010-08-05 at 12:46 -0700, Eric W. Biederman wrote:
> Johannes Berg <johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org> writes:
>
> > From: Johannes Berg <johannes.berg-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> >
> > Enable using network namespaces with
> > wireless devices even when sysfs is
> > enabled using the same infrastructure
> > that was built for netdevs.
>
> Acked-by: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
>
> This looks reasonable. I assume you have tested this and it is
> working now?
Yes, I tested it. Was missing the no-op device_rename() at first, but
now it works.
johannes
--
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: null pointer at cls_api.c
From: David Miller @ 2010-08-05 20:07 UTC (permalink / raw)
To: franchoze; +Cc: netdev
In-Reply-To: <282881281036255@web101.yandex.ru>
From: Franchoze Eric <franchoze@yandex.ru>
Date: Thu, 05 Aug 2010 23:24:15 +0400
> @@ -255,6 +255,11 @@ replay:
> kfree(tp);
> goto errout;
> }
> +
> + if (!tp || !tp->ops) {
> + err = -ENOENT;
> + goto errout;
> + }
> tp->ops = tp_ops;
> tp->protocol = protocol;
> tp->prio = nprio ? : TC_H_MAJ(tcf_auto_prio(*back));
>
This patch makes no sense.
We check for "tp" being non-NULL in the code block about the if() block you're
adding these checks to.
And tp->ops of course might be NULL here, and that's perfectly fine,
as we're about to assign "tp_ops" to it.
Looking at your backtrace I think perhaps your crash is elsewhere.
^ permalink raw reply
* [PATCH RFC] vhost: max s/g to match qemu
From: Michael S. Tsirkin @ 2010-08-05 20:03 UTC (permalink / raw)
To: Michael S. Tsirkin, Aristeu Rozanski, Juan Quintela, Herbert Xu,
David S. Miller
qemu supports up to UIO_MAXIOV s/g so we have to match that.
Apparently windows guests rely on this (more precisely,
they want to fill all of vq with s/g entries of a single
descriptor).
Allocate indirect and log arrays dynamically to avoid
using too much contigious memory.
hdr array is used to store the virtio header.
Since each iovec entry has >= 1 byte length, we never need
more than header length entries to store the header.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
This fixes Red Hat bugzilla 619002.
Dave, I'll queue this through the vhost tree so there's no
need for you to apply this.
Labeling RFC to make this explicit.
drivers/vhost/vhost.c | 32 ++++++++++++++++++++++++++++++--
drivers/vhost/vhost.h | 17 ++++++++---------
2 files changed, 38 insertions(+), 11 deletions(-)
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index e519950..b21a5e5 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -123,10 +123,31 @@ static void vhost_vq_reset(struct vhost_dev *dev,
vq->log_ctx = NULL;
}
+/* Helper to allocate iovec buffers for all vqs. */
+static long vhost_dev_alloc_iovecs(struct vhost_dev *dev)
+{
+ int i;
+ for (i = 0; i < dev->nvqs; ++i) {
+ dev->vqs[i].indirect = kmalloc(GFP_KERNEL, UIO_MAXIOV *
+ sizeof *dev->vqs[i].indirect);
+ dev->vqs[i].log = kmalloc(GFP_KERNEL, UIO_MAXIOV *
+ sizeof *dev->vqs[i].log);
+ if (!dev->vqs[i].indirect || !dev->vqs[i].log)
+ goto err_nomem;
+ }
+ return 0;
+err_nomem:
+ for (; i >= 0; --i) {
+ kfree(dev->vqs[i].indirect);
+ kfree(dev->vqs[i].log);
+ }
+ return -ENOMEM;
+}
+
long vhost_dev_init(struct vhost_dev *dev,
struct vhost_virtqueue *vqs, int nvqs)
{
- int i;
+ int i, ret;
dev->vqs = vqs;
dev->nvqs = nvqs;
mutex_init(&dev->mutex);
@@ -136,6 +157,10 @@ long vhost_dev_init(struct vhost_dev *dev,
dev->mm = NULL;
dev->wq = NULL;
+ ret = vhost_dev_alloc_iovecs(dev);
+ if (ret)
+ return ret;
+
for (i = 0; i < dev->nvqs; ++i) {
dev->vqs[i].dev = dev;
mutex_init(&dev->vqs[i].mutex);
@@ -222,6 +247,9 @@ void vhost_dev_cleanup(struct vhost_dev *dev)
if (dev->vqs[i].call)
fput(dev->vqs[i].call);
vhost_vq_reset(dev, dev->vqs + i);
+
+ kfree(dev->vqs[i].indirect);
+ kfree(dev->vqs[i].log);
}
if (dev->log_ctx)
eventfd_ctx_put(dev->log_ctx);
@@ -824,7 +852,7 @@ static int get_indirect(struct vhost_dev *dev, struct vhost_virtqueue *vq,
}
ret = translate_desc(dev, indirect->addr, indirect->len, vq->indirect,
- ARRAY_SIZE(vq->indirect));
+ UIO_MAXIOV);
if (unlikely(ret < 0)) {
vq_err(vq, "Translation failure %d in indirect.\n", ret);
return ret;
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
index 19f4334..61b1a6e 100644
--- a/drivers/vhost/vhost.h
+++ b/drivers/vhost/vhost.h
@@ -12,14 +12,10 @@
#include <linux/uio.h>
#include <linux/virtio_config.h>
#include <linux/virtio_ring.h>
+#include <linux/virtio_net.h>
struct vhost_device;
-enum {
- /* Enough place for all fragments, head, and virtio net header. */
- VHOST_NET_MAX_SG = MAX_SKB_FRAGS + 2,
-};
-
/* Poll a file (eventfd or socket) */
/* Note: there's nothing vhost specific about this structure. */
struct vhost_poll {
@@ -83,9 +79,12 @@ struct vhost_virtqueue {
bool log_used;
u64 log_addr;
- struct iovec indirect[VHOST_NET_MAX_SG];
- struct iovec iov[VHOST_NET_MAX_SG];
- struct iovec hdr[VHOST_NET_MAX_SG];
+ struct iovec iov[UIO_MAXIOV];
+ /* hdr is used to store the virtio header.
+ * Since each iovec entry has >= 1 byte length, we never need more than
+ * header length entries to store the header. */
+ struct iovec hdr[sizeof(struct virtio_net_hdr_mrg_rxbuf)];
+ struct iovec *indirect;
size_t hdr_size;
/* We use a kind of RCU to access private pointer.
* All readers access it from workqueue, which makes it possible to
@@ -97,7 +96,7 @@ struct vhost_virtqueue {
void *private_data;
/* Log write descriptors */
void __user *log_base;
- struct vhost_log log[VHOST_NET_MAX_SG];
+ struct vhost_log *log;
};
struct vhost_dev {
--
1.7.2.rc0.14.g41c1c
^ permalink raw reply related
* Re: NET_NS: unregister_netdevice: waiting for lo to become free (adding ipv6 address to interface)
From: David Miller @ 2010-08-05 20:11 UTC (permalink / raw)
To: ebiederm; +Cc: lkml20100708, greg, netdev, linux-kernel, adobriyan, kaber
In-Reply-To: <m1bp9g7ry0.fsf@fess.ebiederm.org>
From: ebiederm@xmission.com (Eric W. Biederman)
Date: Thu, 05 Aug 2010 12:57:59 -0700
> I wonder what has changed with ipv6 recently.
There was a recent fix to the IGMP snooping code we have in
the bridging layer, if parsing of an ipv6 IGMP packet failed
we'd leak the packet (and thus references to whatever device
it referenced).
commit 6d1d1d398cb7db7a12c5d652d50f85355345234f
Author: Herbert Xu <herbert@gondor.apana.org.au>
Date: Thu Jul 29 01:12:31 2010 +0000
bridge: Fix skb leak when multicast parsing fails on TX
On the bridge TX path we're leaking an skb when br_multicast_rcv
returns an error.
Reported-by: David Lamparter <equinox@diac24.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index 4cec805..f49bcd9 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -48,8 +48,10 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
rcu_read_lock();
if (is_multicast_ether_addr(dest)) {
- if (br_multicast_rcv(br, NULL, skb))
+ if (br_multicast_rcv(br, NULL, skb)) {
+ kfree_skb(skb);
goto out;
+ }
mdst = br_mdb_get(br, skb);
if (mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb))
^ permalink raw reply related
* [PATCH 1/42] drivers/net/wan: Adjust confusing if indentation
From: Julia Lawall @ 2010-08-05 20:17 UTC (permalink / raw)
To: Krzysztof Halasa, netdev, linux-kernel, kernel-janitors
From: Julia Lawall <julia@diku.dk>
Indent the branch of an if.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r disable braces4@
position p1,p2;
statement S1,S2;
@@
(
if (...) { ... }
|
if (...) S1@p1 S2@p2
)
@script:python@
p1 << r.p1;
p2 << r.p2;
@@
if (p1[0].column == p2[0].column):
cocci.print_main("branch",p1)
cocci.print_secs("after",p2)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
drivers/net/wan/c101.c | 2 +-
drivers/net/wan/n2.c | 2 +-
drivers/net/wan/pci200syn.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wan/c101.c b/drivers/net/wan/c101.c
index 0bd898c..4ac85a0 100644
--- a/drivers/net/wan/c101.c
+++ b/drivers/net/wan/c101.c
@@ -264,7 +264,7 @@ static int c101_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
new_line.clock_type != CLOCK_TXFROMRX &&
new_line.clock_type != CLOCK_INT &&
new_line.clock_type != CLOCK_TXINT)
- return -EINVAL; /* No such clock setting */
+ return -EINVAL; /* No such clock setting */
if (new_line.loopback != 0 && new_line.loopback != 1)
return -EINVAL;
diff --git a/drivers/net/wan/n2.c b/drivers/net/wan/n2.c
index 5394b51..7a3720f 100644
--- a/drivers/net/wan/n2.c
+++ b/drivers/net/wan/n2.c
@@ -282,7 +282,7 @@ static int n2_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
new_line.clock_type != CLOCK_TXFROMRX &&
new_line.clock_type != CLOCK_INT &&
new_line.clock_type != CLOCK_TXINT)
- return -EINVAL; /* No such clock setting */
+ return -EINVAL; /* No such clock setting */
if (new_line.loopback != 0 && new_line.loopback != 1)
return -EINVAL;
diff --git a/drivers/net/wan/pci200syn.c b/drivers/net/wan/pci200syn.c
index e2cff64..fd73759 100644
--- a/drivers/net/wan/pci200syn.c
+++ b/drivers/net/wan/pci200syn.c
@@ -220,7 +220,7 @@ static int pci200_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
new_line.clock_type != CLOCK_TXFROMRX &&
new_line.clock_type != CLOCK_INT &&
new_line.clock_type != CLOCK_TXINT)
- return -EINVAL; /* No such clock setting */
+ return -EINVAL; /* No such clock setting */
if (new_line.loopback != 0 && new_line.loopback != 1)
return -EINVAL;
^ permalink raw reply related
* [PATCH 7/42] net/atm: Adjust confusing if indentation
From: Julia Lawall @ 2010-08-05 20:19 UTC (permalink / raw)
To: David S. Miller, linux-kernel, netdev, kernel-janitors
From: Julia Lawall <julia@diku.dk>
Outdent the code following an if.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r disable braces4@
position p1,p2;
statement S1,S2;
@@
(
if (...) { ... }
|
if (...) S1@p1 S2@p2
)
@script:python@
p1 << r.p1;
p2 << r.p2;
@@
if (p1[0].column == p2[0].column):
cocci.print_main("branch",p1)
cocci.print_secs("after",p2)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
net/atm/common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/atm/common.c b/net/atm/common.c
index 940404a..1b9c52a 100644
--- a/net/atm/common.c
+++ b/net/atm/common.c
@@ -792,7 +792,7 @@ int vcc_getsockopt(struct socket *sock, int level, int optname,
default:
if (level == SOL_SOCKET)
return -EINVAL;
- break;
+ break;
}
if (!vcc->dev || !vcc->dev->ops->getsockopt)
return -EINVAL;
^ permalink raw reply related
* [PATCH 8/42] drivers/net/ixgbe: Adjust confusing if indentation
From: Julia Lawall @ 2010-08-05 20:19 UTC (permalink / raw)
To: Jeff Kirsher, Jesse Brandeburg, Bruce Allan, Alex Duyck, PJ
From: Julia Lawall <julia@diku.dk>
Both ifs and assignments to autoc seem similar enough that they are both
put in the if branch indicated by their indentation.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r disable braces4@
position p1,p2;
statement S1,S2;
@@
(
if (...) { ... }
|
if (...) S1@p1 S2@p2
)
@script:python@
p1 << r.p1;
p2 << r.p2;
@@
if (p1[0].column == p2[0].column):
cocci.print_main("branch",p1)
cocci.print_secs("after",p2)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
This changes the semantics and might be the wrong fix. Not tested.
drivers/net/ixgbe/ixgbe_82599.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ixgbe/ixgbe_82599.c b/drivers/net/ixgbe/ixgbe_82599.c
index 3e06a61..a5fcdce 100644
--- a/drivers/net/ixgbe/ixgbe_82599.c
+++ b/drivers/net/ixgbe/ixgbe_82599.c
@@ -766,12 +766,13 @@ s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw,
link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII) {
/* Set KX4/KX/KR support according to speed requested */
autoc &= ~(IXGBE_AUTOC_KX4_KX_SUPP_MASK | IXGBE_AUTOC_KR_SUPP);
- if (speed & IXGBE_LINK_SPEED_10GB_FULL)
+ if (speed & IXGBE_LINK_SPEED_10GB_FULL) {
if (orig_autoc & IXGBE_AUTOC_KX4_SUPP)
autoc |= IXGBE_AUTOC_KX4_SUPP;
if ((orig_autoc & IXGBE_AUTOC_KR_SUPP) &&
(hw->phy.smart_speed_active == false))
autoc |= IXGBE_AUTOC_KR_SUPP;
+ }
if (speed & IXGBE_LINK_SPEED_1GB_FULL)
autoc |= IXGBE_AUTOC_KX_SUPP;
} else if ((pma_pmd_1g == IXGBE_AUTOC_1G_SFI) &&
^ permalink raw reply related
* Re: [PATCH] usbnet: remove noisy and hardly useful printk
From: David Miller @ 2010-08-05 20:21 UTC (permalink / raw)
To: christian.samsel; +Cc: netdev, dhollis
In-Reply-To: <1280996076-19708-1-git-send-email-christian.samsel@rwth-aachen.de>
From: Christian Samsel <christian.samsel@rwth-aachen.de>
Date: Thu, 05 Aug 2010 10:14:36 +0200
> With turned on hspa modem (Dell 5530 internal card) and activated usb auto
> suspend, my system gets up 100 "usbnet_resume has delayed data" per
> minute. I didnt noticed any pathological behaviour, so just drop
> this message. if any objections, please at least change it to _DEBUG.
>
> Signed-off-by: Christian Samsel <christian.samsel@rwth-aachen.de>
I agree, and I'll apply this, thanks.
^ permalink raw reply
* Re: [patch] isdn: fix information leak
From: David Miller @ 2010-08-05 20:21 UTC (permalink / raw)
To: error27; +Cc: isdn, netdev, kernel-janitors
In-Reply-To: <20100805093806.GF9031@bicker>
From: Dan Carpenter <error27@gmail.com>
Date: Thu, 5 Aug 2010 11:38:06 +0200
> The main motivation of this patch changing strcpy() to strlcpy().
> We strcpy() to copy a 48 byte buffers into a 49 byte buffers. So at
> best the last byte has leaked information, or maybe there is an
> overflow? Anyway, this patch closes the information leaks by zeroing
> the memory and the calls to strlcpy() prevent overflows.
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
Applied.
^ permalink raw reply
* [PATCH 16/42] net/ipv6/netfilter: Adjust confusing if indentation
From: Julia Lawall @ 2010-08-05 20:21 UTC (permalink / raw)
To: Patrick McHardy, David S. Miller, Alexey Kuznetsov,
Pekka Savola (ipv6), James Morris <jmorris@
From: Julia Lawall <julia@diku.dk>
Indent the branch of an if.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r disable braces4@
position p1,p2;
statement S1,S2;
@@
(
if (...) { ... }
|
if (...) S1@p1 S2@p2
)
@script:python@
p1 << r.p1;
p2 << r.p2;
@@
if (p1[0].column == p2[0].column):
cocci.print_main("branch",p1)
cocci.print_secs("after",p2)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
index 1df3c8b..befccff 100644
--- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
@@ -192,7 +192,7 @@ icmpv6_error(struct net *net, struct nf_conn *tmpl,
icmp6h = skb_header_pointer(skb, dataoff, sizeof(_ih), &_ih);
if (icmp6h == NULL) {
if (LOG_INVALID(net, IPPROTO_ICMPV6))
- nf_log_packet(PF_INET6, 0, skb, NULL, NULL, NULL,
+ nf_log_packet(PF_INET6, 0, skb, NULL, NULL, NULL,
"nf_ct_icmpv6: short packet ");
return -NF_ACCEPT;
}
^ permalink raw reply related
* Re: [PATCH v2] net: Fix napi_gro_frags vs netpoll path
From: David Miller @ 2010-08-05 20:22 UTC (permalink / raw)
To: jarkao2; +Cc: netdev, herbert, xiaohui.xin
In-Reply-To: <20100805111911.GB19965@ff.dom.local>
From: Jarek Poplawski <jarkao2@gmail.com>
Date: Thu, 5 Aug 2010 11:19:11 +0000
> Slight changelog and subject fixes only, sorry.
>
> Jarek P.
> ------------------>
>
> The netpoll_rx_on() check in __napi_gro_receive() skips part of the
> "common" GRO_NORMAL path, especially "pull:" in dev_gro_receive(),
> where at least eth header should be copied for entirely paged skbs.
>
> Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
Applied, with Herbert's ACK to v1.
^ permalink raw reply
* Re: null pointer at cls_api.c
From: Stephen Hemminger @ 2010-08-05 20:21 UTC (permalink / raw)
To: David Miller; +Cc: franchoze, netdev
In-Reply-To: <20100805.130755.57491167.davem@davemloft.net>
On Thu, 05 Aug 2010 13:07:55 -0700 (PDT)
David Miller <davem@davemloft.net> wrote:
> From: Franchoze Eric <franchoze@yandex.ru>
> Date: Thu, 05 Aug 2010 23:24:15 +0400
>
> > @@ -255,6 +255,11 @@ replay:
> > kfree(tp);
> > goto errout;
> > }
> > +
> > + if (!tp || !tp->ops) {
> > + err = -ENOENT;
> > + goto errout;
> > + }
> > tp->ops = tp_ops;
> > tp->protocol = protocol;
> > tp->prio = nprio ? : TC_H_MAJ(tcf_auto_prio(*back));
> >
>
> This patch makes no sense.
>
> We check for "tp" being non-NULL in the code block about the if() block you're
> adding these checks to.
>
> And tp->ops of course might be NULL here, and that's perfectly fine,
> as we're about to assign "tp_ops" to it.
>
> Looking at your backtrace I think perhaps your crash is elsewhere.
Looks like a cls_u32 bug:
Aug 5 12:58:21 nehalam kernel: [15160.920162] u32 classifier
Aug 5 12:58:21 nehalam kernel: [15160.920165] Actions configured
Aug 5 12:58:21 nehalam kernel: [15160.920346] PGD b6901067 PUD 93323067 PMD 0
Aug 5 12:58:21 nehalam kernel: [15160.920357] CPU 6
Aug 5 12:58:21 nehalam kernel: [15160.920358] Modules linked in: cls_u32 sch_sfq sch_htb dummy ntfs vfat msdos fat nfs lockd fscache nfs_acl auth_rpcgss sunrpc autofs4 binfmt_misc ipt_MASQUERADE iptable_nat nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack ipt_REJECT xt_tcpudp iptable_filter ip_tables x_tables bridge stp llc kvm_intel kvm radeon ttm drm_kms_helper drm i2c_algo_bit snd_hda_codec_analog ipv6 snd_hda_intel snd_hda_codec snd_hwdep snd_pcm_oss snd_mixer_oss snd_pcm snd_seq_dummy snd_seq_oss snd_seq_midi snd_rawmidi snd_seq_midi_event snd_seq snd_timer snd_seq_device snd psmouse asus_atk0110 soundcore serio_raw snd_page_alloc usbhid mvsas libsas floppy scsi_transport_sas e1000e sky2
Aug 5 12:58:21 nehalam kernel: [15160.920427]
Aug 5 12:58:21 nehalam kernel: [15160.920433] Pid: 25645, comm: tc Not tainted 2.6.35+ #31 P6T DELUXE/System Product Name
Aug 5 12:58:21 nehalam kernel: [15160.920436] RIP: 0010:[<0000000000000000>] [<(null)>] (null)
Aug 5 12:58:21 nehalam kernel: [15160.920441] RSP: 0018:ffff880093399850 EFLAGS: 00010286
Aug 5 12:58:21 nehalam kernel: [15160.920445] RAX: ffffffffa0502fc0 RBX: ffff8801b38bd9c0 RCX: ffff880093399878
Aug 5 12:58:21 nehalam kernel: [15160.920449] RDX: 0000000000020001 RSI: 0000000000000000 RDI: ffff880047d88000
Aug 5 12:58:21 nehalam kernel: [15160.920452] RBP: ffff8800933998b8 R08: ffffffffa050a4a0 R09: 0000000000000000
Aug 5 12:58:21 nehalam kernel: [15160.920456] R10: ffffffffa050997e R11: 2222222222222222 R12: ffff8801b4eb9d40
Aug 5 12:58:21 nehalam kernel: [15160.920461] R13: ffff8800933998e8 R14: ffff880093399878 R15: ffff8801b4fdc740
Aug 5 12:58:21 nehalam kernel: [15160.920466] FS: 00007fb43c74d700(0000) GS:ffff880001ec0000(0000) knlGS:0000000000000000
Aug 5 12:58:21 nehalam kernel: [15160.920471] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
Aug 5 12:58:21 nehalam kernel: [15160.920475] CR2: 0000000000000000 CR3: 000000001ccfb000 CR4: 00000000000006e0
Aug 5 12:58:21 nehalam kernel: [15160.920480] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
Aug 5 12:58:21 nehalam kernel: [15160.920484] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Aug 5 12:58:21 nehalam kernel: [15160.920489] Process tc (pid: 25645, threadinfo ffff880093398000, task ffff8801b77802c0)
Aug 5 12:58:21 nehalam kernel: [15160.920495] ffffffffa0509c05 ffff8800933998a8 ffffffff8110208a ffff8800933998b8
Aug 5 12:58:21 nehalam kernel: [15160.920501] <0> 0000000000000000 0000000000000000 ffff8801b4fdc740 ffff8801b38bd9c0
Aug 5 12:58:21 nehalam kernel: [15160.920509] <0> ffff8801b4fdc740 ffff8801b38bd9c0 ffff8800933999e8 0000000080000800
Aug 5 12:58:21 nehalam kernel: [15160.920524] [<ffffffffa0509c05>] ? u32_set_parms+0x125/0x260 [cls_u32]
Aug 5 12:58:21 nehalam kernel: [15160.920531] [<ffffffff8110208a>] ? __kmalloc+0x21a/0x230
Aug 5 12:58:21 nehalam kernel: [15160.920537] [<ffffffffa0509f18>] u32_change+0x1d8/0x4f0 [cls_u32]
Aug 5 12:58:21 nehalam kernel: [15160.920543] [<ffffffffa050a338>] ? u32_init+0x108/0x180 [cls_u32]
Aug 5 12:58:21 nehalam kernel: [15160.920551] [<ffffffff813f90e1>] tc_ctl_tfilter+0x321/0x780
Aug 5 12:58:21 nehalam kernel: [15160.920560] [<ffffffff813ea733>] rtnetlink_rcv_msg+0x163/0x270
Aug 5 12:58:21 nehalam kernel: [15160.920564] [<ffffffff813ea5d0>] ? rtnetlink_rcv_msg+0x0/0x270
Aug 5 12:58:21 nehalam kernel: [15160.920568] [<ffffffff813fed31>] netlink_rcv_skb+0xa1/0xd0
Aug 5 12:58:21 nehalam kernel: [15160.920572] [<ffffffff813ea5c0>] rtnetlink_rcv+0x20/0x30
Aug 5 12:58:21 nehalam kernel: [15160.920576] [<ffffffff813fe966>] netlink_unicast+0x296/0x2e0
Aug 5 12:58:21 nehalam kernel: [15160.920579] [<ffffffff813ff73e>] netlink_sendmsg+0x1fe/0x2e0
Aug 5 12:58:21 nehalam kernel: [15160.920585] [<ffffffff813cac9e>] sock_sendmsg+0xee/0x120
Aug 5 12:58:21 nehalam kernel: [15160.920590] [<ffffffff813cb77d>] ? move_addr_to_kernel+0x5d/0x60
Aug 5 12:58:21 nehalam kernel: [15160.920594] [<ffffffff813d6513>] ? verify_iovec+0x93/0x100
Aug 5 12:58:21 nehalam kernel: [15160.920598] [<ffffffff813cc510>] sys_sendmsg+0x240/0x3a0
Aug 5 12:58:21 nehalam kernel: [15160.920604] [<ffffffff8109a664>] ? audit_syscall_entry+0x254/0x280
Aug 5 12:58:21 nehalam kernel: [15160.920609] [<ffffffff8148622d>] ? do_page_fault+0x14d/0x310
Aug 5 12:58:21 nehalam kernel: [15160.920614] [<ffffffff810026ab>] system_call_fastpath+0x16/0x1b
Aug 5 12:58:21 nehalam kernel: [15160.920625] RSP <ffff880093399850>
Aug 5 12:58:21 nehalam kernel: [15160.920629] ---[ end trace fad08b9c79000a10 ]---
^ permalink raw reply
* [PATCH 17/42] drivers/net/irda: Adjust confusing if indentation
From: Julia Lawall @ 2010-08-05 20:22 UTC (permalink / raw)
To: Samuel Ortiz, netdev, linux-kernel, kernel-janitors
From: Julia Lawall <julia@diku.dk>
Indent the branch of an if.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r disable braces4@
position p1,p2;
statement S1,S2;
@@
(
if (...) { ... }
|
if (...) S1@p1 S2@p2
)
@script:python@
p1 << r.p1;
p2 << r.p2;
@@
if (p1[0].column == p2[0].column):
cocci.print_main("branch",p1)
cocci.print_secs("after",p2)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
drivers/net/irda/mcs7780.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/irda/mcs7780.c b/drivers/net/irda/mcs7780.c
index 5b1036a..74b20f1 100644
--- a/drivers/net/irda/mcs7780.c
+++ b/drivers/net/irda/mcs7780.c
@@ -734,7 +734,7 @@ static int mcs_net_open(struct net_device *netdev)
}
if (!mcs_setup_urbs(mcs))
- goto error3;
+ goto error3;
ret = mcs_receive_start(mcs);
if (ret)
^ permalink raw reply related
* [PATCH 18/42] drivers/net: Adjust confusing if indentation
From: Julia Lawall @ 2010-08-05 20:22 UTC (permalink / raw)
To: netdev, linux-kernel, kernel-janitors
From: Julia Lawall <julia@diku.dk>
In amd8111e.c, indent the branch of an if.
In eepro.c, outdent the code following the if.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r disable braces4@
position p1,p2;
statement S1,S2;
@@
(
if (...) { ... }
|
if (...) S1@p1 S2@p2
)
@script:python@
p1 << r.p1;
p2 << r.p2;
@@
if (p1[0].column == p2[0].column):
cocci.print_main("branch",p1)
cocci.print_secs("after",p2)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
drivers/net/amd8111e.c | 4 ++--
drivers/net/eepro.c | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c
index 585c25f..1f5fc64 100644
--- a/drivers/net/amd8111e.c
+++ b/drivers/net/amd8111e.c
@@ -396,7 +396,7 @@ static int amd8111e_set_coalesce(struct net_device * dev, enum coal_mode cmod)
event_count = coal_conf->rx_event_count;
if( timeout > MAX_TIMEOUT ||
event_count > MAX_EVENT_COUNT )
- return -EINVAL;
+ return -EINVAL;
timeout = timeout * DELAY_TIMER_CONV;
writel(VAL0|STINTEN, mmio+INTEN0);
@@ -409,7 +409,7 @@ static int amd8111e_set_coalesce(struct net_device * dev, enum coal_mode cmod)
event_count = coal_conf->tx_event_count;
if( timeout > MAX_TIMEOUT ||
event_count > MAX_EVENT_COUNT )
- return -EINVAL;
+ return -EINVAL;
timeout = timeout * DELAY_TIMER_CONV;
diff --git a/drivers/net/eepro.c b/drivers/net/eepro.c
index 8d97f16..7c82631 100644
--- a/drivers/net/eepro.c
+++ b/drivers/net/eepro.c
@@ -1457,11 +1457,11 @@ hardware_send_packet(struct net_device *dev, void *buf, short length)
if (net_debug > 5)
printk(KERN_DEBUG "%s: entering hardware_send_packet routine.\n", dev->name);
- /* determine how much of the transmit buffer space is available */
- if (lp->tx_end > lp->tx_start)
+ /* determine how much of the transmit buffer space is available */
+ if (lp->tx_end > lp->tx_start)
tx_available = lp->xmt_ram - (lp->tx_end - lp->tx_start);
- else if (lp->tx_end < lp->tx_start)
- tx_available = lp->tx_start - lp->tx_end;
+ else if (lp->tx_end < lp->tx_start)
+ tx_available = lp->tx_start - lp->tx_end;
else tx_available = lp->xmt_ram;
if (((((length + 3) >> 1) << 1) + 2*XMT_HEADER) >= tx_available) {
^ permalink raw reply related
* [PATCH 23/42] drivers/net/wireless/libertas: Adjust confusing if indentation
From: Julia Lawall @ 2010-08-05 20:23 UTC (permalink / raw)
To: Dan Williams, John W. Linville, libertas-dev, linux-wireless,
netdev, linux-kernel
From: Julia Lawall <julia@diku.dk>
At the point of the patched code, err has already been tested, so it is
only worthwhile to test it again in the if branches where it is changed.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r disable braces4@
position p1,p2;
statement S1,S2;
@@
(
if (...) { ... }
|
if (...) S1@p1 S2@p2
)
@script:python@
p1 << r.p1;
p2 << r.p2;
@@
if (p1[0].column == p2[0].column):
cocci.print_main("branch",p1)
cocci.print_secs("after",p2)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
drivers/net/wireless/libertas/if_spi.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c
index fe3f080..3965c6c 100644
--- a/drivers/net/wireless/libertas/if_spi.c
+++ b/drivers/net/wireless/libertas/if_spi.c
@@ -800,14 +800,16 @@ static int lbs_spi_thread(void *data)
goto err;
}
- if (hiStatus & IF_SPI_HIST_CMD_UPLOAD_RDY)
+ if (hiStatus & IF_SPI_HIST_CMD_UPLOAD_RDY) {
err = if_spi_c2h_cmd(card);
if (err)
goto err;
- if (hiStatus & IF_SPI_HIST_RX_UPLOAD_RDY)
+ }
+ if (hiStatus & IF_SPI_HIST_RX_UPLOAD_RDY) {
err = if_spi_c2h_data(card);
if (err)
goto err;
+ }
/* workaround: in PS mode, the card does not set the Command
* Download Ready bit, but it sets TX Download Ready. */
^ permalink raw reply related
* [PATCH 28/42] drivers/atm: Adjust confusing if indentation
From: Julia Lawall @ 2010-08-05 20:25 UTC (permalink / raw)
To: Chas Williams, linux-atm-general, netdev, linux-kernel,
kernel-janitors
From: Julia Lawall <julia@diku.dk>
Indent the branch of an if.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r disable braces4@
position p1,p2;
statement S1,S2;
@@
(
if (...) { ... }
|
if (...) S1@p1 S2@p2
)
@script:python@
p1 << r.p1;
p2 << r.p2;
@@
if (p1[0].column == p2[0].column):
cocci.print_main("branch",p1)
cocci.print_secs("after",p2)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
drivers/atm/iphase.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
index ee9ddeb..8b358d7 100644
--- a/drivers/atm/iphase.c
+++ b/drivers/atm/iphase.c
@@ -220,7 +220,7 @@ static u16 get_desc (IADEV *dev, struct ia_vcc *iavcc) {
while (!desc_num || (dev->desc_tbl[desc_num -1]).timestamp) {
dev->ffL.tcq_rd += 2;
if (dev->ffL.tcq_rd > dev->ffL.tcq_ed)
- dev->ffL.tcq_rd = dev->ffL.tcq_st;
+ dev->ffL.tcq_rd = dev->ffL.tcq_st;
if (dev->ffL.tcq_rd == dev->host_tcq_wr)
return 0xFFFF;
desc_num = *(u_short *)(dev->seg_ram + dev->ffL.tcq_rd);
^ permalink raw reply related
* [PATCH 30/42] drivers/net/wireless/prism54: Adjust confusing if indentation
From: Julia Lawall @ 2010-08-05 20:26 UTC (permalink / raw)
To: Luis R. Rodriguez, John W. Linville, linux-wireless, netdev,
linux-kernel, kernel-janit
From: Julia Lawall <julia@diku.dk>
Indent the branch of an if.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r disable braces4@
position p1,p2;
statement S1,S2;
@@
(
if (...) { ... }
|
if (...) S1@p1 S2@p2
)
@script:python@
p1 << r.p1;
p2 << r.p2;
@@
if (p1[0].column == p2[0].column):
cocci.print_main("branch",p1)
cocci.print_secs("after",p2)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
drivers/net/wireless/prism54/isl_ioctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/prism54/isl_ioctl.c b/drivers/net/wireless/prism54/isl_ioctl.c
index 77cd65d..d97a2ca 100644
--- a/drivers/net/wireless/prism54/isl_ioctl.c
+++ b/drivers/net/wireless/prism54/isl_ioctl.c
@@ -3234,7 +3234,7 @@ prism54_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)
switch (cmd) {
case PRISM54_HOSTAPD:
if (!capable(CAP_NET_ADMIN))
- return -EPERM;
+ return -EPERM;
ret = prism54_hostapd(ndev, &wrq->u.data);
return ret;
}
^ permalink raw reply related
* [PATCH 31/42] drivers/net: Adjust confusing if indentation
From: Julia Lawall @ 2010-08-05 20:26 UTC (permalink / raw)
To: Grant Likely, netdev-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA
From: Julia Lawall <julia-dAYI7NvHqcQ@public.gmane.org>
Outdent the code following the if.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r disable braces4@
position p1,p2;
statement S1,S2;
@@
(
if (...) { ... }
|
if (...) S1@p1 S2@p2
)
@script:python@
p1 << r.p1;
p2 << r.p2;
@@
if (p1[0].column == p2[0].column):
cocci.print_main("branch",p1)
cocci.print_secs("after",p2)
// </smpl>
Signed-off-by: Julia Lawall <julia-dAYI7NvHqcQ@public.gmane.org>
---
drivers/net/gianfar.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index a1b6301..36ccc37 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -1859,7 +1859,7 @@ static int register_grp_irqs(struct gfar_priv_grp *grp)
printk(KERN_ERR "%s: Can't get IRQ %d\n",
dev->name, grp->interruptError);
- goto err_irq_fail;
+ goto err_irq_fail;
}
if ((err = request_irq(grp->interruptTransmit, gfar_transmit,
^ permalink raw reply related
* [PATCH 32/42] drivers/net/bnx2x: Adjust confusing if indentation
From: Julia Lawall @ 2010-08-05 20:26 UTC (permalink / raw)
To: Eilon Greenstein, netdev, linux-kernel, kernel-janitors
From: Julia Lawall <julia@diku.dk>
Outdent the code following the if.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r disable braces4@
position p1,p2;
statement S1,S2;
@@
(
if (...) { ... }
|
if (...) S1@p1 S2@p2
)
@script:python@
p1 << r.p1;
p2 << r.p2;
@@
if (p1[0].column == p2[0].column):
cocci.print_main("branch",p1)
cocci.print_secs("after",p2)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
This patch doesn't change the semantics of the code. But it might not be
what is intended.
drivers/net/bnx2x/bnx2x_link.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/bnx2x/bnx2x_link.c b/drivers/net/bnx2x/bnx2x_link.c
index 0383e30..0fa0991 100644
--- a/drivers/net/bnx2x/bnx2x_link.c
+++ b/drivers/net/bnx2x/bnx2x_link.c
@@ -1254,11 +1254,11 @@ static void bnx2x_set_autoneg(struct link_params *params,
PORT_HW_CFG_SPEED_CAPABILITY_D0_1G)
reg_val |= MDIO_CL73_IEEEB1_AN_ADV2_ADVR_1000M_KX;
- CL45_WR_OVER_CL22(bp, params->port,
- params->phy_addr,
- MDIO_REG_BANK_CL73_IEEEB1,
- MDIO_CL73_IEEEB1_AN_ADV2,
- reg_val);
+ CL45_WR_OVER_CL22(bp, params->port,
+ params->phy_addr,
+ MDIO_REG_BANK_CL73_IEEEB1,
+ MDIO_CL73_IEEEB1_AN_ADV2,
+ reg_val);
/* CL73 Autoneg Enabled */
reg_val = MDIO_CL73_IEEEB0_CL73_AN_CONTROL_AN_EN;
^ permalink raw reply related
* [PATCH 33/42] drivers/net/wireless/ath/ath9k: Adjust confusing if indentation
From: Julia Lawall @ 2010-08-05 20:26 UTC (permalink / raw)
To: Luis R. Rodriguez, Jouni Malinen, Sujith Manoharan,
Vasanthakumar Thiagarajan
From: Julia Lawall <julia@diku.dk>
Outdent the code following the if.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r disable braces4@
position p1,p2;
statement S1,S2;
@@
(
if (...) { ... }
|
if (...) S1@p1 S2@p2
)
@script:python@
p1 << r.p1;
p2 << r.p2;
@@
if (p1[0].column == p2[0].column):
cocci.print_main("branch",p1)
cocci.print_secs("after",p2)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
This patch doesn't change the semantics of the code. But it might not be
what is intended.
drivers/net/wireless/ath/ath9k/ar9003_mac.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_mac.c b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
index 5b995be..a462da2 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_mac.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
@@ -185,7 +185,7 @@ static bool ar9003_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked)
ath_print(common, ATH_DBG_INTERRUPT,
"AR_INTR_SYNC_LOCAL_TIMEOUT\n");
- REG_WRITE(ah, AR_INTR_SYNC_CAUSE_CLR, sync_cause);
+ REG_WRITE(ah, AR_INTR_SYNC_CAUSE_CLR, sync_cause);
(void) REG_READ(ah, AR_INTR_SYNC_CAUSE_CLR);
}
^ permalink raw reply related
* [PATCH 37/42] drivers/net/hamradio: Adjust confusing if indentation
From: Julia Lawall @ 2010-08-05 20:28 UTC (permalink / raw)
To: Joerg Reuter, Klaus Kudielka, linux-hams, netdev, linux-kernel,
kernel-janitors
From: Julia Lawall <julia@diku.dk>
Indent the branch of an if.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r disable braces4@
position p1,p2;
statement S1,S2;
@@
(
if (...) { ... }
|
if (...) S1@p1 S2@p2
)
@script:python@
p1 << r.p1;
p2 << r.p2;
@@
if (p1[0].column == p2[0].column):
cocci.print_main("branch",p1)
cocci.print_secs("after",p2)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
drivers/net/hamradio/scc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/hamradio/scc.c b/drivers/net/hamradio/scc.c
index 9f64c86..3365581 100644
--- a/drivers/net/hamradio/scc.c
+++ b/drivers/net/hamradio/scc.c
@@ -1069,7 +1069,8 @@ static void scc_tx_done(struct scc_channel *scc)
case KISS_DUPLEX_LINK:
scc->stat.tx_state = TXS_IDLE2;
if (scc->kiss.idletime != TIMER_OFF)
- scc_start_tx_timer(scc, t_idle, scc->kiss.idletime*100);
+ scc_start_tx_timer(scc, t_idle,
+ scc->kiss.idletime*100);
break;
case KISS_DUPLEX_OPTIMA:
scc_notify(scc, HWEV_ALL_SENT);
^ 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