Re: powernow-k8 and non-standard multipliers

2007-11-14 Thread Philip Langdale
Langsdorf, Mark wrote:
> 
> The standard PowerNow! driver, by design, will stop 
> working in this situation.  I'm not going to support
> a driver that allows non-standard multipliers because
> it could cause a lot of hard to debug maintenance
> issues.

Just a follow-up to get this into the public record. I
discussed this with Mark privately and then did more
digging and established that in my particular case, the
problem was that the BIOS was hiding the p-state table
when a non-standard multiplier was used. So, I built
a custom DSDT that included the p-state table along
with an extra entry for my higher speed and now I've
happily got powernow support again.

--phil
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support

2007-11-14 Thread Thomas Gleixner
On Wed, 14 Nov 2007, David Brownell wrote:

> On Wednesday 14 November 2007, Thomas Gleixner wrote:
> > struct gpio_desc {
> >struct gpio_chip *chip;
> >int pinoffset;
> > };
> 
> Eric Miao has a different notion of "gpio_desc" more analagous to
> the "irq_desc", so I'll not use that name for such a structure.
> 
> Let me call yours a "struct gpio_pin" instead -- purely for some
> discussion here.
>
> 
> There's been some desire for a "gpio_pin" struct for entirely
> different reasons ... as the identifiers passed into a slightly
> different type of GPIO programming interface.  So for example
> 
>   static inline void gpiopin_set_value(struct gpio_pin *p, int v)
>   {
>   p->chip->set(p->chip, p->pinoffset, v);
>   }
> 
> One reason to be interested in gpio_chip is that it it would
> easily support interoperation between traditional GPIO ID schemes
> (numbered to match the SOC at the heart of a given board) and
> more dynamic ones that might be needed to use curiousities like
> a set of USB-to-GPIO adapters.

So can we please do this right from the beginning instead of adding a
new library first which suffers from bad design compromises.

tglx
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 06/23] Fix SKB_WITH_OVERHEAD calculations.

2007-11-14 Thread Herbert Xu
On Wed, Nov 14, 2007 at 11:00:39PM -0800, David Miller wrote:
>
> I was just about to mention this and what I think we should do
> instead is keep the SKB_WITH_OVERHEAD calculation fix in there
> (it fixes a serious bug which users are hitting) and add the
> fix for the second bug fix this round as well.
> 
> Therefore, Greg please keep the patch add the following one as it will
> address all of the issues.

I agree.  If the stable team could make an exception for this
it would be great.

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support

2007-11-14 Thread Thomas Gleixner
On Wed, 14 Nov 2007, David Brownell wrote:
> > The protection of the chip list can be converted to a mutex and
> > does not need to be a spinlock at all.
> 
> No, we still need to use a spinlock to protect table changes.
> The reason for that is briefly:
> 
>   - gpio_request()/gpio_free() have so far been optional.  Most
> platforms implement them as NOPs, not all drivers use them.
> (Having gpiolib in place should help change that ...)

By magically doing the request of the pin ? See below.

>   - gpio_direction_input()/gpio_direction_output() implicitly
> request the pins, if they weren't already requested.

Eek, that's completely wrong. Allowing to access a resource _before_
it is assigned and then doing the assignment implicit is a really bad
idea.

>   - Those input/output direction-setting calls may be called
> in IRQ contexts, which means (on non-RT kernels) no mutex.

There is no reason to do that if you actually have a useful reference
to the chip _before_ accessing the pin.
 
> So we're actually in good shape; just take out a bit of code
> (or turn it into debugging instrumentation) and I don't think
> anyone will complain about the locking any more.

This still does not solve the lookup, which is done for each operation
on a pin (direction setting, read, write).

 tglx

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support

2007-11-14 Thread David Brownell
On Wednesday 14 November 2007, Thomas Gleixner wrote:
> struct gpio_desc {
>        struct gpio_chip *chip;
>        int pinoffset;
> };

Eric Miao has a different notion of "gpio_desc" more analagous to
the "irq_desc", so I'll not use that name for such a structure.

Let me call yours a "struct gpio_pin" instead -- purely for some
discussion here.


There's been some desire for a "gpio_pin" struct for entirely
different reasons ... as the identifiers passed into a slightly
different type of GPIO programming interface.  So for example

  static inline void gpiopin_set_value(struct gpio_pin *p, int v)
  {
p->chip->set(p->chip, p->pinoffset, v);
  }

One reason to be interested in gpio_chip is that it it would
easily support interoperation between traditional GPIO ID schemes
(numbered to match the SOC at the heart of a given board) and
more dynamic ones that might be needed to use curiousities like
a set of USB-to-GPIO adapters.

- Dave
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 16/19] x86 setup: handle boot loaders which set up the stack incorrectly

2007-11-14 Thread H. Peter Anvin

Greg KH wrote:

-stable review patch.  If anyone has any objections, please let us know.

--
From: H. Peter Anvin <[EMAIL PROTECTED]>

patch 6b6815c6d5d1dc209701d1661a7a0e09a295db2f in mainline.

Apparently some specific versions of LILO enter the kernel with a
stack pointer that doesn't match the rest of the segments.  Make our
best attempt at untangling the resulting mess.

Signed-off-by: H. Peter Anvin <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>


Just FYI:

It has been reported that while this patch fixes old LILO, and possibly 
some other boot loaders (unknown), it has also broken older versions of 
SYSLINUX: they still boot, but the command line is truncated (exactly 
how much depends on the BIOS, but typical values are around 130 bytes.)


This is definitely traceable to a bug in SYSLINUX that was already fixed 
in release 3.50 (the current version of SYSLINUX is 3.52).


I have chosen to leave the patch in mainline, rather than trying yet 
another recipe and hope it doesn't break on some other random 
combination of bootloaders, since:


a) SYSLINUX is generally easily updated, compared to other bootloaders;
b) The failure mode is less severe (it still boots.)

... however, you may choose to call differently.

-hpa
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support

2007-11-14 Thread David Brownell
On Wednesday 14 November 2007, Haavard Skinnemoen wrote:
> On Wed, 14 Nov 2007 00:37:57 -0800
> David Brownell <[EMAIL PROTECTED]> wrote:
> 
> > Although another point is related to "trivial":  the data
> > is being protected through an operation too trivial to be
> > worth paying for any of that priority logic.
> 
> But isn't there any way we can remove the lock from the fast path
> altogether? What is it really protecting?

The integrity of the table.  Entries can be added and removed
(both operations being *RARE* which is good!) at any time.


> Since this is the code that runs under the lock

No, there's more than that.  This is what runs under it in
the hot paths, yes, but the gpio request/free paths do
more work than this.  (That includes direction setting,
since that can be an implicit request.)


> (excluding the "extra checks" case):
> 
> +static inline struct gpio_chip *gpio_to_chip(unsigned gpio)
> +{
> + return chips[gpio / ARCH_GPIOS_PER_CHIP];
> +}
> 
> I'd say it protects against chips being removed in the middle of the
> operation. However, this comment says that chips cannot be removed
> while any gpio on it is requested:
> 
> +/* gpio_lock protects the table of chips and to gpio_chip->requested.
> + * While any gpio is requested, its gpio_chip is not removable.  It's
> + * a raw spinlock to ensure safe access from hardirq contexts, and to
> + * shrink bitbang overhead:  per-bit preemption would be very wrong.
> + */
>
> And since we drop the lock before calling the actual get/set bit
> operation, we would be screwed anyway if the chip was removed during
> the call to __gpio_set_value(). So what does the lock really buy us?

The get/set bit calls are the hot paths.  Locking on those paths
buys us a consistent locking policy, which is obviously correct.
It's consistent with the request/free paths.

But I think what you're suggesting is that the "requested" flag
is effectively a long-term lock, so grabbing the spinlock on
those paths is not necessary.  Right?

Hmm ... that makes some sense.  I hadn't started out thinking of
that "requested" flag as a lock bit, but in fact that's what it
ended up becoming.

Removing the spinlock from those paths -- at least in the "no
extra checks case" -- would let us avoid all this flamage about
whether raw spinlocks are ever OK.

I think I forsee a patch coming...

- Dave
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support

2007-11-14 Thread David Brownell
On Wednesday 14 November 2007, Thomas Gleixner wrote:
> On Mon, 12 Nov 2007, David Brownell wrote:
> > > I'm still trying to understand what you've observed here.  Is it the case
> > > that a single gpio operation went from 6.4 up to 11.2 usecs?
> > 
> > That was a single bitbanged I2C bit transfer, with embedded udelay()s.
> > I believe that was four gpio operations, as summarized at the end of
> > that email above.  Enabling preempt + debug increased the cost of
> > each GPIO call from whatever it was (reasonable) by 1.2 usecs.
> 
> This raw lock change is just pampering over the design problem of the
> gpio lib:
> 
> There is no need to check for every single access to a GPIO pin,
> whether the pin has a valid number and the chip, which provides access
> to the pin, is still registered.

As Haavard had noted.  The "requested" flag is actually serving
as a longterm bit-level lock, which -- assuming well-behaved
callers, and no debug instrumentation -- obviates any need to
grab a spinlock in hot paths.


> Each driver, which wants to access a pin, needs to make sure that
> 
> - the pin is available
> - the pin is associated to this driver
> - the chip reference count is incremented
> 
> _before_ it starts to do anything with the pin. Once this is done the
> access to the pin is completely lock free except for the protection of
> the chip hardware itself.

That's what the gpio_request() call does, although it's using
something isomorphic to a refcount, not an actual refcount.

The key observation here is that we already *have* a bit which
is serving as a per-gpio lock.  It's just never been viewed as
a lock before.  :)


> The protection of the chip list can be converted to a mutex and
> does not need to be a spinlock at all.

No, we still need to use a spinlock to protect table changes.
The reason for that is briefly:

  - gpio_request()/gpio_free() have so far been optional.  Most
platforms implement them as NOPs, not all drivers use them.
(Having gpiolib in place should help change that ...)

  - gpio_direction_input()/gpio_direction_output() implicitly
request the pins, if they weren't already requested.

  - Those input/output direction-setting calls may be called
in IRQ contexts, which means (on non-RT kernels) no mutex.


So we're actually in good shape; just take out a bit of code
(or turn it into debugging instrumentation) and I don't think
anyone will complain about the locking any more.

- Dave

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support

2007-11-14 Thread David Brownell
On Tuesday 13 November 2007, Nick Piggin wrote:
> > All this does is prevent constant and needless checking for
> > "do you want to preempt me now?" "now?" "now?" in "now?" the
> > middle "now?" of "now?" i/o "now?" loops.
> 
> Actually that's wrong.

Certainly it's right for the mainstream kernel.  Dropping a
lock (other than a raw spinlock) does that checking; when a
loop needs to acquire then drop such a lock, that's exactly
what's going on.

And in the RT kernel, it's got to do the same thing ...
because dropping that lock may mean that a higher priority
task should immediately run and grab the lock.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support

2007-11-14 Thread David Brownell
On Tuesday 13 November 2007, Nick Piggin wrote:
> > > But these ones
> > > are raw locks rather than normal locks probably because that
> > > they are trivially an innermost and correct lock.
> >
> > As in the $SUBJECT case, I'd say.
> >
> > Although another point is related to "trivial":  the data
> > is being protected through an operation too trivial to be
> > worth paying for any of that priority logic.
> 
> A driver shouldn't get to decide that, IMO.

Not that I was talking about driver code...


> And if there is 
> some policy in the -rt tree allowing these decisions, then
> it's exactly the kind of thing we don't want upsream.

Making raw spinlocks available allows those decisions...

On the other hand, I can't see things working sanely
without them being available.  The problem seems to be
the usual one that crops up whenever anyone tries to
create a "bright line" decision algorithm in areas that
need flexibility.  Any "bright line" rule will lead to
wrong results.

- Dave

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [stable] warning, huge 2.6.23-stable review cycle about to start

2007-11-14 Thread Greg Kroah-Hartman
On Wed, Nov 14, 2007 at 09:59:02PM -0800, Greg Kroah-Hartman wrote:
> Ok, I've been slacking on the -stable front for a bit here, and didn't
> realize how far behind I've gotten.  Everyone has been sending patches
> in, which is great, but now we are facing a HUGE 114 patch release.
> 
> As there's no real way that everyone can review all of these patches,
> I've decided to split them up into 6 different categories, and will be
> sending patches out in these categories for review.  If people can just
> glance over the ones in the areas they care about, I would really
> appreciate it.

There are 6 different roll-up patches on kernel.org if people want to
use those instead:

> The 6 categories are:
>   - core kernel changes

http://www.kernel.org/pub/linux/kernel/v2.6/stable-review/patch-2.6.23.2-rc1.gz

>   - arch specific changes

http://www.kernel.org/pub/linux/kernel/v2.6/stable-review/patch-2.6.23.3-rc1.gz

>   - networking changes

http://www.kernel.org/pub/linux/kernel/v2.6/stable-review/patch-2.6.23.4-rc1.gz

>   - network driver changes

http://www.kernel.org/pub/linux/kernel/v2.6/stable-review/patch-2.6.23.5-rc1.gz

>   - non-network driver changes

http://www.kernel.org/pub/linux/kernel/v2.6/stable-review/patch-2.6.23.6-rc1.gz

>   - filesystems

http://www.kernel.org/pub/linux/kernel/v2.6/stable-review/patch-2.6.23.7-rc1.gz

thanks,

greg k-h
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 06/23] Fix SKB_WITH_OVERHEAD calculations.

2007-11-14 Thread David Miller
From: Herbert Xu <[EMAIL PROTECTED]>
Date: Thu, 15 Nov 2007 14:29:39 +0800

> On Wed, Nov 14, 2007 at 10:20:22PM -0800, Greg KH wrote:
> > -stable review patch.  If anyone has any objections, please let us know.
> > 
> > --
> > 
> > From: Herbert Xu <[EMAIL PROTECTED]>
> > 
> > patch deea84b0ae3d26b41502ae0a39fe7fe134e703d0 in mainline.
> > 
> > [NET]: Fix SKB_WITH_OVERHEAD calculation
> 
> Although this is correct as it is, it tirggers a latent bug
> which is fixed by
> 
> commit fb93134dfc2a6e6fbedc7c270a31da03fce88db9
> Author: Herbert Xu <[EMAIL PROTECTED]>
> Date:   Wed Nov 14 15:45:21 2007 -0800
> 
> [TCP]: Fix size calculation in sk_stream_alloc_pskb
> 
> So please postpone it to the next round such that both patches
> can be included together.

I was just about to mention this and what I think we should do
instead is keep the SKB_WITH_OVERHEAD calculation fix in there
(it fixes a serious bug which users are hitting) and add the
fix for the second bug fix this round as well.

Therefore, Greg please keep the patch add the following one as it will
address all of the issues.

[TCP]: Fix size calculation in sk_stream_alloc_pskb

[ Upstream commit: fb93134dfc2a6e6fbedc7c270a31da03fce88db9 ]

We round up the header size in sk_stream_alloc_pskb so that
TSO packets get zero tail room.  Unfortunately this rounding
up is not coordinated with the select_size() function used by
TCP to calculate the second parameter of sk_stream_alloc_pskb.

As a result, we may allocate more than a page of data in the
non-TSO case when exactly one page is desired.

In fact, rounding up the head room is detrimental in the non-TSO
case because it makes memory that would otherwise be available to
the payload head room.  TSO doesn't need this either, all it wants
is the guarantee that there is no tail room.

So this patch fixes this by adjusting the skb_reserve call so that
exactly the requested amount (which all callers have calculated in
a precise way) is made available as tail room.

Signed-off-by: Herbert Xu <[EMAIL PROTECTED]>
Signed-off-by: David S. Miller <[EMAIL PROTECTED]>

diff --git a/include/net/sock.h b/include/net/sock.h
index 5504fb9..567e468 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1235,14 +1235,16 @@ static inline struct sk_buff 
*sk_stream_alloc_pskb(struct sock *sk,
   gfp_t gfp)
 {
struct sk_buff *skb;
-   int hdr_len;
 
-   hdr_len = SKB_DATA_ALIGN(sk->sk_prot->max_header);
-   skb = alloc_skb_fclone(size + hdr_len, gfp);
+   skb = alloc_skb_fclone(size + sk->sk_prot->max_header, gfp);
if (skb) {
skb->truesize += mem;
if (sk_stream_wmem_schedule(sk, skb->truesize)) {
-   skb_reserve(skb, hdr_len);
+   /*
+* Make sure that we have exactly size bytes
+* available to the caller, no more, no less.
+*/
+   skb_reserve(skb, skb_tailroom(skb) - size);
return skb;
}
__kfree_skb(skb);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: OT: Does Linux have any "Perfect Code"

2007-11-14 Thread David Miller
From: Eric Dumazet <[EMAIL PROTECTED]>
Date: Thu, 15 Nov 2007 07:29:47 +0100

> hrtime_t
> ts2hrt(const timestruc_t *tsp)
> {
> return tsp->tv_sec * NANOSEC + tsp->tv_nsec;
> }
> 
> can be inlined as it is trivial (and much faster than Solaris version)
> 
>  movq(%rdi), %rdx
>  mov 8(%rdi), %eax
>  imulq   $10, %rdx, %rdx
>  addq%rdx, %rax

This is exactly the kind of thing that is not happening to the Solaris
code base.  These gradual improvements that are being done constantly
to every nook and cranny of the Linux kernel.

Code sits untouched for 6+ years in the Solaris tree not because it's
perfect and bug free, but rather because Sun simply does not have the
environment and resources with which to make the kinds of ongoing
improvements Linux can.

The things Sun is trying to say is so great about the Solaris code
base is actually, as shown by Eric, it's greatest weakness.
Development is glacial and a lot of stuff simply does not get looked
at.

Someone who really wants to get some kind of idea on what scale Linux
development is compared to Solaris should sit down with a current
Linux git tree and a current OpenSolaris mercurial checkout and do
some comparisons.

Here is one you could ferret out that I am pretty sure of.  I bet that
in the 2.6.24 merge window (1.5 weeks of merging patches) we had more
individual contributors to the Linux kernel than OpenSolaris has had
in it's entire existence.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 2/3] ocfs2: fix write() performance regression

2007-11-14 Thread Greg Kroah-Hartman

-stable review patch.  If anyone has any objections, please let us know.

--
From: Mark Fasheh <[EMAIL PROTECTED]>

patch 4e9563fd55ff4479f2b118d0757d121dd0cfc39c in mainline.

ocfs2: fix write() performance regression

On file systems which don't support sparse files, Ocfs2_map_page_blocks()
was reading blocks on appending writes. This caused write performance to
suffer dramatically. Fix this by detecting an appending write on a nonsparse
fs and skipping the read.

Signed-off-by: Mark Fasheh <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 fs/ocfs2/aops.c |   22 ++
 1 file changed, 22 insertions(+)

--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -661,6 +661,27 @@ static void ocfs2_clear_page_regions(str
 }
 
 /*
+ * Nonsparse file systems fully allocate before we get to the write
+ * code. This prevents ocfs2_write() from tagging the write as an
+ * allocating one, which means ocfs2_map_page_blocks() might try to
+ * read-in the blocks at the tail of our file. Avoid reading them by
+ * testing i_size against each block offset.
+ */
+static int ocfs2_should_read_blk(struct inode *inode, struct page *page,
+unsigned int block_start)
+{
+   u64 offset = page_offset(page) + block_start;
+
+   if (ocfs2_sparse_alloc(OCFS2_SB(inode->i_sb)))
+   return 1;
+
+   if (i_size_read(inode) > offset)
+   return 1;
+
+   return 0;
+}
+
+/*
  * Some of this taken from block_prepare_write(). We already have our
  * mapping by now though, and the entire write will be allocating or
  * it won't, so not much need to use BH_New.
@@ -713,6 +734,7 @@ int ocfs2_map_page_blocks(struct page *p
set_buffer_uptodate(bh);
} else if (!buffer_uptodate(bh) && !buffer_delay(bh) &&
   !buffer_new(bh) &&
+  ocfs2_should_read_blk(inode, page, block_start) &&
   (block_start < from || block_end > to)) {
ll_rw_block(READ, 1, &bh);
*wait_bh++=bh;

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 3/3] NFS: Fix a writeback race...

2007-11-14 Thread Greg Kroah-Hartman

-stable review patch.  If anyone has any objections, please let us know.

--
From: Trond Myklebust <[EMAIL PROTECTED]>

patch 61e930a904966cc37e0a3404276f0b73037e57ca in mainline

This patch fixes a regression that was introduced by commit
44dd151d5c21234cc534c47d7382f5c28c3143cd

We cannot zero the user page in nfs_mark_uptodate() any more, since

  a) We'd be modifying the page without holding the page lock
  b) We can race with other updates of the page, most notably
 because of the call to nfs_wb_page() in nfs_writepage_setup().

Instead, we do the zeroing in nfs_update_request() if we see that we're
creating a request that might potentially be marked as up to date.

Thanks to Olivier Paquet for reporting the bug and providing a test-case.

Signed-off-by: Trond Myklebust <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 fs/nfs/write.c |   17 +
 1 file changed, 13 insertions(+), 4 deletions(-)

--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -167,8 +167,6 @@ static void nfs_mark_uptodate(struct pag
return;
if (count != nfs_page_length(page))
return;
-   if (count != PAGE_CACHE_SIZE)
-   zero_user_page(page, count, PAGE_CACHE_SIZE - count, KM_USER0);
SetPageUptodate(page);
 }
 
@@ -643,7 +641,8 @@ static struct nfs_page * nfs_update_requ
return ERR_PTR(error);
}
spin_unlock(&inode->i_lock);
-   return new;
+   req = new;
+   goto zero_page;
}
spin_unlock(&inode->i_lock);
 
@@ -671,13 +670,23 @@ static struct nfs_page * nfs_update_requ
if (offset < req->wb_offset) {
req->wb_offset = offset;
req->wb_pgbase = offset;
-   req->wb_bytes = rqend - req->wb_offset;
+   req->wb_bytes = max(end, rqend) - req->wb_offset;
+   goto zero_page;
}
 
if (end > rqend)
req->wb_bytes = end - req->wb_offset;
 
return req;
+zero_page:
+   /* If this page might potentially be marked as up to date,
+* then we need to zero any uninitalised data. */
+   if (req->wb_pgbase == 0 && req->wb_bytes != PAGE_CACHE_SIZE
+   && !PageUptodate(req->wb_page))
+   zero_user_page(req->wb_page, req->wb_bytes,
+   PAGE_CACHE_SIZE - req->wb_bytes,
+   KM_USER0);
+   return req;
 }
 
 int nfs_flush_incompatible(struct file *file, struct page *page)

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 01/40] POWERPC: Fix platinumfb framebuffer

2007-11-14 Thread Greg Kroah-Hartman

-stable review patch.  If anyone has any objections, please let us know.

--
From: Benjamin Herrenschmidt <[EMAIL PROTECTED]>

Patch 4c2a54b09ba35a409afc34bd331a57a994921664 in mailine.

Current kernels have a non-working platinumfb due to some resource
management issues.  This fixes it.

Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]>
Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/video/platinumfb.c |   48 -
 1 file changed, 26 insertions(+), 22 deletions(-)

--- a/drivers/video/platinumfb.c
+++ b/drivers/video/platinumfb.c
@@ -17,6 +17,8 @@
  *  more details.
  */
 
+#undef DEBUG
+
 #include 
 #include 
 #include 
@@ -535,33 +537,35 @@ static int __devinit platinumfb_probe(st
volatile __u8   *fbuffer;
int bank0, bank1, bank2, bank3, rc;
 
-   printk(KERN_INFO "platinumfb: Found Apple Platinum video hardware\n");
+   dev_info(&odev->dev, "Found Apple Platinum video hardware\n");
 
info = framebuffer_alloc(sizeof(*pinfo), &odev->dev);
-   if (info == NULL)
+   if (info == NULL) {
+   dev_err(&odev->dev, "Failed to allocate fbdev !\n");
return -ENOMEM;
+   }
pinfo = info->par;
 
if (of_address_to_resource(dp, 0, &pinfo->rsrc_reg) ||
of_address_to_resource(dp, 1, &pinfo->rsrc_fb)) {
-   printk(KERN_ERR "platinumfb: Can't get resources\n");
-   framebuffer_release(info);
-   return -ENXIO;
-   }
-   if (!request_mem_region(pinfo->rsrc_reg.start,
-   pinfo->rsrc_reg.start -
-   pinfo->rsrc_reg.end + 1,
-   "platinumfb registers")) {
+   dev_err(&odev->dev, "Can't get resources\n");
framebuffer_release(info);
return -ENXIO;
}
+   dev_dbg(&odev->dev, " registers  : 0x%llx...0x%llx\n",
+   (unsigned long long)pinfo->rsrc_reg.start,
+   (unsigned long long)pinfo->rsrc_reg.end);
+   dev_dbg(&odev->dev, " framebuffer: 0x%llx...0x%llx\n",
+   (unsigned long long)pinfo->rsrc_fb.start,
+   (unsigned long long)pinfo->rsrc_fb.end);
+
+   /* Do not try to request register space, they overlap with the
+* northbridge and that can fail. Only request framebuffer
+*/
if (!request_mem_region(pinfo->rsrc_fb.start,
-   pinfo->rsrc_fb.start
-   - pinfo->rsrc_fb.end + 1,
+   pinfo->rsrc_fb.end - pinfo->rsrc_fb.start + 1,
"platinumfb framebuffer")) {
-   release_mem_region(pinfo->rsrc_reg.start,
-  pinfo->rsrc_reg.end -
-  pinfo->rsrc_reg.start + 1);
+   printk(KERN_ERR "platinumfb: Can't request framebuffer !\n");
framebuffer_release(info);
return -ENXIO;
}
@@ -600,7 +604,8 @@ static int __devinit platinumfb_probe(st
bank2 = fbuffer[0x20] == 0x56;
bank3 = fbuffer[0x30] == 0x78;
pinfo->total_vram = (bank0 + bank1 + bank2 + bank3) * 0x10;
-   printk(KERN_INFO "platinumfb: Total VRAM = %dMB (%d%d%d%d)\n", (int) 
(pinfo->total_vram / 1024 / 1024),
+   printk(KERN_INFO "platinumfb: Total VRAM = %dMB (%d%d%d%d)\n",
+  (unsigned int) (pinfo->total_vram / 1024 / 1024),
   bank3, bank2, bank1, bank0);
 
/*
@@ -644,16 +649,15 @@ static int __devexit platinumfb_remove(s
 unregister_framebuffer (info);

/* Unmap frame buffer and registers */
+   iounmap(pinfo->frame_buffer);
+   iounmap(pinfo->platinum_regs);
+   iounmap(pinfo->cmap_regs);
+
release_mem_region(pinfo->rsrc_fb.start,
   pinfo->rsrc_fb.end -
   pinfo->rsrc_fb.start + 1);
-   release_mem_region(pinfo->rsrc_reg.start,
-  pinfo->rsrc_reg.end -
-  pinfo->rsrc_reg.start + 1);
-   iounmap(pinfo->frame_buffer);
-   iounmap(pinfo->platinum_regs);
+
release_mem_region(pinfo->cmap_regs_phys, 0x1000);
-   iounmap(pinfo->cmap_regs);
 
framebuffer_release(info);
 

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 03/40] hwmon/w83627hf: Fix setting fan min right after driver load

2007-11-14 Thread Greg Kroah-Hartman

-stable review patch.  If anyone has any objections, please let us know.

--
From: Jean Delvare <[EMAIL PROTECTED]>

Already in Linus' tree:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=c09c5184a26158da32801e89d5849d774605f0dd

We need to read the fan clock dividers at initialization time,
otherwise the code in store_fan_min() may use uninitialized values.
That's pretty much the same bug and same fix as for the w83627ehf
driver last month.

Signed-off-by: Jean Delvare <[EMAIL PROTECTED]>
Signed-off-by: Mark M. Hoffman <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/hwmon/w83627hf.c |   34 ++
 1 file changed, 22 insertions(+), 12 deletions(-)

--- a/drivers/hwmon/w83627hf.c
+++ b/drivers/hwmon/w83627hf.c
@@ -391,6 +391,7 @@ static int __devexit w83627hf_remove(str
 
 static int w83627hf_read_value(struct w83627hf_data *data, u16 reg);
 static int w83627hf_write_value(struct w83627hf_data *data, u16 reg, u16 
value);
+static void w83627hf_update_fan_div(struct w83627hf_data *data);
 static struct w83627hf_data *w83627hf_update_device(struct device *dev);
 static void w83627hf_init_device(struct platform_device *pdev);
 
@@ -1244,6 +1245,7 @@ static int __devinit w83627hf_probe(stru
data->fan_min[0] = w83627hf_read_value(data, W83781D_REG_FAN_MIN(1));
data->fan_min[1] = w83627hf_read_value(data, W83781D_REG_FAN_MIN(2));
data->fan_min[2] = w83627hf_read_value(data, W83781D_REG_FAN_MIN(3));
+   w83627hf_update_fan_div(data);
 
/* Register common device attributes */
if ((err = sysfs_create_group(&dev->kobj, &w83627hf_group)))
@@ -1556,6 +1558,24 @@ static void __devinit w83627hf_init_devi
| 0x01);
 }
 
+static void w83627hf_update_fan_div(struct w83627hf_data *data)
+{
+   int reg;
+
+   reg = w83627hf_read_value(data, W83781D_REG_VID_FANDIV);
+   data->fan_div[0] = (reg >> 4) & 0x03;
+   data->fan_div[1] = (reg >> 6) & 0x03;
+   if (data->type != w83697hf) {
+   data->fan_div[2] = (w83627hf_read_value(data,
+  W83781D_REG_PIN) >> 6) & 0x03;
+   }
+   reg = w83627hf_read_value(data, W83781D_REG_VBAT);
+   data->fan_div[0] |= (reg >> 3) & 0x04;
+   data->fan_div[1] |= (reg >> 4) & 0x04;
+   if (data->type != w83697hf)
+   data->fan_div[2] |= (reg >> 5) & 0x04;
+}
+
 static struct w83627hf_data *w83627hf_update_device(struct device *dev)
 {
struct w83627hf_data *data = dev_get_drvdata(dev);
@@ -1633,18 +1653,8 @@ static struct w83627hf_data *w83627hf_up
  w83627hf_read_value(data, W83781D_REG_TEMP_HYST(3));
}
 
-   i = w83627hf_read_value(data, W83781D_REG_VID_FANDIV);
-   data->fan_div[0] = (i >> 4) & 0x03;
-   data->fan_div[1] = (i >> 6) & 0x03;
-   if (data->type != w83697hf) {
-   data->fan_div[2] = (w83627hf_read_value(data,
-  W83781D_REG_PIN) >> 6) & 0x03;
-   }
-   i = w83627hf_read_value(data, W83781D_REG_VBAT);
-   data->fan_div[0] |= (i >> 3) & 0x04;
-   data->fan_div[1] |= (i >> 4) & 0x04;
-   if (data->type != w83697hf)
-   data->fan_div[2] |= (i >> 5) & 0x04;
+   w83627hf_update_fan_div(data);
+
data->alarms =
w83627hf_read_value(data, W83781D_REG_ALARM1) |
(w83627hf_read_value(data, W83781D_REG_ALARM2) << 8) |

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 16/16] zd1211rw, fix oops when ejecting install media

2007-11-14 Thread Greg KH


-stable review patch.  If anyone has any objections, please let us know.

--

From: Marc Pignat <[EMAIL PROTECTED]>

patch e0579d576cb894a4cf3c5af04fbf38e8c1281738 in mainline.

The disconnect function can dereference the net_device structure when it
is never allocated. This is the case when ejecting the device installer.

Signed-off-by: Marc Pignat <[EMAIL PROTECTED]>
Acked-by: Daniel Drake <[EMAIL PROTECTED]>
Signed-off-by: John W. Linville <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/net/wireless/zd1211rw/zd_usb.c |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

--- a/drivers/net/wireless/zd1211rw/zd_usb.c
+++ b/drivers/net/wireless/zd1211rw/zd_usb.c
@@ -1041,14 +1041,17 @@ error:
 static void disconnect(struct usb_interface *intf)
 {
struct net_device *netdev = zd_intf_to_netdev(intf);
-   struct zd_mac *mac = zd_netdev_mac(netdev);
-   struct zd_usb *usb = &mac->chip.usb;
+   struct zd_mac *mac;
+   struct zd_usb *usb;
 
/* Either something really bad happened, or we're just dealing with
 * a DEVICE_INSTALLER. */
if (netdev == NULL)
return;
 
+   mac = zd_netdev_mac(netdev);
+   usb = &mac->chip.usb;
+
dev_dbg_f(zd_usb_dev(usb), "\n");
 
zd_netdev_disconnect(netdev);

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 00/40] 2.6.23-stable review, driver (sans network) changes

2007-11-14 Thread Greg Kroah-Hartman
This is the start of the stable review cycle for the 2.6.23.X release.
There are 40 patches in this series, all will be posted as a response to
this one.  If anyone has any issues with these being applied, please let
us know.  If anyone is a maintainer of the proper subsystem, and wants
to add a Signed-off-by: line to the patch, please respond with it.

These patches are sent out with a number of different people on the Cc:
line.  If you wish to be a reviewer, please email [EMAIL PROTECTED] to
add your name to the list.  If you want to be off the reviewer list,
also email us.

Responses should be made by Friday 00:00:00 UTC.  Anything received
after that time might be too late.

This set of patches focuses on drivers except for networking (those were
in a different series).

The diffstat of this review series is included below.

thanks,

greg k-h

-

 drivers/acpi/sleep/main.c   |5 -
 drivers/ata/ahci.c  |  143 
 drivers/ata/libata-core.c   |9 +-
 drivers/ata/libata-eh.c |   32 +--
 drivers/char/drm/i915_irq.c |2 
 drivers/char/drm/radeon_cp.c|5 -
 drivers/char/drm/radeon_drv.h   |1 
 drivers/char/moxa.c |4 
 drivers/char/rocket.c   |   14 ++-
 drivers/hwmon/lm87.c|4 
 drivers/hwmon/w83627hf.c|   78 +
 drivers/ide/pci/cs5535.c|2 
 drivers/ide/pci/serverworks.c   |1 
 drivers/ide/pci/siimage.c   |2 
 drivers/infiniband/core/uverbs_cmd.c|8 +
 drivers/infiniband/hw/mthca/mthca_cmd.c |6 +
 drivers/isdn/hardware/avm/b1.c  |   28 ++
 drivers/isdn/hardware/avm/c4.c  |   14 ++-
 drivers/md/bitmap.c |2 
 drivers/md/dm-delay.c   |2 
 drivers/md/dm.c |4 
 drivers/md/raid5.c  |   17 +++
 drivers/pci/msi.c   |2 
 drivers/scsi/hptiop.c   |5 -
 drivers/usb/core/hcd.h  |8 +
 drivers/usb/core/hub.c  |   15 +++
 drivers/usb/core/quirks.c   |   81 --
 drivers/usb/core/urb.c  |2 
 drivers/usb/gadget/ether.c  |   12 ++
 drivers/usb/host/ehci-hcd.c |8 +
 drivers/usb/serial/generic.c|7 -
 drivers/video/platinumfb.c  |   48 +-
 include/linux/ide.h |7 +
 include/linux/libata.h  |2 
 include/linux/usb/quirks.h  |7 -
 sound/core/Makefile |3 
 sound/core/memalloc.c   |6 +
 sound/pci/emu10k1/emumixer.c|4 
 sound/pci/hda/patch_sigmatel.c  |   29 --
 sound/pci/rme9652/hdsp.c|3 
 sound/usb/usbmixer.c|2 
 41 files changed, 418 insertions(+), 216 deletions(-)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 12/16] sky2: fix power settings on Yukon XL

2007-11-14 Thread Greg KH

-stable review patch.  If anyone has any objections, please let us know.

--

From: Stephen Hemminger <[EMAIL PROTECTED]>

patch ff35164e72648e0bf0b10ec4410c195e8607e88b in mainline.

Make sure PCI register for PHY power gets set correctly.

Signed-off-by: Stephen Hemminger <[EMAIL PROTECTED]>
Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>


---
 drivers/net/sky2.c |   13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -603,21 +603,22 @@ static void sky2_phy_init(struct sky2_hw
 static void sky2_phy_power(struct sky2_hw *hw, unsigned port, int onoff)
 {
u32 reg1;
-   static const u32 phy_power[]
-   = { PCI_Y2_PHY1_POWD, PCI_Y2_PHY2_POWD };
-
-   /* looks like this XL is back asswards .. */
-   if (hw->chip_id == CHIP_ID_YUKON_XL && hw->chip_rev > 1)
-   onoff = !onoff;
+   static const u32 phy_power[] = { PCI_Y2_PHY1_POWD, PCI_Y2_PHY2_POWD };
+   static const u32 coma_mode[] = { PCI_Y2_PHY1_COMA, PCI_Y2_PHY2_COMA };
 
sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
reg1 = sky2_pci_read32(hw, PCI_DEV_REG1);
+
if (onoff)
/* Turn off phy power saving */
reg1 &= ~phy_power[port];
else
reg1 |= phy_power[port];
 
+   if (onoff && hw->chip_id == CHIP_ID_YUKON_XL && hw->chip_rev > 1)
+   reg1 |= coma_mode[port];
+
+
sky2_pci_write32(hw, PCI_DEV_REG1, reg1);
sky2_pci_read32(hw, PCI_DEV_REG1);
sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 07/16] Fix L2TP oopses.

2007-11-14 Thread Greg KH

-stable review patch.  If anyone has any objections, please let us know.

--
From: James Chapman <[EMAIL PROTECTED]>

changeset 91781004b9c029ee55b7aa9ef950a373ba865dc6 in mainline.

[PPP]: L2TP: Fix oops in transmit and receive paths

Changes made on 18-sep to fix skb handling in the pppol2tp driver
broke the transmit and receive paths. Users are only running into this
now because distros are now using 2.6.23 and I must have messed up
when I tested the change.

For receive, we now do our own calculation of how much to pull from
the skb (variable length L2TP header) rather than using
skb_transport_offset(). Also, if the skb isn't a data packet, it must
be passed back to UDP with skb->data pointing to the UDP header.

For transmit, make sure skb->sk is set up because ip_queue_xmit()
needs it.

Signed-off-by: James Chapman <[EMAIL PROTECTED]>
Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/net/pppol2tp.c |   25 ++---
 1 file changed, 18 insertions(+), 7 deletions(-)

--- a/drivers/net/pppol2tp.c
+++ b/drivers/net/pppol2tp.c
@@ -487,7 +487,7 @@ static int pppol2tp_recv_core(struct soc
 {
struct pppol2tp_session *session = NULL;
struct pppol2tp_tunnel *tunnel;
-   unsigned char *ptr;
+   unsigned char *ptr, *optr;
u16 hdrflags;
u16 tunnel_id, session_id;
int length;
@@ -495,7 +495,7 @@ static int pppol2tp_recv_core(struct soc
 
tunnel = pppol2tp_sock_to_tunnel(sock);
if (tunnel == NULL)
-   goto error;
+   goto no_tunnel;
 
/* UDP always verifies the packet length. */
__skb_pull(skb, sizeof(struct udphdr));
@@ -508,7 +508,7 @@ static int pppol2tp_recv_core(struct soc
}
 
/* Point to L2TP header */
-   ptr = skb->data;
+   optr = ptr = skb->data;
 
/* Get L2TP header flags */
hdrflags = ntohs(*(__be16*)ptr);
@@ -636,12 +636,14 @@ static int pppol2tp_recv_core(struct soc
/* If offset bit set, skip it. */
if (hdrflags & L2TP_HDRFLAG_O) {
offset = ntohs(*(__be16 *)ptr);
-   skb->transport_header += 2 + offset;
-   if (!pskb_may_pull(skb, skb_transport_offset(skb) + 2))
-   goto discard;
+   ptr += 2 + offset;
}
 
-   __skb_pull(skb, skb_transport_offset(skb));
+   offset = ptr - optr;
+   if (!pskb_may_pull(skb, offset))
+   goto discard;
+
+   __skb_pull(skb, offset);
 
/* Skip PPP header, if present.  In testing, Microsoft L2TP clients
 * don't send the PPP header (PPP header compression enabled), but
@@ -651,6 +653,9 @@ static int pppol2tp_recv_core(struct soc
 * Note that skb->data[] isn't dereferenced from a u16 ptr here since
 * the field may be unaligned.
 */
+   if (!pskb_may_pull(skb, 2))
+   goto discard;
+
if ((skb->data[0] == 0xff) && (skb->data[1] == 0x03))
skb_pull(skb, 2);
 
@@ -708,6 +713,10 @@ discard:
return 0;
 
 error:
+   /* Put UDP header back */
+   __skb_push(skb, sizeof(struct udphdr));
+
+no_tunnel:
return 1;
 }
 
@@ -1049,6 +1058,8 @@ static int pppol2tp_xmit(struct ppp_chan
/* Get routing info from the tunnel socket */
dst_release(skb->dst);
skb->dst = sk_dst_get(sk_tun);
+   skb_orphan(skb);
+   skb->sk = sk_tun;
 
/* Queue the packet to IP for output */
len = skb->len;

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 00/16] 2.6.23-stable review, network driver changes

2007-11-14 Thread Greg KH
This is the start of the stable review cycle for the 2.6.23.X release.
There are 16 patches in this series, all will be posted as a response to
this one.  If anyone has any issues with these being applied, please let
us know.  If anyone is a maintainer of the proper subsystem, and wants
to add a Signed-off-by: line to the patch, please respond with it.

These patches are sent out with a number of different people on the Cc:
line.  If you wish to be a reviewer, please email [EMAIL PROTECTED] to
add your name to the list.  If you want to be off the reviewer list,
also email us.

Responses should be made by Friday 00:00:00 UTC.  Anything received
after that time might be too late.

This set of patches focuses on only networking drivers.

The diffstat of this review series is included below.

thanks,

greg k-h

-

 drivers/net/ehea/ehea_qmr.c|   20 +---
 drivers/net/ehea/ehea_qmr.h|2 
 drivers/net/forcedeth.c|   35 ++--
 drivers/net/pppol2tp.c |   25 -
 drivers/net/skge.c |  141 +
 drivers/net/skge.h |6 -
 drivers/net/sky2.c |   87 
 drivers/net/tg3.c  |   10 +-
 drivers/net/wireless/ipw2100.c |   39 +
 drivers/net/wireless/ipw2100.h |4 
 drivers/net/wireless/libertas/11d.c|2 
 drivers/net/wireless/libertas/cmd.c|6 -
 drivers/net/wireless/libertas/wext.c   |8 -
 drivers/net/wireless/rtl8187_dev.c |   31 +++
 drivers/net/wireless/zd1201.c  |4 
 drivers/net/wireless/zd1211rw/zd_usb.c |7 +
 include/linux/pci_ids.h|4 
 17 files changed, 283 insertions(+), 148 deletions(-)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 06/16] TG3: Fix performance regression on 5705.

2007-11-14 Thread Greg KH


-stable review patch.  If anyone has any objections, please let us know.

--
From: Michael Chan <[EMAIL PROTECTED]>

patch 114342f2d38439cb1a54f1f724fa38729b093c48 in mainline.

A performance regression was introduced by the following commit:

commit ee6a99b539a50b4e9398938a0a6d37f8bf911550
Author: Michael Chan <[EMAIL PROTECTED]>
Date:   Wed Jul 18 21:49:10 2007 -0700

[TG3]: Fix msi issue with kexec/kdump.

In making that change, the PCI latency timer and cache line size
registers were not restored after chip reset.  On the 5705, the
latency timer gets reset to 0 during chip reset and this causes
very poor performance.

Update version to 3.81.1

Signed-off-by: Michael Chan <[EMAIL PROTECTED]>
Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/net/tg3.c |   10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -64,8 +64,8 @@
 
 #define DRV_MODULE_NAME"tg3"
 #define PFX DRV_MODULE_NAME": "
-#define DRV_MODULE_VERSION "3.81"
-#define DRV_MODULE_RELDATE "September 5, 2007"
+#define DRV_MODULE_VERSION "3.81.1"
+#define DRV_MODULE_RELDATE "October 18, 2007"
 
 #define TG3_DEF_MAC_MODE   0
 #define TG3_DEF_RX_MODE0
@@ -4874,6 +4874,12 @@ static void tg3_restore_pci_state(struct
 
pci_write_config_dword(tp->pdev, TG3PCI_COMMAND, tp->pci_cmd);
 
+   if (!(tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS)) {
+   pci_write_config_byte(tp->pdev, PCI_CACHE_LINE_SIZE,
+ tp->pci_cacheline_sz);
+   pci_write_config_byte(tp->pdev, PCI_LATENCY_TIMER,
+ tp->pci_lat_timer);
+   }
/* Make sure PCI-X relaxed ordering bit is clear. */
pci_read_config_dword(tp->pdev, TG3PCI_X_CAPS, &val);
val &= ~PCIX_CAPS_RELAXED_ORDERING;

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 0/3] 2.6.23-stable review, filesystem changes

2007-11-14 Thread Greg Kroah-Hartman
This is the start of the stable review cycle for the 2.6.23.X release.
There are 3 patches in this series, all will be posted as a response to
this one.  If anyone has any issues with these being applied, please let
us know.  If anyone is a maintainer of the proper subsystem, and wants
to add a Signed-off-by: line to the patch, please respond with it.

These patches are sent out with a number of different people on the Cc:
line.  If you wish to be a reviewer, please email [EMAIL PROTECTED] to
add your name to the list.  If you want to be off the reviewer list,
also email us.

Responses should be made by Friday 00:00:00 UTC.  Anything received
after that time might be too late.

This set of patches focuses on filesystems.

The diffstat of this review series is included below.

thanks,

greg k-h

-- 

 fs/minix/itree_v1.c |9 +++--
 fs/minix/itree_v2.c |9 +++--
 fs/nfs/write.c  |   17 +
 fs/ocfs2/aops.c |   22 ++
 4 files changed, 49 insertions(+), 8 deletions(-)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 1/3] minixfs: limit minixfs printks on corrupted dir i_size (CVE-2006-6058)

2007-11-14 Thread Greg Kroah-Hartman
-stable review patch.  If anyone has any objections, please let us know.

--

From: Eric Sandeen <[EMAIL PROTECTED]>

patch f44ec6f3f89889a469773b1fd894f8fcc07c29cf upstream.

This attempts to address CVE-2006-6058
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2006-6058

first reported at http://projects.info-pull.com/mokb/MOKB-17-11-2006.html

Essentially a corrupted minix dir inode reporting a very large
i_size will loop for a very long time in minix_readdir, minix_find_entry,
etc, because on EIO they just move on to try the next page.  This is
under the BKL, printk-storming as well.  This can lock up the machine
for a very long time.  Simply ratelimiting the printks gets things back
under control.  Make the message a bit more informative while we're here.

Signed-off-by: Eric Sandeen <[EMAIL PROTECTED]>
Cc: Bodo Eggert <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 fs/minix/itree_v1.c |9 +++--
 fs/minix/itree_v2.c |9 +++--
 2 files changed, 14 insertions(+), 4 deletions(-)

--- a/fs/minix/itree_v1.c
+++ b/fs/minix/itree_v1.c
@@ -23,11 +23,16 @@ static inline block_t *i_data(struct ino
 static int block_to_path(struct inode * inode, long block, int offsets[DEPTH])
 {
int n = 0;
+   char b[BDEVNAME_SIZE];
 
if (block < 0) {
-   printk("minix_bmap: block<0\n");
+   printk("MINIX-fs: block_to_path: block %ld < 0 on dev %s\n",
+   block, bdevname(inode->i_sb->s_bdev, b));
} else if (block >= (minix_sb(inode->i_sb)->s_max_size/BLOCK_SIZE)) {
-   printk("minix_bmap: block>big\n");
+   if (printk_ratelimit())
+   printk("MINIX-fs: block_to_path: "
+  "block %ld too big on dev %s\n",
+   block, bdevname(inode->i_sb->s_bdev, b));
} else if (block < 7) {
offsets[n++] = block;
} else if ((block -= 7) < 512) {
--- a/fs/minix/itree_v2.c
+++ b/fs/minix/itree_v2.c
@@ -23,12 +23,17 @@ static inline block_t *i_data(struct ino
 static int block_to_path(struct inode * inode, long block, int offsets[DEPTH])
 {
int n = 0;
+   char b[BDEVNAME_SIZE];
struct super_block *sb = inode->i_sb;
 
if (block < 0) {
-   printk("minix_bmap: block<0\n");
+   printk("MINIX-fs: block_to_path: block %ld < 0 on dev %s\n",
+   block, bdevname(sb->s_bdev, b));
} else if (block >= 
(minix_sb(inode->i_sb)->s_max_size/sb->s_blocksize)) {
-   printk("minix_bmap: block>big\n");
+   if (printk_ratelimit())
+   printk("MINIX-fs: block_to_path: "
+  "block %ld too big on dev %s\n",
+   block, bdevname(sb->s_bdev, b));
} else if (block < 7) {
offsets[n++] = block;
} else if ((block -= 7) < 256) {

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 39/40] ACPI: sleep: Fix GPE suspend cleanup

2007-11-14 Thread Greg Kroah-Hartman

-stable review patch.  If anyone has any objections, please let us know.

--
From: Alexey Starikovskiy <[EMAIL PROTECTED]>

patch is 9c1c6a1ba786d58bd03e27ee49f89a5685e8e07b in mainline.

ACPI: sleep: Fix GPE suspend cleanup

Commit 9b039330808b83acac3597535da26f47ad1862ce removed
acpi_gpe_sleep_prepare(), the only function used at S5 transition
Add call to generic acpi_enable_wake_device().

Reference: https://bugzilla.novell.com/show_bug.cgi?id=299882

Signed-off-by: Alexey Starikovskiy <[EMAIL PROTECTED]>
Acked-by: Rafael J. Wysocki <[EMAIL PROTECTED]>
Signed-off-by: Len Brown <[EMAIL PROTECTED]>
Cc: Chuck Ebbert <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/acpi/sleep/main.c |1 +
 1 file changed, 1 insertion(+)

--- a/drivers/acpi/sleep/main.c
+++ b/drivers/acpi/sleep/main.c
@@ -389,6 +389,7 @@ static void acpi_power_off(void)
/* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */
printk("%s called\n", __FUNCTION__);
local_irq_disable();
+   acpi_enable_wakeup_device(ACPI_STATE_S5);
acpi_enter_sleep_state(ACPI_STATE_S5);
 }
 

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 40/40] ACPI: suspend: Wrong order of GPE restore.

2007-11-14 Thread Greg Kroah-Hartman

-stable review patch.  If anyone has any objections, please let us know.

--
From: Alexey Starikovskiy <[EMAIL PROTECTED]>

commit 1dbc1fda5d8ca907f320b806005d4a447977d26a in mainline.

ACPI: suspend: Wrong order of GPE restore.

acpi_leave_sleep_state() should have correct list of wake and
runtime GPEs, which is available only after disable_wakeup_device()
is called.

[EMAIL PROTECTED]: backport to 2.6.23]

Signed-off-by: Alexey Starikovskiy <[EMAIL PROTECTED]>
Acked-by: Rafael J. Wysocki <[EMAIL PROTECTED]>
Signed-off-by: Len Brown <[EMAIL PROTECTED]>
Cc: Chuck Ebbert <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/acpi/sleep/main.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/acpi/sleep/main.c
+++ b/drivers/acpi/sleep/main.c
@@ -170,8 +170,8 @@ static int acpi_pm_finish(suspend_state_
 {
u32 acpi_state = acpi_target_sleep_state;
 
-   acpi_leave_sleep_state(acpi_state);
acpi_disable_wakeup_device(acpi_state);
+   acpi_leave_sleep_state(acpi_state);
 
/* reset firmware waking vector */
acpi_set_firmware_waking_vector((acpi_physical_address) 0);
@@ -256,8 +256,8 @@ static int acpi_hibernation_enter(void)
 
 static void acpi_hibernation_finish(void)
 {
-   acpi_leave_sleep_state(ACPI_STATE_S4);
acpi_disable_wakeup_device(ACPI_STATE_S4);
+   acpi_leave_sleep_state(ACPI_STATE_S4);
 
/* reset firmware waking vector */
acpi_set_firmware_waking_vector((acpi_physical_address) 0);

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 38/40] libata: backport ATA_FLAG_NO_SRST and ATA_FLAG_ASSUME_ATA, part 2

2007-11-14 Thread Greg Kroah-Hartman

-stable review patch.  If anyone has any objections, please let us know.

--
From: Tejun Heo <[EMAIL PROTECTED]>

Differs from mainline, but the functionality is already there.

P5W-DH Deluxe has ICH7R which doesn't have PMP support but SIMG 4726
hardwired to the second port of AHCI controller at PCI device 1f.2.
The 4726 doesn't work as PMP but as a storage processor which can do
hardware RAID on downstream ports.

When no device is attached to the downstream port of the 4726, pseudo
ATA device for configuration appears.  Unfortunately, ATA emulation on
the device is very lousy and causes long hang during boot.

This patch implements workaround for the board.  If the mainboard is
P5W-DH Deluxe (matched using DMI), only hardreset is used on the
second port of AHCI controller @ 1f.2 and the hardreset doesn't depend
on receiving the first FIS and just proceed to IDENTIFY.

This workaround fixes bugzilla #8923.

  http://bugzilla.kernel.org/show_bug.cgi?id=8923

Signed-off-by: Tejun Heo <[EMAIL PROTECTED]>
Cc: Jeff Garzik <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/ata/ahci.c |  143 +
 1 file changed, 143 insertions(+)

--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -231,6 +232,7 @@ static void ahci_freeze(struct ata_port 
 static void ahci_thaw(struct ata_port *ap);
 static void ahci_error_handler(struct ata_port *ap);
 static void ahci_vt8251_error_handler(struct ata_port *ap);
+static void ahci_p5wdh_error_handler(struct ata_port *ap);
 static void ahci_post_internal_cmd(struct ata_queued_cmd *qc);
 static int ahci_port_resume(struct ata_port *ap);
 static unsigned int ahci_fill_sg(struct ata_queued_cmd *qc, void *cmd_tbl);
@@ -329,6 +331,40 @@ static const struct ata_port_operations 
.port_stop  = ahci_port_stop,
 };
 
+static const struct ata_port_operations ahci_p5wdh_ops = {
+   .port_disable   = ata_port_disable,
+
+   .check_status   = ahci_check_status,
+   .check_altstatus= ahci_check_status,
+   .dev_select = ata_noop_dev_select,
+
+   .tf_read= ahci_tf_read,
+
+   .qc_prep= ahci_qc_prep,
+   .qc_issue   = ahci_qc_issue,
+
+   .irq_clear  = ahci_irq_clear,
+   .irq_on = ata_dummy_irq_on,
+   .irq_ack= ata_dummy_irq_ack,
+
+   .scr_read   = ahci_scr_read,
+   .scr_write  = ahci_scr_write,
+
+   .freeze = ahci_freeze,
+   .thaw   = ahci_thaw,
+
+   .error_handler  = ahci_p5wdh_error_handler,
+   .post_internal_cmd  = ahci_post_internal_cmd,
+
+#ifdef CONFIG_PM
+   .port_suspend   = ahci_port_suspend,
+   .port_resume= ahci_port_resume,
+#endif
+
+   .port_start = ahci_port_start,
+   .port_stop  = ahci_port_stop,
+};
+
 static const struct ata_port_info ahci_port_info[] = {
/* board_ahci */
{
@@ -1176,6 +1212,52 @@ static int ahci_vt8251_hardreset(struct 
return rc ?: -EAGAIN;
 }
 
+static int ahci_p5wdh_hardreset(struct ata_port *ap, unsigned int *class,
+   unsigned long deadline)
+{
+   struct ahci_port_priv *pp = ap->private_data;
+   u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG;
+   struct ata_taskfile tf;
+   int rc;
+
+   ahci_stop_engine(ap);
+
+   /* clear D2H reception area to properly wait for D2H FIS */
+   ata_tf_init(ap->device, &tf);
+   tf.command = 0x80;
+   ata_tf_to_fis(&tf, 0, 0, d2h_fis);
+
+   rc = sata_port_hardreset(ap, sata_ehc_deb_timing(&ap->eh_context),
+deadline);
+
+   ahci_start_engine(ap);
+
+   if (rc || ata_port_offline(ap))
+   return rc;
+
+   /* spec mandates ">= 2ms" before checking status */
+   msleep(150);
+
+   /* The pseudo configuration device on SIMG4726 attached to
+* ASUS P5W-DH Deluxe doesn't send signature FIS after
+* hardreset if no device is attached to the first downstream
+* port && the pseudo device locks up on SRST w/ PMP==0.  To
+* work around this, wait for !BSY only briefly.  If BSY isn't
+* cleared, perform CLO and proceed to IDENTIFY (achieved by
+* ATA_LFLAG_NO_SRST and ATA_LFLAG_ASSUME_ATA).
+*
+* Wait for two seconds.  Devices attached to downstream port
+* which can't process the following IDENTIFY after this will
+* have to be reset again.  For most cases, this should
+* suffice while making probing snappish enough.
+*/
+   rc = ata_wait_ready(ap, jiffies + 2 * HZ);
+   if (rc)
+   ahci_kick_engine(ap, 0);
+
+   return 0;
+}
+

[patch 36/40] libata: add HTS542525K9SA00 to NCQ blacklist

2007-11-14 Thread Greg Kroah-Hartman

-stable review patch.  If anyone has any objections, please let us know.

--
From: Tejun Heo <[EMAIL PROTECTED]>

patch e14cbfa630cd3ab2631ee21b718b290928f47868 in mainline.

Another one doing spurious NCQ completions.  Blacklist it.

Signed-off-by: Tejun Heo <[EMAIL PROTECTED]>
Cc: Luca Tettamanti <[EMAIL PROTECTED]>
Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/ata/libata-core.c |1 +
 1 file changed, 1 insertion(+)

--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3795,6 +3795,7 @@ static const struct ata_blacklist_entry 
{ "HTS541612J9SA00","SBDIC7JP", ATA_HORKAGE_NONCQ, },
{ "HDT722516DLA380","V43OA96A", ATA_HORKAGE_NONCQ, },
{ "Hitachi HTS541616J9SA00", "SB4OC70P", ATA_HORKAGE_NONCQ, },
+   { "Hitachi HTS542525K9SA00", "BBFOC31P", ATA_HORKAGE_NONCQ, },
{ "WDC WD740ADFD-00NLR1", NULL, ATA_HORKAGE_NONCQ, },
{ "WDC WD3200AAJS-00RYA0", "12.01B01",  ATA_HORKAGE_NONCQ, },
{ "FUJITSU MHV2080BH",  "00840028", ATA_HORKAGE_NONCQ, },

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 37/40] libata: backport ATA_FLAG_NO_SRST and ATA_FLAG_ASSUME_ATA

2007-11-14 Thread Greg Kroah-Hartman

-stable review patch.  If anyone has any objections, please let us know.

--
From: Tejun Heo <[EMAIL PROTECTED]>

Differs from mainline, but the functionality is already there.

Backport ATA_FLAG_NO_SRST and ATA_FLAG_ASSUME_ATA.  These are
originally link flags (ATA_LFLAG_*) but link abstraction doesn't exist
on 2.6.23, so make it port flags.

This is for the following workaround for ASUS P5W DH Deluxe.

These new flags don't introduce any behavior change unless set and
nobody sets them yet.

Signed-off-by: Tejun Heo <[EMAIL PROTECTED]>
Cc: Jeff Garzik <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/ata/libata-eh.c |   32 
 include/linux/libata.h  |2 ++
 2 files changed, 26 insertions(+), 8 deletions(-)

--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -1759,9 +1759,11 @@ static int ata_do_reset(struct ata_port 
return 0;
 }
 
-static int ata_eh_followup_srst_needed(int rc, int classify,
-  const unsigned int *classes)
+static int ata_eh_followup_srst_needed(struct ata_port *ap, int rc,
+   int classify, const unsigned int *classes)
 {
+   if (ap->flags & ATA_FLAG_NO_SRST)
+   return 0;
if (rc == -EAGAIN)
return 1;
if (rc != 0)
@@ -1792,7 +1794,8 @@ static int ata_eh_reset(struct ata_port 
 */
action = ehc->i.action;
ehc->i.action &= ~ATA_EH_RESET_MASK;
-   if (softreset && (!hardreset || (!sata_set_spd_needed(ap) &&
+   if (softreset && (!hardreset || (!(ap->flags & ATA_FLAG_NO_SRST) &&
+!sata_set_spd_needed(ap) &&
 !(action & ATA_EH_HARDRESET
ehc->i.action |= ATA_EH_SOFTRESET;
else
@@ -1855,7 +1858,7 @@ static int ata_eh_reset(struct ata_port 
rc = ata_do_reset(ap, reset, classes, deadline);
 
if (reset == hardreset &&
-   ata_eh_followup_srst_needed(rc, classify, classes)) {
+   ata_eh_followup_srst_needed(ap, rc, classify, classes)) {
/* okay, let's do follow-up softreset */
reset = softreset;
 
@@ -1870,8 +1873,8 @@ static int ata_eh_reset(struct ata_port 
ata_eh_about_to_do(ap, NULL, ATA_EH_RESET_MASK);
rc = ata_do_reset(ap, reset, classes, deadline);
 
-   if (rc == 0 && classify &&
-   classes[0] == ATA_DEV_UNKNOWN) {
+   if (rc == 0 && classify && classes[0] == ATA_DEV_UNKNOWN &&
+   !(ap->flags & ATA_FLAG_ASSUME_ATA)) {
ata_port_printk(ap, KERN_ERR,
"classification failed\n");
rc = -EINVAL;
@@ -1879,6 +1882,10 @@ static int ata_eh_reset(struct ata_port 
}
}
 
+   /* if we skipped follow-up srst, clear rc */
+   if (rc == -EAGAIN)
+   rc = 0;
+
if (rc && try < ARRAY_SIZE(ata_eh_reset_timeouts)) {
unsigned long now = jiffies;
 
@@ -1906,8 +1913,17 @@ static int ata_eh_reset(struct ata_port 
/* After the reset, the device state is PIO 0 and the
 * controller state is undefined.  Record the mode.
 */
-   for (i = 0; i < ATA_MAX_DEVICES; i++)
-   ap->device[i].pio_mode = XFER_PIO_0;
+   for (i = 0; i < ata_port_max_devices(ap); i++) {
+   struct ata_device *dev = &ap->device[i];
+
+   dev->pio_mode = XFER_PIO_0;
+
+   if (ata_port_offline(ap))
+   continue;
+
+   if (ap->flags & ATA_FLAG_ASSUME_ATA)
+   classes[dev->devno] = ATA_DEV_ATA;
+   }
 
/* record current link speed */
if (sata_scr_read(ap, SCR_STATUS, &sstatus) == 0)
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -177,6 +177,8 @@ enum {
ATA_FLAG_IGN_SIMPLEX= (1 << 15), /* ignore SIMPLEX */
ATA_FLAG_NO_IORDY   = (1 << 16), /* controller lacks iordy */
ATA_FLAG_ACPI_SATA  = (1 << 17), /* need native SATA ACPI layout */
+   ATA_FLAG_NO_SRST= (1 << 18),
+   ATA_FLAG_ASSUME_ATA = (1 << 19),
 
/* The following flag belongs to ap->pflags but is kept in
 * ap->flags because it's referenced in many LLDs and will be

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 34/40] Char: moxa, fix and optimise empty timer

2007-11-14 Thread Greg Kroah-Hartman


-stable review patch.  If anyone has any objections, please let us know.

--
From: Jiri Slaby <[EMAIL PROTECTED]>

patch c43422053bea7a5ce09f18d0c50a606fe1a549f4 in mainline.

moxa, fix and optimise empty timer

don't wait and delete empty timer in empty timer function. Also fire next
empty timer at rounded jiffies to save power.

This fixes a lockup, because we wait for ourselves to finish forever.
(i.e.  sync called from the timer itself).


Signed-off-by: Jiri Slaby <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/char/moxa.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/char/moxa.c
+++ b/drivers/char/moxa.c
@@ -1040,14 +1040,14 @@ static void check_xmit_empty(unsigned lo
struct moxa_port *ch;
 
ch = (struct moxa_port *) data;
-   del_timer_sync(&moxa_ports[ch->port].emptyTimer);
if (ch->tty && (ch->statusflags & EMPTYWAIT)) {
if (MoxaPortTxQueue(ch->port) == 0) {
ch->statusflags &= ~EMPTYWAIT;
tty_wakeup(ch->tty);
return;
}
-   mod_timer(&moxa_ports[ch->port].emptyTimer, jiffies + HZ);
+   mod_timer(&moxa_ports[ch->port].emptyTimer,
+   round_jiffies(jiffies + HZ));
} else
ch->statusflags &= ~EMPTYWAIT;
 }

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 35/40] radeon: set the address to access the GART table on the CPU side correctly

2007-11-14 Thread Greg Kroah-Hartman

-stable review patch.  If anyone has any objections, please let us know.

--
From: Dave Airlie <[EMAIL PROTECTED]>

Upstream as 7fc86860cf73e060ab8ed9763010dfe5b5389b1c

This code relied on the CPU and GPU address for the aperture being the same,
On some r5xx hardware I was playing with I noticed that this isn't always true.
This fixes issues seen on some r400 cards. (bugs.freedesktop.org 9957)

Signed-off-by: Dave Airlie <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/char/drm/radeon_cp.c  |5 +++--
 drivers/char/drm/radeon_drv.h |1 +
 2 files changed, 4 insertions(+), 2 deletions(-)

--- a/drivers/char/drm/radeon_cp.c
+++ b/drivers/char/drm/radeon_cp.c
@@ -1679,7 +1679,7 @@ static int radeon_do_init_cp(struct drm_
dev_priv->gart_info.bus_addr =
dev_priv->pcigart_offset + dev_priv->fb_location;
dev_priv->gart_info.mapping.offset =
-   dev_priv->gart_info.bus_addr;
+   dev_priv->pcigart_offset + dev_priv->fb_aper_offset;
dev_priv->gart_info.mapping.size =
dev_priv->gart_info.table_size;
 
@@ -2291,7 +2291,8 @@ int radeon_driver_firstopen(struct drm_d
if (ret != 0)
return ret;
 
-   ret = drm_addmap(dev, drm_get_resource_start(dev, 0),
+   dev_priv->fb_aper_offset = drm_get_resource_start(dev, 0);
+   ret = drm_addmap(dev, dev_priv->fb_aper_offset,
 drm_get_resource_len(dev, 0), _DRM_FRAME_BUFFER,
 _DRM_WRITE_COMBINING, &map);
if (ret != 0)
--- a/drivers/char/drm/radeon_drv.h
+++ b/drivers/char/drm/radeon_drv.h
@@ -293,6 +293,7 @@ typedef struct drm_radeon_private {
 
/* starting from here on, data is preserved accross an open */
uint32_t flags; /* see radeon_chip_flags */
+   unsigned long fb_aper_offset;
 } drm_radeon_private_t;
 
 typedef struct drm_radeon_buf_priv {

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 32/40] hptiop: avoid buffer overflow when returning sense data

2007-11-14 Thread Greg Kroah-Hartman


-stable review patch.  If anyone has any objections, please let us know.

--
From: HighPoint Linux Team <[EMAIL PROTECTED]>

patch 0fec02c93f60fb44ba3a24a0d3e4a52521d34d3f in mainline.

avoid buffer overflow when returning sense data.

With current adapter firmware the driver is working but future firmware
updates may return sense data larger than 96 bytes, causing overflow on
scp->sense_buffer and a kernel crash.

This fix should be backported to earlier kernels.

Signed-off-by: HighPoint Linux Team <[EMAIL PROTECTED]>
Signed-off-by: James Bottomley <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/scsi/hptiop.c |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/drivers/scsi/hptiop.c
+++ b/drivers/scsi/hptiop.c
@@ -365,8 +365,9 @@ static void hptiop_host_request_callback
scp->result = SAM_STAT_CHECK_CONDITION;
memset(&scp->sense_buffer,
0, sizeof(scp->sense_buffer));
-   memcpy(&scp->sense_buffer,
-   &req->sg_list, le32_to_cpu(req->dataxfer_length));
+   memcpy(&scp->sense_buffer, &req->sg_list,
+   min(sizeof(scp->sense_buffer),
+   le32_to_cpu(req->dataxfer_length)));
break;
 
default:

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 33/40] Char: rocket, fix dynamic_dev tty

2007-11-14 Thread Greg Kroah-Hartman

-stable review patch.  If anyone has any objections, please let us know.

--
From: Jiri Slaby <[EMAIL PROTECTED]>

patch ac6aec2f5683588361ab408cb3346b08c66bdfbe in mainline.

- register_device unconditionally (non-pci dependent) to have also isa
  devices in /dev
- unregister devices on module removal
- don't set TTY_DRIVER_DYNAMIC_DEV twice (removed the one dependent on some
  macro)

This is the substantial part of the patch and the previous point is for
not checking which devices to unregister and which not (simply register
and unregister all found no matter on which bus they are plugged).


Signed-off-by: Jiri Slaby <[EMAIL PROTECTED]>
Cc: Ferenc Wagner <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/char/rocket.c |   14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

--- a/drivers/char/rocket.c
+++ b/drivers/char/rocket.c
@@ -699,8 +699,8 @@ static void init_r_port(int board, int a
spin_lock_init(&info->slock);
mutex_init(&info->write_mtx);
rp_table[line] = info;
-   if (pci_dev)
-   tty_register_device(rocket_driver, line, &pci_dev->dev);
+   tty_register_device(rocket_driver, line, pci_dev ? &pci_dev->dev :
+   NULL);
 }
 
 /*
@@ -2434,7 +2434,7 @@ static int __init rp_init(void)
rocket_driver->init_termios.c_ispeed = 9600;
rocket_driver->init_termios.c_ospeed = 9600;
 #ifdef ROCKET_SOFT_FLOW
-   rocket_driver->flags |= TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
+   rocket_driver->flags |= TTY_DRIVER_REAL_RAW;
 #endif
tty_set_operations(rocket_driver, &rocket_ops);
 
@@ -2491,10 +2491,14 @@ static void rp_cleanup_module(void)
if (retval)
printk(KERN_INFO "Error %d while trying to unregister "
   "rocketport driver\n", -retval);
-   put_tty_driver(rocket_driver);
 
for (i = 0; i < MAX_RP_PORTS; i++)
-   kfree(rp_table[i]);
+   if (rp_table[i]) {
+   tty_unregister_device(rocket_driver, i);
+   kfree(rp_table[i]);
+   }
+
+   put_tty_driver(rocket_driver);
 
for (i = 0; i < NUM_BOARDS; i++) {
if (rcktpt_io_addr[i] <= 0 || is_PCI[i])

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 30/40] ide: Fix siimage driver accessing beyond array boundary

2007-11-14 Thread Greg Kroah-Hartman

-stable review patch.  If anyone has any objections, please let us know.

--
From: Benjamin Herrenschmidt <[EMAIL PROTECTED]>

patch a87a87ccdc541e0a0cc8c7d01a365be8d9153a7b in mainline.

The siimage uses an incorrect construct to access the other drive of a pair,
causing it to access beyond an array boundary on the secondary interface.

This fixes it by using the new ide_get_paired_drive() helper instead.

Bart: patch description fixes

Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]>
Cc: Andrew Morton <[EMAIL PROTECTED]>
Acked-by: Sergei Shtylyov <[EMAIL PROTECTED]>
Signed-off-by: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/ide/pci/siimage.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/ide/pci/siimage.c
+++ b/drivers/ide/pci/siimage.c
@@ -180,7 +180,7 @@ static void sil_tune_pio(ide_drive_t *dr
const u16 data_speed[]  = { 0x328a, 0x2283, 0x1104, 0x10c3, 0x10c1 };
 
ide_hwif_t *hwif= HWIF(drive);
-   ide_drive_t *pair   = &hwif->drives[drive->dn ^ 1];
+   ide_drive_t *pair   = ide_get_paired_drive(drive);
u32 speedt  = 0;
u16 speedp  = 0;
unsigned long addr  = siimage_seldev(drive, 0x04);

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 31/40] ide: Fix cs5535 driver accessing beyond array boundary

2007-11-14 Thread Greg Kroah-Hartman

-stable review patch.  If anyone has any objections, please let us know.

--
From: Benjamin Herrenschmidt <[EMAIL PROTECTED]>


patch 15d8061bf02aa299b2447f7a22fd18b4a503ea9d in mainline.

The cs5535 uses an incorrect construct to access the other drive of a pair,
causing it to access beyond an array boundary on the secondary interface.

This fixes it by using the new ide_get_paired_drive() helper instead.

Bart: patch description fixes

Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]>
Cc: Andrew Morton <[EMAIL PROTECTED]>
Acked-by: Sergei Shtylyov <[EMAIL PROTECTED]>
Signed-off-by: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/ide/pci/cs5535.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/ide/pci/cs5535.c
+++ b/drivers/ide/pci/cs5535.c
@@ -84,7 +84,7 @@ static void cs5535_set_speed(ide_drive_t
 
/* Set the PIO timings */
if ((speed & XFER_MODE) == XFER_PIO) {
-   ide_drive_t *pair = &drive->hwif->drives[drive->dn ^ 1];
+   ide_drive_t *pair = ide_get_paired_drive(drive);
u8 cmd, pioa;
 
cmd = pioa = speed - XFER_PIO_0;

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 28/40] ide: fix serverworks.c UDMA regression

2007-11-14 Thread Greg Kroah-Hartman

-stable review patch.  If anyone has any objections, please let us know.

--
From: Tony Battersby <[EMAIL PROTECTED]>

patch 0c824b51b338c808de650b440ba5f9f4a725f7fc in mainline.

The patch described by the following excerpt from ChangeLog-2.6.22 makes
it impossible to use UDMA on a Tyan S2707 motherboard (SvrWks CSB5):

commit 2d5eaa6dd744a641e75503232a01f52d0768884c
Author: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
Date:   Thu May 10 00:01:08 2007 +0200

ide: rework the code for selecting the best DMA transfer mode (v3)

...

This one-line patch against 2.6.23 fixes the problem.

Signed-off-by: Tony Battersby <[EMAIL PROTECTED]>
Signed-off-by: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/ide/pci/serverworks.c |1 +
 1 file changed, 1 insertion(+)

--- a/drivers/ide/pci/serverworks.c
+++ b/drivers/ide/pci/serverworks.c
@@ -97,6 +97,7 @@ static u8 svwks_udma_filter(ide_drive_t 
mode = 2;
 
switch(mode) {
+   case 3:  mask = 0x3f; break;
case 2:  mask = 0x1f; break;
case 1:  mask = 0x07; break;
default: mask = 0x00; break;

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 29/40] ide: Add ide_get_paired_drive() helper

2007-11-14 Thread Greg Kroah-Hartman

-stable review patch.  If anyone has any objections, please let us know.

--
From: Benjamin Herrenschmidt <[EMAIL PROTECTED]>

patch 1b678347121001c3c230c6eccfdf9f65c3ec1a4e in mainline.

This adds a helper to get to the "other" drive on a pair connected
to a given hwif.

Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]>
Cc: Andrew Morton <[EMAIL PROTECTED]>
Acked-by: Sergei Shtylyov <[EMAIL PROTECTED]>
Signed-off-by: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 include/linux/ide.h |7 +++
 1 file changed, 7 insertions(+)

--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1437,4 +1437,11 @@ static inline int hwif_to_node(ide_hwif_
return dev ? pcibus_to_node(dev->bus) : -1;
 }
 
+static inline ide_drive_t *ide_get_paired_drive(ide_drive_t *drive)
+{
+   ide_hwif_t *hwif= HWIF(drive);
+
+   return &hwif->drives[(drive->dn ^ 1) & 1];
+}
+
 #endif /* _IDE_H */

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 26/40] i4l: Fix random hard freeze with AVM c4 card

2007-11-14 Thread Greg Kroah-Hartman


-stable review patch.  If anyone has any objections, please let us know.

--
From: Karsten Keil <[EMAIL PROTECTED]>

patch 1ccfd63367c1a6aaf8b33943f18856dde85f2f0b in mainline.

The patch
- Includes the call to capilib_data_b3_req in the spinlock. This routine
  in turn calls the offending mq_enqueue routine that triggered the
  freeze if not locked.  This should also fix other indicators of
  incosistent capilib_msgidqueue list, that trigger messages like:
  Oct  5 03:05:57 BERL0 kernel: kcapi: msgid 3019 ncci 0x30301 not on queue
  that we saw several times a day (usually several in a row).
- Fixes all occurrences of c4_dispatch_tx to be called with active
  spinlock, there were some instances where no lock was active. Mostly
  these are in very infrequently called routines, so the additional
  performance penalty is minimal.

Signed-off-by: Karsten Keil <[EMAIL PROTECTED]>
Signed-off-by: Rainer Brestan <[EMAIL PROTECTED]>
Signed-off-by: Ralf Schlatterbeck <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/isdn/hardware/avm/c4.c |   14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

--- a/drivers/isdn/hardware/avm/c4.c
+++ b/drivers/isdn/hardware/avm/c4.c
@@ -727,6 +727,7 @@ static void c4_send_init(avmcard *card)
 {
struct sk_buff *skb;
void *p;
+   unsigned long flags;
 
skb = alloc_skb(15, GFP_ATOMIC);
if (!skb) {
@@ -744,12 +745,15 @@ static void c4_send_init(avmcard *card)
skb_put(skb, (u8 *)p - (u8 *)skb->data);
 
skb_queue_tail(&card->dma->send_queue, skb);
+   spin_lock_irqsave(&card->lock, flags);
c4_dispatch_tx(card);
+   spin_unlock_irqrestore(&card->lock, flags);
 }
 
 static int queue_sendconfigword(avmcard *card, u32 val)
 {
struct sk_buff *skb;
+   unsigned long flags;
void *p;
 
skb = alloc_skb(3+4, GFP_ATOMIC);
@@ -766,7 +770,9 @@ static int queue_sendconfigword(avmcard 
skb_put(skb, (u8 *)p - (u8 *)skb->data);
 
skb_queue_tail(&card->dma->send_queue, skb);
+   spin_lock_irqsave(&card->lock, flags);
c4_dispatch_tx(card);
+   spin_unlock_irqrestore(&card->lock, flags);
return 0;
 }
 
@@ -986,7 +992,9 @@ static void c4_release_appl(struct capi_
struct sk_buff *skb;
void *p;
 
+   spin_lock_irqsave(&card->lock, flags);
capilib_release_appl(&cinfo->ncci_head, appl);
+   spin_unlock_irqrestore(&card->lock, flags);
 
if (ctrl->cnr == card->cardnr) {
skb = alloc_skb(7, GFP_ATOMIC);
@@ -1019,7 +1027,8 @@ static u16 c4_send_message(struct capi_c
u16 retval = CAPI_NOERROR;
unsigned long flags;
 
-   if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_REQ) {
+   spin_lock_irqsave(&card->lock, flags);
+   if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_REQ) {
retval = capilib_data_b3_req(&cinfo->ncci_head,
 CAPIMSG_APPID(skb->data),
 CAPIMSG_NCCI(skb->data),
@@ -1027,10 +1036,9 @@ static u16 c4_send_message(struct capi_c
}
if (retval == CAPI_NOERROR) {
skb_queue_tail(&card->dma->send_queue, skb);
-   spin_lock_irqsave(&card->lock, flags);
c4_dispatch_tx(card);
-   spin_unlock_irqrestore(&card->lock, flags);
}
+   spin_unlock_irqrestore(&card->lock, flags);
return retval;
 }
 

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 27/40] i4l: fix random freezes with AVM B1 drivers

2007-11-14 Thread Greg Kroah-Hartman


-stable review patch.  If anyone has any objections, please let us know.

--
From: Karsten Keil <[EMAIL PROTECTED]>

patch 9713d9e650045f7f2afd81d58a068827be306993 in mainline.

This fix the same issue which was debbuged for the C4 controller for the B1
versions.

The capilib_ function modify or traverse a linked list without locking.

This patch extends the existing locking to the calls of these function to
prevent access to a list which is in the middle of a modification.

Signed-off-by: Karsten Keil <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/isdn/hardware/avm/b1.c |   28 +---
 1 file changed, 13 insertions(+), 15 deletions(-)

--- a/drivers/isdn/hardware/avm/b1.c
+++ b/drivers/isdn/hardware/avm/b1.c
@@ -321,12 +321,15 @@ void b1_reset_ctr(struct capi_ctr *ctrl)
avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata);
avmcard *card = cinfo->card;
unsigned int port = card->port;
+   unsigned long flags;
 
b1_reset(port);
b1_reset(port);
 
memset(cinfo->version, 0, sizeof(cinfo->version));
+   spin_lock_irqsave(&card->lock, flags);
capilib_release(&cinfo->ncci_head);
+   spin_unlock_irqrestore(&card->lock, flags);
capi_ctr_reseted(ctrl);
 }
 
@@ -361,9 +364,8 @@ void b1_release_appl(struct capi_ctr *ct
unsigned int port = card->port;
unsigned long flags;
 
-   capilib_release_appl(&cinfo->ncci_head, appl);
-
spin_lock_irqsave(&card->lock, flags);
+   capilib_release_appl(&cinfo->ncci_head, appl);
b1_put_byte(port, SEND_RELEASE);
b1_put_word(port, appl);
spin_unlock_irqrestore(&card->lock, flags);
@@ -380,27 +382,27 @@ u16 b1_send_message(struct capi_ctr *ctr
u8 subcmd = CAPIMSG_SUBCOMMAND(skb->data);
u16 dlen, retval;
 
+   spin_lock_irqsave(&card->lock, flags);
if (CAPICMD(cmd, subcmd) == CAPI_DATA_B3_REQ) {
retval = capilib_data_b3_req(&cinfo->ncci_head,
 CAPIMSG_APPID(skb->data),
 CAPIMSG_NCCI(skb->data),
 CAPIMSG_MSGID(skb->data));
-   if (retval != CAPI_NOERROR) 
+   if (retval != CAPI_NOERROR) {
+   spin_unlock_irqrestore(&card->lock, flags);
return retval;
+   }
 
dlen = CAPIMSG_DATALEN(skb->data);
 
-   spin_lock_irqsave(&card->lock, flags);
b1_put_byte(port, SEND_DATA_B3_REQ);
b1_put_slice(port, skb->data, len);
b1_put_slice(port, skb->data + len, dlen);
-   spin_unlock_irqrestore(&card->lock, flags);
} else {
-   spin_lock_irqsave(&card->lock, flags);
b1_put_byte(port, SEND_MESSAGE);
b1_put_slice(port, skb->data, len);
-   spin_unlock_irqrestore(&card->lock, flags);
}
+   spin_unlock_irqrestore(&card->lock, flags);
 
dev_kfree_skb_any(skb);
return CAPI_NOERROR;
@@ -534,17 +536,17 @@ irqreturn_t b1_interrupt(int interrupt, 
 
ApplId = (unsigned) b1_get_word(card->port);
MsgLen = b1_get_slice(card->port, card->msgbuf);
-   spin_unlock_irqrestore(&card->lock, flags);
if (!(skb = alloc_skb(MsgLen, GFP_ATOMIC))) {
printk(KERN_ERR "%s: incoming packet dropped\n",
card->name);
+   spin_unlock_irqrestore(&card->lock, flags);
} else {
memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen);
if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_CONF)
capilib_data_b3_conf(&cinfo->ncci_head, ApplId,
 CAPIMSG_NCCI(skb->data),
 CAPIMSG_MSGID(skb->data));
-
+   spin_unlock_irqrestore(&card->lock, flags);
capi_ctr_handle_message(ctrl, ApplId, skb);
}
break;
@@ -554,21 +556,17 @@ irqreturn_t b1_interrupt(int interrupt, 
ApplId = b1_get_word(card->port);
NCCI = b1_get_word(card->port);
WindowSize = b1_get_word(card->port);
-   spin_unlock_irqrestore(&card->lock, flags);
-
capilib_new_ncci(&cinfo->ncci_head, ApplId, NCCI, WindowSize);
-
+   spin_unlock_irqrestore(&card->lock, flags);
break;
 
case RECEIVE_FREE_NCCI:
 
ApplId = b1_get_word(card->port);
NCCI = b1_get_word(card->port);
-   spin_unlock_irqrestore(&card->lock, fla

[patch 25/40] ALSA: hda-codec - Add array terminator for dmic in STAC codec

2007-11-14 Thread Greg Kroah-Hartman

-stable review patch.  If anyone has any objections, please let us know.

--
From: Takashi Iwai <[EMAIL PROTECTED]>

patch f6e9852ad05fa28301c83d4e2b082620de010358 in mainline.

[ALSA] hda-codec - Add array terminator for dmic in STAC codec

Reported by Jan-Marek Glogowski.

The dmic array is passed to snd_hda_parse_pin_def_config() and
should be zero-terminated.

Signed-off-by: Takashi Iwai <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 sound/pci/hda/patch_sigmatel.c |   14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -162,8 +162,9 @@ static hda_nid_t stac925x_dac_nids[1] = 
 0x02,
 };
 
-static hda_nid_t stac925x_dmic_nids[1] = {
-   0x15, 
+#define STAC925X_NUM_DMICS 1
+static hda_nid_t stac925x_dmic_nids[STAC925X_NUM_DMICS + 1] = {
+   0x15, 0
 };
 
 static hda_nid_t stac922x_adc_nids[2] = {
@@ -190,8 +191,9 @@ static hda_nid_t stac9205_mux_nids[2] = 
 0x19, 0x1a
 };
 
-static hda_nid_t stac9205_dmic_nids[2] = {
-0x17, 0x18,
+#define STAC9205_NUM_DMICS 2
+static hda_nid_t stac9205_dmic_nids[STAC9205_NUM_DMICS + 1] = {
+0x17, 0x18, 0
 };
 
 static hda_nid_t stac9200_pin_nids[8] = {
@@ -2063,7 +2065,7 @@ static int patch_stac925x(struct hda_cod
case 0x83847633: /* STAC9202D */
case 0x83847636: /* STAC9251  */
case 0x83847637: /* STAC9251D */
-   spec->num_dmics = 1;
+   spec->num_dmics = STAC925X_NUM_DMICS;
spec->dmic_nids = stac925x_dmic_nids;
break;
default:
@@ -2307,7 +2309,7 @@ static int patch_stac9205(struct hda_cod
spec->mux_nids = stac9205_mux_nids;
spec->num_muxes = ARRAY_SIZE(stac9205_mux_nids);
spec->dmic_nids = stac9205_dmic_nids;
-   spec->num_dmics = ARRAY_SIZE(stac9205_dmic_nids);
+   spec->num_dmics = STAC9205_NUM_DMICS;
spec->dmux_nid = 0x1d;
 
spec->init = stac9205_core_init;

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 23/40] USB: add URB_FREE_BUFFER to permissible flags

2007-11-14 Thread Greg Kroah-Hartman


-stable review patch.  If anyone has any objections, please let us know.

--
From: Oliver Neukum <[EMAIL PROTECTED]>

patch 0b28baaf74ca04be2e0cc4d4dd2bbc801697f744 in mainline.

URB_FREE_BUFFER needs to be allowed in the sanity checks to use drivers that
use that flag.


Signed-off-by: Oliver Neukum <[EMAIL PROTECTED]>
Acked-by: Marcel Holtmann <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/usb/core/urb.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/usb/core/urb.c
+++ b/drivers/usb/core/urb.c
@@ -358,7 +358,7 @@ int usb_submit_urb(struct urb *urb, gfp_
 
/* enforce simple/standard policy */
allowed = (URB_NO_TRANSFER_DMA_MAP | URB_NO_SETUP_DMA_MAP |
-   URB_NO_INTERRUPT);
+   URB_NO_INTERRUPT | URB_FREE_BUFFER);
switch (temp) {
case PIPE_BULK:
if (is_out)

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 24/40] USB: usbserial - fix potential deadlock between write() and IRQ

2007-11-14 Thread Greg Kroah-Hartman

-stable review patch.  If anyone has any objections, please let us know.

--
From: Jiri Kosina <[EMAIL PROTECTED]>

patch acd2a847e7fee7df11817f67dba75a2802793e5d in mainline.

USB: usbserial - fix potential deadlock between write() and IRQ

usb_serial_generic_write() doesn't disable interrupts when taking port->lock,
and could therefore deadlock with usb_serial_generic_read_bulk_callback()
being called from interrupt, taking the same lock. Fix it.

Signed-off-by: Jiri Kosina <[EMAIL PROTECTED]>
Acked-by: Larry Finger <[EMAIL PROTECTED]>
Cc: Marcin Slusarz <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/usb/serial/generic.c |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -208,14 +208,15 @@ int usb_serial_generic_write(struct usb_
 
/* only do something if we have a bulk out endpoint */
if (serial->num_bulk_out) {
-   spin_lock_bh(&port->lock);
+   unsigned long flags;
+   spin_lock_irqsave(&port->lock, flags);
if (port->write_urb_busy) {
-   spin_unlock_bh(&port->lock);
+   spin_unlock_irqrestore(&port->lock, flags);
dbg("%s - already writing", __FUNCTION__);
return 0;
}
port->write_urb_busy = 1;
-   spin_unlock_bh(&port->lock);
+   spin_unlock_irqrestore(&port->lock, flags);
 
count = (count > port->bulk_out_size) ? port->bulk_out_size : 
count;
 

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 20/40] USB: remove USB_QUIRK_NO_AUTOSUSPEND

2007-11-14 Thread Greg Kroah-Hartman


-stable review patch.  If anyone has any objections, please let us know.

--
From: Alan Stern <[EMAIL PROTECTED]>

patch a691efa9888e71232dfb4088fb8a8304ffc7b0f9 in mainline.

This patch (as995) cleans up the remains of the former NO_AUTOSUSPEND
quirk.  Since autosuspend is disabled by default, we will let
userspace worry about which devices can safely be suspended.  Thus the
lengthy series of quirk entries is no longer needed, and neither is
the quirk ID.  I suppose someone might eventually run across a hub
that can't be suspended; let's ignore the possibility for now.

The patch also cleans up the hasty way in which autosuspend gets
disabled.  Setting udev->autosuspend_delay to -1 wasn't quite right,
because the value is always supposed to be a multiple of HZ.  It's
better to leave the delay value alone and set autosuspend_disabled,
which is what the quirk routine used to do.

Signed-off-by: Alan Stern <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/usb/core/quirks.c  |   81 -
 include/linux/usb/quirks.h |7 +--
 2 files changed, 3 insertions(+), 85 deletions(-)

--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -32,52 +32,6 @@ static const struct usb_device_id usb_qu
{ USB_DEVICE(0x0204, 0x6025), .driver_info = USB_QUIRK_RESET_RESUME },
/* HP 5300/5370C scanner */
{ USB_DEVICE(0x03f0, 0x0701), .driver_info = USB_QUIRK_STRING_FETCH_255 
},
-   /* Hewlett-Packard PhotoSmart 720 / PhotoSmart 935 (storage) */
-   { USB_DEVICE(0x03f0, 0x4002), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
-
-   /* SGS Thomson Microelectronics 4in1 card reader */
-   { USB_DEVICE(0x0483, 0x0321), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
-
-   /* Acer Peripherals Inc. (now BenQ Corp.) Prisa 640BU */
-   { USB_DEVICE(0x04a5, 0x207e), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
-   /* Benq S2W 3300U */
-   { USB_DEVICE(0x04a5, 0x20b0), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
-   /* Canon, Inc. CanoScan N1240U/LiDE30 */
-   { USB_DEVICE(0x04a9, 0x220e), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
-   /* Canon, Inc. CanoScan N650U/N656U */
-   { USB_DEVICE(0x04a9, 0x2206), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
-   /* Canon, Inc. CanoScan 1220U */
-   { USB_DEVICE(0x04a9, 0x2207), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
-   /* Canon, Inc. CanoScan N670U/N676U/LiDE 20 */
-   { USB_DEVICE(0x04a9, 0x220d), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
-   /* old Cannon scanner */
-   { USB_DEVICE(0x04a9, 0x2220), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
-   /* Seiko Epson Corp. Perfection 1200 */
-   { USB_DEVICE(0x04b8, 0x0104), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
-   /* Seiko Epson Corp. Perfection 660 */
-   { USB_DEVICE(0x04b8, 0x0114), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
-   /* Epson Perfection 1260 Photo */
-   { USB_DEVICE(0x04b8, 0x011d), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
-   /* Seiko Epson Corp - Perfection 1670 */
-   { USB_DEVICE(0x04b8, 0x011f), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
-   /* EPSON Perfection 2480 */
-   { USB_DEVICE(0x04b8, 0x0121), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
-   /* Seiko Epson Corp.*/
-   { USB_DEVICE(0x04b8, 0x0122), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
-   /* Samsung ML-2010 printer */
-   { USB_DEVICE(0x04e8, 0x326c), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
-   /* Samsung ML-2510 Series printer */
-   { USB_DEVICE(0x04e8, 0x327e), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
-   /* Elsa MicroLink 56k (V.250) */
-   { USB_DEVICE(0x05cc, 0x2267), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
-   /* Ultima Electronics Corp.*/
-   { USB_DEVICE(0x05d8, 0x4005), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
-
-   /* Genesys USB-to-IDE */
-   { USB_DEVICE(0x0503, 0x0702), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
-
-   /* USB Graphical LCD - EEH Datalink GmbH */
-   { USB_DEVICE(0x060c, 0x04eb), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
 
/* INTEL VALUE SSD */
{ USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME },
@@ -85,44 +39,15 @@ static const struct usb_device_id usb_qu
/* M-Systems Flash Disk Pioneers */
{ USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME },
 
-   /* Agfa Snapscan1212u */
-   { USB_DEVICE(0x06bd, 0x2061), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
-   /* Seagate RSS LLC */
-   { USB_DEVICE(0x0bc2, 0x3000), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
-   /* Umax [hex] Astra 3400U */
-   { USB_DEVICE(0x1606, 0x0060), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
-
/* Philips PSC805 audio device */
{ USB_DEVICE(0x0471, 0x0155), .driver_info = USB_QUIRK_RESET_RESUME },
 
-   /* Alcor multi-card reader */
-   { USB_DEVICE(0x058

[patch 22/40] USB: mutual exclusion for EHCI init and port resets

2007-11-14 Thread Greg Kroah-Hartman


-stable review patch.  If anyone has any objections, please let us know.

--
From: Alan Stern <[EMAIL PROTECTED]>

patch 32fe01985aa2cb2562f6fc171e526e279abe10db in mainline.

This patch (as999) fixes a problem that sometimes shows up when host
controller driver modules are loaded in the wrong order.  If ehci-hcd
happens to initialize an EHCI controller while the companion OHCI or
UHCI controller is in the middle of a port reset, the reset can fail
and the companion may get very confused.  The patch adds an
rw-semaphore and uses it to keep EHCI initialization and port resets
mutually exclusive.

Signed-off-by: Alan Stern <[EMAIL PROTECTED]>
Acked-by: David Brownell <[EMAIL PROTECTED]>
Cc: David Miller <[EMAIL PROTECTED]>
Cc: Dely L Sy <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 drivers/usb/core/hcd.h  |8 +++-
 drivers/usb/core/hub.c  |   15 ++-
 drivers/usb/host/ehci-hcd.c |8 
 3 files changed, 29 insertions(+), 2 deletions(-)

--- a/drivers/usb/core/hcd.h
+++ b/drivers/usb/core/hcd.h
@@ -19,6 +19,8 @@
 
 #ifdef __KERNEL__
 
+#include 
+
 /* This file contains declarations of usbcore internals that are mostly
  * used or exposed by Host Controller Drivers.
  */
@@ -454,5 +456,9 @@ static inline void usbmon_urb_complete(s
: (in_interrupt () ? "in_interrupt" : "can sleep"))
 
 
-#endif /* __KERNEL__ */
+/* This rwsem is for use only by the hub driver and ehci-hcd.
+ * Nobody else should touch it.
+ */
+extern struct rw_semaphore ehci_cf_port_reset_rwsem;
 
+#endif /* __KERNEL__ */
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -125,6 +125,12 @@ MODULE_PARM_DESC(use_both_schemes,
"try the other device initialization scheme if the "
"first one fails");
 
+/* Mutual exclusion for EHCI CF initialization.  This interferes with
+ * port reset on some companion controllers.
+ */
+DECLARE_RWSEM(ehci_cf_port_reset_rwsem);
+EXPORT_SYMBOL_GPL(ehci_cf_port_reset_rwsem);
+
 
 static inline char *portspeed(int portstatus)
 {
@@ -1460,6 +1466,11 @@ static int hub_port_reset(struct usb_hub
 {
int i, status;
 
+   /* Block EHCI CF initialization during the port reset.
+* Some companion controllers don't like it when they mix.
+*/
+   down_read(&ehci_cf_port_reset_rwsem);
+
/* Reset the port */
for (i = 0; i < PORT_RESET_TRIES; i++) {
status = set_port_feature(hub->hdev,
@@ -1490,7 +1501,7 @@ static int hub_port_reset(struct usb_hub
usb_set_device_state(udev, status
? USB_STATE_NOTATTACHED
: USB_STATE_DEFAULT);
-   return status;
+   goto done;
}
 
dev_dbg (hub->intfdev,
@@ -1503,6 +1514,8 @@ static int hub_port_reset(struct usb_hub
"Cannot enable port %i.  Maybe the USB cable is bad?\n",
port1);
 
+ done:
+   up_read(&ehci_cf_port_reset_rwsem);
return status;
 }
 
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -570,10 +570,18 @@ static int ehci_run (struct usb_hcd *hcd
 * are explicitly handed to companion controller(s), so no TT is
 * involved with the root hub.  (Except where one is integrated,
 * and there's no companion controller unless maybe for USB OTG.)
+*
+* Turning on the CF flag will transfer ownership of all ports
+* from the companions to the EHCI controller.  If any of the
+* companions are in the middle of a port reset at the time, it
+* could cause trouble.  Write-locking ehci_cf_port_reset_rwsem
+* guarantees that no resets are in progress.
 */
+   down_write(&ehci_cf_port_reset_rwsem);
hcd->state = HC_STATE_RUNNING;
ehci_writel(ehci, FLAG_CF, &ehci->regs->configured_flag);
ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */
+   up_write(&ehci_cf_port_reset_rwsem);
 
temp = HC_VERSION(ehci_readl(ehci, &ehci->caps->hc_capbase));
ehci_info (ehci,

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 19/40] MSI: Use correct data offset for 32-bit MSI in read_msi_msg()

2007-11-14 Thread Greg Kroah-Hartman


-stable review patch.  If anyone has any objections, please let us know.

--
From: Roland Dreier <[EMAIL PROTECTED]>

patch cbf5d9e6b9bcf03291cbb51db144b3e2773a8a2d in mainline.

While reading the MSI code trying to find a reason why MSI wouldn't
work for devices that have a 32-bit MSI address capability, I noticed
that read_msi_msg() seems to read the message data from the wrong
offset in this case.

Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
Acked-by: Eric W. Biederman <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/pci/msi.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -132,7 +132,7 @@ void read_msi_msg(unsigned int irq, stru
pci_read_config_word(dev, msi_data_reg(pos, 1), &data);
} else {
msg->address_hi = 0;
-   pci_read_config_word(dev, msi_data_reg(pos, 1), &data);
+   pci_read_config_word(dev, msi_data_reg(pos, 0), &data);
}
msg->data = data;
break;

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 21/40] usb-gadget-ether: prevent oops caused by error interrupt race

2007-11-14 Thread Greg Kroah-Hartman


-stable review patch.  If anyone has any objections, please let us know.

--
From: Benedikt Spranger <[EMAIL PROTECTED]>

patch 5395353e0c8272fe73ac914acd7e4add0da2bef0 in mainline.

Fix a longstanding race in the Ethernet gadget driver, which can cause an
oops on device disconnect.  The fix is just to make the TX path check
whether its freelist is empty.  That check is otherwise not necessary,
since the queue is always stopped when that list empties (and restarted
when request completion puts an entry back on that freelist).

The race window starts when the network code decides to transmit a packet,
and ends when hard_start_xmit() grabs the freelist lock.  When disconnect()
is called inside that window, it shuts down the TX queue and breaks the
otherwise-solid assumption that packets are never sent through a TX queue
that's stopped.

Signed-off-by: Benedikt Spranger <[EMAIL PROTECTED]>
Signed-off-by: Thomas Gleixner <[EMAIL PROTECTED]>
Signed-off-by: David Brownell <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/usb/gadget/ether.c |   12 
 1 file changed, 12 insertions(+)

--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -1989,8 +1989,20 @@ static int eth_start_xmit (struct sk_buf
}
 
spin_lock_irqsave(&dev->req_lock, flags);
+   /*
+* this freelist can be empty if an interrupt triggered disconnect()
+* and reconfigured the gadget (shutting down this queue) after the
+* network stack decided to xmit but before we got the spinlock.
+*/
+   if (list_empty(&dev->tx_reqs)) {
+   spin_unlock_irqrestore(&dev->req_lock, flags);
+   return 1;
+   }
+
req = container_of (dev->tx_reqs.next, struct usb_request, list);
list_del (&req->list);
+
+   /* temporarily stop TX queue when the freelist empties */
if (list_empty (&dev->tx_reqs))
netif_stop_queue (net);
spin_unlock_irqrestore(&dev->req_lock, flags);

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 17/40] md: fix an unsigned compare to allow creation of bitmaps with v1.0 metadata

2007-11-14 Thread Greg Kroah-Hartman


-stable review patch.  If anyone has any objections, please let us know.

--
From: NeilBrown <[EMAIL PROTECTED]>

patch 85bfb4da8cad483a4e550ec89060d05a4daf895b in mainline.

As page->index is unsigned, this all becomes an unsigned comparison, which
 almost always returns an error.

Signed-off-by: Neil Brown <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/md/bitmap.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -274,7 +274,7 @@ static int write_sb_page(struct bitmap *
if (bitmap->offset < 0) {
/* DATA  BITMAP METADATA  */
if (bitmap->offset
-   + page->index * (PAGE_SIZE/512)
+   + (long)(page->index * (PAGE_SIZE/512))
+ size/512 > 0)
/* bitmap runs in to metadata */
return -EINVAL;

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 18/40] md: raid5: fix clearing of biofill operations

2007-11-14 Thread Greg Kroah-Hartman

-stable review patch.  If anyone has any objections, please let us know.

--

From: Dan Williams <[EMAIL PROTECTED]>

raid5: fix clearing of biofill operations

This is the correct merge of the two upstream patches for this issue (it
was mis-merged...)

ops_complete_biofill() runs outside of spin_lock(&sh->lock) and clears the
'pending' and 'ack' bits.  Since the test_and_ack_op() macro only checks
against 'complete' it can get an inconsistent snapshot of pending work.

Move the clearing of these bits to handle_stripe5(), under the lock.

Signed-off-by: Dan Williams <[EMAIL PROTECTED]>
Tested-by: Joel Bertrand <[EMAIL PROTECTED]>
Signed-off-by: Neil Brown <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/md/raid5.c |   17 ++---
 1 file changed, 14 insertions(+), 3 deletions(-)

--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -377,7 +377,12 @@ static unsigned long get_stripe_work(str
ack++;
 
sh->ops.count -= ack;
-   BUG_ON(sh->ops.count < 0);
+   if (unlikely(sh->ops.count < 0)) {
+   printk(KERN_ERR "pending: %#lx ops.pending: %#lx ops.ack: %#lx "
+   "ops.complete: %#lx\n", pending, sh->ops.pending,
+   sh->ops.ack, sh->ops.complete);
+   BUG();
+   }
 
return pending;
 }
@@ -551,8 +556,7 @@ static void ops_complete_biofill(void *s
}
}
}
-   clear_bit(STRIPE_OP_BIOFILL, &sh->ops.ack);
-   clear_bit(STRIPE_OP_BIOFILL, &sh->ops.pending);
+   set_bit(STRIPE_OP_BIOFILL, &sh->ops.complete);
 
return_io(return_bi);
 
@@ -2630,6 +2634,13 @@ static void handle_stripe5(struct stripe
s.expanded = test_bit(STRIPE_EXPAND_READY, &sh->state);
/* Now to look around and see what can be done */
 
+   /* clean-up completed biofill operations */
+   if (test_bit(STRIPE_OP_BIOFILL, &sh->ops.complete)) {
+   clear_bit(STRIPE_OP_BIOFILL, &sh->ops.pending);
+   clear_bit(STRIPE_OP_BIOFILL, &sh->ops.ack);
+   clear_bit(STRIPE_OP_BIOFILL, &sh->ops.complete);
+   }
+
rcu_read_lock();
for (i=disks; i--; ) {
mdk_rdev_t *rdev;

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 15/40] dm delay: fix status

2007-11-14 Thread Greg Kroah-Hartman


-stable review patch.  If anyone has any objections, please let us know.

--
From: Milan Broz <[EMAIL PROTECTED]>

patch 79662d1ea37392651f2cff08626cab6a40ba3adc in mainline.


Fix missing space in dm-delay target status output
if separate read and write delay are configured.

Signed-off-by: Milan Broz <[EMAIL PROTECTED]>
Signed-off-by: Alasdair G Kergon <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>


---
 drivers/md/dm-delay.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/md/dm-delay.c
+++ b/drivers/md/dm-delay.c
@@ -305,7 +305,7 @@ static int delay_status(struct dm_target
   (unsigned long long) dc->start_read,
   dc->read_delay);
if (dc->dev_write)
-   DMEMIT("%s %llu %u", dc->dev_write->name,
+   DMEMIT(" %s %llu %u", dc->dev_write->name,
   (unsigned long long) dc->start_write,
   dc->write_delay);
break;

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 16/40] dm: fix thaw_bdev

2007-11-14 Thread Greg Kroah-Hartman


-stable review patch.  If anyone has any objections, please let us know.

--
From: Jun'ichi Nomura <[EMAIL PROTECTED]>

patch ae9da83f6d800fe1f3b23bfbc8f7222ad1c5bb74 in mainline.

This patch fixes a bd_mount_sem counter corruption bug in device-mapper.

thaw_bdev() should be called only when freeze_bdev() was called for the
device.
Otherwise, thaw_bdev() will up bd_mount_sem and corrupt the semaphore counter.
struct block_device with the corrupted semaphore may remain in slab cache
and be reused later.

Attached patch will fix it by calling unlock_fs() instead.
unlock_fs() will determine whether it should call thaw_bdev()
by checking the device is frozen or not.

Easy reproducer is:
  #!/bin/sh
  while [ 1 ]; do
 dmsetup --notable create a
 dmsetup --nolockfs suspend a
 dmsetup remove a
  done

It's not easy to see the effect of corrupted semaphore.
So I have tested with putting printk below in bdev_alloc_inode():
if (atomic_read(&ei->bdev.bd_mount_sem.count) != 1)
printk(KERN_DEBUG "Incorrect semaphore count = %d (%p)\n",
atomic_read(&ei->bdev.bd_mount_sem.count),
&ei->bdev);

Without the patch, I saw something like:
 Incorrect semaphore count = 17 (f2ab91c0)

With the patch, the message didn't appear.

The bug was introduced in 2.6.16 with this bug fix:

commit d9dde59ba03095e526640988c0fedd75e93bc8b7
Date:   Fri Feb 24 13:04:24 2006 -0800

[PATCH] dm: missing bdput/thaw_bdev at removal

Need to unfreeze and release bdev otherwise the bdev inode with
inconsistent state is reused later and cause problem.

and backported to 2.6.15.5.

It occurs only in free_dev(), which is called only when the dm device is
removed.  The buggy code is executed only if md->suspended_bdev is
non-NULL and that can happen only when the device was suspended without
noflush.

Signed-off-by: Jun'ichi Nomura <[EMAIL PROTECTED]>
Signed-off-by: Alasdair G Kergon <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>


---
 drivers/md/dm.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1064,12 +1064,14 @@ static struct mapped_device *alloc_dev(i
return NULL;
 }
 
+static void unlock_fs(struct mapped_device *md);
+
 static void free_dev(struct mapped_device *md)
 {
int minor = md->disk->first_minor;
 
if (md->suspended_bdev) {
-   thaw_bdev(md->suspended_bdev, NULL);
+   unlock_fs(md);
bdput(md->suspended_bdev);
}
mempool_destroy(md->tio_pool);

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 13/40] ALSA: hdsp - Fix zero division

2007-11-14 Thread Greg Kroah-Hartman

-stable review patch.  If anyone has any objections, please let us know.

--
From: Takashi Iwai <[EMAIL PROTECTED]>

patch 2a3988f6d2c5be9d02463097775d1c66a8290527 in mainline.

Fix zero-division bug in the calculation dds offset.

Signed-off-by: Takashi Iwai <[EMAIL PROTECTED]>
Signed-off-by: Jaroslav Kysela <[EMAIL PROTECTED]>
Cc: Maarten Bressers <[EMAIL PROTECTED]>
Cc: gentoo kernel <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 sound/pci/rme9652/hdsp.c |3 +++
 1 file changed, 3 insertions(+)

--- a/sound/pci/rme9652/hdsp.c
+++ b/sound/pci/rme9652/hdsp.c
@@ -3108,6 +3108,9 @@ static int hdsp_dds_offset(struct hdsp *
unsigned int dds_value = hdsp->dds_value;
int system_sample_rate = hdsp->system_sample_rate;
 
+   if (!dds_value)
+   return 0;
+
n = DDS_NUMERATOR;
/*
 * dds_value = n / rate

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 14/40] libata: sync NCQ blacklist with upstream

2007-11-14 Thread Greg Kroah-Hartman

-stable review patch.  If anyone has any objections, please let us know.

--
From: Tejun Heo <[EMAIL PROTECTED]>

Synchronize NCQ blacklist with the current upstream.  Based on changes
already in Linus's 2.6.24-rc kernel tree.

Signed-off-by: Tejun Heo <[EMAIL PROTECTED]>
Cc: Jeff Garzik <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/ata/libata-core.c |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3793,11 +3793,17 @@ static const struct ata_blacklist_entry 
/* Drives which do spurious command completion */
{ "HTS541680J9SA00","SB2IC7EP", ATA_HORKAGE_NONCQ, },
{ "HTS541612J9SA00","SBDIC7JP", ATA_HORKAGE_NONCQ, },
+   { "HDT722516DLA380","V43OA96A", ATA_HORKAGE_NONCQ, },
{ "Hitachi HTS541616J9SA00", "SB4OC70P", ATA_HORKAGE_NONCQ, },
{ "WDC WD740ADFD-00NLR1", NULL, ATA_HORKAGE_NONCQ, },
+   { "WDC WD3200AAJS-00RYA0", "12.01B01",  ATA_HORKAGE_NONCQ, },
{ "FUJITSU MHV2080BH",  "00840028", ATA_HORKAGE_NONCQ, },
+   { "ST9120822AS","3.CLF",ATA_HORKAGE_NONCQ, },
{ "ST9160821AS","3.CLF",ATA_HORKAGE_NONCQ, },
-   { "ST3160812AS","3.AD", ATA_HORKAGE_NONCQ, },
+   { "ST9160821AS","3.ALD",ATA_HORKAGE_NONCQ, },
+   { "ST9160821AS","3.CCD",ATA_HORKAGE_NONCQ, },
+   { "ST3160812AS","3.ADJ",ATA_HORKAGE_NONCQ, },
+   { "ST980813AS", "3.ADB",ATA_HORKAGE_NONCQ, },
{ "SAMSUNG HD401LJ","ZZ100-15", ATA_HORKAGE_NONCQ, },
 
/* devices which puke on READ_NATIVE_MAX */

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 11/40] ALSA: Fix build error without CONFIG_HAS_DMA

2007-11-14 Thread Greg Kroah-Hartman

-stable review patch.  If anyone has any objections, please let us know.

--
From: Takashi Iwai <[EMAIL PROTECTED]>

patch 8f11551b1798170dcffdd28475075ca4f1c6c990 in mainline

[ALSA] Fix build error without CONFIG_HAS_DMA

The recent change of include/asm-generic/dma-mapping-broken.h breaks
the build without CONFIG_HAS_DMA.  This patch is an ad hoc fix.

Signed-off-by: Takashi Iwai <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 sound/core/Makefile   |3 ++-
 sound/core/memalloc.c |6 ++
 2 files changed, 8 insertions(+), 1 deletion(-)

--- a/sound/core/Makefile
+++ b/sound/core/Makefile
@@ -14,7 +14,8 @@ endif
 snd-pcm-objs := pcm.o pcm_native.o pcm_lib.o pcm_timer.o pcm_misc.o \
pcm_memory.o
 
-snd-page-alloc-objs := memalloc.o sgbuf.o
+snd-page-alloc-y := memalloc.o
+snd-page-alloc-$(CONFIG_HAS_DMA) += sgbuf.o
 
 snd-rawmidi-objs  := rawmidi.o
 snd-timer-objs:= timer.o
--- a/sound/core/memalloc.c
+++ b/sound/core/memalloc.c
@@ -206,6 +206,7 @@ void snd_free_pages(void *ptr, size_t si
  *
  */
 
+#ifdef CONFIG_HAS_DMA
 /* allocate the coherent DMA pages */
 static void *snd_malloc_dev_pages(struct device *dev, size_t size, dma_addr_t 
*dma)
 {
@@ -239,6 +240,7 @@ static void snd_free_dev_pages(struct de
dec_snd_pages(pg);
dma_free_coherent(dev, PAGE_SIZE << pg, ptr, dma);
 }
+#endif /* CONFIG_HAS_DMA */
 
 #ifdef CONFIG_SBUS
 
@@ -312,12 +314,14 @@ int snd_dma_alloc_pages(int type, struct
dmab->area = snd_malloc_sbus_pages(device, size, &dmab->addr);
break;
 #endif
+#ifdef CONFIG_HAS_DMA
case SNDRV_DMA_TYPE_DEV:
dmab->area = snd_malloc_dev_pages(device, size, &dmab->addr);
break;
case SNDRV_DMA_TYPE_DEV_SG:
snd_malloc_sgbuf_pages(device, size, dmab, NULL);
break;
+#endif
default:
printk(KERN_ERR "snd-malloc: invalid device type %d\n", type);
dmab->area = NULL;
@@ -383,12 +387,14 @@ void snd_dma_free_pages(struct snd_dma_b
snd_free_sbus_pages(dmab->dev.dev, dmab->bytes, dmab->area, 
dmab->addr);
break;
 #endif
+#ifdef CONFIG_HAS_DMA
case SNDRV_DMA_TYPE_DEV:
snd_free_dev_pages(dmab->dev.dev, dmab->bytes, dmab->area, 
dmab->addr);
break;
case SNDRV_DMA_TYPE_DEV_SG:
snd_free_sgbuf_pages(dmab);
break;
+#endif
default:
printk(KERN_ERR "snd-malloc: invalid device type %d\n", 
dmab->dev.type);
}

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 12/40] ALSA: emu10k1 - Fix memory corruption

2007-11-14 Thread Greg Kroah-Hartman

-stable review patch.  If anyone has any objections, please let us know.

--
From: Takashi Iwai <[EMAIL PROTECTED]>

patch 7583cb51a1e276591f57a2fae05489c878f8ef54 from mainline.

[ALSA] emu10k1 - Fix memory corruption

The number of mixer elements for SPDIF control don't match with the
actual array size (3).  This may result in a memory corruption that
overwrites the i2c_capture_source field (ALSA bug#3095).

Signed-off-by: Takashi Iwai <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 sound/pci/emu10k1/emumixer.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/sound/pci/emu10k1/emumixer.c
+++ b/sound/pci/emu10k1/emumixer.c
@@ -871,7 +871,7 @@ static struct snd_kcontrol_new snd_emu10
.access =   SNDRV_CTL_ELEM_ACCESS_READ,
.iface =SNDRV_CTL_ELEM_IFACE_PCM,
.name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,MASK),
-   .count =4,
+   .count =3,
.info = snd_emu10k1_spdif_info,
.get =  snd_emu10k1_spdif_get_mask
 };
@@ -880,7 +880,7 @@ static struct snd_kcontrol_new snd_emu10
 {
.iface =SNDRV_CTL_ELEM_IFACE_PCM,
.name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT),
-   .count =4,
+   .count =3,
.info = snd_emu10k1_spdif_info,
.get =  snd_emu10k1_spdif_get,
.put =  snd_emu10k1_spdif_put

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 09/40] ALSA: hda-codec - Avoid zero NID in line_out_pinsof STAC codecs

2007-11-14 Thread Greg Kroah-Hartman

-stable review patch.  If anyone has any objections, please let us know.

--
From: Takashi Iwai <[EMAIL PROTECTED]>

patch c480f79bdca58923e605ff5e4698cfe1779bae70 in mainline

[ALSA] hda-codec - Avoid zero NID in line_out_pins[] of STAC codecs

The STAC codes adds line_out_pins[] for shared mic/line-inputs accordingly.
But, the current code may give a hole with NID=0 in some setting, which
results in an error at probe.  This patch fixes the problem.

Signed-off-by: Takashi Iwai <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 sound/pci/hda/patch_sigmatel.c |   15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -1182,7 +1182,8 @@ static int stac92xx_add_dyn_out_pins(str
case 3:
/* add line-in as side */
if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 3) {
-   cfg->line_out_pins[3] = cfg->input_pins[AUTO_PIN_LINE];
+   cfg->line_out_pins[cfg->line_outs] =
+   cfg->input_pins[AUTO_PIN_LINE];
spec->line_switch = 1;
cfg->line_outs++;
}
@@ -1190,12 +1191,14 @@ static int stac92xx_add_dyn_out_pins(str
case 2:
/* add line-in as clfe and mic as side */
if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 2) {
-   cfg->line_out_pins[2] = cfg->input_pins[AUTO_PIN_LINE];
+   cfg->line_out_pins[cfg->line_outs] =
+   cfg->input_pins[AUTO_PIN_LINE];
spec->line_switch = 1;
cfg->line_outs++;
}
if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 3) {
-   cfg->line_out_pins[3] = cfg->input_pins[AUTO_PIN_MIC];
+   cfg->line_out_pins[cfg->line_outs] =
+   cfg->input_pins[AUTO_PIN_MIC];
spec->mic_switch = 1;
cfg->line_outs++;
}
@@ -1203,12 +1206,14 @@ static int stac92xx_add_dyn_out_pins(str
case 1:
/* add line-in as surr and mic as clfe */
if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 1) {
-   cfg->line_out_pins[1] = cfg->input_pins[AUTO_PIN_LINE];
+   cfg->line_out_pins[cfg->line_outs] =
+   cfg->input_pins[AUTO_PIN_LINE];
spec->line_switch = 1;
cfg->line_outs++;
}
if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 2) {
-   cfg->line_out_pins[2] = cfg->input_pins[AUTO_PIN_MIC];
+   cfg->line_out_pins[cfg->line_outs] =
+   cfg->input_pins[AUTO_PIN_MIC];
spec->mic_switch = 1;
cfg->line_outs++;
}

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 10/40] ALSA: fix selector unit bug affecting some USB speakerphones

2007-11-14 Thread Greg Kroah-Hartman

-stable review patch.  If anyone has any objections, please let us know.

--
From: Russ Cox <[EMAIL PROTECTED]>

patch 38977e96cb32e658716e11a05ec7f1fc4618e0f3 in mainline.

[ALSA] fix selector unit bug affecting some USB speakerphones

Following the suggestion in this thread:
https://bugs.launchpad.net/ubuntu/+source/alsa-lib/+bug/26683
the correct upper bound on desc[0] is 5 + num_ins not 6 + num_ins,
because the index used later is 5+i, not 6+i.
This change makes my Vosky Chatterbox speakerphone work.
Apparently it also helps with the Minivox MV100.

Signed-off-by: Russ Cox <[EMAIL PROTECTED]>
Signed-off-by: Takashi Iwai <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 sound/usb/usbmixer.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/sound/usb/usbmixer.c
+++ b/sound/usb/usbmixer.c
@@ -1483,7 +1483,7 @@ static int parse_audio_selector_unit(str
struct snd_kcontrol *kctl;
char **namelist;
 
-   if (! num_ins || desc[0] < 6 + num_ins) {
+   if (! num_ins || desc[0] < 5 + num_ins) {
snd_printk(KERN_ERR "invalid SELECTOR UNIT descriptor %d\n", 
unitid);
return -EINVAL;
}

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 07/40] IB/uverbs: Fix checking of userspace object ownership

2007-11-14 Thread Greg Kroah-Hartman

-stable review patch.  If anyone has any objections, please let us know.

--
From: Roland Dreier <[EMAIL PROTECTED]>

Upstream as cbfb50e6e2e9c580848c0f51d37c24cdfb1cb704

Commit 9ead190b ("IB/uverbs: Don't serialize with ib_uverbs_idr_mutex")
rewrote how userspace objects are looked up in the uverbs module's
idrs, and introduced a severe bug in the process: there is no checking
that an operation is being performed by the right process any more.
Fix this by adding the missing check of uobj->context in __idr_get_uobj().

Apparently everyone is being very careful to only touch their own
objects, because this bug was introduced in June 2006 in 2.6.18, and
has gone undetected until now.

Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/infiniband/core/uverbs_cmd.c |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -147,8 +147,12 @@ static struct ib_uobject *__idr_get_uobj
 
spin_lock(&ib_uverbs_idr_lock);
uobj = idr_find(idr, id);
-   if (uobj)
-   kref_get(&uobj->ref);
+   if (uobj) {
+   if (uobj->context == context)
+   kref_get(&uobj->ref);
+   else
+   uobj = NULL;
+   }
spin_unlock(&ib_uverbs_idr_lock);
 
return uobj;

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 08/40] IB/mthca: Use mmiowb() to avoid firmware commands getting jumbled up

2007-11-14 Thread Greg Kroah-Hartman

-stable review patch.  If anyone has any objections, please let us know.

--
From: Roland Dreier <[EMAIL PROTECTED]>

Upstream as 76d7cc0345a037e8eea426f8abc710abd22946dd

Firmware commands are sent to the HCA by writing multiple words to a
command register block.  Access to this block of registers is
serialized with a mutex.  However, on large SGI systems, problems were
seen with multiple CPUs issuing FW commands at the same time, because
the writes to the register block may be reordered within the system
interconnect and reach the HCA in a different order than they were
issued (even with the mutex).  Fix this by adding an mmiowb() before
dropping the mutex.

Tested-by: Arthur Kepner <[EMAIL PROTECTED]>
Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/infiniband/hw/mthca/mthca_cmd.c |6 ++
 1 file changed, 6 insertions(+)

--- a/drivers/infiniband/hw/mthca/mthca_cmd.c
+++ b/drivers/infiniband/hw/mthca/mthca_cmd.c
@@ -290,6 +290,12 @@ static int mthca_cmd_post(struct mthca_d
err = mthca_cmd_post_hcr(dev, in_param, out_param, in_modifier,
 op_modifier, op, token, event);
 
+   /*
+* Make sure that our HCR writes don't get mixed in with
+* writes from another CPU starting a FW command.
+*/
+   mmiowb();
+
mutex_unlock(&dev->cmd.hcr_mutex);
return err;
 }

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 05/40] hwmon/lm87: Fix a division by zero

2007-11-14 Thread Greg Kroah-Hartman

-stable review patch.  If anyone has any objections, please let us know.

--
From: Jean Delvare <[EMAIL PROTECTED]>

Already in Linus' tree:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=b965d4b7f614522170af6a7e450be0333792ccd2

Missing parentheses in the definition of FAN_FROM_REG cause a
division by zero for a specific register value.

Signed-off-by: Jean Delvare <[EMAIL PROTECTED]>
Acked-by: Hans de Goede <[EMAIL PROTECTED]>
Signed-off-by: Mark M. Hoffman <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/hwmon/lm87.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/hwmon/lm87.c
+++ b/drivers/hwmon/lm87.c
@@ -129,7 +129,7 @@ static u8 LM87_REG_TEMP_LOW[3] = { 0x3A,
 (((val) < 0 ? (val)-500 : (val)+500) / 1000))
 
 #define FAN_FROM_REG(reg,div)  ((reg) == 255 || (reg) == 0 ? 0 : \
-135 + (reg)*(div) / 2) / ((reg)*(div))
+(135 + (reg)*(div) / 2) / ((reg)*(div)))
 #define FAN_TO_REG(val,div)((val)*(div) * 255 <= 135 ? 255 : \
 (135 + (val)*(div) / 2) / ((val)*(div)))
 

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 06/40] hwmon/lm87: Disable VID when it should be

2007-11-14 Thread Greg Kroah-Hartman

-stable review patch.  If anyone has any objections, please let us know.

--
From: Jean Delvare <[EMAIL PROTECTED]>

Already in Linus' tree:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=889af3d5d9586db795a06c619e416b4baee11da8

A stupid bit shifting bug caused the VID value to be always exported
even when the hardware is configured for something different.

Signed-off-by: Jean Delvare <[EMAIL PROTECTED]>
Signed-off-by: Mark M. Hoffman <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/hwmon/lm87.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/hwmon/lm87.c
+++ b/drivers/hwmon/lm87.c
@@ -145,7 +145,7 @@ static u8 LM87_REG_TEMP_LOW[3] = { 0x3A,
 #define CHAN_NO_FAN(nr)(1 << (nr))
 #define CHAN_TEMP3 (1 << 2)
 #define CHAN_VCC_5V(1 << 3)
-#define CHAN_NO_VID(1 << 8)
+#define CHAN_NO_VID(1 << 7)
 
 /*
  * Functions declaration

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 02/40] i915: fix vbl swap allocation size.

2007-11-14 Thread Greg Kroah-Hartman

-stable review patch.  If anyone has any objections, please let us know.

--
From: Dave Airlie <[EMAIL PROTECTED]>

This is upstream as 54583bf4efda79388fc13163e35c016c8bc5de81

Oops...

Signed-off-by: Dave Airlie <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/char/drm/i915_irq.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/char/drm/i915_irq.c
+++ b/drivers/char/drm/i915_irq.c
@@ -553,7 +553,7 @@ int i915_vblank_swap(DRM_IOCTL_ARGS)
return DRM_ERR(EBUSY);
}
 
-   vbl_swap = drm_calloc(1, sizeof(vbl_swap), DRM_MEM_DRIVER);
+   vbl_swap = drm_calloc(1, sizeof(*vbl_swap), DRM_MEM_DRIVER);
 
if (!vbl_swap) {
DRM_ERROR("Failed to allocate memory to queue swap\n");

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 04/40] hwmon/w83627hf: Dont assume bank 0

2007-11-14 Thread Greg Kroah-Hartman

-stable review patch.  If anyone has any objections, please let us know.

--
From: Jean Delvare <[EMAIL PROTECTED]>

Already in Linus' tree:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=d58df9cd788e6fb4962e1c8d5ba7b8b95d639a44

The bank switching code assumes that the bank selector is set to 0
when the driver is loaded. This might not be the case. This is exactly
the same bug as was fixed in the w83627ehf driver two months ago:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0956895aa6f8dc6a33210967252fd7787652537d

In practice, this bug was causing the sensor thermal types to be
improperly reported for my W83627THF the first time I was loading the
w83627hf driver. From the driver history, I'd say that it has been
broken since September 2005 (when we stopped resetting the chip by
default at driver load.)

Signed-off-by: Jean Delvare <[EMAIL PROTECTED]>
Signed-off-by: Mark M. Hoffman <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/hwmon/w83627hf.c |   44 ++--
 1 file changed, 22 insertions(+), 22 deletions(-)

--- a/drivers/hwmon/w83627hf.c
+++ b/drivers/hwmon/w83627hf.c
@@ -1335,6 +1335,24 @@ static int __devexit w83627hf_remove(str
 }
 
 
+/* Registers 0x50-0x5f are banked */
+static inline void w83627hf_set_bank(struct w83627hf_data *data, u16 reg)
+{
+   if ((reg & 0x00f0) == 0x50) {
+   outb_p(W83781D_REG_BANK, data->addr + W83781D_ADDR_REG_OFFSET);
+   outb_p(reg >> 8, data->addr + W83781D_DATA_REG_OFFSET);
+   }
+}
+
+/* Not strictly necessary, but play it safe for now */
+static inline void w83627hf_reset_bank(struct w83627hf_data *data, u16 reg)
+{
+   if (reg & 0xff00) {
+   outb_p(W83781D_REG_BANK, data->addr + W83781D_ADDR_REG_OFFSET);
+   outb_p(0, data->addr + W83781D_DATA_REG_OFFSET);
+   }
+}
+
 static int w83627hf_read_value(struct w83627hf_data *data, u16 reg)
 {
int res, word_sized;
@@ -1345,12 +1363,7 @@ static int w83627hf_read_value(struct w8
  && (((reg & 0x00ff) == 0x50)
   || ((reg & 0x00ff) == 0x53)
   || ((reg & 0x00ff) == 0x55));
-   if (reg & 0xff00) {
-   outb_p(W83781D_REG_BANK,
-  data->addr + W83781D_ADDR_REG_OFFSET);
-   outb_p(reg >> 8,
-  data->addr + W83781D_DATA_REG_OFFSET);
-   }
+   w83627hf_set_bank(data, reg);
outb_p(reg & 0xff, data->addr + W83781D_ADDR_REG_OFFSET);
res = inb_p(data->addr + W83781D_DATA_REG_OFFSET);
if (word_sized) {
@@ -1360,11 +1373,7 @@ static int w83627hf_read_value(struct w8
(res << 8) + inb_p(data->addr +
   W83781D_DATA_REG_OFFSET);
}
-   if (reg & 0xff00) {
-   outb_p(W83781D_REG_BANK,
-  data->addr + W83781D_ADDR_REG_OFFSET);
-   outb_p(0, data->addr + W83781D_DATA_REG_OFFSET);
-   }
+   w83627hf_reset_bank(data, reg);
mutex_unlock(&data->lock);
return res;
 }
@@ -1435,12 +1444,7 @@ static int w83627hf_write_value(struct w
   || ((reg & 0xff00) == 0x200))
  && (((reg & 0x00ff) == 0x53)
   || ((reg & 0x00ff) == 0x55));
-   if (reg & 0xff00) {
-   outb_p(W83781D_REG_BANK,
-  data->addr + W83781D_ADDR_REG_OFFSET);
-   outb_p(reg >> 8,
-  data->addr + W83781D_DATA_REG_OFFSET);
-   }
+   w83627hf_set_bank(data, reg);
outb_p(reg & 0xff, data->addr + W83781D_ADDR_REG_OFFSET);
if (word_sized) {
outb_p(value >> 8,
@@ -1450,11 +1454,7 @@ static int w83627hf_write_value(struct w
}
outb_p(value & 0xff,
   data->addr + W83781D_DATA_REG_OFFSET);
-   if (reg & 0xff00) {
-   outb_p(W83781D_REG_BANK,
-  data->addr + W83781D_ADDR_REG_OFFSET);
-   outb_p(0, data->addr + W83781D_DATA_REG_OFFSET);
-   }
+   w83627hf_reset_bank(data, reg);
mutex_unlock(&data->lock);
return 0;
 }

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 15/16] rtl8187: Fix more frag bit checking, rts duration calc

2007-11-14 Thread Greg KH


-stable review patch.  If anyone has any objections, please let us know.

--

From: Michael Wu <[EMAIL PROTECTED]>

patch 98798f4875b7149db4eb7d0a126fc6dcd9637821 in mainline.

The wrong pointer is passed to ieee80211_get_morefrag. Fix this.

While we're at it, reorder things so they look better and the rts duration
calculation is done with the right length.

Thanks to Christoph Hellwig for finding the ieee80211_get_morefrag issue.

Signed-off-by: Michael Wu <[EMAIL PROTECTED]>
Signed-off-by: John W. Linville <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/net/wireless/rtl8187_dev.c |   31 ---
 1 file changed, 16 insertions(+), 15 deletions(-)

--- a/drivers/net/wireless/rtl8187_dev.c
+++ b/drivers/net/wireless/rtl8187_dev.c
@@ -78,7 +78,8 @@ static int rtl8187_tx(struct ieee80211_h
struct rtl8187_tx_hdr *hdr;
struct rtl8187_tx_info *info;
struct urb *urb;
-   u32 tmp;
+   __le16 rts_dur = 0;
+   u32 flags;
 
urb = usb_alloc_urb(0, GFP_ATOMIC);
if (!urb) {
@@ -86,24 +87,24 @@ static int rtl8187_tx(struct ieee80211_h
return 0;
}
 
-   hdr = (struct rtl8187_tx_hdr *)skb_push(skb, sizeof(*hdr));
-   tmp = skb->len - sizeof(*hdr);
-   tmp |= RTL8187_TX_FLAG_NO_ENCRYPT;
-   tmp |= control->rts_cts_rate << 19;
-   tmp |= control->tx_rate << 24;
-   if (ieee80211_get_morefrag((struct ieee80211_hdr *)skb))
-   tmp |= RTL8187_TX_FLAG_MORE_FRAG;
+   flags = skb->len;
+   flags |= RTL8187_TX_FLAG_NO_ENCRYPT;
+   flags |= control->rts_cts_rate << 19;
+   flags |= control->tx_rate << 24;
+   if (ieee80211_get_morefrag((struct ieee80211_hdr *)skb->data))
+   flags |= RTL8187_TX_FLAG_MORE_FRAG;
if (control->flags & IEEE80211_TXCTL_USE_RTS_CTS) {
-   tmp |= RTL8187_TX_FLAG_RTS;
-   hdr->rts_duration =
-   ieee80211_rts_duration(dev, skb->len, control);
+   flags |= RTL8187_TX_FLAG_RTS;
+   rts_dur = ieee80211_rts_duration(dev, skb->len, control);
}
if (control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT)
-   tmp |= RTL8187_TX_FLAG_CTS;
-   hdr->flags = cpu_to_le32(tmp);
+   flags |= RTL8187_TX_FLAG_CTS;
+
+   hdr = (struct rtl8187_tx_hdr *)skb_push(skb, sizeof(*hdr));
+   hdr->flags = cpu_to_le32(flags);
hdr->len = 0;
-   tmp = control->retry_limit << 8;
-   hdr->retry = cpu_to_le32(tmp);
+   hdr->rts_duration = rts_dur;
+   hdr->retry = cpu_to_le32(control->retry_limit << 8);
 
info = (struct rtl8187_tx_info *)skb->cb;
info->control = kmemdup(control, sizeof(*control), GFP_ATOMIC);

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 13/16] zd1201: avoid null ptr access of skb->dev

2007-11-14 Thread Greg KH


-stable review patch.  If anyone has any objections, please let us know.

--

From: John W. Linville <[EMAIL PROTECTED]>

patch 3ba72b25211217de195e3f528dd36132b38a205b in mainline.

skb->dev is not set until eth_type_trans is called...

Signed-off-by: John W. Linville <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/net/wireless/zd1201.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/net/wireless/zd1201.c
+++ b/drivers/net/wireless/zd1201.c
@@ -327,8 +327,8 @@ static void zd1201_usbrx(struct urb *urb
memcpy(skb_put(skb, 6), &data[datalen-8], 6);
memcpy(skb_put(skb, 2), &data[datalen-24], 2);
memcpy(skb_put(skb, len), data, len);
-   skb->dev->last_rx = jiffies;
skb->protocol = eth_type_trans(skb, zd->dev);
+   skb->dev->last_rx = jiffies;
zd->stats.rx_packets++;
zd->stats.rx_bytes += skb->len;
netif_rx(skb);
@@ -384,8 +384,8 @@ static void zd1201_usbrx(struct urb *urb
memcpy(skb_put(skb, 2), &data[6], 2);
memcpy(skb_put(skb, len), data+8, len);
}
-   skb->dev->last_rx = jiffies;
skb->protocol = eth_type_trans(skb, zd->dev);
+   skb->dev->last_rx = jiffies;
zd->stats.rx_packets++;
zd->stats.rx_bytes += skb->len;
netif_rx(skb);

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 14/16] ipw2100: send WEXT scan events

2007-11-14 Thread Greg KH


-stable review patch.  If anyone has any objections, please let us know.

--

From: Dan Williams <[EMAIL PROTECTED]>

patch d20c678a450a25c1c12925f60c1b4cc040acc17d in mainline

ipw2100 wasn't sending WEXT scan events at all on scan completion.  And
like ipw2200, the driver aggressively auto-scans, requiring
non-user-requested scan events to be batched together and sent at
specific intervals instead of many times per seconds.

Signed-off-by: Dan Williams <[EMAIL PROTECTED]>
Signed-off-by: John W. Linville <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/net/wireless/ipw2100.c |   39 +++
 drivers/net/wireless/ipw2100.h |4 
 2 files changed, 43 insertions(+)

--- a/drivers/net/wireless/ipw2100.c
+++ b/drivers/net/wireless/ipw2100.c
@@ -2102,12 +2102,46 @@ static void isr_indicate_rf_kill(struct 
queue_delayed_work(priv->workqueue, &priv->rf_kill, round_jiffies(HZ));
 }
 
+static void send_scan_event(void *data)
+{
+   struct ipw2100_priv *priv = data;
+   union iwreq_data wrqu;
+
+   wrqu.data.length = 0;
+   wrqu.data.flags = 0;
+   wireless_send_event(priv->net_dev, SIOCGIWSCAN, &wrqu, NULL);
+}
+
+static void ipw2100_scan_event_later(struct work_struct *work)
+{
+   send_scan_event(container_of(work, struct ipw2100_priv,
+   scan_event_later.work));
+}
+
+static void ipw2100_scan_event_now(struct work_struct *work)
+{
+   send_scan_event(container_of(work, struct ipw2100_priv,
+   scan_event_now));
+}
+
 static void isr_scan_complete(struct ipw2100_priv *priv, u32 status)
 {
IPW_DEBUG_SCAN("scan complete\n");
/* Age the scan results... */
priv->ieee->scans++;
priv->status &= ~STATUS_SCANNING;
+
+   /* Only userspace-requested scan completion events go out immediately */
+   if (!priv->user_requested_scan) {
+   if (!delayed_work_pending(&priv->scan_event_later))
+   queue_delayed_work(priv->workqueue,
+   &priv->scan_event_later,
+   round_jiffies(msecs_to_jiffies(4000)));
+   } else {
+   priv->user_requested_scan = 0;
+   cancel_delayed_work(&priv->scan_event_later);
+   queue_work(priv->workqueue, &priv->scan_event_now);
+   }
 }
 
 #ifdef CONFIG_IPW2100_DEBUG
@@ -4376,6 +4410,7 @@ static void ipw2100_kill_workqueue(struc
cancel_delayed_work(&priv->wx_event_work);
cancel_delayed_work(&priv->hang_check);
cancel_delayed_work(&priv->rf_kill);
+   cancel_delayed_work(&priv->scan_event_later);
destroy_workqueue(priv->workqueue);
priv->workqueue = NULL;
}
@@ -6118,6 +6153,8 @@ static struct net_device *ipw2100_alloc_
INIT_DELAYED_WORK(&priv->wx_event_work, ipw2100_wx_event_work);
INIT_DELAYED_WORK(&priv->hang_check, ipw2100_hang_check);
INIT_DELAYED_WORK(&priv->rf_kill, ipw2100_rf_kill);
+   INIT_WORK(&priv->scan_event_now, ipw2100_scan_event_now);
+   INIT_DELAYED_WORK(&priv->scan_event_later, ipw2100_scan_event_later);
 
tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long))
 ipw2100_irq_tasklet, (unsigned long)priv);
@@ -7427,6 +7464,8 @@ static int ipw2100_wx_set_scan(struct ne
}
 
IPW_DEBUG_WX("Initiating scan...\n");
+
+   priv->user_requested_scan = 1;
if (ipw2100_set_scan_options(priv) || ipw2100_start_scan(priv)) {
IPW_DEBUG_WX("Start scan failed.\n");
 
--- a/drivers/net/wireless/ipw2100.h
+++ b/drivers/net/wireless/ipw2100.h
@@ -588,6 +588,10 @@ struct ipw2100_priv {
struct delayed_work wx_event_work;
struct delayed_work hang_check;
struct delayed_work rf_kill;
+   struct work_struct scan_event_now;
+   struct delayed_work scan_event_later;
+
+   int user_requested_scan;
 
u32 interrupts;
int tx_interrupts;

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 11/16] sky2: ethtool register reserved area blackout

2007-11-14 Thread Greg KH

-stable review patch.  If anyone has any objections, please let us know.

--

From: Stephen Hemminger <[EMAIL PROTECTED]>

patch 295b54c4902c52cd00d7c837d50a86e39e26caec in mainline.

Make sure and not dump reserved areas of device space.
Touching some of these causes machine check exceptions on boards
like D-Link DGE-550SX.

Coding note, used a complex switch statement rather than bitmap
because it is easier to relate the block values to the documentation
rather than looking at a encoded bitmask.

Signed-off-by: Stephen Hemminger <[EMAIL PROTECTED]>
Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>


---
 drivers/net/sky2.c |   62 +
 1 file changed, 53 insertions(+), 9 deletions(-)

--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -3570,20 +3570,64 @@ static void sky2_get_regs(struct net_dev
 {
const struct sky2_port *sky2 = netdev_priv(dev);
const void __iomem *io = sky2->hw->regs;
+   unsigned int b;
 
regs->version = 1;
-   memset(p, 0, regs->len);
 
-   memcpy_fromio(p, io, B3_RAM_ADDR);
-
-   /* skip diagnostic ram region */
-   memcpy_fromio(p + B3_RI_WTO_R1, io + B3_RI_WTO_R1, 0x2000 - 
B3_RI_WTO_R1);
+   for (b = 0; b < 128; b++) {
+   /* This complicated switch statement is to make sure and
+* only access regions that are unreserved.
+* Some blocks are only valid on dual port cards.
+* and block 3 has some special diagnostic registers that
+* are poison.
+*/
+   switch (b) {
+   case 3:
+   /* skip diagnostic ram region */
+   memcpy_fromio(p + 0x10, io + 0x10, 128 - 0x10);
+   break;
 
-   /* copy GMAC registers */
-   memcpy_fromio(p + BASE_GMAC_1, io + BASE_GMAC_1, 0x1000);
-   if (sky2->hw->ports > 1)
-   memcpy_fromio(p + BASE_GMAC_2, io + BASE_GMAC_2, 0x1000);
+   /* dual port cards only */
+   case 5: /* Tx Arbiter 2 */
+   case 9: /* RX2 */
+   case 14 ... 15: /* TX2 */
+   case 17: case 19: /* Ram Buffer 2 */
+   case 22 ... 23: /* Tx Ram Buffer 2 */
+   case 25:/* Rx MAC Fifo 1 */
+   case 27:/* Tx MAC Fifo 2 */
+   case 31:/* GPHY 2 */
+   case 40 ... 47: /* Pattern Ram 2 */
+   case 52: case 54: /* TCP Segmentation 2 */
+   case 112 ... 116: /* GMAC 2 */
+   if (sky2->hw->ports == 1)
+   goto reserved;
+   /* fall through */
+   case 0: /* Control */
+   case 2: /* Mac address */
+   case 4: /* Tx Arbiter 1 */
+   case 7: /* PCI express reg */
+   case 8: /* RX1 */
+   case 12 ... 13: /* TX1 */
+   case 16: case 18:/* Rx Ram Buffer 1 */
+   case 20 ... 21: /* Tx Ram Buffer 1 */
+   case 24:/* Rx MAC Fifo 1 */
+   case 26:/* Tx MAC Fifo 1 */
+   case 28 ... 29: /* Descriptor and status unit */
+   case 30:/* GPHY 1*/
+   case 32 ... 39: /* Pattern Ram 1 */
+   case 48: case 50: /* TCP Segmentation 1 */
+   case 56 ... 60: /* PCI space */
+   case 80 ... 84: /* GMAC 1 */
+   memcpy_fromio(p, io, 128);
+   break;
+   default:
+reserved:
+   memset(p, 0, 128);
+   }
 
+   p += 128;
+   io += 128;
+   }
 }
 
 /* In order to do Jumbo packets on these chips, need to turn off the

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 10/16] sky2: status ring race fix

2007-11-14 Thread Greg KH

-stable review patch.  If anyone has any objections, please let us know.

--

From: Stephen Hemminger <[EMAIL PROTECTED]>

patch ab5adecb2d02f3688719dfb5936a82833fcc3955 in mainline.

The D-Link PCI-X board (and maybe others) can lie about status
ring entries. It seems it will update the register for last status
index before completing the DMA for the ring entry. To avoid reading
stale data, zap the old entry and check.

Signed-off-by: Stephen Hemminger <[EMAIL PROTECTED]>
Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/net/sky2.c |   12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -2246,20 +2246,26 @@ static int sky2_status_intr(struct sky2_
while (hw->st_idx != hwidx) {
struct sky2_port *sky2;
struct sky2_status_le *le  = hw->st_le + hw->st_idx;
-   unsigned port = le->css & CSS_LINK_BIT;
+   unsigned port;
struct net_device *dev;
struct sk_buff *skb;
u32 status;
u16 length;
+   u8 opcode = le->opcode;
+
+   if (!(opcode & HW_OWNER))
+   break;
 
hw->st_idx = RING_NEXT(hw->st_idx, STATUS_RING_SIZE);
 
+   port = le->css & CSS_LINK_BIT;
dev = hw->dev[port];
sky2 = netdev_priv(dev);
length = le16_to_cpu(le->length);
status = le32_to_cpu(le->status);
 
-   switch (le->opcode & ~HW_OWNER) {
+   le->opcode = 0;
+   switch (opcode & ~HW_OWNER) {
case OP_RXSTAT:
++rx[port];
skb = sky2_receive(dev, length, status);
@@ -2352,7 +2358,7 @@ static int sky2_status_intr(struct sky2_
default:
if (net_ratelimit())
printk(KERN_WARNING PFX
-  "unknown status opcode 0x%x\n", 
le->opcode);
+  "unknown status opcode 0x%x\n", opcode);
}
}
 

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 09/16] skge: XM PHY handling fixes

2007-11-14 Thread Greg KH

-stable review patch.  If anyone has any objections, please let us know.

--
From: Stephen Hemminger <[EMAIL PROTECTED]>

patch 501fb72d052d2a302b423bef7dec98d9d98c8a36 in mainline.

Change how PHY is managed on SysKonnect fibre based boards.
Poll for PHY coming up 1 per second, but use interrupt to detect loss.

Signed-off-by: Stephen Hemminger <[EMAIL PROTECTED]>
Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/net/skge.c |   90 -
 drivers/net/skge.h |6 +--
 2 files changed, 51 insertions(+), 45 deletions(-)

--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -57,7 +57,7 @@
 #define TX_WATCHDOG(5 * HZ)
 #define NAPI_WEIGHT64
 #define BLINK_MS   250
-#define LINK_HZ(HZ/2)
+#define LINK_HZHZ
 
 MODULE_DESCRIPTION("SysKonnect Gigabit Ethernet driver");
 MODULE_AUTHOR("Stephen Hemminger <[EMAIL PROTECTED]>");
@@ -992,19 +992,15 @@ static void xm_link_down(struct skge_hw 
 {
struct net_device *dev = hw->dev[port];
struct skge_port *skge = netdev_priv(dev);
-   u16 cmd, msk;
+   u16 cmd = xm_read16(hw, port, XM_MMU_CMD);
 
-   if (hw->phy_type == SK_PHY_XMAC) {
-   msk = xm_read16(hw, port, XM_IMSK);
-   msk |= XM_IS_INP_ASS | XM_IS_LIPA_RC | XM_IS_RX_PAGE | 
XM_IS_AND;
-   xm_write16(hw, port, XM_IMSK, msk);
-   }
+   xm_write16(hw, port, XM_IMSK, XM_IMSK_DISABLE);
 
-   cmd = xm_read16(hw, port, XM_MMU_CMD);
cmd &= ~(XM_MMU_ENA_RX | XM_MMU_ENA_TX);
xm_write16(hw, port, XM_MMU_CMD, cmd);
+
/* dummy read to ensure writing */
-   (void) xm_read16(hw, port, XM_MMU_CMD);
+   xm_read16(hw, port, XM_MMU_CMD);
 
if (netif_carrier_ok(dev))
skge_link_down(skge);
@@ -1100,7 +1096,7 @@ static void genesis_reset(struct skge_hw
 
/* reset the statistics module */
xm_write32(hw, port, XM_GP_PORT, XM_GP_RES_STAT);
-   xm_write16(hw, port, XM_IMSK, 0x);  /* disable XMAC IRQs */
+   xm_write16(hw, port, XM_IMSK, XM_IMSK_DISABLE);
xm_write32(hw, port, XM_MODE, 0);   /* clear Mode Reg */
xm_write16(hw, port, XM_TX_CMD, 0); /* reset TX CMD Reg */
xm_write16(hw, port, XM_RX_CMD, 0); /* reset RX CMD Reg */
@@ -1138,7 +1134,7 @@ static void bcom_check_link(struct skge_
u16 status;
 
/* read twice because of latch */
-   (void) xm_phy_read(hw, port, PHY_BCOM_STAT);
+   xm_phy_read(hw, port, PHY_BCOM_STAT);
status = xm_phy_read(hw, port, PHY_BCOM_STAT);
 
if ((status & PHY_ST_LSYNC) == 0) {
@@ -1339,7 +1335,7 @@ static void xm_phy_init(struct skge_port
mod_timer(&skge->link_timer, jiffies + LINK_HZ);
 }
 
-static void xm_check_link(struct net_device *dev)
+static int xm_check_link(struct net_device *dev)
 {
struct skge_port *skge = netdev_priv(dev);
struct skge_hw *hw = skge->hw;
@@ -1347,25 +1343,25 @@ static void xm_check_link(struct net_dev
u16 status;
 
/* read twice because of latch */
-   (void) xm_phy_read(hw, port, PHY_XMAC_STAT);
+   xm_phy_read(hw, port, PHY_XMAC_STAT);
status = xm_phy_read(hw, port, PHY_XMAC_STAT);
 
if ((status & PHY_ST_LSYNC) == 0) {
xm_link_down(hw, port);
-   return;
+   return 0;
}
 
if (skge->autoneg == AUTONEG_ENABLE) {
u16 lpa, res;
 
if (!(status & PHY_ST_AN_OVER))
-   return;
+   return 0;
 
lpa = xm_phy_read(hw, port, PHY_XMAC_AUNE_LP);
if (lpa & PHY_B_AN_RF) {
printk(KERN_NOTICE PFX "%s: remote fault\n",
   dev->name);
-   return;
+   return 0;
}
 
res = xm_phy_read(hw, port, PHY_XMAC_RES_ABI);
@@ -1381,7 +1377,7 @@ static void xm_check_link(struct net_dev
default:
printk(KERN_NOTICE PFX "%s: duplex mismatch\n",
   dev->name);
-   return;
+   return 0;
}
 
/* We are using IEEE 802.3z/D5.0 Table 37-4 */
@@ -1405,11 +1401,14 @@ static void xm_check_link(struct net_dev
 
if (!netif_carrier_ok(dev))
genesis_link_up(skge);
+   return 1;
 }
 
 /* Poll to check for link coming up.
+ *
  * Since internal PHY is wired to a level triggered pin, can't
- * get an interrupt when carrier is detected.
+ * get an interrupt when carrier is detected, need to poll for
+ * link coming up.
  */
 static void xm_link_timer(unsigned long arg)
 {
@@ -1417,29 +1416,35 @@ static void xm_link_timer(unsigned long 
struct net_device *dev = skge->netd

[patch 08/16] skge: fix ram buffer size calculation

2007-11-14 Thread Greg KH

-stable review patch.  If anyone has any objections, please let us know.

--
From: Stephen Hemminger <[EMAIL PROTECTED]>

patch 7fb7ac241162dc51ec0f7644d4a97b2855213c32 in mainline.

This fixes problems with transmit hangs on older fiber based SysKonnect boards.

Adjust ram buffer sizing calculation to make it correct on all boards
and make it like the code in sky2 driver.

Signed-off-by: Stephen Hemminger <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>

---
 drivers/net/skge.c |   51 ---
 1 file changed, 24 insertions(+), 27 deletions(-)

--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -2400,32 +2400,31 @@ static int skge_ioctl(struct net_device 
return err;
 }
 
-static void skge_ramset(struct skge_hw *hw, u16 q, u32 start, size_t len)
+/* Assign Ram Buffer allocation to queue */
+static void skge_ramset(struct skge_hw *hw, u16 q, u32 start, u32 space)
 {
u32 end;
 
-   start /= 8;
-   len /= 8;
-   end = start + len - 1;
+   /* convert from K bytes to qwords used for hw register */
+   start *= 1024/8;
+   space *= 1024/8;
+   end = start + space - 1;
 
skge_write8(hw, RB_ADDR(q, RB_CTRL), RB_RST_CLR);
skge_write32(hw, RB_ADDR(q, RB_START), start);
+   skge_write32(hw, RB_ADDR(q, RB_END), end);
skge_write32(hw, RB_ADDR(q, RB_WP), start);
skge_write32(hw, RB_ADDR(q, RB_RP), start);
-   skge_write32(hw, RB_ADDR(q, RB_END), end);
 
if (q == Q_R1 || q == Q_R2) {
+   u32 tp = space - space/4;
+
/* Set thresholds on receive queue's */
-   skge_write32(hw, RB_ADDR(q, RB_RX_UTPP),
-start + (2*len)/3);
-   skge_write32(hw, RB_ADDR(q, RB_RX_LTPP),
-start + (len/3));
-   } else {
-   /* Enable store & forward on Tx queue's because
-* Tx FIFO is only 4K on Genesis and 1K on Yukon
-*/
+   skge_write32(hw, RB_ADDR(q, RB_RX_UTPP), tp);
+   skge_write32(hw, RB_ADDR(q, RB_RX_LTPP), space/4);
+   } else if (hw->chip_id != CHIP_ID_GENESIS)
+   /* Genesis Tx Fifo is too small for normal store/forward */
skge_write8(hw, RB_ADDR(q, RB_CTRL), RB_ENA_STFWD);
-   }
 
skge_write8(hw, RB_ADDR(q, RB_CTRL), RB_ENA_OP_MD);
 }
@@ -2453,7 +2452,7 @@ static int skge_up(struct net_device *de
struct skge_port *skge = netdev_priv(dev);
struct skge_hw *hw = skge->hw;
int port = skge->port;
-   u32 chunk, ram_addr;
+   u32 ramaddr, ramsize, rxspace;
size_t rx_size, tx_size;
int err;
 
@@ -2508,14 +2507,15 @@ static int skge_up(struct net_device *de
spin_unlock_bh(&hw->phy_lock);
 
/* Configure RAMbuffers */
-   chunk = hw->ram_size / ((hw->ports + 1)*2);
-   ram_addr = hw->ram_offset + 2 * chunk * port;
+   ramsize = (hw->ram_size - hw->ram_offset) / hw->ports;
+   ramaddr = hw->ram_offset + port * ramsize;
+   rxspace = 8 + (2*(ramsize - 16))/3;
 
-   skge_ramset(hw, rxqaddr[port], ram_addr, chunk);
-   skge_qset(skge, rxqaddr[port], skge->rx_ring.to_clean);
+   skge_ramset(hw, rxqaddr[port], ramaddr, rxspace);
+   skge_ramset(hw, txqaddr[port], ramaddr + rxspace, ramsize - rxspace);
 
+   skge_qset(skge, rxqaddr[port], skge->rx_ring.to_clean);
BUG_ON(skge->tx_ring.to_use != skge->tx_ring.to_clean);
-   skge_ramset(hw, txqaddr[port], ram_addr+chunk, chunk);
skge_qset(skge, txqaddr[port], skge->tx_ring.to_use);
 
/* Start receiver BMU */
@@ -3450,15 +3450,12 @@ static int skge_reset(struct skge_hw *hw
if (hw->chip_id == CHIP_ID_GENESIS) {
if (t8 == 3) {
/* special case: 4 x 64k x 36, offset = 0x8 */
-   hw->ram_size = 0x10;
-   hw->ram_offset = 0x8;
+   hw->ram_size = 1024;
+   hw->ram_offset = 512;
} else
hw->ram_size = t8 * 512;
-   }
-   else if (t8 == 0)
-   hw->ram_size = 0x2;
-   else
-   hw->ram_size = t8 * 4096;
+   } else /* Yukon */
+   hw->ram_size = t8 ? t8 * 4 : 128;
 
hw->intr_mask = IS_HW_ERR;
 

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 03/16] ehea: 64K page kernel support fix

2007-11-14 Thread Greg KH

-stable review patch.  If anyone has any objections, please let us know.

--
From: Jan-Bernd Themann <[EMAIL PROTECTED]>

based on 2c69448bbcedebeb8409ddb05fbc7d3fe1cfbda7 in mainline.

The current eHEA module compiled for 64K page kernels can not
be loaded with insmod due to bad hypervisor call parameters.
The patch is a subset of the follwing patch which has been applied
for 2.6.24 upstream:

http://www.spinics.net/lists/netdev/msg42814.html

Signed-off-by: Jan-Bernd Themann <[EMAIL PROTECTED]>
Cc: Jeff Garzik <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/net/ehea/ehea_qmr.c |   20 
 drivers/net/ehea/ehea_qmr.h |2 +-
 2 files changed, 9 insertions(+), 13 deletions(-)

--- a/drivers/net/ehea/ehea_qmr.c
+++ b/drivers/net/ehea/ehea_qmr.c
@@ -563,8 +563,7 @@ int ehea_destroy_qp(struct ehea_qp *qp)
 int ehea_create_busmap( void )
 {
u64 vaddr = EHEA_BUSMAP_START;
-   unsigned long abs_max_pfn = 0;
-   unsigned long sec_max_pfn;
+   unsigned long high_section_index = 0;
int i;
 
/*
@@ -574,14 +573,10 @@ int ehea_create_busmap( void )
ehea_bmap.valid_sections = 0;
 
for (i = 0; i < NR_MEM_SECTIONS; i++)
-   if (valid_section_nr(i)) {
-   sec_max_pfn = section_nr_to_pfn(i);
-   if (sec_max_pfn > abs_max_pfn)
-   abs_max_pfn = sec_max_pfn;
-   ehea_bmap.valid_sections++;
-   }
+   if (valid_section_nr(i))
+   high_section_index = i;
 
-   ehea_bmap.entries = abs_max_pfn / EHEA_PAGES_PER_SECTION + 1;
+   ehea_bmap.entries = high_section_index + 1;
ehea_bmap.vaddr = vmalloc(ehea_bmap.entries * sizeof(*ehea_bmap.vaddr));
 
if (!ehea_bmap.vaddr)
@@ -593,6 +588,7 @@ int ehea_create_busmap( void )
if (pfn_valid(pfn)) {
ehea_bmap.vaddr[i] = vaddr;
vaddr += EHEA_SECTSIZE;
+   ehea_bmap.valid_sections++;
} else
ehea_bmap.vaddr[i] = 0;
}
@@ -637,7 +633,7 @@ int ehea_reg_kernel_mr(struct ehea_adapt
 
mr_len = ehea_bmap.valid_sections * EHEA_SECTSIZE;
 
-   pt =  kzalloc(EHEA_MAX_RPAGE * sizeof(u64), GFP_KERNEL);
+   pt =  kzalloc(PAGE_SIZE, GFP_KERNEL);
if (!pt) {
ehea_error("no mem");
ret = -ENOMEM;
@@ -660,8 +656,8 @@ int ehea_reg_kernel_mr(struct ehea_adapt
void *sectbase = __va(i << SECTION_SIZE_BITS);
unsigned long k = 0;
 
-   for (j = 0; j < (PAGES_PER_SECTION / EHEA_MAX_RPAGE);
- j++) {
+   for (j = 0; j < (EHEA_PAGES_PER_SECTION /
+EHEA_MAX_RPAGE); j++) {
 
for (m = 0; m < EHEA_MAX_RPAGE; m++) {
pg = sectbase + ((k++) * EHEA_PAGESIZE);
--- a/drivers/net/ehea/ehea_qmr.h
+++ b/drivers/net/ehea/ehea_qmr.h
@@ -39,7 +39,7 @@
 #define EHEA_PAGESHIFT 12
 #define EHEA_PAGESIZE  (1UL << EHEA_PAGESHIFT)
 #define EHEA_SECTSIZE  (1UL << 24)
-#define EHEA_PAGES_PER_SECTION (EHEA_SECTSIZE >> PAGE_SHIFT)
+#define EHEA_PAGES_PER_SECTION (EHEA_SECTSIZE >> EHEA_PAGESHIFT)
 
 #if (1UL << SECTION_SIZE_BITS) < EHEA_SECTSIZE
 #error eHEA module can't work if kernel sectionsize < ehea sectionsize

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 04/16] forcedeth msi bugfix

2007-11-14 Thread Greg KH

-stable review patch.  If anyone has any objections, please let us know.

--
From: Manfred Spraul <[EMAIL PROTECTED]>

patch a7475906bc496456ded9e4b062f94067fb93057a in mainline.

pci_enable_msi() replaces the INTx irq number in pci_dev->irq with the
new MSI irq number.
The forcedeth driver did not update the copy in netdevice->irq and
parts of the driver used the stale copy.
See bugzilla.kernel.org, bug 9047.

The patch
- updates netdevice->irq
- replaces all accesses to netdevice->irq with pci_dev->irq.

The patch is against 2.6.23.1. IMHO suitable for both 2.6.23 and 2.6.24

Signed-off-by: Manfred Spraul <[EMAIL PROTECTED]>
Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/net/forcedeth.c |   19 +++
 1 file changed, 11 insertions(+), 8 deletions(-)

--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -988,7 +988,7 @@ static void nv_enable_irq(struct net_dev
if (np->msi_flags & NV_MSI_X_ENABLED)
enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector);
else
-   enable_irq(dev->irq);
+   enable_irq(np->pci_dev->irq);
} else {
enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector);
enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector);
@@ -1004,7 +1004,7 @@ static void nv_disable_irq(struct net_de
if (np->msi_flags & NV_MSI_X_ENABLED)

disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector);
else
-   disable_irq(dev->irq);
+   disable_irq(np->pci_dev->irq);
} else {
disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector);
disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector);
@@ -1601,7 +1601,7 @@ static void nv_do_rx_refill(unsigned lon
if (np->msi_flags & NV_MSI_X_ENABLED)

disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector);
else
-   disable_irq(dev->irq);
+   disable_irq(np->pci_dev->irq);
} else {
disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector);
}
@@ -1619,7 +1619,7 @@ static void nv_do_rx_refill(unsigned lon
if (np->msi_flags & NV_MSI_X_ENABLED)
enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector);
else
-   enable_irq(dev->irq);
+   enable_irq(np->pci_dev->irq);
} else {
enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector);
}
@@ -3557,10 +3557,12 @@ static int nv_request_irq(struct net_dev
if (ret != 0 && np->msi_flags & NV_MSI_CAPABLE) {
if ((ret = pci_enable_msi(np->pci_dev)) == 0) {
np->msi_flags |= NV_MSI_ENABLED;
+   dev->irq = np->pci_dev->irq;
if (request_irq(np->pci_dev->irq, handler, IRQF_SHARED, 
dev->name, dev) != 0) {
printk(KERN_INFO "forcedeth: request_irq failed 
%d\n", ret);
pci_disable_msi(np->pci_dev);
np->msi_flags &= ~NV_MSI_ENABLED;
+   dev->irq = np->pci_dev->irq;
goto out_err;
}
 
@@ -3623,7 +3625,7 @@ static void nv_do_nic_poll(unsigned long
if (np->msi_flags & NV_MSI_X_ENABLED)

disable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector);
else
-   disable_irq_lockdep(dev->irq);
+   disable_irq_lockdep(np->pci_dev->irq);
mask = np->irqmask;
} else {
if (np->nic_poll_irq & NVREG_IRQ_RX_ALL) {
@@ -3641,6 +3643,8 @@ static void nv_do_nic_poll(unsigned long
}
np->nic_poll_irq = 0;
 
+   /* disable_irq() contains synchronize_irq, thus no irq handler can run 
now */
+
if (np->recover_error) {
np->recover_error = 0;
printk(KERN_INFO "forcedeth: MAC in recoverable error state\n");
@@ -3677,7 +3681,6 @@ static void nv_do_nic_poll(unsigned long
}
}
 
-   /* FIXME: Do we need synchronize_irq(dev->irq) here? */
 
writel(mask, base + NvRegIrqMask);
pci_push(base);
@@ -3690,7 +3693,7 @@ static void nv_do_nic_poll(unsigned long
if (np->msi_flags & NV_MSI_X_ENABLED)

enable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector);
else
-   enable_irq_lockdep(dev->irq);
+   enable_irq_lockdep(np->pci_dev->irq);
} else {
if (np->nic_poll_irq & NVREG_IRQ_RX_ALL) {
nv_nic_irq_rx(0, dev);
@@ -4943,7 +494

[patch 01/16] libertas: more endianness breakage

2007-11-14 Thread Greg KH


-stable review patch.  If anyone has any objections, please let us know.

--
From: Al Viro <[EMAIL PROTECTED]>

based on patch 8362cd413e8116306fafbaf414f0419db0595142 in mainline.

domain->header.len is le16 and has just been assigned
cpu_to_le16(arithmetical expression).  And all fields of adapter->logmsg
are __le32; not a single 16-bit among them...
That's incremental to the previous one

Signed-off-by: Al Viro <[EMAIL PROTECTED]>
Signed-off-by: Dan Williams <[EMAIL PROTECTED]>
Signed-off-by: John W. Linville <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/net/wireless/libertas/11d.c  |2 +-
 drivers/net/wireless/libertas/wext.c |8 
 2 files changed, 5 insertions(+), 5 deletions(-)

--- a/drivers/net/wireless/libertas/11d.c
+++ b/drivers/net/wireless/libertas/11d.c
@@ -562,7 +562,7 @@ int libertas_cmd_802_11d_domain_info(wla
   nr_subband * sizeof(struct ieeetypes_subbandset));
 
cmd->size = cpu_to_le16(sizeof(pdomaininfo->action) +
-domain->header.len +
+le16_to_cpu(domain->header.len) +
 sizeof(struct mrvlietypesheader) +
 S_DS_GEN);
} else {
--- a/drivers/net/wireless/libertas/wext.c
+++ b/drivers/net/wireless/libertas/wext.c
@@ -973,7 +973,7 @@ static struct iw_statistics *wlan_get_wi
/* Quality by TX errors */
priv->wstats.discard.retries = priv->stats.tx_errors;
 
-   tx_retries = le16_to_cpu(adapter->logmsg.retry);
+   tx_retries = le32_to_cpu(adapter->logmsg.retry);
 
if (tx_retries > 75)
tx_qual = (90 - tx_retries) * POOR / 15;
@@ -989,10 +989,10 @@ static struct iw_statistics *wlan_get_wi
(PERFECT - VERY_GOOD) / 50 + VERY_GOOD;
quality = min(quality, tx_qual);
 
-   priv->wstats.discard.code = 
le16_to_cpu(adapter->logmsg.wepundecryptable);
-   priv->wstats.discard.fragment = le16_to_cpu(adapter->logmsg.rxfrag);
+   priv->wstats.discard.code = 
le32_to_cpu(adapter->logmsg.wepundecryptable);
+   priv->wstats.discard.fragment = le32_to_cpu(adapter->logmsg.rxfrag);
priv->wstats.discard.retries = tx_retries;
-   priv->wstats.discard.misc = le16_to_cpu(adapter->logmsg.ackfailure);
+   priv->wstats.discard.misc = le32_to_cpu(adapter->logmsg.ackfailure);
 
/* Calculate quality */
priv->wstats.qual.qual = max(quality, (u32)100);

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 05/16] forcedeth: add MCP77 device IDs

2007-11-14 Thread Greg KH

-stable review patch.  If anyone has any objections, please let us know.

--
From: Ayaz Abdulla <[EMAIL PROTECTED]>

patch 96fd4cd3e40e240f0c385af87f58e74da8b7099a in mainline.

Signed-off-by: Ayaz Abdulla <[EMAIL PROTECTED]>
Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/net/forcedeth.c |   16 
 include/linux/pci_ids.h |4 
 2 files changed, 20 insertions(+)

--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -5566,6 +5566,22 @@ static struct pci_device_id pci_tbl[] = 
PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 
PCI_DEVICE_ID_NVIDIA_NVENET_31),
.driver_data = 
DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR,
},
+   {   /* MCP77 Ethernet Controller */
+   PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 
PCI_DEVICE_ID_NVIDIA_NVENET_32),
+   .driver_data = 
DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
+   },
+   {   /* MCP77 Ethernet Controller */
+   PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 
PCI_DEVICE_ID_NVIDIA_NVENET_33),
+   .driver_data = 
DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
+   },
+   {   /* MCP77 Ethernet Controller */
+   PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 
PCI_DEVICE_ID_NVIDIA_NVENET_34),
+   .driver_data = 
DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
+   },
+   {   /* MCP77 Ethernet Controller */
+   PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 
PCI_DEVICE_ID_NVIDIA_NVENET_35),
+   .driver_data = 
DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
+   },
{0,},
 };
 
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1233,6 +1233,10 @@
 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE   0x0560
 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE   0x056C
 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE   0x0759
+#define PCI_DEVICE_ID_NVIDIA_NVENET_32  0x0760
+#define PCI_DEVICE_ID_NVIDIA_NVENET_33  0x0761
+#define PCI_DEVICE_ID_NVIDIA_NVENET_34  0x0762
+#define PCI_DEVICE_ID_NVIDIA_NVENET_35  0x0763
 
 #define PCI_VENDOR_ID_IMS  0x10e0
 #define PCI_DEVICE_ID_IMS_TT1280x9128

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 04/13] param_sysfs_builtin memchr argument fix

2007-11-14 Thread Greg KH
-stable review patch.  If anyone has any objections, please let us know.

--
From: Dave Young <[EMAIL PROTECTED]>

patch faf8c714f4508207a9c81cc94dafc76ed6680b44 in mainline.

If memchr argument is longer than strlen(kp->name), there will be some
weird result.

It will casuse duplicate filenames in sysfs for the "nousb".  kernel
warning messages are as bellow:

sysfs: duplicate filename 'usbcore' can not be created
WARNING: at fs/sysfs/dir.c:416 sysfs_add_one()
 [] sysfs_add_one+0xa0/0xe0
 [] create_dir+0x48/0xb0
 [] sysfs_create_dir+0x29/0x50
 [] create_dir+0x1b/0x50
 [] kobject_add+0x46/0x150
 [] kobject_init+0x3a/0x80
 [] kernel_param_sysfs_setup+0x50/0xb0
 [] param_sysfs_builtin+0xee/0x130
 [] param_sysfs_init+0x23/0x60
 [] __next_cpu+0x12/0x20
 [] kernel_init+0x0/0xb0
 [] kernel_init+0x0/0xb0
 [] do_initcalls+0x46/0x1e0
 [] create_proc_entry+0x52/0x90
 [] register_irq_proc+0x9c/0xc0
 [] proc_mkdir_mode+0x34/0x50
 [] kernel_init+0x0/0xb0
 [] kernel_init+0x62/0xb0
 [] kernel_thread_helper+0x7/0x14
 ===
kobject_add failed for usbcore with -EEXIST, don't try to register things with 
the same name in the same directory.
 [] kobject_add+0xf6/0x150
 [] kernel_param_sysfs_setup+0x50/0xb0
 [] param_sysfs_builtin+0xee/0x130
 [] param_sysfs_init+0x23/0x60
 [] __next_cpu+0x12/0x20
 [] kernel_init+0x0/0xb0
 [] kernel_init+0x0/0xb0
 [] do_initcalls+0x46/0x1e0
 [] create_proc_entry+0x52/0x90
 [] register_irq_proc+0x9c/0xc0
 [] proc_mkdir_mode+0x34/0x50
 [] kernel_init+0x0/0xb0
 [] kernel_init+0x62/0xb0
 [] kernel_thread_helper+0x7/0x14
 ===
Module 'usbcore' failed to be added to sysfs, error number -17
The system will be unstable now.

Signed-off-by: Dave Young <[EMAIL PROTECTED]>
Cc: Greg KH <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
Cc: Chuck Ebbert <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 kernel/params.c |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

--- a/kernel/params.c
+++ b/kernel/params.c
@@ -595,11 +595,17 @@ static void __init param_sysfs_builtin(v
 
for (i=0; i < __stop___param - __start___param; i++) {
char *dot;
+   size_t kplen;
 
kp = &__start___param[i];
+   kplen = strlen(kp->name);
 
/* We do not handle args without periods. */
-   dot = memchr(kp->name, '.', MAX_KBUILD_MODNAME);
+   if (kplen > MAX_KBUILD_MODNAME) {
+   DEBUGP("kernel parameter name is too long: %s\n", 
kp->name);
+   continue;
+   }
+   dot = memchr(kp->name, '.', kplen);
if (!dot) {
DEBUGP("couldn't find period in %s\n", kp->name);
continue;

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 02/16] libertas: fix endianness breakage

2007-11-14 Thread Greg KH


-stable review patch.  If anyone has any objections, please let us know.

--
From: Al Viro <[EMAIL PROTECTED]>

patch 5707708111ca6c4e9a1160acffdc98a98d95e462 in mainline.

wep->keytype[] is u8

Signed-off-by: Al Viro <[EMAIL PROTECTED]>
Signed-off-by: Dan Williams <[EMAIL PROTECTED]>
Signed-off-by: John W. Linville <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/net/wireless/libertas/cmd.c |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -185,14 +185,12 @@ static int wlan_cmd_802_11_set_wep(wlan_
 
switch (pkey->len) {
case KEY_LEN_WEP_40:
-   wep->keytype[i] =
-   cpu_to_le16(cmd_type_wep_40_bit);
+   wep->keytype[i] = cmd_type_wep_40_bit;
memmove(&wep->keymaterial[i], pkey->key,
pkey->len);
break;
case KEY_LEN_WEP_104:
-   wep->keytype[i] =
-   cpu_to_le16(cmd_type_wep_104_bit);
+   wep->keytype[i] = cmd_type_wep_104_bit;
memmove(&wep->keymaterial[i], pkey->key,
pkey->len);
break;

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 03/13] Remove broken ptrace() special-case code from file mapping

2007-11-14 Thread Greg KH

stable review patch.  If anyone has any objections, please let us know.

--

The kernel has for random historical reasons allowed ptrace() accesses
to access (and insert) pages into the page cache above the size of the
file.

However, Nick broke that by mistake when doing the new fault handling in
commit 54cb8821de07f2ffcd28c380ce9b93d5784b40d7 ("mm: merge populate and
nopage into fault (fixes nonlinear)".  The breakage caused a hang with
gdb when trying to access the invalid page.

The ptrace "feature" really isn't worth resurrecting, since it really is
wrong both from a portability _and_ from an internal page cache validity
standpoint.  So this removes those old broken remnants, and fixes the
ptrace() hang in the process.

Noticed and bisected by Duane Griffin, who also supplied a test-case
(quoth Nick: "Well that's probably the best bug report I've ever had,
thanks Duane!").

Cc: Duane Griffin <[EMAIL PROTECTED]>
Acked-by: Nick Piggin <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 mm/filemap.c |   13 ++---
 1 file changed, 2 insertions(+), 11 deletions(-)

--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1312,7 +1312,7 @@ int filemap_fault(struct vm_area_struct 
 
size = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
if (vmf->pgoff >= size)
-   goto outside_data_content;
+   return VM_FAULT_SIGBUS;
 
/* If we don't want any read-ahead, don't bother */
if (VM_RandomReadHint(vma))
@@ -1389,7 +1389,7 @@ retry_find:
if (unlikely(vmf->pgoff >= size)) {
unlock_page(page);
page_cache_release(page);
-   goto outside_data_content;
+   return VM_FAULT_SIGBUS;
}
 
/*
@@ -1400,15 +1400,6 @@ retry_find:
vmf->page = page;
return ret | VM_FAULT_LOCKED;
 
-outside_data_content:
-   /*
-* An external ptracer can access pages that normally aren't
-* accessible..
-*/
-   if (vma->vm_mm == current->mm)
-   return VM_FAULT_SIGBUS;
-
-   /* Fall through to the non-read-ahead case */
 no_cached_page:
/*
 * We're only likely to ever get here if MADV_RANDOM is in

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: OT: Does Linux have any "Perfect Code"

2007-11-14 Thread Eric Dumazet

Russell Leighton a écrit :


Bryan Cantrill of Sun (ala DTrace) has a notion of perfect code:

http://blogs.sun.com/bmc/entry/on_i_dreaming_in_code

He also has some examples (from bottom comment section of above):




Can you list a small number of examples of "software perfection"?

Posted by Russell Leighton on November 14, 2007 at 04:02 AM PST #

Russell,

My canonical small example of perfection in Solaris would be Jeff 
Bonwick's mod-by-a-billion code in hrt2ts():


http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/os/timers.c#875 



Solaris of course has lots of bigger, more complicated examples. Now 
on the one hand, one wants to refrain from pointing to thousands of 
lines of code and saying that there are no bugs therein, but on the 
other, there are many subsystems that have been in place and in heavy 
use for years without defect or modification. At the risk of being 
egocentric, the cyclic subsystem (which is executed at least 100 times 
per second on every Solaris system) had its last substantial fix over 
six years ago, and its last fix of any flavor over three years ago:


http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/os/cyclic.c 



Modesty (and the lack, of course, of a proof of its correctness) 
prevents me from calling the cyclic subsystem perfect -- but such as 
unknown defects remain, there are damn few of them, and we can say 
that they must be a result of highly usual (or at least, heretofore 
unseen) circumstances.


A non-Solaris example -- and one that I've been known to use as the 
canonical example of the persistence of software -- is Super Mario 
Kart. This is a game that was developed (to its completion) fifteen 
years ago for the Super Nintendo console. Source code, to the best of 
my knowledge, is not publicly available and may indeed be lost -- but 
the binaries persist and (if my coworkers are any indication) remain 
in active use. Given the longevity of, say, Homer's Odyssey, there is 
reason to believe that Super Mario Kart will survive in perpetuity -- 
that thousands of years from now, twenty-somethings somewhere will be 
using the software exactly as it is used today. Is this perfection? 
Perhaps not -- but it also might not be discernible from perfection...


Posted by Bryan Cantrill on November 14, 2007 at 07:51 AM PST #


Does Linux have any such examples true software perfection?



I dont know, (what a strange idea is it anyway ?) but reading two Solaris 
functions just gave me the example of non true software perfection.


http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/os/timers.c#1106

I would say this code was OK 10 years ago.

Now that a processor (say an Opteron in 64 bits mode, used on SUN hardware), 
can perform a multiply in few cycles, ts2hrt() could use a normal multiply and 
an addition.


Processors are improving, compilers are improving, memory sizes are 
increasing, source code (and algorithms) should be changed accordingly.


(gcc for example already knows the reciprocal division trick and so can 
compile this :


hrt2ts_div(hrtime_t hrt, timestruc_t *tsp)
{
tsp->tv_nsec = do_div(hrt, NANOSEC);
tsp->tv_sec = hrt;
}

to :

movq%rdi, %rdx
movabsq $19342813113834067, %rax
shrq$9, %rdx
mulq%rdx
shrq$11, %rdx
imulq   $10, %rdx, %rax
movq%rdx, (%rsi)
subq%rax, %rdi
movl%edi, 8(%rsi)

while

hrtime_t
ts2hrt(const timestruc_t *tsp)
{
return tsp->tv_sec * NANOSEC + tsp->tv_nsec;
}

can be inlined as it is trivial (and much faster than Solaris version)

movq(%rdi), %rdx
mov 8(%rdi), %eax
imulq   $10, %rdx, %rdx
addq%rdx, %rax

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 06/23] Fix SKB_WITH_OVERHEAD calculations.

2007-11-14 Thread Herbert Xu
On Wed, Nov 14, 2007 at 10:20:22PM -0800, Greg KH wrote:
> -stable review patch.  If anyone has any objections, please let us know.
> 
> --
> 
> From: Herbert Xu <[EMAIL PROTECTED]>
> 
> patch deea84b0ae3d26b41502ae0a39fe7fe134e703d0 in mainline.
> 
> [NET]: Fix SKB_WITH_OVERHEAD calculation

Although this is correct as it is, it tirggers a latent bug
which is fixed by

commit fb93134dfc2a6e6fbedc7c270a31da03fce88db9
Author: Herbert Xu <[EMAIL PROTECTED]>
Date:   Wed Nov 14 15:45:21 2007 -0800

[TCP]: Fix size calculation in sk_stream_alloc_pskb

So please postpone it to the next round such that both patches
can be included together.

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 22/23] mac80211: only honor IW_SCAN_THIS_ESSID in STA, IBSS, and AP modes

2007-11-14 Thread Greg KH
-stable review patch.  If anyone has any objections, please let us know.

--


From: John W. Linville <[EMAIL PROTECTED]>

patch d114f399b4da6fa7f9da3bbf1fb841370c11e788 in mainline.

The previous IW_SCAN_THIS_ESSID patch left a hole allowing scan
requests on interfaces in inappropriate modes.

Signed-off-by: John W. Linville <[EMAIL PROTECTED]>
Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 net/mac80211/ieee80211_ioctl.c |   37 +++--
 1 file changed, 19 insertions(+), 18 deletions(-)

--- a/net/mac80211/ieee80211_ioctl.c
+++ b/net/mac80211/ieee80211_ioctl.c
@@ -698,29 +698,30 @@ static int ieee80211_ioctl_siwscan(struc
if (!netif_running(dev))
return -ENETDOWN;
 
+   switch (sdata->type) {
+   case IEEE80211_IF_TYPE_STA:
+   case IEEE80211_IF_TYPE_IBSS:
+   if (local->scan_flags & IEEE80211_SCAN_MATCH_SSID) {
+   ssid = sdata->u.sta.ssid;
+   ssid_len = sdata->u.sta.ssid_len;
+   }
+   break;
+   case IEEE80211_IF_TYPE_AP:
+   if (local->scan_flags & IEEE80211_SCAN_MATCH_SSID) {
+   ssid = sdata->u.ap.ssid;
+   ssid_len = sdata->u.ap.ssid_len;
+   }
+   break;
+   default:
+   return -EOPNOTSUPP;
+   }
+
+   /* if SSID was specified explicitly then use that */
if (wrqu->data.length == sizeof(struct iw_scan_req) &&
wrqu->data.flags & IW_SCAN_THIS_ESSID) {
req = (struct iw_scan_req *)extra;
ssid = req->essid;
ssid_len = req->essid_len;
-   } else {
-   switch (sdata->type) {
-   case IEEE80211_IF_TYPE_STA:
-   case IEEE80211_IF_TYPE_IBSS:
-   if (local->scan_flags & IEEE80211_SCAN_MATCH_SSID) {
-   ssid = sdata->u.sta.ssid;
-   ssid_len = sdata->u.sta.ssid_len;
-   }
-   break;
-   case IEEE80211_IF_TYPE_AP:
-   if (local->scan_flags & IEEE80211_SCAN_MATCH_SSID) {
-   ssid = sdata->u.ap.ssid;
-   ssid_len = sdata->u.ap.ssid_len;
-   }
-   break;
-   default:
-   return -EOPNOTSUPP;
-   }
}
 
return ieee80211_sta_req_scan(dev, ssid, ssid_len);

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 23/23] mac80211: make ieee802_11_parse_elems return void

2007-11-14 Thread Greg KH
-stable review patch.  If anyone has any objections, please let us know.

--


From: John W. Linville <[EMAIL PROTECTED]>

patch 67a4cce4a89718d252b61aaf58882c69c0e2f6e3 in mainline.

Some APs send management frames with junk padding after the last IE.
We already account for a similar problem with some Apple Airport
devices, but at least one device is known to send more than a single
extra byte.  The device in question is the Draytek Vigor2900:

http://www.draytek.com.au/products/Vigor2900.php

The junk in question looks like an IE that runs off the end of the
frame.  This cause us to return ParseFailed.  Since the frame in
question is an association response, this causes us to fail to associate
with this AP.

The return code from ieee802_11_parse_elems is superfluous.
All callers still check for the presence of the specific IEs that
interest them anyway.  So, remove the return code so the parse never
"fails".

Acked-by: Michael Wu <[EMAIL PROTECTED]>
Signed-off-by: John W. Linville <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 net/mac80211/ieee80211_sta.c |   56 ++-
 1 file changed, 9 insertions(+), 47 deletions(-)

--- a/net/mac80211/ieee80211_sta.c
+++ b/net/mac80211/ieee80211_sta.c
@@ -108,15 +108,11 @@ struct ieee802_11_elems {
u8 wmm_param_len;
 };
 
-typedef enum { ParseOK = 0, ParseUnknown = 1, ParseFailed = -1 } ParseRes;
-
-
-static ParseRes ieee802_11_parse_elems(u8 *start, size_t len,
-  struct ieee802_11_elems *elems)
+static void ieee802_11_parse_elems(u8 *start, size_t len,
+  struct ieee802_11_elems *elems)
 {
size_t left = len;
u8 *pos = start;
-   int unknown = 0;
 
memset(elems, 0, sizeof(*elems));
 
@@ -127,15 +123,8 @@ static ParseRes ieee802_11_parse_elems(u
elen = *pos++;
left -= 2;
 
-   if (elen > left) {
-#if 0
-   if (net_ratelimit())
-   printk(KERN_DEBUG "IEEE 802.11 element parse "
-  "failed (id=%d elen=%d left=%d)\n",
-  id, elen, left);
-#endif
-   return ParseFailed;
-   }
+   if (elen > left)
+   return;
 
switch (id) {
case WLAN_EID_SSID:
@@ -202,28 +191,15 @@ static ParseRes ieee802_11_parse_elems(u
elems->ext_supp_rates_len = elen;
break;
default:
-#if 0
-   printk(KERN_DEBUG "IEEE 802.11 element parse ignored "
- "unknown element (id=%d elen=%d)\n",
- id, elen);
-#endif
-   unknown++;
break;
}
 
left -= elen;
pos += elen;
}
-
-   /* Do not trigger error if left == 1 as Apple Airport base stations
-* send AssocResps that are one spurious byte too long. */
-
-   return unknown ? ParseUnknown : ParseOK;
 }
 
 
-
-
 static int ecw2cw(int ecw)
 {
int cw = 1;
@@ -907,12 +883,7 @@ static void ieee80211_auth_challenge(str
 
printk(KERN_DEBUG "%s: replying to auth challenge\n", dev->name);
pos = mgmt->u.auth.variable;
-   if (ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems)
-   == ParseFailed) {
-   printk(KERN_DEBUG "%s: failed to parse Auth(challenge)\n",
-  dev->name);
-   return;
-   }
+   ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems);
if (!elems.challenge) {
printk(KERN_DEBUG "%s: no challenge IE in shared key auth "
   "frame\n", dev->name);
@@ -1200,12 +1171,7 @@ static void ieee80211_rx_mgmt_assoc_resp
aid &= ~(BIT(15) | BIT(14));
 
pos = mgmt->u.assoc_resp.variable;
-   if (ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems)
-   == ParseFailed) {
-   printk(KERN_DEBUG "%s: failed to parse AssocResp\n",
-  dev->name);
-   return;
-   }
+   ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems);
 
if (!elems.supp_rates) {
printk(KERN_DEBUG "%s: no SuppRates element in AssocResp\n",
@@ -1434,7 +1400,7 @@ static void ieee80211_rx_bss_info(struct
struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
struct ieee802_11_elems elems;
size_t baselen;
-   int channel, invalid = 0, clen;
+   int channel, clen;
struct ieee80211_sta_bss *bss;
struct sta_info *sta;
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
@@ -1478,9 +1444,7 @@ static void ieee80211_rx_bss_info(struct
 #endif /* CONFIG_MAC8021

[patch 21/23] mac80211: honor IW_SCAN_THIS_ESSID in siwscan ioctl

2007-11-14 Thread Greg KH
-stable review patch.  If anyone has any objections, please let us know.

--


From: Bill Moss <[EMAIL PROTECTED]>

patch 107acb23ba763197d390ae9ffd347f3e2a524d39 in mainline.

This patch fixes the problem of associating with wpa_secured hidden
AP.  Please try out.

The original author of this patch is Bill Moss <[EMAIL PROTECTED]>

Signed-off-by: Abhijeet Kolekar <[EMAIL PROTECTED]>
Signed-off-by: John W. Linville <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 net/mac80211/ieee80211_ioctl.c |   40 
 1 file changed, 24 insertions(+), 16 deletions(-)

--- a/net/mac80211/ieee80211_ioctl.c
+++ b/net/mac80211/ieee80211_ioctl.c
@@ -687,32 +687,40 @@ static int ieee80211_ioctl_giwap(struct 
 
 static int ieee80211_ioctl_siwscan(struct net_device *dev,
   struct iw_request_info *info,
-  struct iw_point *data, char *extra)
+  union iwreq_data *wrqu, char *extra)
 {
struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+   struct iw_scan_req *req = NULL;
u8 *ssid = NULL;
size_t ssid_len = 0;
 
if (!netif_running(dev))
return -ENETDOWN;
 
-   switch (sdata->type) {
-   case IEEE80211_IF_TYPE_STA:
-   case IEEE80211_IF_TYPE_IBSS:
-   if (local->scan_flags & IEEE80211_SCAN_MATCH_SSID) {
-   ssid = sdata->u.sta.ssid;
-   ssid_len = sdata->u.sta.ssid_len;
-   }
-   break;
-   case IEEE80211_IF_TYPE_AP:
-   if (local->scan_flags & IEEE80211_SCAN_MATCH_SSID) {
-   ssid = sdata->u.ap.ssid;
-   ssid_len = sdata->u.ap.ssid_len;
+   if (wrqu->data.length == sizeof(struct iw_scan_req) &&
+   wrqu->data.flags & IW_SCAN_THIS_ESSID) {
+   req = (struct iw_scan_req *)extra;
+   ssid = req->essid;
+   ssid_len = req->essid_len;
+   } else {
+   switch (sdata->type) {
+   case IEEE80211_IF_TYPE_STA:
+   case IEEE80211_IF_TYPE_IBSS:
+   if (local->scan_flags & IEEE80211_SCAN_MATCH_SSID) {
+   ssid = sdata->u.sta.ssid;
+   ssid_len = sdata->u.sta.ssid_len;
+   }
+   break;
+   case IEEE80211_IF_TYPE_AP:
+   if (local->scan_flags & IEEE80211_SCAN_MATCH_SSID) {
+   ssid = sdata->u.ap.ssid;
+   ssid_len = sdata->u.ap.ssid_len;
+   }
+   break;
+   default:
+   return -EOPNOTSUPP;
}
-   break;
-   default:
-   return -EOPNOTSUPP;
}
 
return ieee80211_sta_req_scan(dev, ssid, ssid_len);

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 19/23] mac80211: store channel info in sta_bss_list

2007-11-14 Thread Greg KH
-stable review patch.  If anyone has any objections, please let us know.

--

From: John W. Linville <[EMAIL PROTECTED]>

patch 65c107ab3befc37b21d1c970a6159525bc0121b8 in mainline.

Some AP equipment "in the wild" uses the same BSSID on multiple channels
(particularly "a" vs. "b/g").  This patch changes the key of sta_bss_list
to include both the BSSID and the channel so as to prevent a BSSID on
one channel from eclipsing the same BSSID on another channel.

Signed-off-by: John W. Linville <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 net/mac80211/ieee80211_sta.c |   35 ---
 1 file changed, 20 insertions(+), 15 deletions(-)

--- a/net/mac80211/ieee80211_sta.c
+++ b/net/mac80211/ieee80211_sta.c
@@ -61,7 +61,7 @@
 static void ieee80211_send_probe_req(struct net_device *dev, u8 *dst,
 u8 *ssid, size_t ssid_len);
 static struct ieee80211_sta_bss *
-ieee80211_rx_bss_get(struct net_device *dev, u8 *bssid);
+ieee80211_rx_bss_get(struct net_device *dev, u8 *bssid, int channel);
 static void ieee80211_rx_bss_put(struct net_device *dev,
 struct ieee80211_sta_bss *bss);
 static int ieee80211_sta_find_ibss(struct net_device *dev,
@@ -387,6 +387,7 @@ static void ieee80211_set_associated(str
 struct ieee80211_if_sta *ifsta, int assoc)
 {
union iwreq_data wrqu;
+   struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 
if (ifsta->associated == assoc)
@@ -401,7 +402,8 @@ static void ieee80211_set_associated(str
if (sdata->type != IEEE80211_IF_TYPE_STA)
return;
 
-   bss = ieee80211_rx_bss_get(dev, ifsta->bssid);
+   bss = ieee80211_rx_bss_get(dev, ifsta->bssid,
+  local->hw.conf.channel);
if (bss) {
if (bss->has_erp_value)
ieee80211_handle_erp_ie(dev, bss->erp_value);
@@ -543,7 +545,7 @@ static void ieee80211_send_assoc(struct 
capab |= WLAN_CAPABILITY_SHORT_SLOT_TIME |
WLAN_CAPABILITY_SHORT_PREAMBLE;
}
-   bss = ieee80211_rx_bss_get(dev, ifsta->bssid);
+   bss = ieee80211_rx_bss_get(dev, ifsta->bssid, local->hw.conf.channel);
if (bss) {
if (bss->capability & WLAN_CAPABILITY_PRIVACY)
capab |= WLAN_CAPABILITY_PRIVACY;
@@ -695,6 +697,7 @@ static void ieee80211_send_disassoc(stru
 static int ieee80211_privacy_mismatch(struct net_device *dev,
  struct ieee80211_if_sta *ifsta)
 {
+   struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
struct ieee80211_sta_bss *bss;
int res = 0;
 
@@ -702,7 +705,7 @@ static int ieee80211_privacy_mismatch(st
ifsta->key_mgmt != IEEE80211_KEY_MGMT_NONE)
return 0;
 
-   bss = ieee80211_rx_bss_get(dev, ifsta->bssid);
+   bss = ieee80211_rx_bss_get(dev, ifsta->bssid, local->hw.conf.channel);
if (!bss)
return 0;
 
@@ -1211,7 +1214,8 @@ static void ieee80211_rx_mgmt_assoc_resp
 * update our stored copy */
if (elems.erp_info && elems.erp_info_len >= 1) {
struct ieee80211_sta_bss *bss
-   = ieee80211_rx_bss_get(dev, ifsta->bssid);
+   = ieee80211_rx_bss_get(dev, ifsta->bssid,
+  local->hw.conf.channel);
if (bss) {
bss->erp_value = elems.erp_info[0];
bss->has_erp_value = 1;
@@ -1241,7 +1245,8 @@ static void ieee80211_rx_mgmt_assoc_resp
   " AP\n", dev->name);
return;
}
-   bss = ieee80211_rx_bss_get(dev, ifsta->bssid);
+   bss = ieee80211_rx_bss_get(dev, ifsta->bssid,
+  local->hw.conf.channel);
if (bss) {
sta->last_rssi = bss->rssi;
sta->last_signal = bss->signal;
@@ -1322,7 +1327,7 @@ static void __ieee80211_rx_bss_hash_del(
 
 
 static struct ieee80211_sta_bss *
-ieee80211_rx_bss_add(struct net_device *dev, u8 *bssid)
+ieee80211_rx_bss_add(struct net_device *dev, u8 *bssid, int channel)
 {
struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
struct ieee80211_sta_bss *bss;
@@ -1333,6 +1338,7 @@ ieee80211_rx_bss_add(struct net_device *
atomic_inc(&bss->users);
atomic_inc(&bss->users);
memcpy(bss->bssid, bssid, ETH_ALEN);
+   bss->channel = channel;
 
spin_lock_bh(&local->sta_bss_lock);
/* TODO: order by RSSI? */
@@ -1344,7 +1350,7 @@ ieee80211_rx_bss_add(struct net_device *
 
 
 st

[patch 20/23] mac80211: store SSID in sta_bss_list

2007-11-14 Thread Greg KH
-stable review patch.  If anyone has any objections, please let us know.

--


From: John W. Linville <[EMAIL PROTECTED]>

patch cffdd30d20d163343b1c6de25bcb0cc978a1ebf9 in mainline.

Some AP equipment "in the wild" services multiple SSIDs using the
same BSSID.  This patch changes the key of sta_bss_list to include
the SSID as well as the BSSID and the channel so as to prevent one
SSID from eclipsing another SSID with the same BSSID.

Signed-off-by: John W. Linville <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 net/mac80211/ieee80211_sta.c |   54 ++-
 1 file changed, 33 insertions(+), 21 deletions(-)

--- a/net/mac80211/ieee80211_sta.c
+++ b/net/mac80211/ieee80211_sta.c
@@ -12,7 +12,6 @@
  */
 
 /* TODO:
- * BSS table: use  as the key to support multi-SSID APs
  * order BSS list by RSSI(?) ("quality of AP")
  * scan result table filtering (by capability (privacy, IBSS/BSS, WPA/RSN IE,
  *SSID)
@@ -61,7 +60,8 @@
 static void ieee80211_send_probe_req(struct net_device *dev, u8 *dst,
 u8 *ssid, size_t ssid_len);
 static struct ieee80211_sta_bss *
-ieee80211_rx_bss_get(struct net_device *dev, u8 *bssid, int channel);
+ieee80211_rx_bss_get(struct net_device *dev, u8 *bssid, int channel,
+u8 *ssid, u8 ssid_len);
 static void ieee80211_rx_bss_put(struct net_device *dev,
 struct ieee80211_sta_bss *bss);
 static int ieee80211_sta_find_ibss(struct net_device *dev,
@@ -403,7 +403,8 @@ static void ieee80211_set_associated(str
return;
 
bss = ieee80211_rx_bss_get(dev, ifsta->bssid,
-  local->hw.conf.channel);
+  local->hw.conf.channel,
+  ifsta->ssid, ifsta->ssid_len);
if (bss) {
if (bss->has_erp_value)
ieee80211_handle_erp_ie(dev, bss->erp_value);
@@ -545,7 +546,8 @@ static void ieee80211_send_assoc(struct 
capab |= WLAN_CAPABILITY_SHORT_SLOT_TIME |
WLAN_CAPABILITY_SHORT_PREAMBLE;
}
-   bss = ieee80211_rx_bss_get(dev, ifsta->bssid, local->hw.conf.channel);
+   bss = ieee80211_rx_bss_get(dev, ifsta->bssid, local->hw.conf.channel,
+  ifsta->ssid, ifsta->ssid_len);
if (bss) {
if (bss->capability & WLAN_CAPABILITY_PRIVACY)
capab |= WLAN_CAPABILITY_PRIVACY;
@@ -705,7 +707,8 @@ static int ieee80211_privacy_mismatch(st
ifsta->key_mgmt != IEEE80211_KEY_MGMT_NONE)
return 0;
 
-   bss = ieee80211_rx_bss_get(dev, ifsta->bssid, local->hw.conf.channel);
+   bss = ieee80211_rx_bss_get(dev, ifsta->bssid, local->hw.conf.channel,
+  ifsta->ssid, ifsta->ssid_len);
if (!bss)
return 0;
 
@@ -1215,7 +1218,8 @@ static void ieee80211_rx_mgmt_assoc_resp
if (elems.erp_info && elems.erp_info_len >= 1) {
struct ieee80211_sta_bss *bss
= ieee80211_rx_bss_get(dev, ifsta->bssid,
-  local->hw.conf.channel);
+  local->hw.conf.channel,
+  ifsta->ssid, ifsta->ssid_len);
if (bss) {
bss->erp_value = elems.erp_info[0];
bss->has_erp_value = 1;
@@ -1246,7 +1250,8 @@ static void ieee80211_rx_mgmt_assoc_resp
return;
}
bss = ieee80211_rx_bss_get(dev, ifsta->bssid,
-  local->hw.conf.channel);
+  local->hw.conf.channel,
+  ifsta->ssid, ifsta->ssid_len);
if (bss) {
sta->last_rssi = bss->rssi;
sta->last_signal = bss->signal;
@@ -1327,7 +1332,8 @@ static void __ieee80211_rx_bss_hash_del(
 
 
 static struct ieee80211_sta_bss *
-ieee80211_rx_bss_add(struct net_device *dev, u8 *bssid, int channel)
+ieee80211_rx_bss_add(struct net_device *dev, u8 *bssid, int channel,
+u8 *ssid, u8 ssid_len)
 {
struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
struct ieee80211_sta_bss *bss;
@@ -1339,6 +1345,10 @@ ieee80211_rx_bss_add(struct net_device *
atomic_inc(&bss->users);
memcpy(bss->bssid, bssid, ETH_ALEN);
bss->channel = channel;
+   if (ssid && ssid_len <= IEEE80211_MAX_SSID_LEN) {
+   memcpy(bss->ssid, ssid, ssid_len);
+   bss->ssid_len = ssid_len;
+   }
 
spin_lock_bh(&local->sta_bss_lock);
/* TODO: order by RSSI? */
@@ -1350,7 +1360,8 @@ ieee80211_rx_b

[patch 17/23] ieee80211: fix TKIP QoS bug

2007-11-14 Thread Greg KH
-stable review patch.  If anyone has any objections, please let us know.

--


From: Johannes Berg <[EMAIL PROTECTED]>

patch e797aa1b7da6bfcb2e19a10ae5ead9aa7aea732b in mainline.

The commit 65b6a277 titled "ieee80211: Fix header->qos_ctl endian issue"
*introduced* an endianness bug. Partially revert it.

Signed-off-by: Johannes Berg <[EMAIL PROTECTED]>
Signed-off-by: John W. Linville <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 net/ieee80211/ieee80211_crypt_tkip.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/net/ieee80211/ieee80211_crypt_tkip.c
+++ b/net/ieee80211/ieee80211_crypt_tkip.c
@@ -584,7 +584,7 @@ static void michael_mic_hdr(struct sk_bu
if (stype & IEEE80211_STYPE_QOS_DATA) {
const struct ieee80211_hdr_3addrqos *qoshdr =
(struct ieee80211_hdr_3addrqos *)skb->data;
-   hdr[12] = qoshdr->qos_ctl & cpu_to_le16(IEEE80211_QCTL_TID);
+   hdr[12] = le16_to_cpu(qoshdr->qos_ctl) & IEEE80211_QCTL_TID;
} else
hdr[12] = 0;/* priority */
 

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 18/23] mac80211: reorder association debug output

2007-11-14 Thread Greg KH
-stable review patch.  If anyone has any objections, please let us know.

--


From: Johannes Berg <[EMAIL PROTECTED]>

patch 1dd84aa213d0f98a91a1ec9be2f750f5f48e75a0 in mainline.

There's no reason to warn about an invalid AID field when the
association was denied.

Signed-off-by: Johannes Berg <[EMAIL PROTECTED]>
Acked-by: Michael Wu <[EMAIL PROTECTED]>
Signed-off-by: John W. Linville <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 net/mac80211/ieee80211_sta.c |   11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

--- a/net/mac80211/ieee80211_sta.c
+++ b/net/mac80211/ieee80211_sta.c
@@ -1174,15 +1174,11 @@ static void ieee80211_rx_mgmt_assoc_resp
capab_info = le16_to_cpu(mgmt->u.assoc_resp.capab_info);
status_code = le16_to_cpu(mgmt->u.assoc_resp.status_code);
aid = le16_to_cpu(mgmt->u.assoc_resp.aid);
-   if ((aid & (BIT(15) | BIT(14))) != (BIT(15) | BIT(14)))
-   printk(KERN_DEBUG "%s: invalid aid value %d; bits 15:14 not "
-  "set\n", dev->name, aid);
-   aid &= ~(BIT(15) | BIT(14));
 
printk(KERN_DEBUG "%s: RX %sssocResp from " MAC_FMT " (capab=0x%x "
   "status=%d aid=%d)\n",
   dev->name, reassoc ? "Rea" : "A", MAC_ARG(mgmt->sa),
-  capab_info, status_code, aid);
+  capab_info, status_code, aid & ~(BIT(15) | BIT(14)));
 
if (status_code != WLAN_STATUS_SUCCESS) {
printk(KERN_DEBUG "%s: AP denied association (code=%d)\n",
@@ -1192,6 +1188,11 @@ static void ieee80211_rx_mgmt_assoc_resp
return;
}
 
+   if ((aid & (BIT(15) | BIT(14))) != (BIT(15) | BIT(14)))
+   printk(KERN_DEBUG "%s: invalid aid value %d; bits 15:14 not "
+  "set\n", dev->name, aid);
+   aid &= ~(BIT(15) | BIT(14));
+
pos = mgmt->u.assoc_resp.variable;
if (ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems)
== ParseFailed) {

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 15/23] Fix netlink timeouts.

2007-11-14 Thread Greg KH
-stable review patch.  If anyone has any objections, please let us know.

--

From: Patrick McHardy <[EMAIL PROTECTED]>

[NETLINK]: Fix unicast timeouts

[ Upstream commit: c3d8d1e30cace31fed6186a4b8c6b1401836d89c ]

Commit ed6dcf4a in the history.git tree broke netlink_unicast timeouts
by moving the schedule_timeout() call to a new function that doesn't
propagate the remaining timeout back to the caller. This means on each
retry we start with the full timeout again.

ipc/mqueue.c seems to actually want to wait indefinitely so this
behaviour is retained.

Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]>
Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 include/linux/netlink.h  |2 +-
 ipc/mqueue.c |6 --
 net/netlink/af_netlink.c |   10 +-
 3 files changed, 10 insertions(+), 8 deletions(-)

--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -175,7 +175,7 @@ extern int netlink_unregister_notifier(s
 /* finegrained unicast helpers: */
 struct sock *netlink_getsockbyfilp(struct file *filp);
 int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock,
-   long timeo, struct sock *ssk);
+ long *timeo, struct sock *ssk);
 void netlink_detachskb(struct sock *sk, struct sk_buff *skb);
 int netlink_sendskb(struct sock *sk, struct sk_buff *skb, int protocol);
 
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -1014,6 +1014,8 @@ asmlinkage long sys_mq_notify(mqd_t mqde
return -EINVAL;
}
if (notification.sigev_notify == SIGEV_THREAD) {
+   long timeo;
+
/* create the notify skb */
nc = alloc_skb(NOTIFY_COOKIE_LEN, GFP_KERNEL);
ret = -ENOMEM;
@@ -1042,8 +1044,8 @@ retry:
goto out;
}
 
-   ret = netlink_attachskb(sock, nc, 0,
-   MAX_SCHEDULE_TIMEOUT, NULL);
+   timeo = MAX_SCHEDULE_TIMEOUT;
+   ret = netlink_attachskb(sock, nc, 0, &timeo, NULL);
if (ret == 1)
goto retry;
if (ret) {
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -744,7 +744,7 @@ struct sock *netlink_getsockbyfilp(struc
  * 1: repeat lookup - reference dropped while waiting for socket memory.
  */
 int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock,
-   long timeo, struct sock *ssk)
+ long *timeo, struct sock *ssk)
 {
struct netlink_sock *nlk;
 
@@ -753,7 +753,7 @@ int netlink_attachskb(struct sock *sk, s
if (atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf ||
test_bit(0, &nlk->state)) {
DECLARE_WAITQUEUE(wait, current);
-   if (!timeo) {
+   if (!*timeo) {
if (!ssk || nlk_sk(ssk)->pid == 0)
netlink_overrun(sk);
sock_put(sk);
@@ -767,7 +767,7 @@ int netlink_attachskb(struct sock *sk, s
if ((atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf ||
 test_bit(0, &nlk->state)) &&
!sock_flag(sk, SOCK_DEAD))
-   timeo = schedule_timeout(timeo);
+   *timeo = schedule_timeout(*timeo);
 
__set_current_state(TASK_RUNNING);
remove_wait_queue(&nlk->wait, &wait);
@@ -775,7 +775,7 @@ int netlink_attachskb(struct sock *sk, s
 
if (signal_pending(current)) {
kfree_skb(skb);
-   return sock_intr_errno(timeo);
+   return sock_intr_errno(*timeo);
}
return 1;
}
@@ -839,7 +839,7 @@ retry:
kfree_skb(skb);
return PTR_ERR(sk);
}
-   err = netlink_attachskb(sk, skb, nonblock, timeo, ssk);
+   err = netlink_attachskb(sk, skb, nonblock, &timeo, ssk);
if (err == 1)
goto retry;
if (err)

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 16/23] NETFILTER: nf_conntrack_tcp: fix connection reopening

2007-11-14 Thread Greg KH

-stable review patch.  If anyone has any objections, please let us know.

--


From: Jozsef Kadlecsik <[EMAIL PROTECTED]>

Upstream commits: 17311393 + bc34b841 merged together.  Merge done by
Patrick McHardy <[EMAIL PROTECTED]>

[NETFILTER]: nf_conntrack_tcp: fix connection reopening

With your description I could reproduce the bug and actually you were
completely right: the code above is incorrect. Somehow I was able to
misread RFC1122 and mixed the roles :-(:

   When a connection is >>closed actively<<, it MUST linger in
   TIME-WAIT state for a time 2xMSL (Maximum Segment Lifetime).
   However, it MAY >>accept<< a new SYN from the remote TCP to
   reopen the connection directly from TIME-WAIT state, if it:
   [...]

The fix is as follows: if the receiver initiated an active close, then the
sender may reopen the connection - otherwise try to figure out if we hold
a dead connection.

Signed-off-by: Jozsef Kadlecsik <[EMAIL PROTECTED]>
Tested-by: Krzysztof Piotr Oledzki <[EMAIL PROTECTED]>
Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]>
Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>


---
 net/netfilter/nf_conntrack_proto_tcp.c |   38 ++---
 1 file changed, 17 insertions(+), 21 deletions(-)

--- a/net/netfilter/nf_conntrack_proto_tcp.c
+++ b/net/netfilter/nf_conntrack_proto_tcp.c
@@ -831,6 +831,22 @@ static int tcp_packet(struct nf_conn *co
tuple = &conntrack->tuplehash[dir].tuple;
 
switch (new_state) {
+   case TCP_CONNTRACK_SYN_SENT:
+   if (old_state < TCP_CONNTRACK_TIME_WAIT)
+   break;
+   if ((conntrack->proto.tcp.seen[!dir].flags &
+   IP_CT_TCP_FLAG_CLOSE_INIT)
+   || (conntrack->proto.tcp.last_dir == dir
+   && conntrack->proto.tcp.last_index == TCP_RST_SET)) {
+   /* Attempt to reopen a closed/aborted connection.
+* Delete this connection and look up again. */
+   write_unlock_bh(&tcp_lock);
+   if (del_timer(&conntrack->timeout))
+   conntrack->timeout.function((unsigned long)
+   conntrack);
+   return -NF_REPEAT;
+   }
+   /* Fall through */
case TCP_CONNTRACK_IGNORE:
/* Ignored packets:
 *
@@ -879,27 +895,6 @@ static int tcp_packet(struct nf_conn *co
nf_log_packet(pf, 0, skb, NULL, NULL, NULL,
  "nf_ct_tcp: invalid state ");
return -NF_ACCEPT;
-   case TCP_CONNTRACK_SYN_SENT:
-   if (old_state < TCP_CONNTRACK_TIME_WAIT)
-   break;
-   if ((conntrack->proto.tcp.seen[dir].flags &
-   IP_CT_TCP_FLAG_CLOSE_INIT)
-   || after(ntohl(th->seq),
-conntrack->proto.tcp.seen[dir].td_end)) {
-   /* Attempt to reopen a closed connection.
-   * Delete this connection and look up again. */
-   write_unlock_bh(&tcp_lock);
-   if (del_timer(&conntrack->timeout))
-   conntrack->timeout.function((unsigned long)
-   conntrack);
-   return -NF_REPEAT;
-   } else {
-   write_unlock_bh(&tcp_lock);
-   if (LOG_INVALID(IPPROTO_TCP))
-   nf_log_packet(pf, 0, skb, NULL, NULL,
- NULL, "nf_ct_tcp: invalid SYN");
-   return -NF_ACCEPT;
-   }
case TCP_CONNTRACK_CLOSE:
if (index == TCP_RST_SET
&& ((test_bit(IPS_SEEN_REPLY_BIT, &conntrack->status)
@@ -932,6 +927,7 @@ static int tcp_packet(struct nf_conn *co
  in_window:
/* From now on we have got in-window packets */
conntrack->proto.tcp.last_index = index;
+   conntrack->proto.tcp.last_dir = dir;
 
pr_debug("tcp_conntracks: ");
NF_CT_DUMP_TUPLE(tuple);

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 13/23] Fix SET_VLAN_INGRESS_PRIORITY_CMD error return.

2007-11-14 Thread Greg KH
-stable review patch.  If anyone has any objections, please let us know.

--

From: Patrick McHardy <[EMAIL PROTECTED]>

patch fffe470a803e7f7b74c016291e542a0162761209 in mainline.

[VLAN]: Fix SET_VLAN_INGRESS_PRIORITY_CMD ioctl

Based on report and patch by Doug Kehn <[EMAIL PROTECTED]>:

vconfig returns the following error when attempting to execute the
set_ingress_map command:

vconfig: socket or ioctl error for set_ingress_map: Operation not permitted

In vlan.c, vlan_ioctl_handler for SET_VLAN_INGRESS_PRIORITY_CMD
sets err = -EPERM and calls vlan_dev_set_ingress_priority.
vlan_dev_set_ingress_priority is a void function so err remains
at -EPERM and results in the vconfig error (even though the ingress
map was set).

Fix by setting err = 0 after the vlan_dev_set_ingress_priority call.

Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]>
Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 net/8021q/vlan.c |1 +
 1 file changed, 1 insertion(+)

--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -744,6 +744,7 @@ static int vlan_ioctl_handler(void __use
vlan_dev_set_ingress_priority(dev,
  args.u.skb_priority,
  args.vlan_qos);
+   err = 0;
break;
 
case SET_VLAN_EGRESS_PRIORITY_CMD:

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 14/23] Fix crypto_alloc_comp() error checking.

2007-11-14 Thread Greg KH
-stable review patch.  If anyone has any objections, please let us know.

--

From: Herbert Xu <[EMAIL PROTECTED]>

[IPSEC]: Fix crypto_alloc_comp error checking

[ Upstream commit: 4999f3621f4da622e77931b3d33ada6c7083c705 ]

The function crypto_alloc_comp returns an errno instead of NULL
to indicate error.  So it needs to be tested with IS_ERR.

This is based on a patch by Vicen? Beltran Querol.

Signed-off-by: Herbert Xu <[EMAIL PROTECTED]>
Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 net/ipv4/ipcomp.c  |3 ++-
 net/ipv6/ipcomp6.c |3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

--- a/net/ipv4/ipcomp.c
+++ b/net/ipv4/ipcomp.c
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -355,7 +356,7 @@ static struct crypto_comp **ipcomp_alloc
for_each_possible_cpu(cpu) {
struct crypto_comp *tfm = crypto_alloc_comp(alg_name, 0,
CRYPTO_ALG_ASYNC);
-   if (!tfm)
+   if (IS_ERR(tfm))
goto error;
*per_cpu_ptr(tfms, cpu) = tfm;
}
--- a/net/ipv6/ipcomp6.c
+++ b/net/ipv6/ipcomp6.c
@@ -37,6 +37,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -366,7 +367,7 @@ static struct crypto_comp **ipcomp6_allo
for_each_possible_cpu(cpu) {
struct crypto_comp *tfm = crypto_alloc_comp(alg_name, 0,
CRYPTO_ALG_ASYNC);
-   if (!tfm)
+   if (IS_ERR(tfm))
goto error;
*per_cpu_ptr(tfms, cpu) = tfm;
}

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 10/23] Fix TEQL oops.

2007-11-14 Thread Greg KH
-stable review patch.  If anyone has any objections, please let us know.

--

From: Evgeniy Polyakov <[EMAIL PROTECTED]>

[PKT_SCHED]: Fix OOPS when removing devices from a teql queuing discipline

[ Upstream commit: 4f9f8311a08c0d95c70261264a2b47f2ae99683a ]

tecl_reset() is called from deactivate and qdisc is set to noop already,
but subsequent teql_xmit does not know about it and dereference private
data as teql qdisc and thus oopses.
not catch it first :)

Signed-off-by: Evgeniy Polyakov <[EMAIL PROTECTED]>
Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 net/sched/sch_teql.c |3 +++
 1 file changed, 3 insertions(+)

--- a/net/sched/sch_teql.c
+++ b/net/sched/sch_teql.c
@@ -249,6 +249,9 @@ __teql_resolve(struct sk_buff *skb, stru
 static __inline__ int
 teql_resolve(struct sk_buff *skb, struct sk_buff *skb_res, struct net_device 
*dev)
 {
+   if (dev->qdisc == &noop_qdisc)
+   return -ENODEV;
+
if (dev->hard_header == NULL ||
skb->dst == NULL ||
skb->dst->neighbour == NULL)

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 11/23] Fix endianness bug in U32 classifier.

2007-11-14 Thread Greg KH
-stable review patch.  If anyone has any objections, please let us know.

--

From: Radu Rendec <[EMAIL PROTECTED]>

changeset 543821c6f5dea5221426eaf1eac98b100249c7ac in mainline.

[PKT_SCHED] CLS_U32: Fix endianness problem with u32 classifier hash masks.

While trying to implement u32 hashes in my shaping machine I ran into
a possible bug in the u32 hash/bucket computing algorithm
(net/sched/cls_u32.c).

The problem occurs only with hash masks that extend over the octet
boundary, on little endian machines (where htonl() actually does
something).

Let's say that I would like to use 0x3fc0 as the hash mask. This means
8 contiguous "1" bits starting at b6. With such a mask, the expected
(and logical) behavior is to hash any address in, for instance,
192.168.0.0/26 in bucket 0, then any address in 192.168.0.64/26 in
bucket 1, then 192.168.0.128/26 in bucket 2 and so on.

This is exactly what would happen on a big endian machine, but on
little endian machines, what would actually happen with current
implementation is 0x3fc0 being reversed (into 0xc03f) by htonl()
in the userspace tool and then applied to 192.168.x.x in the u32
classifier. When shifting right by 16 bits (rank of first "1" bit in
the reversed mask) and applying the divisor mask (0xff for divisor
256), what would actually remain is 0x3f applied on the "168" octet of
the address.

One could say is this can be easily worked around by taking endianness
into account in userspace and supplying an appropriate mask (0xfc03)
that would be turned into contiguous "1" bits when reversed
(0x03fc). But the actual problem is the network address (inside
the packet) not being converted to host order, but used as a
host-order value when computing the bucket.

Let's say the network address is written as n31 n30 ... n0, with n0
being the least significant bit. When used directly (without any
conversion) on a little endian machine, it becomes n7 ... n0 n8 ..n15
etc in the machine's registers. Thus bits n7 and n8 would no longer be
adjacent and 192.168.64.0/26 and 192.168.128.0/26 would no longer be
consecutive.

The fix is to apply ntohl() on the hmask before computing fshift,
and in u32_hash_fold() convert the packet data to host order before
shifting down by fshift.

With helpful feedback from Jamal Hadi Salim and Jarek Poplawski.

Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 net/sched/cls_u32.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/net/sched/cls_u32.c
+++ b/net/sched/cls_u32.c
@@ -91,7 +91,7 @@ static struct tc_u_common *u32_list;
 
 static __inline__ unsigned u32_hash_fold(u32 key, struct tc_u32_sel *sel, u8 
fshift)
 {
-   unsigned h = (key & sel->hmask)>>fshift;
+   unsigned h = ntohl(key & sel->hmask)>>fshift;
 
return h;
 }
@@ -615,7 +615,7 @@ static int u32_change(struct tcf_proto *
n->handle = handle;
 {
u8 i = 0;
-   u32 mask = s->hmask;
+   u32 mask = ntohl(s->hmask);
if (mask) {
while (!(mask & 1)) {
i++;

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 12/23] Fix VLAN address syncing.

2007-11-14 Thread Greg KH

-stable review patch.  If anyone has any objections, please let us know.

--


From: Patrick McHardy <[EMAIL PROTECTED]>

patch d932e04a5e7b146c5f9bf517714b986a432a7594 in mainline.

[PATCH] [VLAN]: Don't synchronize addresses while the vlan device is down

While the VLAN device is down, the unicast addresses are not configured
on the underlying device, so we shouldn't attempt to sync them.

Noticed by Dmitry Butskoy <[EMAIL PROTECTED]>

Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]>
Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 net/8021q/vlan.c |4 
 1 file changed, 4 insertions(+)

--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -629,6 +629,10 @@ static int vlan_device_event(struct noti
if (!vlandev)
continue;
 
+   flgs = vlandev->flags;
+   if (!(flgs & IFF_UP))
+   continue;
+
vlan_sync_address(dev, vlandev);
}
break;

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 08/23] softmac: fix wext MLME request reason code endianness

2007-11-14 Thread Greg KH
-stable review patch.  If anyone has any objections, please let us know.

--

From: Johannes Berg <[EMAIL PROTECTED]>

patch 94e10bfb8a7372df3ef2759c9ec2a37de2f24aca in mainline.

The MLME request reason code is host-endian and our passing
it to the low level functions is host-endian as well since
they do the swapping. I noticed that the reason code 768 was
sent (0x300) rather than 3 when wpa_supplicant terminates.
This removes the superfluous cpu_to_le16() call.

Signed-off-by: Johannes Berg <[EMAIL PROTECTED]>
Signed-off-by: John W. Linville <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 net/ieee80211/softmac/ieee80211softmac_wx.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/net/ieee80211/softmac/ieee80211softmac_wx.c
+++ b/net/ieee80211/softmac/ieee80211softmac_wx.c
@@ -469,7 +469,7 @@ ieee80211softmac_wx_set_mlme(struct net_
 {
struct ieee80211softmac_device *mac = ieee80211_priv(dev);
struct iw_mlme *mlme = (struct iw_mlme *)extra;
-   u16 reason = cpu_to_le16(mlme->reason_code);
+   u16 reason = mlme->reason_code;
struct ieee80211softmac_network *net;
int err = -EINVAL;
 

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 09/23] Fix error returns in sys_socketpair()

2007-11-14 Thread Greg KH
-stable review patch.  If anyone has any objections, please let us know.

--

From: David Miller <[EMAIL PROTECTED]>

patch bf3c23d171e35e6e168074a1514b0acd59cfd81a in mainline.

[NET]: Fix error reporting in sys_socketpair().

If either of the two sock_alloc_fd() calls fail, we
forget to update 'err' and thus we'll erroneously
return zero in these cases.

Based upon a report and patch from Rich Paul, and
commentary from Chuck Ebbert.

Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 net/socket.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/net/socket.c
+++ b/net/socket.c
@@ -1245,11 +1245,14 @@ asmlinkage long sys_socketpair(int famil
goto out_release_both;
 
fd1 = sock_alloc_fd(&newfile1);
-   if (unlikely(fd1 < 0))
+   if (unlikely(fd1 < 0)) {
+   err = fd1;
goto out_release_both;
+   }
 
fd2 = sock_alloc_fd(&newfile2);
if (unlikely(fd2 < 0)) {
+   err = fd2;
put_filp(newfile1);
put_unused_fd(fd1);
goto out_release_both;

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 06/23] Fix SKB_WITH_OVERHEAD calculations.

2007-11-14 Thread Greg KH
-stable review patch.  If anyone has any objections, please let us know.

--

From: Herbert Xu <[EMAIL PROTECTED]>

patch deea84b0ae3d26b41502ae0a39fe7fe134e703d0 in mainline.

[NET]: Fix SKB_WITH_OVERHEAD calculation

The calculation in SKB_WITH_OVERHEAD is incorrect in that it can cause
an overflow across a page boundary which is what it's meant to prevent.
In particular, the header length (X) should not be lumped together with
skb_shared_info.  The latter needs to be aligned properly while the header
has no choice but to sit in front of wherever the payload is.

Therefore the correct calculation is to take away the aligned size of
skb_shared_info, and then subtract the header length.  The resulting
quantity L satisfies the following inequality:

SKB_DATA_ALIGN(L + X) + sizeof(struct skb_shared_info) <= PAGE_SIZE

This is the quantity used by alloc_skb to do the actual allocation.

Signed-off-by: Herbert Xu <[EMAIL PROTECTED]>
Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 include/linux/skbuff.h |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -41,8 +41,7 @@
 #define SKB_DATA_ALIGN(X)  (((X) + (SMP_CACHE_BYTES - 1)) & \
 ~(SMP_CACHE_BYTES - 1))
 #define SKB_WITH_OVERHEAD(X)   \
-   (((X) - sizeof(struct skb_shared_info)) & \
-~(SMP_CACHE_BYTES - 1))
+   ((X) - SKB_DATA_ALIGN(sizeof(struct skb_shared_info)))
 #define SKB_MAX_ORDER(X, ORDER) \
SKB_WITH_OVERHEAD((PAGE_SIZE << (ORDER)) - (X))
 #define SKB_MAX_HEAD(X)(SKB_MAX_ORDER((X), 0))

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 07/23] Fix kernel_accept() return handling.

2007-11-14 Thread Greg KH
-stable review patch.  If anyone has any objections, please let us know.

--

From: Tony Battersby <[EMAIL PROTECTED]>

patch fa8705b00aeca19d91a1437b8a5cf865999b28f6 in mainline.

[NET]: sanitize kernel_accept() error path

If kernel_accept() returns an error, it may pass back a pointer to
freed memory (which the caller should ignore).  Make it pass back NULL
instead for better safety.

Signed-off-by: Tony Battersby <[EMAIL PROTECTED]>
Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 net/socket.c |1 +
 1 file changed, 1 insertion(+)

--- a/net/socket.c
+++ b/net/socket.c
@@ -2230,6 +2230,7 @@ int kernel_accept(struct socket *sock, s
err = sock->ops->accept(sock, *newsock, flags);
if (err < 0) {
sock_release(*newsock);
+   *newsock = NULL;
goto done;
}
 

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 04/23] Fix advertised packet scheduler timer resolution

2007-11-14 Thread Greg KH
-stable review patch.  If anyone has any objections, please let us know.

--

From: Patrick McHardy <[EMAIL PROTECTED]>

patch 3c0cfc135829b98f7a4894938652f9ef78e24237 in mainline

The fourth parameter of /proc/net/psched is supposed to show the timer
resultion and is used by HTB userspace to calculate the necessary
burst rate. Currently we show the clock resolution, which results in a
too low burst rate when the two differ.

Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]>
Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 net/sched/sch_api.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -1225,10 +1225,13 @@ EXPORT_SYMBOL(tcf_destroy_chain);
 #ifdef CONFIG_PROC_FS
 static int psched_show(struct seq_file *seq, void *v)
 {
+   struct timespec ts;
+
+   hrtimer_get_res(CLOCK_MONOTONIC, &ts);
seq_printf(seq, "%08x %08x %08x %08x\n",
   (u32)NSEC_PER_USEC, (u32)PSCHED_US2NS(1),
   100,
-  (u32)NSEC_PER_SEC/(u32)ktime_to_ns(KTIME_MONOTONIC_RES));
+  (u32)NSEC_PER_SEC/(u32)ktime_to_ns(timespec_to_ktime(ts)));
 
return 0;
 }

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 05/23] Fix 9P protocol build

2007-11-14 Thread Greg KH
-stable review patch.  If anyone has any objections, please let us know.

--

From: Ingo Molnar <[EMAIL PROTECTED]>

patch 092e9d93b3728d484a4e73df9852dc4002cf9923 in mainline.

[9P]: build fix with !CONFIG_SYSCTL

found via make randconfig build testing:

 net/built-in.o: In function `init_p9':
 mod.c:(.init.text+0x3b39): undefined reference to `p9_sysctl_register'
 net/built-in.o: In function `exit_p9':
 mod.c:(.exit.text+0x36b): undefined reference to `p9_sysctl_unregister'

Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 include/net/9p/9p.h |   12 
 1 file changed, 12 insertions(+)

--- a/include/net/9p/9p.h
+++ b/include/net/9p/9p.h
@@ -412,6 +412,18 @@ int p9_idpool_check(int id, struct p9_id
 
 int p9_error_init(void);
 int p9_errstr2errno(char *, int);
+
+#ifdef CONFIG_SYSCTL
 int __init p9_sysctl_register(void);
 void __exit p9_sysctl_unregister(void);
+#else
+static inline int p9_sysctl_register(void)
+{
+   return 0;
+}
+static inline void p9_sysctl_unregister(void)
+{
+}
+#endif
+
 #endif /* NET_9P_H */

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 02/23] mac80211: Improve sanity checks on injected packets

2007-11-14 Thread Greg KH
-stable review patch.  If anyone has any objections, please let us know.

--

From: Andy Green <[EMAIL PROTECTED]>

patch 9b8a74e3482f9fc077a88c13fa0ceca8feb0b772 in mainline.

Michael Wu noticed that the skb length checking is not taken care of enough when
a packet is presented on the Monitor interface for injection.

This patch improves the sanity checking and removes fake offsets placed
into the skb network and transport header.

Signed-off-by: Andy Green <[EMAIL PROTECTED]>
Signed-off-by: John W. Linville <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 net/mac80211/ieee80211.c |   48 +++
 1 file changed, 28 insertions(+), 20 deletions(-)

--- a/net/mac80211/ieee80211.c
+++ b/net/mac80211/ieee80211.c
@@ -1680,46 +1680,54 @@ int ieee80211_monitor_start_xmit(struct 
struct ieee80211_tx_packet_data *pkt_data;
struct ieee80211_radiotap_header *prthdr =
(struct ieee80211_radiotap_header *)skb->data;
-   u16 len;
+   u16 len_rthdr;
 
-   /*
-* there must be a radiotap header at the
-* start in this case
-*/
-   if (unlikely(prthdr->it_version)) {
-   /* only version 0 is supported */
-   dev_kfree_skb(skb);
-   return NETDEV_TX_OK;
-   }
+   /* check for not even having the fixed radiotap header part */
+   if (unlikely(skb->len < sizeof(struct ieee80211_radiotap_header)))
+   goto fail; /* too short to be possibly valid */
+
+   /* is it a header version we can trust to find length from? */
+   if (unlikely(prthdr->it_version))
+   goto fail; /* only version 0 is supported */
+
+   /* then there must be a radiotap header with a length we can use */
+   len_rthdr = ieee80211_get_radiotap_len(skb);
+
+   /* does the skb contain enough to deliver on the alleged length? */
+   if (unlikely(skb->len < len_rthdr))
+   goto fail; /* skb too short for claimed rt header extent */
 
skb->dev = local->mdev;
 
pkt_data = (struct ieee80211_tx_packet_data *)skb->cb;
memset(pkt_data, 0, sizeof(*pkt_data));
+   /* needed because we set skb device to master */
pkt_data->ifindex = dev->ifindex;
+
pkt_data->mgmt_iface = 0;
pkt_data->do_not_encrypt = 1;
 
-   /* above needed because we set skb device to master */
-
/*
 * fix up the pointers accounting for the radiotap
 * header still being in there.  We are being given
 * a precooked IEEE80211 header so no need for
 * normal processing
 */
-   len = le16_to_cpu(get_unaligned(&prthdr->it_len));
-   skb_set_mac_header(skb, len);
-   skb_set_network_header(skb, len + sizeof(struct ieee80211_hdr));
-   skb_set_transport_header(skb, len + sizeof(struct ieee80211_hdr));
-
+   skb_set_mac_header(skb, len_rthdr);
/*
-* pass the radiotap header up to
-* the next stage intact
+* these are just fixed to the end of the rt area since we
+* don't have any better information and at this point, nobody cares
 */
-   dev_queue_xmit(skb);
+   skb_set_network_header(skb, len_rthdr);
+   skb_set_transport_header(skb, len_rthdr);
 
+   /* pass the radiotap header up to the next stage intact */
+   dev_queue_xmit(skb);
return NETDEV_TX_OK;
+
+fail:
+   dev_kfree_skb(skb);
+   return NETDEV_TX_OK; /* meaning, we dealt with the skb */
 }
 
 

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


  1   2   3   4   5   6   7   >