* [ 01/34] drm/i915: no lvds quirk for AOpen MP45
2012-03-01 21:46 [ 00/34] 2.6.32.58-longterm review Greg KH
@ 2012-03-01 21:39 ` Greg KH
2012-03-01 21:39 ` [ 02/34] hwmon: (f75375s) Fix bit shifting in f75375_write16 Greg KH
` (33 subsequent siblings)
34 siblings, 0 replies; 42+ messages in thread
From: Greg KH @ 2012-03-01 21:39 UTC (permalink / raw)
To: linux-kernel, stable
Cc: torvalds, akpm, alan, Chris Wilson, Daniel Vetter, Keith Packard
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Vetter <daniel.vetter@ffwll.ch>
commit e57b6886f555ab57f40a01713304e2053efe51ec upstream.
According to a bug report, it doesn't have one.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44263
Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/i915/intel_lvds.c | 8 ++++++++
1 file changed, 8 insertions(+)
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -892,6 +892,14 @@ static const struct dmi_system_id intel_
},
{
.callback = intel_no_lvds_dmi_callback,
+ .ident = "AOpen i45GMx-I",
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "AOpen"),
+ DMI_MATCH(DMI_BOARD_NAME, "i45GMx-I"),
+ },
+ },
+ {
+ .callback = intel_no_lvds_dmi_callback,
.ident = "Aopen i945GTt-VFA",
.matches = {
DMI_MATCH(DMI_PRODUCT_VERSION, "AO00001JW"),
^ permalink raw reply [flat|nested] 42+ messages in thread* [ 02/34] hwmon: (f75375s) Fix bit shifting in f75375_write16
2012-03-01 21:46 [ 00/34] 2.6.32.58-longterm review Greg KH
2012-03-01 21:39 ` [ 01/34] drm/i915: no lvds quirk for AOpen MP45 Greg KH
@ 2012-03-01 21:39 ` Greg KH
2012-03-01 21:39 ` [ 03/34] lib: proportion: lower PROP_MAX_SHIFT to 32 on 64-bit kernel Greg KH
` (32 subsequent siblings)
34 siblings, 0 replies; 42+ messages in thread
From: Greg KH @ 2012-03-01 21:39 UTC (permalink / raw)
To: linux-kernel, stable; +Cc: torvalds, akpm, alan, Nikolaus Schulz, Guenter Roeck
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Nikolaus Schulz <schulz@macnetix.de>
commit eb2f255b2d360df3f500042a2258dcf2fcbe89a2 upstream.
In order to extract the high byte of the 16-bit word, shift the word to
the right, not to the left.
Signed-off-by: Nikolaus Schulz <mail@microschulz.de>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/hwmon/f75375s.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/hwmon/f75375s.c
+++ b/drivers/hwmon/f75375s.c
@@ -159,7 +159,7 @@ static inline void f75375_write8(struct
static inline void f75375_write16(struct i2c_client *client, u8 reg,
u16 value)
{
- int err = i2c_smbus_write_byte_data(client, reg, (value << 8));
+ int err = i2c_smbus_write_byte_data(client, reg, (value >> 8));
if (err)
return;
i2c_smbus_write_byte_data(client, reg + 1, (value & 0xFF));
^ permalink raw reply [flat|nested] 42+ messages in thread* [ 03/34] lib: proportion: lower PROP_MAX_SHIFT to 32 on 64-bit kernel
2012-03-01 21:46 [ 00/34] 2.6.32.58-longterm review Greg KH
2012-03-01 21:39 ` [ 01/34] drm/i915: no lvds quirk for AOpen MP45 Greg KH
2012-03-01 21:39 ` [ 02/34] hwmon: (f75375s) Fix bit shifting in f75375_write16 Greg KH
@ 2012-03-01 21:39 ` Greg KH
2012-03-05 15:06 ` Jan Kara
2012-03-01 21:39 ` [ 04/34] relay: prevent integer overflow in relay_open() Greg KH
` (31 subsequent siblings)
34 siblings, 1 reply; 42+ messages in thread
From: Greg KH @ 2012-03-01 21:39 UTC (permalink / raw)
To: linux-kernel, stable
Cc: torvalds, akpm, alan, Peter Zijlstra, Ilya Tumaykin, Wu Fengguang
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Wu Fengguang <fengguang.wu@intel.com>
commit 3310225dfc71a35a2cc9340c15c0e08b14b3c754 upstream.
PROP_MAX_SHIFT should be set to <=32 on 64-bit box. This fixes two bugs
in the below lines of bdi_dirty_limit():
bdi_dirty *= numerator;
do_div(bdi_dirty, denominator);
1) divide error: do_div() only uses the lower 32 bit of the denominator,
which may trimmed to be 0 when PROP_MAX_SHIFT > 32.
2) overflow: (bdi_dirty * numerator) could easily overflow if numerator
used up to 48 bits, leaving only 16 bits to bdi_dirty
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Reported-by: Ilya Tumaykin <librarian_rus@yahoo.com>
Tested-by: Ilya Tumaykin <librarian_rus@yahoo.com>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
include/linux/proportions.h | 4 ++++
1 file changed, 4 insertions(+)
--- a/include/linux/proportions.h
+++ b/include/linux/proportions.h
@@ -81,7 +81,11 @@ void prop_inc_percpu(struct prop_descrip
* Limit the time part in order to ensure there are some bits left for the
* cycle counter and fraction multiply.
*/
+#if BITS_PER_LONG == 32
#define PROP_MAX_SHIFT (3*BITS_PER_LONG/4)
+#else
+#define PROP_MAX_SHIFT (BITS_PER_LONG/2)
+#endif
#define PROP_FRAC_SHIFT (BITS_PER_LONG - PROP_MAX_SHIFT - 1)
#define PROP_FRAC_BASE (1UL << PROP_FRAC_SHIFT)
^ permalink raw reply [flat|nested] 42+ messages in thread* Re: [ 03/34] lib: proportion: lower PROP_MAX_SHIFT to 32 on 64-bit kernel
2012-03-01 21:39 ` [ 03/34] lib: proportion: lower PROP_MAX_SHIFT to 32 on 64-bit kernel Greg KH
@ 2012-03-05 15:06 ` Jan Kara
2012-03-05 21:31 ` Fengguang Wu
0 siblings, 1 reply; 42+ messages in thread
From: Jan Kara @ 2012-03-05 15:06 UTC (permalink / raw)
To: Greg KH
Cc: linux-kernel, stable, torvalds, akpm, alan, Peter Zijlstra,
Ilya Tumaykin, Wu Fengguang
On Thu 01-03-12 13:39:25, Greg KH wrote:
> 2.6.32-longterm review patch. If anyone has any objections, please let me know.
Not that I'd see anything wrong with this patch for 2.6.32. But it is
also unnecessary since the code which was triggering the overflow does not
exist in 2.6.32. So maybe just on the grounds of not applying unneeded
patchs I'd skip this one.
Honza
>
> ------------------
>
> From: Wu Fengguang <fengguang.wu@intel.com>
>
> commit 3310225dfc71a35a2cc9340c15c0e08b14b3c754 upstream.
>
> PROP_MAX_SHIFT should be set to <=32 on 64-bit box. This fixes two bugs
> in the below lines of bdi_dirty_limit():
>
> bdi_dirty *= numerator;
> do_div(bdi_dirty, denominator);
>
> 1) divide error: do_div() only uses the lower 32 bit of the denominator,
> which may trimmed to be 0 when PROP_MAX_SHIFT > 32.
>
> 2) overflow: (bdi_dirty * numerator) could easily overflow if numerator
> used up to 48 bits, leaving only 16 bits to bdi_dirty
>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Reported-by: Ilya Tumaykin <librarian_rus@yahoo.com>
> Tested-by: Ilya Tumaykin <librarian_rus@yahoo.com>
> Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>
> ---
> include/linux/proportions.h | 4 ++++
> 1 file changed, 4 insertions(+)
>
> --- a/include/linux/proportions.h
> +++ b/include/linux/proportions.h
> @@ -81,7 +81,11 @@ void prop_inc_percpu(struct prop_descrip
> * Limit the time part in order to ensure there are some bits left for the
> * cycle counter and fraction multiply.
> */
> +#if BITS_PER_LONG == 32
> #define PROP_MAX_SHIFT (3*BITS_PER_LONG/4)
> +#else
> +#define PROP_MAX_SHIFT (BITS_PER_LONG/2)
> +#endif
>
> #define PROP_FRAC_SHIFT (BITS_PER_LONG - PROP_MAX_SHIFT - 1)
> #define PROP_FRAC_BASE (1UL << PROP_FRAC_SHIFT)
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [ 03/34] lib: proportion: lower PROP_MAX_SHIFT to 32 on 64-bit kernel
2012-03-05 15:06 ` Jan Kara
@ 2012-03-05 21:31 ` Fengguang Wu
2012-03-06 20:35 ` Jan Kara
0 siblings, 1 reply; 42+ messages in thread
From: Fengguang Wu @ 2012-03-05 21:31 UTC (permalink / raw)
To: Jan Kara
Cc: Greg KH, linux-kernel, stable, torvalds, akpm, alan,
Peter Zijlstra, Ilya Tumaykin
On Mon, Mar 05, 2012 at 04:06:57PM +0100, Jan Kara wrote:
> On Thu 01-03-12 13:39:25, Greg KH wrote:
> > 2.6.32-longterm review patch. If anyone has any objections, please let me know.
> Not that I'd see anything wrong with this patch for 2.6.32. But it is
> also unnecessary since the code which was triggering the overflow does not
> exist in 2.6.32. So maybe just on the grounds of not applying unneeded
> patchs I'd skip this one.
FYI I never see this divide error for pre-3.2 kernels. However I've
run into problem (2) before 3.2 which makes bdi dirty threshold go
wild. So it seems safer to go with this patch.
To be frank the boxes that run into bugs (1) or (2) do not have
Terabytes of memory to create the big shift value in
calc_period_shift() which is the sufficient condition for triggering
the bugs as described in the below changelog. However the bugs do
magically go away with the patch applied. Perhaps this patch breaks
one necessary condition for triggering the bugs in a small memory box.
Thanks,
Fengguang
> > ------------------
> >
> > From: Wu Fengguang <fengguang.wu@intel.com>
> >
> > commit 3310225dfc71a35a2cc9340c15c0e08b14b3c754 upstream.
> >
> > PROP_MAX_SHIFT should be set to <=32 on 64-bit box. This fixes two bugs
> > in the below lines of bdi_dirty_limit():
> >
> > bdi_dirty *= numerator;
> > do_div(bdi_dirty, denominator);
> >
> > 1) divide error: do_div() only uses the lower 32 bit of the denominator,
> > which may trimmed to be 0 when PROP_MAX_SHIFT > 32.
> >
> > 2) overflow: (bdi_dirty * numerator) could easily overflow if numerator
> > used up to 48 bits, leaving only 16 bits to bdi_dirty
> >
> > Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> > Reported-by: Ilya Tumaykin <librarian_rus@yahoo.com>
> > Tested-by: Ilya Tumaykin <librarian_rus@yahoo.com>
> > Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> >
> > ---
> > include/linux/proportions.h | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > --- a/include/linux/proportions.h
> > +++ b/include/linux/proportions.h
> > @@ -81,7 +81,11 @@ void prop_inc_percpu(struct prop_descrip
> > * Limit the time part in order to ensure there are some bits left for the
> > * cycle counter and fraction multiply.
> > */
> > +#if BITS_PER_LONG == 32
> > #define PROP_MAX_SHIFT (3*BITS_PER_LONG/4)
> > +#else
> > +#define PROP_MAX_SHIFT (BITS_PER_LONG/2)
> > +#endif
> >
> > #define PROP_FRAC_SHIFT (BITS_PER_LONG - PROP_MAX_SHIFT - 1)
> > #define PROP_FRAC_BASE (1UL << PROP_FRAC_SHIFT)
> >
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> > Please read the FAQ at http://www.tux.org/lkml/
> --
> Jan Kara <jack@suse.cz>
> SUSE Labs, CR
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [ 03/34] lib: proportion: lower PROP_MAX_SHIFT to 32 on 64-bit kernel
2012-03-05 21:31 ` Fengguang Wu
@ 2012-03-06 20:35 ` Jan Kara
2012-03-07 5:14 ` Fengguang Wu
0 siblings, 1 reply; 42+ messages in thread
From: Jan Kara @ 2012-03-06 20:35 UTC (permalink / raw)
To: Fengguang Wu
Cc: Jan Kara, Greg KH, linux-kernel, stable, torvalds, akpm, alan,
Peter Zijlstra, Ilya Tumaykin
On Mon 05-03-12 13:31:26, Wu Fengguang wrote:
> On Mon, Mar 05, 2012 at 04:06:57PM +0100, Jan Kara wrote:
> > On Thu 01-03-12 13:39:25, Greg KH wrote:
> > > 2.6.32-longterm review patch. If anyone has any objections, please let me know.
> > Not that I'd see anything wrong with this patch for 2.6.32. But it is
> > also unnecessary since the code which was triggering the overflow does not
> > exist in 2.6.32. So maybe just on the grounds of not applying unneeded
> > patchs I'd skip this one.
>
> FYI I never see this divide error for pre-3.2 kernels. However I've
> run into problem (2) before 3.2 which makes bdi dirty threshold go
> wild. So it seems safer to go with this patch.
>
> To be frank the boxes that run into bugs (1) or (2) do not have
> Terabytes of memory to create the big shift value in
> calc_period_shift() which is the sufficient condition for triggering
> the bugs as described in the below changelog. However the bugs do
> magically go away with the patch applied. Perhaps this patch breaks
> one necessary condition for triggering the bugs in a small memory box.
The patch went in -stable kernel so this is mostly an academic discussion
but Documentation/stable_kernel_rules.txt says among other things:
- It must fix a real bug that bothers people (not a, "This could be a
problem..." type thing).
- It must fix a problem that causes a build error (but not for things
marked CONFIG_BROKEN), an oops, a hang, data corruption, a real
security issue, or some "oh, that's not good" issue. In short,
something critical.
This patch simply didn't pass these two conditions for me for 2.6.32 and
your arguments didn't convince me it's a critical thing either...
Honza
> > > ------------------
> > >
> > > From: Wu Fengguang <fengguang.wu@intel.com>
> > >
> > > commit 3310225dfc71a35a2cc9340c15c0e08b14b3c754 upstream.
> > >
> > > PROP_MAX_SHIFT should be set to <=32 on 64-bit box. This fixes two bugs
> > > in the below lines of bdi_dirty_limit():
> > >
> > > bdi_dirty *= numerator;
> > > do_div(bdi_dirty, denominator);
> > >
> > > 1) divide error: do_div() only uses the lower 32 bit of the denominator,
> > > which may trimmed to be 0 when PROP_MAX_SHIFT > 32.
> > >
> > > 2) overflow: (bdi_dirty * numerator) could easily overflow if numerator
> > > used up to 48 bits, leaving only 16 bits to bdi_dirty
> > >
> > > Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> > > Reported-by: Ilya Tumaykin <librarian_rus@yahoo.com>
> > > Tested-by: Ilya Tumaykin <librarian_rus@yahoo.com>
> > > Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
> > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > >
> > > ---
> > > include/linux/proportions.h | 4 ++++
> > > 1 file changed, 4 insertions(+)
> > >
> > > --- a/include/linux/proportions.h
> > > +++ b/include/linux/proportions.h
> > > @@ -81,7 +81,11 @@ void prop_inc_percpu(struct prop_descrip
> > > * Limit the time part in order to ensure there are some bits left for the
> > > * cycle counter and fraction multiply.
> > > */
> > > +#if BITS_PER_LONG == 32
> > > #define PROP_MAX_SHIFT (3*BITS_PER_LONG/4)
> > > +#else
> > > +#define PROP_MAX_SHIFT (BITS_PER_LONG/2)
> > > +#endif
> > >
> > > #define PROP_FRAC_SHIFT (BITS_PER_LONG - PROP_MAX_SHIFT - 1)
> > > #define PROP_FRAC_BASE (1UL << PROP_FRAC_SHIFT)
> > >
> > >
> > > --
> > > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > > the body of a message to majordomo@vger.kernel.org
> > > More majordomo info at http://vger.kernel.org/majordomo-info.html
> > > Please read the FAQ at http://www.tux.org/lkml/
> > --
> > Jan Kara <jack@suse.cz>
> > SUSE Labs, CR
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [ 03/34] lib: proportion: lower PROP_MAX_SHIFT to 32 on 64-bit kernel
2012-03-06 20:35 ` Jan Kara
@ 2012-03-07 5:14 ` Fengguang Wu
0 siblings, 0 replies; 42+ messages in thread
From: Fengguang Wu @ 2012-03-07 5:14 UTC (permalink / raw)
To: Jan Kara
Cc: Greg KH, linux-kernel, stable, torvalds, akpm, alan,
Peter Zijlstra, Ilya Tumaykin
On Tue, Mar 06, 2012 at 09:35:08PM +0100, Jan Kara wrote:
> On Mon 05-03-12 13:31:26, Wu Fengguang wrote:
> > On Mon, Mar 05, 2012 at 04:06:57PM +0100, Jan Kara wrote:
> > > On Thu 01-03-12 13:39:25, Greg KH wrote:
> > > > 2.6.32-longterm review patch. If anyone has any objections, please let me know.
> > > Not that I'd see anything wrong with this patch for 2.6.32. But it is
> > > also unnecessary since the code which was triggering the overflow does not
> > > exist in 2.6.32. So maybe just on the grounds of not applying unneeded
> > > patchs I'd skip this one.
> >
> > FYI I never see this divide error for pre-3.2 kernels. However I've
> > run into problem (2) before 3.2 which makes bdi dirty threshold go
> > wild. So it seems safer to go with this patch.
> >
> > To be frank the boxes that run into bugs (1) or (2) do not have
> > Terabytes of memory to create the big shift value in
> > calc_period_shift() which is the sufficient condition for triggering
> > the bugs as described in the below changelog. However the bugs do
> > magically go away with the patch applied. Perhaps this patch breaks
> > one necessary condition for triggering the bugs in a small memory box.
> The patch went in -stable kernel so this is mostly an academic discussion
> but Documentation/stable_kernel_rules.txt says among other things:
> - It must fix a real bug that bothers people (not a, "This could be a
> problem..." type thing).
> - It must fix a problem that causes a build error (but not for things
> marked CONFIG_BROKEN), an oops, a hang, data corruption, a real
> security issue, or some "oh, that's not good" issue. In short,
> something critical.
>
> This patch simply didn't pass these two conditions for me for 2.6.32 and
> your arguments didn't convince me it's a critical thing either...
I see the point. We need *demonstrated* critical bugs for pushing the
fix to -stable.
By this criterion, I agree that there are no strong reasons for
including this patch in -stable.
Thanks,
Fengguang
> Honza
>
> > > > ------------------
> > > >
> > > > From: Wu Fengguang <fengguang.wu@intel.com>
> > > >
> > > > commit 3310225dfc71a35a2cc9340c15c0e08b14b3c754 upstream.
> > > >
> > > > PROP_MAX_SHIFT should be set to <=32 on 64-bit box. This fixes two bugs
> > > > in the below lines of bdi_dirty_limit():
> > > >
> > > > bdi_dirty *= numerator;
> > > > do_div(bdi_dirty, denominator);
> > > >
> > > > 1) divide error: do_div() only uses the lower 32 bit of the denominator,
> > > > which may trimmed to be 0 when PROP_MAX_SHIFT > 32.
> > > >
> > > > 2) overflow: (bdi_dirty * numerator) could easily overflow if numerator
> > > > used up to 48 bits, leaving only 16 bits to bdi_dirty
> > > >
> > > > Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> > > > Reported-by: Ilya Tumaykin <librarian_rus@yahoo.com>
> > > > Tested-by: Ilya Tumaykin <librarian_rus@yahoo.com>
> > > > Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
> > > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > >
> > > > ---
> > > > include/linux/proportions.h | 4 ++++
> > > > 1 file changed, 4 insertions(+)
> > > >
> > > > --- a/include/linux/proportions.h
> > > > +++ b/include/linux/proportions.h
> > > > @@ -81,7 +81,11 @@ void prop_inc_percpu(struct prop_descrip
> > > > * Limit the time part in order to ensure there are some bits left for the
> > > > * cycle counter and fraction multiply.
> > > > */
> > > > +#if BITS_PER_LONG == 32
> > > > #define PROP_MAX_SHIFT (3*BITS_PER_LONG/4)
> > > > +#else
> > > > +#define PROP_MAX_SHIFT (BITS_PER_LONG/2)
> > > > +#endif
> > > >
> > > > #define PROP_FRAC_SHIFT (BITS_PER_LONG - PROP_MAX_SHIFT - 1)
> > > > #define PROP_FRAC_BASE (1UL << PROP_FRAC_SHIFT)
> > > >
> > > >
> > > > --
> > > > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > > > the body of a message to majordomo@vger.kernel.org
> > > > More majordomo info at http://vger.kernel.org/majordomo-info.html
> > > > Please read the FAQ at http://www.tux.org/lkml/
> > > --
> > > Jan Kara <jack@suse.cz>
> > > SUSE Labs, CR
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> > Please read the FAQ at http://www.tux.org/lkml/
> --
> Jan Kara <jack@suse.cz>
> SUSE Labs, CR
^ permalink raw reply [flat|nested] 42+ messages in thread
* [ 04/34] relay: prevent integer overflow in relay_open()
2012-03-01 21:46 [ 00/34] 2.6.32.58-longterm review Greg KH
` (2 preceding siblings ...)
2012-03-01 21:39 ` [ 03/34] lib: proportion: lower PROP_MAX_SHIFT to 32 on 64-bit kernel Greg KH
@ 2012-03-01 21:39 ` Greg KH
2012-03-01 21:39 ` [ 05/34] mac80211: timeout a single frame in the rx reorder buffer Greg KH
` (30 subsequent siblings)
34 siblings, 0 replies; 42+ messages in thread
From: Greg KH @ 2012-03-01 21:39 UTC (permalink / raw)
To: linux-kernel, stable; +Cc: torvalds, akpm, alan, Dan Carpenter, Jens Axboe
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <dan.carpenter@oracle.com>
commit f6302f1bcd75a042df69866d98b8d775a668f8f1 upstream.
"subbuf_size" and "n_subbufs" come from the user and they need to be
capped to prevent an integer overflow.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
kernel/relay.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
--- a/kernel/relay.c
+++ b/kernel/relay.c
@@ -171,10 +171,14 @@ depopulate:
*/
static struct rchan_buf *relay_create_buf(struct rchan *chan)
{
- struct rchan_buf *buf = kzalloc(sizeof(struct rchan_buf), GFP_KERNEL);
- if (!buf)
+ struct rchan_buf *buf;
+
+ if (chan->n_subbufs > UINT_MAX / sizeof(size_t *))
return NULL;
+ buf = kzalloc(sizeof(struct rchan_buf), GFP_KERNEL);
+ if (!buf)
+ return NULL;
buf->padding = kmalloc(chan->n_subbufs * sizeof(size_t *), GFP_KERNEL);
if (!buf->padding)
goto free_buf;
@@ -581,6 +585,8 @@ struct rchan *relay_open(const char *bas
if (!(subbuf_size && n_subbufs))
return NULL;
+ if (subbuf_size > UINT_MAX / n_subbufs)
+ return NULL;
chan = kzalloc(sizeof(struct rchan), GFP_KERNEL);
if (!chan)
^ permalink raw reply [flat|nested] 42+ messages in thread* [ 05/34] mac80211: timeout a single frame in the rx reorder buffer
2012-03-01 21:46 [ 00/34] 2.6.32.58-longterm review Greg KH
` (3 preceding siblings ...)
2012-03-01 21:39 ` [ 04/34] relay: prevent integer overflow in relay_open() Greg KH
@ 2012-03-01 21:39 ` Greg KH
2012-03-01 21:39 ` [ 06/34] kernel.h: fix wrong usage of __ratelimit() Greg KH
` (29 subsequent siblings)
34 siblings, 0 replies; 42+ messages in thread
From: Greg KH @ 2012-03-01 21:39 UTC (permalink / raw)
To: linux-kernel, stable
Cc: torvalds, akpm, alan, Eliad Peller, Johannes Berg,
John W. Linville
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Eliad Peller <eliad@wizery.com>
commit 07ae2dfcf4f7143ce191c6436da1c33f179af0d6 upstream.
The current code checks for stored_mpdu_num > 1, causing
the reorder_timer to be triggered indefinitely, but the
frame is never timed-out (until the next packet is received)
Signed-off-by: Eliad Peller <eliad@wizery.com>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/mac80211/rx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -2363,7 +2363,7 @@ static u8 ieee80211_sta_manage_reorder_b
index = seq_sub(tid_agg_rx->head_seq_num, tid_agg_rx->ssn)
% tid_agg_rx->buf_size;
if (!tid_agg_rx->reorder_buf[index] &&
- tid_agg_rx->stored_mpdu_num > 1) {
+ tid_agg_rx->stored_mpdu_num) {
/*
* No buffers ready to be released, but check whether any
* frames in the reorder buffer have timed out.
^ permalink raw reply [flat|nested] 42+ messages in thread* [ 06/34] kernel.h: fix wrong usage of __ratelimit()
2012-03-01 21:46 [ 00/34] 2.6.32.58-longterm review Greg KH
` (4 preceding siblings ...)
2012-03-01 21:39 ` [ 05/34] mac80211: timeout a single frame in the rx reorder buffer Greg KH
@ 2012-03-01 21:39 ` Greg KH
2012-03-01 21:39 ` [ 07/34] printk_ratelimited(): fix uninitialized spinlock Greg KH
` (28 subsequent siblings)
34 siblings, 0 replies; 42+ messages in thread
From: Greg KH @ 2012-03-01 21:39 UTC (permalink / raw)
To: linux-kernel, stable
Cc: torvalds, akpm, alan, Yong Zhang, Ingo Molnar, Joe Perches
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Yong Zhang <yong.zhang@windriver.com>
commit bb1dc0bacb8ddd7ba6a5906c678a5a5a110cf695 upstream.
When __ratelimit() returns 1 this means that we can go ahead.
Signed-off-by: Yong Zhang <yong.zhang@windriver.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
include/linux/kernel.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -417,7 +417,7 @@ static inline char *pack_hex_byte(char *
.burst = DEFAULT_RATELIMIT_BURST, \
}; \
\
- if (!__ratelimit(&_rs)) \
+ if (__ratelimit(&_rs)) \
printk(fmt, ##__VA_ARGS__); \
})
#else
^ permalink raw reply [flat|nested] 42+ messages in thread* [ 07/34] printk_ratelimited(): fix uninitialized spinlock
2012-03-01 21:46 [ 00/34] 2.6.32.58-longterm review Greg KH
` (5 preceding siblings ...)
2012-03-01 21:39 ` [ 06/34] kernel.h: fix wrong usage of __ratelimit() Greg KH
@ 2012-03-01 21:39 ` Greg KH
2012-03-01 21:39 ` [ 08/34] hwmon: (f75375s) Fix automatic pwm mode setting for F75373 & F75375 Greg KH
` (27 subsequent siblings)
34 siblings, 0 replies; 42+ messages in thread
From: Greg KH @ 2012-03-01 21:39 UTC (permalink / raw)
To: linux-kernel, stable
Cc: torvalds, akpm, alan, OGAWA Hirofumi, Joe Perches,
Sven-Haegar Koch
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
commit d8521fcc5e0ad3e79bbc4231bb20a6cdc2b50164 upstream.
ratelimit_state initialization of printk_ratelimited() seems broken. This
fixes it by using DEFINE_RATELIMIT_STATE() to initialize spinlock
properly.
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Sven-Haegar Koch <haegar@sdinet.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
include/linux/kernel.h | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -411,14 +411,13 @@ static inline char *pack_hex_byte(char *
* no local ratelimit_state used in the !PRINTK case
*/
#ifdef CONFIG_PRINTK
-#define printk_ratelimited(fmt, ...) ({ \
- static struct ratelimit_state _rs = { \
- .interval = DEFAULT_RATELIMIT_INTERVAL, \
- .burst = DEFAULT_RATELIMIT_BURST, \
- }; \
- \
- if (__ratelimit(&_rs)) \
- printk(fmt, ##__VA_ARGS__); \
+#define printk_ratelimited(fmt, ...) ({ \
+ static DEFINE_RATELIMIT_STATE(_rs, \
+ DEFAULT_RATELIMIT_INTERVAL, \
+ DEFAULT_RATELIMIT_BURST); \
+ \
+ if (__ratelimit(&_rs)) \
+ printk(fmt, ##__VA_ARGS__); \
})
#else
/* No effect, but we still get type checking even in the !PRINTK case: */
^ permalink raw reply [flat|nested] 42+ messages in thread* [ 08/34] hwmon: (f75375s) Fix automatic pwm mode setting for F75373 & F75375
2012-03-01 21:46 [ 00/34] 2.6.32.58-longterm review Greg KH
` (6 preceding siblings ...)
2012-03-01 21:39 ` [ 07/34] printk_ratelimited(): fix uninitialized spinlock Greg KH
@ 2012-03-01 21:39 ` Greg KH
2012-03-01 21:39 ` [ 09/34] crypto: sha512 - Use binary and instead of modulus Greg KH
` (26 subsequent siblings)
34 siblings, 0 replies; 42+ messages in thread
From: Greg KH @ 2012-03-01 21:39 UTC (permalink / raw)
To: linux-kernel, stable; +Cc: torvalds, akpm, alan, Nikolaus Schulz
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Nikolaus Schulz <schulz@macnetix.de>
commit 09e87e5c4f9af656af2a8a3afc03487c5d9287c3 upstream.
In order to enable temperature mode aka automatic mode for the F75373 and
F75375 chips, the two FANx_MODE bits in the fan configuration register
need be set to 01, not 10.
Signed-off-by: Nikolaus Schulz <mail@microschulz.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/hwmon/f75375s.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/hwmon/f75375s.c
+++ b/drivers/hwmon/f75375s.c
@@ -311,7 +311,7 @@ static int set_pwm_enable_direct(struct
fanmode |= (3 << FAN_CTRL_MODE(nr));
break;
case 2: /* AUTOMATIC*/
- fanmode |= (2 << FAN_CTRL_MODE(nr));
+ fanmode |= (1 << FAN_CTRL_MODE(nr));
break;
case 3: /* fan speed */
break;
^ permalink raw reply [flat|nested] 42+ messages in thread* [ 09/34] crypto: sha512 - Use binary and instead of modulus
2012-03-01 21:46 [ 00/34] 2.6.32.58-longterm review Greg KH
` (7 preceding siblings ...)
2012-03-01 21:39 ` [ 08/34] hwmon: (f75375s) Fix automatic pwm mode setting for F75373 & F75375 Greg KH
@ 2012-03-01 21:39 ` Greg KH
2012-03-01 21:39 ` [ 10/34] crypto: sha512 - Avoid stack bloat on i386 Greg KH
` (25 subsequent siblings)
34 siblings, 0 replies; 42+ messages in thread
From: Greg KH @ 2012-03-01 21:39 UTC (permalink / raw)
To: linux-kernel, stable; +Cc: torvalds, akpm, alan, Herbert Xu
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Herbert Xu <herbert@gondor.apana.org.au>
commit 58d7d18b5268febb8b1391c6dffc8e2aaa751fcd upstream.
The previous patch used the modulus operator over a power of 2
unnecessarily which may produce suboptimal binary code. This
patch changes changes them to binary ands instead.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
crypto/sha512_generic.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/crypto/sha512_generic.c
+++ b/crypto/sha512_generic.c
@@ -78,7 +78,7 @@ static inline void LOAD_OP(int I, u64 *W
static inline void BLEND_OP(int I, u64 *W)
{
- W[I % 16] += s1(W[(I-2) % 16]) + W[(I-7) % 16] + s0(W[(I-15) % 16]);
+ W[I & 15] += s1(W[(I-2) & 15]) + W[(I-7) & 15] + s0(W[(I-15) & 15]);
}
static void
@@ -105,7 +105,7 @@ sha512_transform(u64 *state, const u8 *i
#define SHA512_16_79(i, a, b, c, d, e, f, g, h) \
BLEND_OP(i, W); \
- t1 = h + e1(e) + Ch(e, f, g) + sha512_K[i] + W[(i)%16]; \
+ t1 = h + e1(e) + Ch(e, f, g) + sha512_K[i] + W[(i)&15]; \
t2 = e0(a) + Maj(a, b, c); \
d += t1; \
h = t1 + t2
^ permalink raw reply [flat|nested] 42+ messages in thread* [ 10/34] crypto: sha512 - Avoid stack bloat on i386
2012-03-01 21:46 [ 00/34] 2.6.32.58-longterm review Greg KH
` (8 preceding siblings ...)
2012-03-01 21:39 ` [ 09/34] crypto: sha512 - Use binary and instead of modulus Greg KH
@ 2012-03-01 21:39 ` Greg KH
2012-03-01 21:39 ` [ 11/34] eCryptfs: Remove mmap from directory operations Greg KH
` (24 subsequent siblings)
34 siblings, 0 replies; 42+ messages in thread
From: Greg KH @ 2012-03-01 21:39 UTC (permalink / raw)
To: linux-kernel, stable; +Cc: torvalds, akpm, alan, Herbert Xu
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Herbert Xu <herbert@gondor.apana.org.au>
commit 3a92d687c8015860a19213e3c102cad6b722f83c upstream.
Unfortunately in reducing W from 80 to 16 we ended up unrolling
the loop twice. As gcc has issues dealing with 64-bit ops on
i386 this means that we end up using even more stack space (>1K).
This patch solves the W reduction by moving LOAD_OP/BLEND_OP
into the loop itself, thus avoiding the need to duplicate it.
While the stack space still isn't great (>0.5K) it is at least
in the same ball park as the amount of stack used for our C sha1
implementation.
Note that this patch basically reverts to the original code so
the diff looks bigger than it really is.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
crypto/sha512_generic.c | 68 ++++++++++++++++++++++--------------------------
1 file changed, 32 insertions(+), 36 deletions(-)
--- a/crypto/sha512_generic.c
+++ b/crypto/sha512_generic.c
@@ -89,46 +89,42 @@ sha512_transform(u64 *state, const u8 *i
int i;
u64 W[16];
- /* load the input */
- for (i = 0; i < 16; i++)
- LOAD_OP(i, W, input);
-
/* load the state into our registers */
a=state[0]; b=state[1]; c=state[2]; d=state[3];
e=state[4]; f=state[5]; g=state[6]; h=state[7];
-#define SHA512_0_15(i, a, b, c, d, e, f, g, h) \
- t1 = h + e1(e) + Ch(e, f, g) + sha512_K[i] + W[i]; \
- t2 = e0(a) + Maj(a, b, c); \
- d += t1; \
- h = t1 + t2
-
-#define SHA512_16_79(i, a, b, c, d, e, f, g, h) \
- BLEND_OP(i, W); \
- t1 = h + e1(e) + Ch(e, f, g) + sha512_K[i] + W[(i)&15]; \
- t2 = e0(a) + Maj(a, b, c); \
- d += t1; \
- h = t1 + t2
-
- for (i = 0; i < 16; i += 8) {
- SHA512_0_15(i, a, b, c, d, e, f, g, h);
- SHA512_0_15(i + 1, h, a, b, c, d, e, f, g);
- SHA512_0_15(i + 2, g, h, a, b, c, d, e, f);
- SHA512_0_15(i + 3, f, g, h, a, b, c, d, e);
- SHA512_0_15(i + 4, e, f, g, h, a, b, c, d);
- SHA512_0_15(i + 5, d, e, f, g, h, a, b, c);
- SHA512_0_15(i + 6, c, d, e, f, g, h, a, b);
- SHA512_0_15(i + 7, b, c, d, e, f, g, h, a);
- }
- for (i = 16; i < 80; i += 8) {
- SHA512_16_79(i, a, b, c, d, e, f, g, h);
- SHA512_16_79(i + 1, h, a, b, c, d, e, f, g);
- SHA512_16_79(i + 2, g, h, a, b, c, d, e, f);
- SHA512_16_79(i + 3, f, g, h, a, b, c, d, e);
- SHA512_16_79(i + 4, e, f, g, h, a, b, c, d);
- SHA512_16_79(i + 5, d, e, f, g, h, a, b, c);
- SHA512_16_79(i + 6, c, d, e, f, g, h, a, b);
- SHA512_16_79(i + 7, b, c, d, e, f, g, h, a);
+ /* now iterate */
+ for (i=0; i<80; i+=8) {
+ if (!(i & 8)) {
+ int j;
+
+ if (i < 16) {
+ /* load the input */
+ for (j = 0; j < 16; j++)
+ LOAD_OP(i + j, W, input);
+ } else {
+ for (j = 0; j < 16; j++) {
+ BLEND_OP(i + j, W);
+ }
+ }
+ }
+
+ t1 = h + e1(e) + Ch(e,f,g) + sha512_K[i ] + W[(i & 15)];
+ t2 = e0(a) + Maj(a,b,c); d+=t1; h=t1+t2;
+ t1 = g + e1(d) + Ch(d,e,f) + sha512_K[i+1] + W[(i & 15) + 1];
+ t2 = e0(h) + Maj(h,a,b); c+=t1; g=t1+t2;
+ t1 = f + e1(c) + Ch(c,d,e) + sha512_K[i+2] + W[(i & 15) + 2];
+ t2 = e0(g) + Maj(g,h,a); b+=t1; f=t1+t2;
+ t1 = e + e1(b) + Ch(b,c,d) + sha512_K[i+3] + W[(i & 15) + 3];
+ t2 = e0(f) + Maj(f,g,h); a+=t1; e=t1+t2;
+ t1 = d + e1(a) + Ch(a,b,c) + sha512_K[i+4] + W[(i & 15) + 4];
+ t2 = e0(e) + Maj(e,f,g); h+=t1; d=t1+t2;
+ t1 = c + e1(h) + Ch(h,a,b) + sha512_K[i+5] + W[(i & 15) + 5];
+ t2 = e0(d) + Maj(d,e,f); g+=t1; c=t1+t2;
+ t1 = b + e1(g) + Ch(g,h,a) + sha512_K[i+6] + W[(i & 15) + 6];
+ t2 = e0(c) + Maj(c,d,e); f+=t1; b=t1+t2;
+ t1 = a + e1(f) + Ch(f,g,h) + sha512_K[i+7] + W[(i & 15) + 7];
+ t2 = e0(b) + Maj(b,c,d); e+=t1; a=t1+t2;
}
state[0] += a; state[1] += b; state[2] += c; state[3] += d;
^ permalink raw reply [flat|nested] 42+ messages in thread* [ 11/34] eCryptfs: Remove mmap from directory operations
2012-03-01 21:46 [ 00/34] 2.6.32.58-longterm review Greg KH
` (9 preceding siblings ...)
2012-03-01 21:39 ` [ 10/34] crypto: sha512 - Avoid stack bloat on i386 Greg KH
@ 2012-03-01 21:39 ` Greg KH
2012-03-01 21:39 ` [ 12/34] Ban ecryptfs over ecryptfs Greg KH
` (23 subsequent siblings)
34 siblings, 0 replies; 42+ messages in thread
From: Greg KH @ 2012-03-01 21:39 UTC (permalink / raw)
To: linux-kernel, stable
Cc: torvalds, akpm, alan, Tyler Hicks, Colin Ian King, Tim Gardner,
Adrian C.
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
backported from 38e3eaeedcac75360af8a92e7b66956ec4f334e5
Adrian reported that mkfontscale didn't work inside of eCryptfs mounts.
Strace revealed the following:
open("./", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
fcntl64(3, F_GETFD) = 0x1 (flags FD_CLOEXEC)
open("./fonts.scale", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 4
getdents(3, /* 80 entries */, 32768) = 2304
open("./.", O_RDONLY) = 5
fcntl64(5, F_SETFD, FD_CLOEXEC) = 0
fstat64(5, {st_mode=S_IFDIR|0755, st_size=16384, ...}) = 0
mmap2(NULL, 16384, PROT_READ, MAP_PRIVATE, 5, 0) = 0xb7fcf000
close(5) = 0
--- SIGBUS (Bus error) @ 0 (0) ---
+++ killed by SIGBUS +++
The mmap2() on a directory was successful, resulting in a SIGBUS
signal later. This patch removes mmap() from the list of possible
ecryptfs_dir_fops so that mmap() isn't possible on eCryptfs directory
files.
http://bugs.launchpad.net/bugs/400443
Reported-by: Adrian C. <anrxc@sysphere.org>
Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/ecryptfs/file.c | 1 -
1 file changed, 1 deletion(-)
--- a/fs/ecryptfs/file.c
+++ b/fs/ecryptfs/file.c
@@ -327,7 +327,6 @@ const struct file_operations ecryptfs_di
#ifdef CONFIG_COMPAT
.compat_ioctl = ecryptfs_compat_ioctl,
#endif
- .mmap = generic_file_mmap,
.open = ecryptfs_open,
.flush = ecryptfs_flush,
.release = ecryptfs_release,
^ permalink raw reply [flat|nested] 42+ messages in thread* [ 12/34] Ban ecryptfs over ecryptfs
2012-03-01 21:46 [ 00/34] 2.6.32.58-longterm review Greg KH
` (10 preceding siblings ...)
2012-03-01 21:39 ` [ 11/34] eCryptfs: Remove mmap from directory operations Greg KH
@ 2012-03-01 21:39 ` Greg KH
2012-03-01 21:39 ` [ 13/34] Add mount option to check uid of device being mounted = expect uid, CVE-2011-1833 Greg KH
` (22 subsequent siblings)
34 siblings, 0 replies; 42+ messages in thread
From: Greg KH @ 2012-03-01 21:39 UTC (permalink / raw)
To: linux-kernel, stable; +Cc: torvalds, akpm, alan, Al Viro, Tim Gardner
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <viro@zeniv.linux.org.uk>
(cherry picked from commit 4403158ba295c8e36f6736b1bb12d0f7e1923dac)
This is a seriously simplified patch from Eric Sandeen; copy of
rationale follows:
===
mounting stacked ecryptfs on ecryptfs has been shown to lead to bugs
in testing. For crypto info in xattr, there is no mechanism for handling
this at all, and for normal file headers, we run into other trouble:
BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
IP: [<ffffffffa015b0b3>] ecryptfs_d_revalidate+0x43/0xa0 [ecryptfs]
...
There doesn't seem to be any good usecase for this, so I'd suggest just
disallowing the configuration.
Based on a patch originally, I believe, from Mike Halcrow.
===
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/ecryptfs/main.c | 8 ++++++++
1 file changed, 8 insertions(+)
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -487,6 +487,7 @@ out:
}
struct kmem_cache *ecryptfs_sb_info_cache;
+static struct file_system_type ecryptfs_fs_type;
/**
* ecryptfs_fill_super
@@ -561,6 +562,13 @@ static int ecryptfs_read_super(struct su
ecryptfs_printk(KERN_WARNING, "path_lookup() failed\n");
goto out;
}
+ if (path.dentry->d_sb->s_type == &ecryptfs_fs_type) {
+ rc = -EINVAL;
+ printk(KERN_ERR "Mount on filesystem of type "
+ "eCryptfs explicitly disallowed due to "
+ "known incompatibilities\n");
+ goto out_free;
+ }
ecryptfs_set_superblock_lower(sb, path.dentry->d_sb);
sb->s_maxbytes = path.dentry->d_sb->s_maxbytes;
sb->s_blocksize = path.dentry->d_sb->s_blocksize;
^ permalink raw reply [flat|nested] 42+ messages in thread* [ 13/34] Add mount option to check uid of device being mounted = expect uid, CVE-2011-1833
2012-03-01 21:46 [ 00/34] 2.6.32.58-longterm review Greg KH
` (11 preceding siblings ...)
2012-03-01 21:39 ` [ 12/34] Ban ecryptfs over ecryptfs Greg KH
@ 2012-03-01 21:39 ` Greg KH
2012-03-01 21:39 ` [ 14/34] crypto: sha512 - use standard ror64() Greg KH
` (21 subsequent siblings)
34 siblings, 0 replies; 42+ messages in thread
From: Greg KH @ 2012-03-01 21:39 UTC (permalink / raw)
To: linux-kernel, stable
Cc: torvalds, akpm, alan, Tim Gardner, John Johansen, stable,
Tyler Hicks
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: John Johansen <john.johansen@canonical.com>
(backported from commit 764355487ea220fdc2faf128d577d7f679b91f97)
Close a TOCTOU race for mounts done via ecryptfs-mount-private. The mount
source (device) can be raced when the ownership test is done in userspace.
Provide Ecryptfs a means to force the uid check at mount time.
BugLink: http://bugs.launchpad.net/bugs/732628
Signed-off-by: John Johansen <john.johansen@canonical.com>
Signed-off-by: Tyler Hicks <tyler.hicks@canonical.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/ecryptfs/main.c | 30 +++++++++++++++++++++++++-----
1 file changed, 25 insertions(+), 5 deletions(-)
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -212,7 +212,8 @@ enum { ecryptfs_opt_sig, ecryptfs_opt_ec
ecryptfs_opt_passthrough, ecryptfs_opt_xattr_metadata,
ecryptfs_opt_encrypted_view, ecryptfs_opt_fnek_sig,
ecryptfs_opt_fn_cipher, ecryptfs_opt_fn_cipher_key_bytes,
- ecryptfs_opt_unlink_sigs, ecryptfs_opt_err };
+ ecryptfs_opt_unlink_sigs, ecryptfs_opt_check_dev_ruid,
+ ecryptfs_opt_err };
static const match_table_t tokens = {
{ecryptfs_opt_sig, "sig=%s"},
@@ -227,6 +228,7 @@ static const match_table_t tokens = {
{ecryptfs_opt_fn_cipher, "ecryptfs_fn_cipher=%s"},
{ecryptfs_opt_fn_cipher_key_bytes, "ecryptfs_fn_key_bytes=%u"},
{ecryptfs_opt_unlink_sigs, "ecryptfs_unlink_sigs"},
+ {ecryptfs_opt_check_dev_ruid, "ecryptfs_check_dev_ruid"},
{ecryptfs_opt_err, NULL}
};
@@ -270,6 +272,7 @@ static void ecryptfs_init_mount_crypt_st
* ecryptfs_parse_options
* @sb: The ecryptfs super block
* @options: The options pased to the kernel
+ * @check_ruid: set to 1 if device uid should be checked against the ruid
*
* Parse mount options:
* debug=N - ecryptfs_verbosity level for debug output
@@ -285,7 +288,8 @@ static void ecryptfs_init_mount_crypt_st
*
* Returns zero on success; non-zero on error
*/
-static int ecryptfs_parse_options(struct super_block *sb, char *options)
+static int ecryptfs_parse_options(struct super_block *sb, char *options,
+ uid_t *check_ruid)
{
char *p;
int rc = 0;
@@ -310,6 +314,8 @@ static int ecryptfs_parse_options(struct
char *cipher_key_bytes_src;
char *fn_cipher_key_bytes_src;
+ *check_ruid = 0;
+
if (!options) {
rc = -EINVAL;
goto out;
@@ -410,6 +416,9 @@ static int ecryptfs_parse_options(struct
case ecryptfs_opt_unlink_sigs:
mount_crypt_stat->flags |= ECRYPTFS_UNLINK_SIGS;
break;
+ case ecryptfs_opt_check_dev_ruid:
+ *check_ruid = 1;
+ break;
case ecryptfs_opt_err:
default:
printk(KERN_WARNING
@@ -552,7 +561,8 @@ out:
* ecryptfs_interpose to create our initial inode and super block
* struct.
*/
-static int ecryptfs_read_super(struct super_block *sb, const char *dev_name)
+static int ecryptfs_read_super(struct super_block *sb, const char *dev_name,
+ uid_t check_ruid)
{
struct path path;
int rc;
@@ -569,6 +579,15 @@ static int ecryptfs_read_super(struct su
"known incompatibilities\n");
goto out_free;
}
+
+ if (check_ruid && path.dentry->d_inode->i_uid != current_uid()) {
+ rc = -EPERM;
+ printk(KERN_ERR "Mount of device (uid: %d) not owned by "
+ "requested user (uid: %d)\n",
+ path.dentry->d_inode->i_uid, current_uid());
+ goto out_free;
+ }
+
ecryptfs_set_superblock_lower(sb, path.dentry->d_sb);
sb->s_maxbytes = path.dentry->d_sb->s_maxbytes;
sb->s_blocksize = path.dentry->d_sb->s_blocksize;
@@ -607,6 +626,7 @@ static int ecryptfs_get_sb(struct file_s
{
int rc;
struct super_block *sb;
+ uid_t check_ruid;
rc = get_sb_nodev(fs_type, flags, raw_data, ecryptfs_fill_super, mnt);
if (rc < 0) {
@@ -614,12 +634,12 @@ static int ecryptfs_get_sb(struct file_s
goto out;
}
sb = mnt->mnt_sb;
- rc = ecryptfs_parse_options(sb, raw_data);
+ rc = ecryptfs_parse_options(sb, raw_data, &check_ruid);
if (rc) {
printk(KERN_ERR "Error parsing options; rc = [%d]\n", rc);
goto out_abort;
}
- rc = ecryptfs_read_super(sb, dev_name);
+ rc = ecryptfs_read_super(sb, dev_name, check_ruid);
if (rc) {
printk(KERN_ERR "Reading sb failed; rc = [%d]\n", rc);
goto out_abort;
^ permalink raw reply [flat|nested] 42+ messages in thread* [ 14/34] crypto: sha512 - use standard ror64()
2012-03-01 21:46 [ 00/34] 2.6.32.58-longterm review Greg KH
` (12 preceding siblings ...)
2012-03-01 21:39 ` [ 13/34] Add mount option to check uid of device being mounted = expect uid, CVE-2011-1833 Greg KH
@ 2012-03-01 21:39 ` Greg KH
2012-03-01 21:39 ` [ 15/34] drm/radeon/kms: fix MSI re-arm on rv370+ Greg KH
` (20 subsequent siblings)
34 siblings, 0 replies; 42+ messages in thread
From: Greg KH @ 2012-03-01 21:39 UTC (permalink / raw)
To: linux-kernel, stable; +Cc: torvalds, akpm, alan, Alexey Dobriyan, Herbert Xu
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Dobriyan <adobriyan@gmail.com>
commit f2ea0f5f04c97b48c88edccba52b0682fbe45087 upstream.
Use standard ror64() instead of hand-written.
There is no standard ror64, so create it.
The difference is shift value being "unsigned int" instead of uint64_t
(for which there is no reason). gcc starts to emit native ROR instructions
which it doesn't do for some reason currently. This should make the code
faster.
Patch survives in-tree crypto test and ping flood with hmac(sha512) on.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
crypto/sha512_generic.c | 13 ++++---------
include/linux/bitops.h | 20 ++++++++++++++++++++
2 files changed, 24 insertions(+), 9 deletions(-)
--- a/crypto/sha512_generic.c
+++ b/crypto/sha512_generic.c
@@ -31,11 +31,6 @@ static inline u64 Maj(u64 x, u64 y, u64
return (x & y) | (z & (x | y));
}
-static inline u64 RORu64(u64 x, u64 y)
-{
- return (x >> y) | (x << (64 - y));
-}
-
static const u64 sha512_K[80] = {
0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL, 0xb5c0fbcfec4d3b2fULL,
0xe9b5dba58189dbbcULL, 0x3956c25bf348b538ULL, 0x59f111f1b605d019ULL,
@@ -66,10 +61,10 @@ static const u64 sha512_K[80] = {
0x5fcb6fab3ad6faecULL, 0x6c44198c4a475817ULL,
};
-#define e0(x) (RORu64(x,28) ^ RORu64(x,34) ^ RORu64(x,39))
-#define e1(x) (RORu64(x,14) ^ RORu64(x,18) ^ RORu64(x,41))
-#define s0(x) (RORu64(x, 1) ^ RORu64(x, 8) ^ (x >> 7))
-#define s1(x) (RORu64(x,19) ^ RORu64(x,61) ^ (x >> 6))
+#define e0(x) (ror64(x,28) ^ ror64(x,34) ^ ror64(x,39))
+#define e1(x) (ror64(x,14) ^ ror64(x,18) ^ ror64(x,41))
+#define s0(x) (ror64(x, 1) ^ ror64(x, 8) ^ (x >> 7))
+#define s1(x) (ror64(x,19) ^ ror64(x,61) ^ (x >> 6))
static inline void LOAD_OP(int I, u64 *W, const u8 *input)
{
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -46,6 +46,26 @@ static inline unsigned long hweight_long
}
/**
+ * rol64 - rotate a 64-bit value left
+ * @word: value to rotate
+ * @shift: bits to roll
+ */
+static inline __u64 rol64(__u64 word, unsigned int shift)
+{
+ return (word << shift) | (word >> (64 - shift));
+}
+
+/**
+ * ror64 - rotate a 64-bit value right
+ * @word: value to rotate
+ * @shift: bits to roll
+ */
+static inline __u64 ror64(__u64 word, unsigned int shift)
+{
+ return (word >> shift) | (word << (64 - shift));
+}
+
+/**
* rol32 - rotate a 32-bit value left
* @word: value to rotate
* @shift: bits to roll
^ permalink raw reply [flat|nested] 42+ messages in thread* [ 15/34] drm/radeon/kms: fix MSI re-arm on rv370+
2012-03-01 21:46 [ 00/34] 2.6.32.58-longterm review Greg KH
` (13 preceding siblings ...)
2012-03-01 21:39 ` [ 14/34] crypto: sha512 - use standard ror64() Greg KH
@ 2012-03-01 21:39 ` Greg KH
2012-03-01 21:39 ` [ 16/34] ecryptfs: read on a directory should return EISDIR if not supported Greg KH
` (19 subsequent siblings)
34 siblings, 0 replies; 42+ messages in thread
From: Greg KH @ 2012-03-01 21:39 UTC (permalink / raw)
To: linux-kernel, stable; +Cc: torvalds, akpm, alan, Alex Deucher, Dave Airlie
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <alexander.deucher@amd.com>
commit b7f5b7dec3d539a84734f2bcb7e53fbb1532a40b upstream.
MSI_REARM_EN register is a write only trigger register.
There is no need RMW when re-arming.
May fix:
https://bugs.freedesktop.org/show_bug.cgi?id=41668
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/radeon/r100.c | 4 +---
drivers/gpu/drm/radeon/rs600.c | 4 +---
2 files changed, 2 insertions(+), 6 deletions(-)
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -218,9 +218,7 @@ int r100_irq_process(struct radeon_devic
WREG32(RADEON_AIC_CNTL, msi_rearm | RS400_MSI_REARM);
break;
default:
- msi_rearm = RREG32(RADEON_MSI_REARM_EN) & ~RV370_MSI_REARM_EN;
- WREG32(RADEON_MSI_REARM_EN, msi_rearm);
- WREG32(RADEON_MSI_REARM_EN, msi_rearm | RV370_MSI_REARM_EN);
+ WREG32(RADEON_MSI_REARM_EN, RV370_MSI_REARM_EN);
break;
}
}
--- a/drivers/gpu/drm/radeon/rs600.c
+++ b/drivers/gpu/drm/radeon/rs600.c
@@ -270,9 +270,7 @@ int rs600_irq_process(struct radeon_devi
WREG32(RADEON_BUS_CNTL, msi_rearm | RS600_MSI_REARM);
break;
default:
- msi_rearm = RREG32(RADEON_MSI_REARM_EN) & ~RV370_MSI_REARM_EN;
- WREG32(RADEON_MSI_REARM_EN, msi_rearm);
- WREG32(RADEON_MSI_REARM_EN, msi_rearm | RV370_MSI_REARM_EN);
+ WREG32(RADEON_MSI_REARM_EN, RV370_MSI_REARM_EN);
break;
}
}
^ permalink raw reply [flat|nested] 42+ messages in thread* [ 16/34] ecryptfs: read on a directory should return EISDIR if not supported
2012-03-01 21:46 [ 00/34] 2.6.32.58-longterm review Greg KH
` (14 preceding siblings ...)
2012-03-01 21:39 ` [ 15/34] drm/radeon/kms: fix MSI re-arm on rv370+ Greg KH
@ 2012-03-01 21:39 ` Greg KH
2012-03-01 21:39 ` [ 17/34] SCSI: 3w-9xxx fix bug in sgl loading Greg KH
` (18 subsequent siblings)
34 siblings, 0 replies; 42+ messages in thread
From: Greg KH @ 2012-03-01 21:39 UTC (permalink / raw)
To: linux-kernel, stable; +Cc: torvalds, akpm, alan, Andy Whitcroft, Tyler Hicks
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Andy Whitcroft <apw@canonical.com>
commit 323ef68faf1bbd9b1e66aea268fd09d358d7e8ab upstream.
read() calls against a file descriptor connected to a directory are
incorrectly returning EINVAL rather than EISDIR:
[EISDIR]
[XSI] [Option Start] The fildes argument refers to a directory and the
implementation does not allow the directory to be read using read()
or pread(). The readdir() function should be used instead. [Option End]
This occurs because we do not have a .read operation defined for
ecryptfs directories. Connect this up to generic_read_dir().
BugLink: http://bugs.launchpad.net/bugs/719691
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
---
fs/ecryptfs/file.c | 1 +
1 file changed, 1 insertion(+)
--- a/fs/ecryptfs/file.c
+++ b/fs/ecryptfs/file.c
@@ -323,6 +323,7 @@ ecryptfs_compat_ioctl(struct file *file,
const struct file_operations ecryptfs_dir_fops = {
.readdir = ecryptfs_readdir,
+ .read = generic_read_dir,
.unlocked_ioctl = ecryptfs_unlocked_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = ecryptfs_compat_ioctl,
^ permalink raw reply [flat|nested] 42+ messages in thread* [ 17/34] SCSI: 3w-9xxx fix bug in sgl loading
2012-03-01 21:46 [ 00/34] 2.6.32.58-longterm review Greg KH
` (15 preceding siblings ...)
2012-03-01 21:39 ` [ 16/34] ecryptfs: read on a directory should return EISDIR if not supported Greg KH
@ 2012-03-01 21:39 ` Greg KH
2012-03-01 21:39 ` [ 18/34] ARM: 7321/1: cache-v7: Disable preemption when reading CCSIDR Greg KH
` (17 subsequent siblings)
34 siblings, 0 replies; 42+ messages in thread
From: Greg KH @ 2012-03-01 21:39 UTC (permalink / raw)
To: linux-kernel, stable
Cc: torvalds, akpm, alan, Adam Radford, James Bottomley,
Ben Hutchings
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: adam radford <aradford@gmail.com>
commit 53ca353594a254e6bd45ccf2d405aa31bcbb7091 upstream.
This small patch fixes a bug in the 3w-9xxx driver where it would load
an invalid sgl address in the ioctl path even if request length was zero.
Signed-off-by: Adam Radford <aradford@gmail.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Cc: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/scsi/3w-9xxx.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
--- a/drivers/scsi/3w-9xxx.c
+++ b/drivers/scsi/3w-9xxx.c
@@ -76,6 +76,7 @@
Fix bug in twa_get_param() on 4GB+.
Use pci_resource_len() for ioremap().
2.26.02.012 - Add power management support.
+ 2.26.02.013 - Fix bug in twa_load_sgl().
*/
#include <linux/module.h>
@@ -100,7 +101,7 @@
#include "3w-9xxx.h"
/* Globals */
-#define TW_DRIVER_VERSION "2.26.02.012"
+#define TW_DRIVER_VERSION "2.26.02.013"
static TW_Device_Extension *twa_device_extension_list[TW_MAX_SLOT];
static unsigned int twa_device_extension_count;
static int twa_major = -1;
@@ -1378,10 +1379,12 @@ static void twa_load_sgl(TW_Device_Exten
newcommand = &full_command_packet->command.newcommand;
newcommand->request_id__lunl =
cpu_to_le16(TW_REQ_LUN_IN(TW_LUN_OUT(newcommand->request_id__lunl), request_id));
- newcommand->sg_list[0].address = TW_CPU_TO_SGL(dma_handle + sizeof(TW_Ioctl_Buf_Apache) - 1);
- newcommand->sg_list[0].length = cpu_to_le32(length);
+ if (length) {
+ newcommand->sg_list[0].address = TW_CPU_TO_SGL(dma_handle + sizeof(TW_Ioctl_Buf_Apache) - 1);
+ newcommand->sg_list[0].length = cpu_to_le32(length);
+ }
newcommand->sgl_entries__lunh =
- cpu_to_le16(TW_REQ_LUN_IN(TW_LUN_OUT(newcommand->sgl_entries__lunh), 1));
+ cpu_to_le16(TW_REQ_LUN_IN(TW_LUN_OUT(newcommand->sgl_entries__lunh), length ? 1 : 0));
} else {
oldcommand = &full_command_packet->command.oldcommand;
oldcommand->request_id = request_id;
^ permalink raw reply [flat|nested] 42+ messages in thread* [ 18/34] ARM: 7321/1: cache-v7: Disable preemption when reading CCSIDR
2012-03-01 21:46 [ 00/34] 2.6.32.58-longterm review Greg KH
` (16 preceding siblings ...)
2012-03-01 21:39 ` [ 17/34] SCSI: 3w-9xxx fix bug in sgl loading Greg KH
@ 2012-03-01 21:39 ` Greg KH
2012-03-01 21:39 ` [ 19/34] ARM: 7325/1: fix v7 boot with lockdep enabled Greg KH
` (16 subsequent siblings)
34 siblings, 0 replies; 42+ messages in thread
From: Greg KH @ 2012-03-01 21:39 UTC (permalink / raw)
To: linux-kernel, stable
Cc: torvalds, akpm, alan, Stephen Boyd, Catalin Marinas,
Nicolas Pitre, Russell King
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Boyd <sboyd@codeaurora.org>
commit b46c0f74657d1fe1c1b0c1452631cc38a9e6987f upstream.
armv7's flush_cache_all() flushes caches via set/way. To
determine the cache attributes (line size, number of sets,
etc.) the assembly first writes the CSSELR register to select a
cache level and then reads the CCSIDR register. The CSSELR register
is banked per-cpu and is used to determine which cache level CCSIDR
reads. If the task is migrated between when the CSSELR is written and
the CCSIDR is read the CCSIDR value may be for an unexpected cache
level (for example L1 instead of L2) and incorrect cache flushing
could occur.
Disable interrupts across the write and read so that the correct
cache attributes are read and used for the cache flushing
routine. We disable interrupts instead of disabling preemption
because the critical section is only 3 instructions and we want
to call v7_dcache_flush_all from __v7_setup which doesn't have a
full kernel stack with a struct thread_info.
This fixes a problem we see in scm_call() when flush_cache_all()
is called from preemptible context and sometimes the L2 cache is
not properly flushed out.
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/arm/mm/cache-v7.S | 6 ++++++
1 file changed, 6 insertions(+)
--- a/arch/arm/mm/cache-v7.S
+++ b/arch/arm/mm/cache-v7.S
@@ -39,9 +39,15 @@ loop1:
and r1, r1, #7 @ mask of the bits for current cache only
cmp r1, #2 @ see what cache we have at this level
blt skip @ skip if no cache, or just i-cache
+#ifdef CONFIG_PREEMPT
+ save_and_disable_irqs r9 @ make cssr&csidr read atomic
+#endif
mcr p15, 2, r10, c0, c0, 0 @ select current cache level in cssr
isb @ isb to sych the new cssr&csidr
mrc p15, 1, r1, c0, c0, 0 @ read the new csidr
+#ifdef CONFIG_PREEMPT
+ restore_irqs_notrace r9
+#endif
and r2, r1, #7 @ extract the length of the cache lines
add r2, r2, #4 @ add 4 (line length offset)
ldr r4, =0x3ff
^ permalink raw reply [flat|nested] 42+ messages in thread* [ 19/34] ARM: 7325/1: fix v7 boot with lockdep enabled
2012-03-01 21:46 [ 00/34] 2.6.32.58-longterm review Greg KH
` (17 preceding siblings ...)
2012-03-01 21:39 ` [ 18/34] ARM: 7321/1: cache-v7: Disable preemption when reading CCSIDR Greg KH
@ 2012-03-01 21:39 ` Greg KH
2012-03-01 21:39 ` [ 20/34] USB: Added Kamstrup VID/PIDs to cp210x serial driver Greg KH
` (15 subsequent siblings)
34 siblings, 0 replies; 42+ messages in thread
From: Greg KH @ 2012-03-01 21:39 UTC (permalink / raw)
To: linux-kernel, stable
Cc: torvalds, akpm, alan, Nicolas Pitre, Stephen Boyd,
Catalin Marinas, Rabin Vincent, Russell King
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Rabin Vincent <rabin@rab.in>
commit 8e43a905dd574f54c5715d978318290ceafbe275 upstream.
Bootup with lockdep enabled has been broken on v7 since b46c0f74657d
("ARM: 7321/1: cache-v7: Disable preemption when reading CCSIDR").
This is because v7_setup (which is called very early during boot) calls
v7_flush_dcache_all, and the save_and_disable_irqs added by that patch
ends up attempting to call into lockdep C code (trace_hardirqs_off())
when we are in no position to execute it (no stack, MMU off).
Fix this by using a notrace variant of save_and_disable_irqs. The code
already uses the notrace variant of restore_irqs.
Reviewed-by: Nicolas Pitre <nico@linaro.org>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Rabin Vincent <rabin@rab.in>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/arm/include/asm/assembler.h | 5 +++++
arch/arm/mm/cache-v7.S | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
--- a/arch/arm/include/asm/assembler.h
+++ b/arch/arm/include/asm/assembler.h
@@ -133,6 +133,11 @@
disable_irq
.endm
+ .macro save_and_disable_irqs_notrace, oldcpsr
+ mrs \oldcpsr, cpsr
+ disable_irq_notrace
+ .endm
+
/*
* Restore interrupt state previously stored in a register. We don't
* guarantee that this will preserve the flags.
--- a/arch/arm/mm/cache-v7.S
+++ b/arch/arm/mm/cache-v7.S
@@ -40,7 +40,7 @@ loop1:
cmp r1, #2 @ see what cache we have at this level
blt skip @ skip if no cache, or just i-cache
#ifdef CONFIG_PREEMPT
- save_and_disable_irqs r9 @ make cssr&csidr read atomic
+ save_and_disable_irqs_notrace r9 @ make cssr&csidr read atomic
#endif
mcr p15, 2, r10, c0, c0, 0 @ select current cache level in cssr
isb @ isb to sych the new cssr&csidr
^ permalink raw reply [flat|nested] 42+ messages in thread* [ 20/34] USB: Added Kamstrup VID/PIDs to cp210x serial driver.
2012-03-01 21:46 [ 00/34] 2.6.32.58-longterm review Greg KH
` (18 preceding siblings ...)
2012-03-01 21:39 ` [ 19/34] ARM: 7325/1: fix v7 boot with lockdep enabled Greg KH
@ 2012-03-01 21:39 ` Greg KH
2012-03-01 21:39 ` [ 21/34] USB: Fix handoff when BIOS disables host PCI device Greg KH
` (14 subsequent siblings)
34 siblings, 0 replies; 42+ messages in thread
From: Greg KH @ 2012-03-01 21:39 UTC (permalink / raw)
To: linux-kernel, stable; +Cc: torvalds, akpm, alan, Bruno Thomsen
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Bruno Thomsen <bruno.thomsen@gmail.com>
commit c6c1e4491dc8d1ed2509fa6aacffa7f34614fc38 upstream.
Signed-off-by: Bruno Thomsen <bruno.thomsen@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/serial/cp210x.c | 2 ++
1 file changed, 2 insertions(+)
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -136,6 +136,8 @@ static struct usb_device_id id_table []
{ USB_DEVICE(0x16DC, 0x0011) }, /* W-IE-NE-R Plein & Baus GmbH RCM Remote Control for MARATON Power Supply */
{ USB_DEVICE(0x16DC, 0x0012) }, /* W-IE-NE-R Plein & Baus GmbH MPOD Multi Channel Power Supply */
{ USB_DEVICE(0x16DC, 0x0015) }, /* W-IE-NE-R Plein & Baus GmbH CML Control, Monitoring and Data Logger */
+ { USB_DEVICE(0x17A8, 0x0001) }, /* Kamstrup Optical Eye/3-wire */
+ { USB_DEVICE(0x17A8, 0x0005) }, /* Kamstrup M-Bus Master MultiPort 250D */
{ USB_DEVICE(0x17F4, 0xAAAA) }, /* Wavesense Jazz blood glucose meter */
{ USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */
{ USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */
^ permalink raw reply [flat|nested] 42+ messages in thread* [ 21/34] USB: Fix handoff when BIOS disables host PCI device.
2012-03-01 21:46 [ 00/34] 2.6.32.58-longterm review Greg KH
` (19 preceding siblings ...)
2012-03-01 21:39 ` [ 20/34] USB: Added Kamstrup VID/PIDs to cp210x serial driver Greg KH
@ 2012-03-01 21:39 ` Greg KH
2012-03-01 21:39 ` [ 22/34] xhci: Fix encoding for HS bulk/control NAK rate Greg KH
` (13 subsequent siblings)
34 siblings, 0 replies; 42+ messages in thread
From: Greg KH @ 2012-03-01 21:39 UTC (permalink / raw)
To: linux-kernel, stable
Cc: torvalds, akpm, alan, Sarah Sharp, Oliver Neukum, Jesse Barnes
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Sarah Sharp <sarah.a.sharp@linux.intel.com>
commit cab928ee1f221c9cc48d6615070fefe2e444384a upstream.
On some systems with an Intel Panther Point xHCI host controller, the
BIOS disables the xHCI PCI device during boot, and switches the xHCI
ports over to EHCI. This allows the BIOS to access USB devices without
having xHCI support.
The downside is that the xHCI BIOS handoff mechanism will fail because
memory mapped I/O is not enabled for the disabled PCI device.
Jesse Barnes says this is expected behavior. The PCI core will enable
BARs before quirks run, but it will leave it in an undefined state, and
it may not have memory mapped I/O enabled.
Make the generic USB quirk handler call pci_enable_device() to re-enable
MMIO, and call pci_disable_device() once the host-specific BIOS handoff
is finished. This will balance the ref counts in the PCI core. When
the PCI probe function is called, usb_hcd_pci_probe() will call
pci_enable_device() again.
This should be back ported to kernels as old as 2.6.31. That was the
first kernel with xHCI support, and no one has complained about BIOS
handoffs failing due to memory mapped I/O being disabled on other hosts
(EHCI, UHCI, or OHCI).
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Acked-by: Oliver Neukum <oneukum@suse.de>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/host/pci-quirks.c | 11 +++++++++++
1 file changed, 11 insertions(+)
--- a/drivers/usb/host/pci-quirks.c
+++ b/drivers/usb/host/pci-quirks.c
@@ -503,7 +503,17 @@ static void __devinit quirk_usb_early_ha
*/
if (pdev->vendor == 0x184e) /* vendor Netlogic */
return;
+ if (pdev->class != PCI_CLASS_SERIAL_USB_UHCI &&
+ pdev->class != PCI_CLASS_SERIAL_USB_OHCI &&
+ pdev->class != PCI_CLASS_SERIAL_USB_EHCI &&
+ pdev->class != PCI_CLASS_SERIAL_USB_XHCI)
+ return;
+ if (pci_enable_device(pdev) < 0) {
+ dev_warn(&pdev->dev, "Can't enable PCI device, "
+ "BIOS handoff failed.\n");
+ return;
+ }
if (pdev->class == PCI_CLASS_SERIAL_USB_UHCI)
quirk_usb_handoff_uhci(pdev);
else if (pdev->class == PCI_CLASS_SERIAL_USB_OHCI)
@@ -512,5 +522,6 @@ static void __devinit quirk_usb_early_ha
quirk_usb_disable_ehci(pdev);
else if (pdev->class == PCI_CLASS_SERIAL_USB_XHCI)
quirk_usb_handoff_xhci(pdev);
+ pci_disable_device(pdev);
}
DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, quirk_usb_early_handoff);
^ permalink raw reply [flat|nested] 42+ messages in thread* [ 22/34] xhci: Fix encoding for HS bulk/control NAK rate.
2012-03-01 21:46 [ 00/34] 2.6.32.58-longterm review Greg KH
` (20 preceding siblings ...)
2012-03-01 21:39 ` [ 21/34] USB: Fix handoff when BIOS disables host PCI device Greg KH
@ 2012-03-01 21:39 ` Greg KH
2012-03-01 21:39 ` [ 23/34] [media] hdpvr: fix race conditon during start of streaming Greg KH
` (12 subsequent siblings)
34 siblings, 0 replies; 42+ messages in thread
From: Greg KH @ 2012-03-01 21:39 UTC (permalink / raw)
To: linux-kernel, stable
Cc: torvalds, akpm, alan, Sarah Sharp, Felipe Contreras, Andiry Xu
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Sarah Sharp <sarah.a.sharp@linux.intel.com>
commit 340a3504fd39dad753ba908fb6f894ee81fc3ae2 upstream.
The xHCI 0.96 spec says that HS bulk and control endpoint NAK rate must
be encoded as an exponent of two number of microframes. The endpoint
descriptor has the NAK rate encoded in number of microframes. We were
just copying the value from the endpoint descriptor into the endpoint
context interval field, which was not correct. This lead to the VIA
host rejecting the add of a bulk OUT endpoint from any USB 2.0 mass
storage device.
The fix is to use the correct encoding. Refactor the code to convert
number of frames to an exponential number of microframes, and make sure
we convert the number of microframes in HS bulk and control endpoints to
an exponent.
This should be back ported to kernels as old as 2.6.31, that contain the
commit dfa49c4ad120a784ef1ff0717168aa79f55a483a "USB: xhci - fix math
in xhci_get_endpoint_interval"
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Tested-by: Felipe Contreras <felipe.contreras@gmail.com>
Suggested-by: Andiry Xu <andiry.xu@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/host/xhci-mem.c | 32 ++++++++++++++++++++++++--------
1 file changed, 24 insertions(+), 8 deletions(-)
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -472,26 +472,42 @@ static unsigned int xhci_parse_exponent_
}
/*
- * Convert bInterval expressed in frames (in 1-255 range) to exponent of
+ * Convert bInterval expressed in microframes (in 1-255 range) to exponent of
* microframes, rounded down to nearest power of 2.
*/
-static unsigned int xhci_parse_frame_interval(struct usb_device *udev,
- struct usb_host_endpoint *ep)
+static unsigned int xhci_microframes_to_exponent(struct usb_device *udev,
+ struct usb_host_endpoint *ep, unsigned int desc_interval,
+ unsigned int min_exponent, unsigned int max_exponent)
{
unsigned int interval;
- interval = fls(8 * ep->desc.bInterval) - 1;
- interval = clamp_val(interval, 3, 10);
- if ((1 << interval) != 8 * ep->desc.bInterval)
+ interval = fls(desc_interval) - 1;
+ interval = clamp_val(interval, min_exponent, max_exponent);
+ if ((1 << interval) != desc_interval)
dev_warn(&udev->dev,
"ep %#x - rounding interval to %d microframes, ep desc says %d microframes\n",
ep->desc.bEndpointAddress,
1 << interval,
- 8 * ep->desc.bInterval);
+ desc_interval);
return interval;
}
+static unsigned int xhci_parse_microframe_interval(struct usb_device *udev,
+ struct usb_host_endpoint *ep)
+{
+ return xhci_microframes_to_exponent(udev, ep,
+ ep->desc.bInterval, 0, 15);
+}
+
+
+static unsigned int xhci_parse_frame_interval(struct usb_device *udev,
+ struct usb_host_endpoint *ep)
+{
+ return xhci_microframes_to_exponent(udev, ep,
+ ep->desc.bInterval * 8, 3, 10);
+}
+
/* Return the polling or NAK interval.
*
* The polling interval is expressed in "microframes". If xHCI's Interval field
@@ -510,7 +526,7 @@ static inline unsigned int xhci_get_endp
/* Max NAK rate */
if (usb_endpoint_xfer_control(&ep->desc) ||
usb_endpoint_xfer_bulk(&ep->desc)) {
- interval = ep->desc.bInterval;
+ interval = xhci_parse_microframe_interval(udev, ep);
break;
}
/* Fall through - SS and HS isoc/int have same decoding */
^ permalink raw reply [flat|nested] 42+ messages in thread* [ 23/34] [media] hdpvr: fix race conditon during start of streaming
2012-03-01 21:46 [ 00/34] 2.6.32.58-longterm review Greg KH
` (21 preceding siblings ...)
2012-03-01 21:39 ` [ 22/34] xhci: Fix encoding for HS bulk/control NAK rate Greg KH
@ 2012-03-01 21:39 ` Greg KH
2012-03-01 21:39 ` [ 24/34] eCryptfs: Use notify_change for truncating lower inodes Greg KH
` (11 subsequent siblings)
34 siblings, 0 replies; 42+ messages in thread
From: Greg KH @ 2012-03-01 21:39 UTC (permalink / raw)
To: linux-kernel, stable
Cc: torvalds, akpm, alan, Joerg Desch, Mauro Carvalho Chehab
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Janne Grunau <j@jannau.net>
commit afa159538af61f1a65d48927f4e949fe514fb4fc upstream.
status has to be set to STREAMING before the streaming worker is
queued. hdpvr_transmit_buffers() will exit immediately otherwise.
Reported-by: Joerg Desch <vvd.joede@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/media/video/hdpvr/hdpvr-video.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/media/video/hdpvr/hdpvr-video.c
+++ b/drivers/media/video/hdpvr/hdpvr-video.c
@@ -279,12 +279,13 @@ static int hdpvr_start_streaming(struct
hdpvr_config_call(dev, CTRL_START_STREAMING_VALUE, 0x00);
+ dev->status = STATUS_STREAMING;
+
INIT_WORK(&dev->worker, hdpvr_transmit_buffers);
queue_work(dev->workqueue, &dev->worker);
v4l2_dbg(MSG_BUFFER, hdpvr_debug, &dev->v4l2_dev,
"streaming started\n");
- dev->status = STATUS_STREAMING;
return 0;
}
^ permalink raw reply [flat|nested] 42+ messages in thread* [ 24/34] eCryptfs: Use notify_change for truncating lower inodes
2012-03-01 21:46 [ 00/34] 2.6.32.58-longterm review Greg KH
` (22 preceding siblings ...)
2012-03-01 21:39 ` [ 23/34] [media] hdpvr: fix race conditon during start of streaming Greg KH
@ 2012-03-01 21:39 ` Greg KH
2012-03-01 21:39 ` [ 25/34] eCryptfs: Remove extra d_delete in ecryptfs_rmdir Greg KH
` (10 subsequent siblings)
34 siblings, 0 replies; 42+ messages in thread
From: Greg KH @ 2012-03-01 21:39 UTC (permalink / raw)
To: linux-kernel, stable
Cc: torvalds, akpm, alan, Christoph Hellwig, Dustin Kirkland,
ecryptfs-devel, linux-fsdevel, Tyler Hicks, Colin Ian King,
Tim Gardner
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
commit 5f3ef64f4da1c587cdcfaaac72311225b7df094c upstream.
When truncating inodes in the lower filesystem, eCryptfs directly
invoked vmtruncate(). As Christoph Hellwig pointed out, vmtruncate() is
a filesystem helper function, but filesystems may need to do more than
just a call to vmtruncate().
This patch moves the lower inode truncation out of ecryptfs_truncate()
and renames the function to truncate_upper(). truncate_upper() updates
an iattr for the lower inode to indicate if the lower inode needs to be
truncated upon return. ecryptfs_setattr() then calls notify_change(),
using the updated iattr for the lower inode, to complete the truncation.
For eCryptfs functions needing to truncate, ecryptfs_truncate() is
reintroduced as a simple way to truncate the upper inode to a specified
size and then truncate the lower inode accordingly.
https://bugs.launchpad.net/bugs/451368
Reported-by: Christoph Hellwig <hch@lst.de>
Acked-by: Dustin Kirkland <kirkland@canonical.com>
Cc: ecryptfs-devel@lists.launchpad.net
Cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/ecryptfs/inode.c | 99 +++++++++++++++++++++++++++++++++++-----------------
1 file changed, 67 insertions(+), 32 deletions(-)
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -758,18 +758,23 @@ upper_size_to_lower_size(struct ecryptfs
}
/**
- * ecryptfs_truncate
+ * truncate_upper
* @dentry: The ecryptfs layer dentry
- * @new_length: The length to expand the file to
+ * @ia: Address of the ecryptfs inode's attributes
+ * @lower_ia: Address of the lower inode's attributes
*
* Function to handle truncations modifying the size of the file. Note
* that the file sizes are interpolated. When expanding, we are simply
- * writing strings of 0's out. When truncating, we need to modify the
- * underlying file size according to the page index interpolations.
+ * writing strings of 0's out. When truncating, we truncate the upper
+ * inode and update the lower_ia according to the page index
+ * interpolations. If ATTR_SIZE is set in lower_ia->ia_valid upon return,
+ * the caller must use lower_ia in a call to notify_change() to perform
+ * the truncation of the lower inode.
*
* Returns zero on success; non-zero otherwise
*/
-int ecryptfs_truncate(struct dentry *dentry, loff_t new_length)
+static int truncate_upper(struct dentry *dentry, struct iattr *ia,
+ struct iattr *lower_ia)
{
int rc = 0;
struct inode *inode = dentry->d_inode;
@@ -780,8 +785,10 @@ int ecryptfs_truncate(struct dentry *den
loff_t lower_size_before_truncate;
loff_t lower_size_after_truncate;
- if (unlikely((new_length == i_size)))
+ if (unlikely((ia->ia_size == i_size))) {
+ lower_ia->ia_valid &= ~ATTR_SIZE;
goto out;
+ }
crypt_stat = &ecryptfs_inode_to_private(dentry->d_inode)->crypt_stat;
/* Set up a fake ecryptfs file, this is used to interface with
* the file in the underlying filesystem so that the
@@ -801,28 +808,30 @@ int ecryptfs_truncate(struct dentry *den
&fake_ecryptfs_file,
ecryptfs_inode_to_private(dentry->d_inode)->lower_file);
/* Switch on growing or shrinking file */
- if (new_length > i_size) {
+ if (ia->ia_size > i_size) {
char zero[] = { 0x00 };
+ lower_ia->ia_valid &= ~ATTR_SIZE;
/* Write a single 0 at the last position of the file;
* this triggers code that will fill in 0's throughout
* the intermediate portion of the previous end of the
* file and the new and of the file */
rc = ecryptfs_write(&fake_ecryptfs_file, zero,
- (new_length - 1), 1);
- } else { /* new_length < i_size_read(inode) */
- /* We're chopping off all the pages down do the page
- * in which new_length is located. Fill in the end of
- * that page from (new_length & ~PAGE_CACHE_MASK) to
+ (ia->ia_size - 1), 1);
+ } else { /* ia->ia_size < i_size_read(inode) */
+ /* We're chopping off all the pages down to the page
+ * in which ia->ia_size is located. Fill in the end of
+ * that page from (ia->ia_size & ~PAGE_CACHE_MASK) to
* PAGE_CACHE_SIZE with zeros. */
size_t num_zeros = (PAGE_CACHE_SIZE
- - (new_length & ~PAGE_CACHE_MASK));
+ - (ia->ia_size & ~PAGE_CACHE_MASK));
if (!(crypt_stat->flags & ECRYPTFS_ENCRYPTED)) {
- rc = vmtruncate(inode, new_length);
+ rc = vmtruncate(inode, ia->ia_size);
if (rc)
goto out_free;
- rc = vmtruncate(lower_dentry->d_inode, new_length);
+ lower_ia->ia_size = ia->ia_size;
+ lower_ia->ia_valid |= ATTR_SIZE;
goto out_free;
}
if (num_zeros) {
@@ -834,7 +843,7 @@ int ecryptfs_truncate(struct dentry *den
goto out_free;
}
rc = ecryptfs_write(&fake_ecryptfs_file, zeros_virt,
- new_length, num_zeros);
+ ia->ia_size, num_zeros);
kfree(zeros_virt);
if (rc) {
printk(KERN_ERR "Error attempting to zero out "
@@ -843,7 +852,7 @@ int ecryptfs_truncate(struct dentry *den
goto out_free;
}
}
- vmtruncate(inode, new_length);
+ vmtruncate(inode, ia->ia_size);
rc = ecryptfs_write_inode_size_to_metadata(inode);
if (rc) {
printk(KERN_ERR "Problem with "
@@ -856,10 +865,12 @@ int ecryptfs_truncate(struct dentry *den
lower_size_before_truncate =
upper_size_to_lower_size(crypt_stat, i_size);
lower_size_after_truncate =
- upper_size_to_lower_size(crypt_stat, new_length);
- if (lower_size_after_truncate < lower_size_before_truncate)
- vmtruncate(lower_dentry->d_inode,
- lower_size_after_truncate);
+ upper_size_to_lower_size(crypt_stat, ia->ia_size);
+ if (lower_size_after_truncate < lower_size_before_truncate) {
+ lower_ia->ia_size = lower_size_after_truncate;
+ lower_ia->ia_valid |= ATTR_SIZE;
+ } else
+ lower_ia->ia_valid &= ~ATTR_SIZE;
}
out_free:
if (ecryptfs_file_to_private(&fake_ecryptfs_file))
@@ -869,6 +880,33 @@ out:
return rc;
}
+/**
+ * ecryptfs_truncate
+ * @dentry: The ecryptfs layer dentry
+ * @new_length: The length to expand the file to
+ *
+ * Simple function that handles the truncation of an eCryptfs inode and
+ * its corresponding lower inode.
+ *
+ * Returns zero on success; non-zero otherwise
+ */
+int ecryptfs_truncate(struct dentry *dentry, loff_t new_length)
+{
+ struct iattr ia = { .ia_valid = ATTR_SIZE, .ia_size = new_length };
+ struct iattr lower_ia = { .ia_valid = 0 };
+ int rc;
+
+ rc = truncate_upper(dentry, &ia, &lower_ia);
+ if (!rc && lower_ia.ia_valid & ATTR_SIZE) {
+ struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry);
+
+ mutex_lock(&lower_dentry->d_inode->i_mutex);
+ rc = notify_change(lower_dentry, &lower_ia);
+ mutex_unlock(&lower_dentry->d_inode->i_mutex);
+ }
+ return rc;
+}
+
static int
ecryptfs_permission(struct inode *inode, int mask)
{
@@ -891,6 +929,7 @@ static int ecryptfs_setattr(struct dentr
{
int rc = 0;
struct dentry *lower_dentry;
+ struct iattr lower_ia;
struct inode *inode;
struct inode *lower_inode;
struct ecryptfs_crypt_stat *crypt_stat;
@@ -929,15 +968,11 @@ static int ecryptfs_setattr(struct dentr
}
}
mutex_unlock(&crypt_stat->cs_mutex);
+ memcpy(&lower_ia, ia, sizeof(lower_ia));
+ if (ia->ia_valid & ATTR_FILE)
+ lower_ia.ia_file = ecryptfs_file_to_lower(ia->ia_file);
if (ia->ia_valid & ATTR_SIZE) {
- ecryptfs_printk(KERN_DEBUG,
- "ia->ia_valid = [0x%x] ATTR_SIZE" " = [0x%x]\n",
- ia->ia_valid, ATTR_SIZE);
- rc = ecryptfs_truncate(dentry, ia->ia_size);
- /* ecryptfs_truncate handles resizing of the lower file */
- ia->ia_valid &= ~ATTR_SIZE;
- ecryptfs_printk(KERN_DEBUG, "ia->ia_valid = [%x]\n",
- ia->ia_valid);
+ rc = truncate_upper(dentry, ia, &lower_ia);
if (rc < 0)
goto out;
}
@@ -946,11 +981,11 @@ static int ecryptfs_setattr(struct dentr
* mode change is for clearing setuid/setgid bits. Allow lower fs
* to interpret this in its own way.
*/
- if (ia->ia_valid & (ATTR_KILL_SUID | ATTR_KILL_SGID))
- ia->ia_valid &= ~ATTR_MODE;
+ if (lower_ia.ia_valid & (ATTR_KILL_SUID | ATTR_KILL_SGID))
+ lower_ia.ia_valid &= ~ATTR_MODE;
mutex_lock(&lower_dentry->d_inode->i_mutex);
- rc = notify_change(lower_dentry, ia);
+ rc = notify_change(lower_dentry, &lower_ia);
mutex_unlock(&lower_dentry->d_inode->i_mutex);
out:
fsstack_copy_attr_all(inode, lower_inode, NULL);
^ permalink raw reply [flat|nested] 42+ messages in thread* [ 25/34] eCryptfs: Remove extra d_delete in ecryptfs_rmdir
2012-03-01 21:46 [ 00/34] 2.6.32.58-longterm review Greg KH
` (23 preceding siblings ...)
2012-03-01 21:39 ` [ 24/34] eCryptfs: Use notify_change for truncating lower inodes Greg KH
@ 2012-03-01 21:39 ` Greg KH
2012-03-01 21:39 ` [ 26/34] eCryptfs: Clear i_nlink in rmdir Greg KH
` (9 subsequent siblings)
34 siblings, 0 replies; 42+ messages in thread
From: Greg KH @ 2012-03-01 21:39 UTC (permalink / raw)
To: linux-kernel, stable
Cc: torvalds, akpm, alan, Tyler Hicks, Colin King, Tim Gardner
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
commit 35ffa948b2f7bdf79e488cd496232935d095087a upstream.
vfs_rmdir() already calls d_delete() on the lower dentry. That was being
duplicated in ecryptfs_rmdir() and caused a NULL pointer dereference
when NFSv3 was the lower filesystem.
BugLink: http://bugs.launchpad.net/bugs/723518
Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
Signed-off-by: Colin King <colin.king@canonical.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/ecryptfs/inode.c | 2 --
1 file changed, 2 deletions(-)
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -575,8 +575,6 @@ static int ecryptfs_rmdir(struct inode *
dget(lower_dentry);
rc = vfs_rmdir(lower_dir_dentry->d_inode, lower_dentry);
dput(lower_dentry);
- if (!rc)
- d_delete(lower_dentry);
fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode);
dir->i_nlink = lower_dir_dentry->d_inode->i_nlink;
unlock_dir(lower_dir_dentry);
^ permalink raw reply [flat|nested] 42+ messages in thread* [ 26/34] eCryptfs: Clear i_nlink in rmdir
2012-03-01 21:46 [ 00/34] 2.6.32.58-longterm review Greg KH
` (24 preceding siblings ...)
2012-03-01 21:39 ` [ 25/34] eCryptfs: Remove extra d_delete in ecryptfs_rmdir Greg KH
@ 2012-03-01 21:39 ` Greg KH
2012-03-01 21:39 ` [ 27/34] cdrom: use copy_to_user() without the underscores Greg KH
` (8 subsequent siblings)
34 siblings, 0 replies; 42+ messages in thread
From: Greg KH @ 2012-03-01 21:39 UTC (permalink / raw)
To: linux-kernel, stable
Cc: torvalds, akpm, alan, Tyler Hicks, Colin King, Tim Gardner
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
commit 07850552b92b3637fa56767b5e460b4238014447 upstream.
eCryptfs wasn't clearing the eCryptfs inode's i_nlink after a successful
vfs_rmdir() on the lower directory. This resulted in the inode evict and
destroy paths to be missed.
https://bugs.launchpad.net/ecryptfs/+bug/723518
Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
Signed-off-by: Colin King <colin.king@canonical.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/ecryptfs/inode.c | 2 ++
1 file changed, 2 insertions(+)
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -575,6 +575,8 @@ static int ecryptfs_rmdir(struct inode *
dget(lower_dentry);
rc = vfs_rmdir(lower_dir_dentry->d_inode, lower_dentry);
dput(lower_dentry);
+ if (!rc && dentry->d_inode)
+ clear_nlink(dentry->d_inode);
fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode);
dir->i_nlink = lower_dir_dentry->d_inode->i_nlink;
unlock_dir(lower_dir_dentry);
^ permalink raw reply [flat|nested] 42+ messages in thread* [ 27/34] cdrom: use copy_to_user() without the underscores
2012-03-01 21:46 [ 00/34] 2.6.32.58-longterm review Greg KH
` (25 preceding siblings ...)
2012-03-01 21:39 ` [ 26/34] eCryptfs: Clear i_nlink in rmdir Greg KH
@ 2012-03-01 21:39 ` Greg KH
2012-03-01 21:39 ` [ 28/34] autofs: work around unhappy compat problem on x86-64 Greg KH
` (7 subsequent siblings)
34 siblings, 0 replies; 42+ messages in thread
From: Greg KH @ 2012-03-01 21:39 UTC (permalink / raw)
To: linux-kernel, stable; +Cc: torvalds, akpm, alan, Dan Carpenter, Jens Axboe
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <dan.carpenter@oracle.com>
commit 822bfa51ce44f2c63c300fdb76dc99c4d5a5ca9f upstream.
"nframes" comes from the user and "nframes * CD_FRAMESIZE_RAW" can wrap
on 32 bit systems. That would have been ok if we used the same wrapped
value for the copy, but we use a shifted value. We should just use the
checked version of copy_to_user() because it's not going to make a
difference to the speed.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/cdrom/cdrom.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -2057,11 +2057,6 @@ static int cdrom_read_cdda_old(struct cd
if (!nr)
return -ENOMEM;
- if (!access_ok(VERIFY_WRITE, ubuf, nframes * CD_FRAMESIZE_RAW)) {
- ret = -EFAULT;
- goto out;
- }
-
cgc.data_direction = CGC_DATA_READ;
while (nframes > 0) {
if (nr > nframes)
@@ -2070,7 +2065,7 @@ static int cdrom_read_cdda_old(struct cd
ret = cdrom_read_block(cdi, &cgc, lba, nr, 1, CD_FRAMESIZE_RAW);
if (ret)
break;
- if (__copy_to_user(ubuf, cgc.buffer, CD_FRAMESIZE_RAW * nr)) {
+ if (copy_to_user(ubuf, cgc.buffer, CD_FRAMESIZE_RAW * nr)) {
ret = -EFAULT;
break;
}
@@ -2078,7 +2073,6 @@ static int cdrom_read_cdda_old(struct cd
nframes -= nr;
lba += nr;
}
-out:
kfree(cgc.buffer);
return ret;
}
^ permalink raw reply [flat|nested] 42+ messages in thread* [ 28/34] autofs: work around unhappy compat problem on x86-64
2012-03-01 21:46 [ 00/34] 2.6.32.58-longterm review Greg KH
` (26 preceding siblings ...)
2012-03-01 21:39 ` [ 27/34] cdrom: use copy_to_user() without the underscores Greg KH
@ 2012-03-01 21:39 ` Greg KH
2012-03-01 21:39 ` [ 29/34] Fix autofs compile without CONFIG_COMPAT Greg KH
` (6 subsequent siblings)
34 siblings, 0 replies; 42+ messages in thread
From: Greg KH @ 2012-03-01 21:39 UTC (permalink / raw)
To: linux-kernel, stable; +Cc: torvalds, akpm, alan, Ian Kent, Jonathan Nieder
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Ian Kent <raven@themaw.net>
commit a32744d4abae24572eff7269bc17895c41bd0085 upstream.
When the autofs protocol version 5 packet type was added in commit
5c0a32fc2cd0 ("autofs4: add new packet type for v5 communications"), it
obvously tried quite hard to be word-size agnostic, and uses explicitly
sized fields that are all correctly aligned.
However, with the final "char name[NAME_MAX+1]" array at the end, the
actual size of the structure ends up being not very well defined:
because the struct isn't marked 'packed', doing a "sizeof()" on it will
align the size of the struct up to the biggest alignment of the members
it has.
And despite all the members being the same, the alignment of them is
different: a "__u64" has 4-byte alignment on x86-32, but native 8-byte
alignment on x86-64. And while 'NAME_MAX+1' ends up being a nice round
number (256), the name[] array starts out a 4-byte aligned.
End result: the "packed" size of the structure is 300 bytes: 4-byte, but
not 8-byte aligned.
As a result, despite all the fields being in the same place on all
architectures, sizeof() will round up that size to 304 bytes on
architectures that have 8-byte alignment for u64.
Note that this is *not* a problem for 32-bit compat mode on POWER, since
there __u64 is 8-byte aligned even in 32-bit mode. But on x86, 32-bit
and 64-bit alignment is different for 64-bit entities, and as a result
the structure that has exactly the same layout has different sizes.
So on x86-64, but no other architecture, we will just subtract 4 from
the size of the structure when running in a compat task. That way we
will write the properly sized packet that user mode expects.
Not pretty. Sadly, this very subtle, and unnecessary, size difference
has been encoded in user space that wants to read packets of *exactly*
the right size, and will refuse to touch anything else.
Reported-and-tested-by: Thomas Meyer <thomas@m3y3r.de>
Signed-off-by: Ian Kent <raven@themaw.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/autofs4/autofs_i.h | 1 +
fs/autofs4/dev-ioctl.c | 1 +
fs/autofs4/inode.c | 2 ++
fs/autofs4/waitq.c | 22 +++++++++++++++++++---
4 files changed, 23 insertions(+), 3 deletions(-)
--- a/fs/autofs4/autofs_i.h
+++ b/fs/autofs4/autofs_i.h
@@ -125,6 +125,7 @@ struct autofs_sb_info {
int sub_version;
int min_proto;
int max_proto;
+ int compat_daemon;
unsigned long exp_timeout;
unsigned int type;
int reghost_enabled;
--- a/fs/autofs4/dev-ioctl.c
+++ b/fs/autofs4/dev-ioctl.c
@@ -389,6 +389,7 @@ static int autofs_dev_ioctl_setpipefd(st
sbi->pipefd = pipefd;
sbi->pipe = pipe;
sbi->catatonic = 0;
+ sbi->compat_daemon = is_compat_task();
}
out:
mutex_unlock(&sbi->wq_mutex);
--- a/fs/autofs4/inode.c
+++ b/fs/autofs4/inode.c
@@ -19,6 +19,7 @@
#include <linux/parser.h>
#include <linux/bitops.h>
#include <linux/magic.h>
+#include <linux/compat.h>
#include "autofs_i.h"
#include <linux/module.h>
@@ -341,6 +342,7 @@ int autofs4_fill_super(struct super_bloc
set_autofs_type_indirect(&sbi->type);
sbi->min_proto = 0;
sbi->max_proto = 0;
+ sbi->compat_daemon = is_compat_task();
mutex_init(&sbi->wq_mutex);
spin_lock_init(&sbi->fs_lock);
sbi->queues = NULL;
--- a/fs/autofs4/waitq.c
+++ b/fs/autofs4/waitq.c
@@ -90,7 +90,24 @@ static int autofs4_write(struct file *fi
return (bytes > 0);
}
-
+
+/*
+ * The autofs_v5 packet was misdesigned.
+ *
+ * The packets are identical on x86-32 and x86-64, but have different
+ * alignment. Which means that 'sizeof()' will give different results.
+ * Fix it up for the case of running 32-bit user mode on a 64-bit kernel.
+ */
+static noinline size_t autofs_v5_packet_size(struct autofs_sb_info *sbi)
+{
+ size_t pktsz = sizeof(struct autofs_v5_packet);
+#if defined(CONFIG_X86_64) && defined(CONFIG_COMPAT)
+ if (sbi->compat_daemon > 0)
+ pktsz -= 4;
+#endif
+ return pktsz;
+}
+
static void autofs4_notify_daemon(struct autofs_sb_info *sbi,
struct autofs_wait_queue *wq,
int type)
@@ -147,8 +164,7 @@ static void autofs4_notify_daemon(struct
{
struct autofs_v5_packet *packet = &pkt.v5_pkt.v5_packet;
- pktsz = sizeof(*packet);
-
+ pktsz = autofs_v5_packet_size(sbi);
packet->wait_queue_token = wq->wait_queue_token;
packet->len = wq->name.len;
memcpy(packet->name, wq->name.name, wq->name.len);
^ permalink raw reply [flat|nested] 42+ messages in thread* [ 29/34] Fix autofs compile without CONFIG_COMPAT
2012-03-01 21:46 [ 00/34] 2.6.32.58-longterm review Greg KH
` (27 preceding siblings ...)
2012-03-01 21:39 ` [ 28/34] autofs: work around unhappy compat problem on x86-64 Greg KH
@ 2012-03-01 21:39 ` Greg KH
2012-03-01 21:39 ` [ 30/34] compat: fix compile breakage on s390 Greg KH
` (5 subsequent siblings)
34 siblings, 0 replies; 42+ messages in thread
From: Greg KH @ 2012-03-01 21:39 UTC (permalink / raw)
To: linux-kernel, stable; +Cc: torvalds, akpm, alan, Jonathan Nieder
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <torvalds@linux-foundation.org>
commit 3c761ea05a8900a907f32b628611873f6bef24b2 upstream.
The autofs compat handling fix caused a compile failure when
CONFIG_COMPAT isn't defined.
Instead of adding random #ifdef'fery in autofs, let's just make the
compat helpers earlier to use: without CONFIG_COMPAT, is_compat_task()
just hardcodes to zero.
We could probably do something similar for a number of other cases where
we have #ifdef's in code, but this is the low-hanging fruit.
Reported-and-tested-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
include/linux/compat.h | 4 ++++
1 file changed, 4 insertions(+)
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -311,5 +311,9 @@ asmlinkage long compat_sys_openat(unsign
extern void __user *compat_alloc_user_space(unsigned long len);
+#else
+
+#define is_compat_task() (0)
+
#endif /* CONFIG_COMPAT */
#endif /* _LINUX_COMPAT_H */
^ permalink raw reply [flat|nested] 42+ messages in thread* [ 30/34] compat: fix compile breakage on s390
2012-03-01 21:46 [ 00/34] 2.6.32.58-longterm review Greg KH
` (28 preceding siblings ...)
2012-03-01 21:39 ` [ 29/34] Fix autofs compile without CONFIG_COMPAT Greg KH
@ 2012-03-01 21:39 ` Greg KH
2012-03-01 21:39 ` [ 31/34] PM: Print a warning if firmware is requested when tasks are frozen Greg KH
` (4 subsequent siblings)
34 siblings, 0 replies; 42+ messages in thread
From: Greg KH @ 2012-03-01 21:39 UTC (permalink / raw)
To: linux-kernel, stable
Cc: torvalds, akpm, alan, Heiko Carstens, Jonathan Nieder
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <heiko.carstens@de.ibm.com>
commit 048cd4e51d24ebf7f3552226d03c769d6ad91658 upstream.
The new is_compat_task() define for the !COMPAT case in
include/linux/compat.h conflicts with a similar define in
arch/s390/include/asm/compat.h.
This is the minimal patch which fixes the build issues.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/s390/include/asm/compat.h | 7 -------
arch/s390/kernel/process.c | 1 -
arch/s390/kernel/ptrace.c | 2 +-
arch/s390/kernel/setup.c | 2 +-
arch/s390/mm/mmap.c | 2 +-
drivers/s390/block/dasd_eckd.c | 1 +
drivers/s390/block/dasd_ioctl.c | 1 +
drivers/s390/char/fs3270.c | 1 +
drivers/s390/char/vmcp.c | 1 +
drivers/s390/cio/chsc_sch.c | 1 +
drivers/s390/scsi/zfcp_cfdc.c | 1 +
11 files changed, 9 insertions(+), 11 deletions(-)
--- a/arch/s390/include/asm/compat.h
+++ b/arch/s390/include/asm/compat.h
@@ -171,13 +171,6 @@ static inline int is_compat_task(void)
return test_thread_flag(TIF_31BIT);
}
-#else
-
-static inline int is_compat_task(void)
-{
- return 0;
-}
-
#endif
static inline void __user *arch_compat_alloc_user_space(long len)
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -32,7 +32,6 @@
#include <linux/kernel_stat.h>
#include <linux/syscalls.h>
#include <linux/compat.h>
-#include <asm/compat.h>
#include <asm/uaccess.h>
#include <asm/pgtable.h>
#include <asm/system.h>
--- a/arch/s390/kernel/ptrace.c
+++ b/arch/s390/kernel/ptrace.c
@@ -36,8 +36,8 @@
#include <linux/regset.h>
#include <linux/tracehook.h>
#include <linux/seccomp.h>
+#include <linux/compat.h>
#include <trace/syscall.h>
-#include <asm/compat.h>
#include <asm/segment.h>
#include <asm/page.h>
#include <asm/pgtable.h>
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -43,6 +43,7 @@
#include <linux/reboot.h>
#include <linux/topology.h>
#include <linux/ftrace.h>
+#include <linux/compat.h>
#include <asm/ipl.h>
#include <asm/uaccess.h>
@@ -56,7 +57,6 @@
#include <asm/ptrace.h>
#include <asm/sections.h>
#include <asm/ebcdic.h>
-#include <asm/compat.h>
#include <asm/kvm_virtio.h>
long psw_kernel_bits = (PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_PRIMARY |
--- a/arch/s390/mm/mmap.c
+++ b/arch/s390/mm/mmap.c
@@ -27,8 +27,8 @@
#include <linux/personality.h>
#include <linux/mm.h>
#include <linux/module.h>
+#include <linux/compat.h>
#include <asm/pgalloc.h>
-#include <asm/compat.h>
/*
* Top of mmap area (just below the process stack).
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -19,6 +19,7 @@
#include <linux/bio.h>
#include <linux/module.h>
#include <linux/init.h>
+#include <linux/compat.h>
#include <asm/debug.h>
#include <asm/idals.h>
--- a/drivers/s390/block/dasd_ioctl.c
+++ b/drivers/s390/block/dasd_ioctl.c
@@ -13,6 +13,7 @@
#define KMSG_COMPONENT "dasd"
#include <linux/interrupt.h>
+#include <linux/compat.h>
#include <linux/major.h>
#include <linux/fs.h>
#include <linux/blkpg.h>
--- a/drivers/s390/char/fs3270.c
+++ b/drivers/s390/char/fs3270.c
@@ -14,6 +14,7 @@
#include <linux/list.h>
#include <linux/types.h>
#include <linux/smp_lock.h>
+#include <linux/compat.h>
#include <asm/ccwdev.h>
#include <asm/cio.h>
--- a/drivers/s390/char/vmcp.c
+++ b/drivers/s390/char/vmcp.c
@@ -16,6 +16,7 @@
#include <linux/fs.h>
#include <linux/init.h>
+#include <linux/compat.h>
#include <linux/kernel.h>
#include <linux/miscdevice.h>
#include <linux/module.h>
--- a/drivers/s390/cio/chsc_sch.c
+++ b/drivers/s390/cio/chsc_sch.c
@@ -11,6 +11,7 @@
#include <linux/module.h>
#include <linux/uaccess.h>
#include <linux/miscdevice.h>
+#include <linux/compat.h>
#include <asm/cio.h>
#include <asm/chsc.h>
--- a/drivers/s390/scsi/zfcp_cfdc.c
+++ b/drivers/s390/scsi/zfcp_cfdc.c
@@ -12,6 +12,7 @@
#include <linux/types.h>
#include <linux/miscdevice.h>
+#include <linux/compat.h>
#include <asm/ccwdev.h>
#include "zfcp_def.h"
#include "zfcp_ext.h"
^ permalink raw reply [flat|nested] 42+ messages in thread* [ 31/34] PM: Print a warning if firmware is requested when tasks are frozen
2012-03-01 21:46 [ 00/34] 2.6.32.58-longterm review Greg KH
` (29 preceding siblings ...)
2012-03-01 21:39 ` [ 30/34] compat: fix compile breakage on s390 Greg KH
@ 2012-03-01 21:39 ` Greg KH
2012-03-01 21:39 ` [ 32/34] firmware loader: allow builtin firmware load even if usermodehelper is disabled Greg KH
` (3 subsequent siblings)
34 siblings, 0 replies; 42+ messages in thread
From: Greg KH @ 2012-03-01 21:39 UTC (permalink / raw)
To: linux-kernel, stable
Cc: torvalds, akpm, alan, rjw, valdis.kletnieks, cloos, riesebie,
penguin-kernel, srivatsa.bhat
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <rjw@sisk.pl>
[ Upstream commit a144c6a6c924aa1da04dd77fb84b89927354fdff ]
Some drivers erroneously use request_firmware() from their ->resume()
(or ->thaw(), or ->restore()) callbacks, which is not going to work
unless the firmware has been built in. This causes system resume to
stall until the firmware-loading timeout expires, which makes users
think that the resume has failed and reboot their machines
unnecessarily. For this reason, make _request_firmware() print a
warning and return immediately with error code if it has been called
when tasks are frozen and it's impossible to start any new usermode
helpers.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Reviewed-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/base/firmware_class.c | 5 +++++
include/linux/kmod.h | 5 +++++
kernel/kmod.c | 9 +++++++++
3 files changed, 19 insertions(+)
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -489,6 +489,11 @@ _request_firmware(const struct firmware
if (!firmware_p)
return -EINVAL;
+ if (WARN_ON(usermodehelper_is_disabled())) {
+ dev_err(device, "firmware: %s will not be loaded\n", name);
+ return -EBUSY;
+ }
+
*firmware_p = firmware = kzalloc(sizeof(*firmware), GFP_KERNEL);
if (!firmware) {
dev_err(device, "%s: kmalloc(struct firmware) failed\n",
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -104,7 +104,12 @@ struct file;
extern int call_usermodehelper_pipe(char *path, char *argv[], char *envp[],
struct file **filp);
+#ifdef CONFIG_PM_SLEEP
extern int usermodehelper_disable(void);
extern void usermodehelper_enable(void);
+extern bool usermodehelper_is_disabled(void);
+#else
+static inline bool usermodehelper_is_disabled(void) { return false; }
+#endif
#endif /* __LINUX_KMOD_H__ */
--- a/kernel/kmod.c
+++ b/kernel/kmod.c
@@ -337,6 +337,15 @@ void usermodehelper_enable(void)
usermodehelper_disabled = 0;
}
+/**
+ * usermodehelper_is_disabled - check if new helpers are allowed to be started
+ */
+bool usermodehelper_is_disabled(void)
+{
+ return usermodehelper_disabled;
+}
+EXPORT_SYMBOL_GPL(usermodehelper_is_disabled);
+
static void helper_lock(void)
{
atomic_inc(&running_helpers);
^ permalink raw reply [flat|nested] 42+ messages in thread* [ 32/34] firmware loader: allow builtin firmware load even if usermodehelper is disabled
2012-03-01 21:46 [ 00/34] 2.6.32.58-longterm review Greg KH
` (30 preceding siblings ...)
2012-03-01 21:39 ` [ 31/34] PM: Print a warning if firmware is requested when tasks are frozen Greg KH
@ 2012-03-01 21:39 ` Greg KH
2012-03-01 21:39 ` [ 33/34] PM / Sleep: Fix freezer failures due to racy usermodehelper_is_disabled() Greg KH
` (2 subsequent siblings)
34 siblings, 0 replies; 42+ messages in thread
From: Greg KH @ 2012-03-01 21:39 UTC (permalink / raw)
To: linux-kernel, stable
Cc: torvalds, akpm, alan, rjw, valdis.kletnieks, cloos, riesebie,
penguin-kernel, srivatsa.bhat, Michel Dänzer
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2244 bytes --]
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <torvalds@linux-foundation.org>
[ Upstream commit caca9510ff4e5d842c0589110243d60927836222 ]
In commit a144c6a6c924 ("PM: Print a warning if firmware is requested
when tasks are frozen") we not only printed a warning if somebody tried
to load the firmware when tasks are frozen - we also failed the load.
But that check was done before the check for built-in firmware, and then
when we disallowed usermode helpers during bootup (commit 288d5abec831:
"Boot up with usermodehelper disabled"), that actually means that
built-in modules can no longer load their firmware even if the firmware
is built in too. Which used to work, and some people depended on it for
the R100 driver.
So move the test for usermodehelper_is_disabled() down, to after
checking the built-in firmware.
This should fix:
https://bugzilla.kernel.org/show_bug.cgi?id=40952
Reported-by: James Cloos <cloos@hjcloos.com>
Bisected-by: Elimar Riesebieter <riesebie@lxtec.de>
Cc: Michel Dänzer <michel@daenzer.net>
Cc: Rafael Wysocki <rjw@sisk.pl>
Cc: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/base/firmware_class.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -489,11 +489,6 @@ _request_firmware(const struct firmware
if (!firmware_p)
return -EINVAL;
- if (WARN_ON(usermodehelper_is_disabled())) {
- dev_err(device, "firmware: %s will not be loaded\n", name);
- return -EBUSY;
- }
-
*firmware_p = firmware = kzalloc(sizeof(*firmware), GFP_KERNEL);
if (!firmware) {
dev_err(device, "%s: kmalloc(struct firmware) failed\n",
@@ -513,6 +508,12 @@ _request_firmware(const struct firmware
return 0;
}
+ if (WARN_ON(usermodehelper_is_disabled())) {
+ dev_err(device, "firmware: %s will not be loaded\n", name);
+ retval = -EBUSY;
+ goto out;
+ }
+
if (uevent)
dev_info(device, "firmware: requesting %s\n", name);
^ permalink raw reply [flat|nested] 42+ messages in thread* [ 33/34] PM / Sleep: Fix freezer failures due to racy usermodehelper_is_disabled()
2012-03-01 21:46 [ 00/34] 2.6.32.58-longterm review Greg KH
` (31 preceding siblings ...)
2012-03-01 21:39 ` [ 32/34] firmware loader: allow builtin firmware load even if usermodehelper is disabled Greg KH
@ 2012-03-01 21:39 ` Greg KH
2012-03-01 21:39 ` [ 34/34] PM / Sleep: Fix read_unlock_usermodehelper() call Greg KH
2012-03-02 7:19 ` [ 00/34] 2.6.32.58-longterm review Willy Tarreau
34 siblings, 0 replies; 42+ messages in thread
From: Greg KH @ 2012-03-01 21:39 UTC (permalink / raw)
To: linux-kernel, stable
Cc: torvalds, akpm, alan, rjw, valdis.kletnieks, cloos, riesebie,
penguin-kernel, srivatsa.bhat
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
[ Upstream commit b298d289c79211508f11cb50749b0d1d54eb244a ]
Commit a144c6a (PM: Print a warning if firmware is requested when tasks
are frozen) introduced usermodehelper_is_disabled() to warn and exit
immediately if firmware is requested when usermodehelpers are disabled.
However, it is racy. Consider the following scenario, currently used in
drivers/base/firmware_class.c:
...
if (usermodehelper_is_disabled())
goto out;
/* Do actual work */
...
out:
return err;
Nothing prevents someone from disabling usermodehelpers just after the check
in the 'if' condition, which means that it is quite possible to try doing the
"actual work" with usermodehelpers disabled, leading to undesirable
consequences.
In particular, this race condition in _request_firmware() causes task freezing
failures whenever suspend/hibernation is in progress because, it wrongly waits
to get the firmware/microcode image from userspace when actually the
usermodehelpers are disabled or userspace has been frozen.
Some of the example scenarios that cause freezing failures due to this race
are those that depend on userspace via request_firmware(), such as x86
microcode module initialization and microcode image reload.
Previous discussions about this issue can be found at:
http://thread.gmane.org/gmane.linux.kernel/1198291/focus=1200591
This patch adds proper synchronization to fix this issue.
It is to be noted that this patchset fixes the freezing failures but doesn't
remove the warnings. IOW, it does not attempt to add explicit synchronization
to x86 microcode driver to avoid requesting microcode image at inopportune
moments. Because, the warnings were introduced to highlight such cases, in the
first place. And we need not silence the warnings, since we take care of the
*real* problem (freezing failure) and hence, after that, the warnings are
pretty harmless anyway.
Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/base/firmware_class.c | 3 +++
include/linux/kmod.h | 4 ++++
kernel/kmod.c | 24 +++++++++++++++++++++++-
3 files changed, 30 insertions(+), 1 deletion(-)
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -508,6 +508,8 @@ _request_firmware(const struct firmware
return 0;
}
+ read_lock_usermodehelper();
+
if (WARN_ON(usermodehelper_is_disabled())) {
dev_err(device, "firmware: %s will not be loaded\n", name);
retval = -EBUSY;
@@ -551,6 +553,7 @@ error_kfree_fw:
kfree(firmware);
*firmware_p = NULL;
out:
+ read_unlock_usermodehelper();
return retval;
}
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -108,8 +108,12 @@ extern int call_usermodehelper_pipe(char
extern int usermodehelper_disable(void);
extern void usermodehelper_enable(void);
extern bool usermodehelper_is_disabled(void);
+extern void read_lock_usermodehelper(void);
+extern void read_unlock_usermodehelper(void);
#else
static inline bool usermodehelper_is_disabled(void) { return false; }
+static inline void read_lock_usermodehelper(void) {}
+static inline void read_unlock_usermodehelper(void) {}
#endif
#endif /* __LINUX_KMOD_H__ */
--- a/kernel/kmod.c
+++ b/kernel/kmod.c
@@ -35,6 +35,7 @@
#include <linux/resource.h>
#include <linux/notifier.h>
#include <linux/suspend.h>
+#include <linux/rwsem.h>
#include <asm/uaccess.h>
#include <trace/events/module.h>
@@ -43,6 +44,8 @@ extern int max_threads;
static struct workqueue_struct *khelper_wq;
+static DECLARE_RWSEM(umhelper_sem);
+
#ifdef CONFIG_MODULES
/*
@@ -286,6 +289,7 @@ static void __call_usermodehelper(struct
* If set, call_usermodehelper_exec() will exit immediately returning -EBUSY
* (used for preventing user land processes from being created after the user
* land has been frozen during a system-wide hibernation or suspend operation).
+ * Should always be manipulated under umhelper_sem acquired for write.
*/
static int usermodehelper_disabled;
@@ -304,6 +308,18 @@ static DECLARE_WAIT_QUEUE_HEAD(running_h
*/
#define RUNNING_HELPERS_TIMEOUT (5 * HZ)
+void read_lock_usermodehelper(void)
+{
+ down_read(&umhelper_sem);
+}
+EXPORT_SYMBOL_GPL(read_lock_usermodehelper);
+
+void read_unlock_usermodehelper(void)
+{
+ up_read(&umhelper_sem);
+}
+EXPORT_SYMBOL_GPL(read_unlock_usermodehelper);
+
/**
* usermodehelper_disable - prevent new helpers from being started
*/
@@ -311,8 +327,10 @@ int usermodehelper_disable(void)
{
long retval;
+ down_write(&umhelper_sem);
usermodehelper_disabled = 1;
- smp_mb();
+ up_write(&umhelper_sem);
+
/*
* From now on call_usermodehelper_exec() won't start any new
* helpers, so it is sufficient if running_helpers turns out to
@@ -325,7 +343,9 @@ int usermodehelper_disable(void)
if (retval)
return 0;
+ down_write(&umhelper_sem);
usermodehelper_disabled = 0;
+ up_write(&umhelper_sem);
return -EAGAIN;
}
@@ -334,7 +354,9 @@ int usermodehelper_disable(void)
*/
void usermodehelper_enable(void)
{
+ down_write(&umhelper_sem);
usermodehelper_disabled = 0;
+ up_write(&umhelper_sem);
}
/**
^ permalink raw reply [flat|nested] 42+ messages in thread* [ 34/34] PM / Sleep: Fix read_unlock_usermodehelper() call.
2012-03-01 21:46 [ 00/34] 2.6.32.58-longterm review Greg KH
` (32 preceding siblings ...)
2012-03-01 21:39 ` [ 33/34] PM / Sleep: Fix freezer failures due to racy usermodehelper_is_disabled() Greg KH
@ 2012-03-01 21:39 ` Greg KH
2012-03-02 7:19 ` [ 00/34] 2.6.32.58-longterm review Willy Tarreau
34 siblings, 0 replies; 42+ messages in thread
From: Greg KH @ 2012-03-01 21:39 UTC (permalink / raw)
To: linux-kernel, stable
Cc: torvalds, akpm, alan, rjw, valdis.kletnieks, cloos, riesebie,
penguin-kernel, srivatsa.bhat, Tetsuo Handa
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
[ Upstream commit e4c89a508f4385a0cd8681c2749a2cd2fa476e40 ]
Commit b298d289
"PM / Sleep: Fix freezer failures due to racy usermodehelper_is_disabled()"
added read_unlock_usermodehelper() but read_unlock_usermodehelper() is called
without read_lock_usermodehelper() when kmalloc() failed.
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Acked-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/base/firmware_class.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -493,8 +493,7 @@ _request_firmware(const struct firmware
if (!firmware) {
dev_err(device, "%s: kmalloc(struct firmware) failed\n",
__func__);
- retval = -ENOMEM;
- goto out;
+ return -ENOMEM;
}
for (builtin = __start_builtin_fw; builtin != __end_builtin_fw;
^ permalink raw reply [flat|nested] 42+ messages in thread* Re: [ 00/34] 2.6.32.58-longterm review
2012-03-01 21:46 [ 00/34] 2.6.32.58-longterm review Greg KH
` (33 preceding siblings ...)
2012-03-01 21:39 ` [ 34/34] PM / Sleep: Fix read_unlock_usermodehelper() call Greg KH
@ 2012-03-02 7:19 ` Willy Tarreau
2012-03-02 13:51 ` Stefan Bader
2012-03-02 15:37 ` Greg KH
34 siblings, 2 replies; 42+ messages in thread
From: Willy Tarreau @ 2012-03-02 7:19 UTC (permalink / raw)
To: Greg KH; +Cc: linux-kernel, stable, torvalds, akpm, alan
Hi Greg,
On Thu, Mar 01, 2012 at 01:46:54PM -0800, Greg KH wrote:
> NOTE:
> I have NOT tested this rc release. I now no longer own any
> machines that can run the 2.6.32 kernel. Because of this, this
> will be the last 2.6.32-longterm kernel that I will release. I
> will be passing on the .32 kernel to someone else after this
> release. Please, if you care about the .32 kernel, test this
> release, I have _only_ build tested it, and have no idea if I
> got something wrong or not.
OK, tested here on an atom-based netbook (x86-32+i915 graphics).
WiFi (incl firmware loading), bluetooth (over USB), NFS, suspend/resume,
ACPI were tested with success. So I think that once again you did the job
right till your last release :-)
Cheers,
Willy
^ permalink raw reply [flat|nested] 42+ messages in thread* Re: [ 00/34] 2.6.32.58-longterm review
2012-03-02 7:19 ` [ 00/34] 2.6.32.58-longterm review Willy Tarreau
@ 2012-03-02 13:51 ` Stefan Bader
2012-03-02 15:37 ` Greg KH
1 sibling, 0 replies; 42+ messages in thread
From: Stefan Bader @ 2012-03-02 13:51 UTC (permalink / raw)
To: Willy Tarreau; +Cc: Greg KH, linux-kernel, stable, torvalds, akpm, alan
On 02.03.2012 08:19, Willy Tarreau wrote:
> Hi Greg,
>
> On Thu, Mar 01, 2012 at 01:46:54PM -0800, Greg KH wrote:
>> NOTE:
>> I have NOT tested this rc release. I now no longer own any
>> machines that can run the 2.6.32 kernel. Because of this, this
>> will be the last 2.6.32-longterm kernel that I will release. I
>> will be passing on the .32 kernel to someone else after this
>> release. Please, if you care about the .32 kernel, test this
>> release, I have _only_ build tested it, and have no idea if I
>> got something wrong or not.
>
> OK, tested here on an atom-based netbook (x86-32+i915 graphics).
> WiFi (incl firmware loading), bluetooth (over USB), NFS, suspend/resume,
> ACPI were tested with success. So I think that once again you did the job
> right till your last release :-)
>
> Cheers,
> Willy
>
FWIW, tested too on a AMD Turion based laptop (x86_64+ATI X1200 graphics).
Ok, not exactly that but the 2.6.32.58+drm33. But that one also did not show
obvious problems.
-Stefan
> --
> To unsubscribe from this list: send the line "unsubscribe stable" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [ 00/34] 2.6.32.58-longterm review
2012-03-02 7:19 ` [ 00/34] 2.6.32.58-longterm review Willy Tarreau
2012-03-02 13:51 ` Stefan Bader
@ 2012-03-02 15:37 ` Greg KH
1 sibling, 0 replies; 42+ messages in thread
From: Greg KH @ 2012-03-02 15:37 UTC (permalink / raw)
To: Willy Tarreau; +Cc: linux-kernel, stable, torvalds, akpm, alan
On Fri, Mar 02, 2012 at 08:19:14AM +0100, Willy Tarreau wrote:
> Hi Greg,
>
> On Thu, Mar 01, 2012 at 01:46:54PM -0800, Greg KH wrote:
> > NOTE:
> > I have NOT tested this rc release. I now no longer own any
> > machines that can run the 2.6.32 kernel. Because of this, this
> > will be the last 2.6.32-longterm kernel that I will release. I
> > will be passing on the .32 kernel to someone else after this
> > release. Please, if you care about the .32 kernel, test this
> > release, I have _only_ build tested it, and have no idea if I
> > got something wrong or not.
>
> OK, tested here on an atom-based netbook (x86-32+i915 graphics).
> WiFi (incl firmware loading), bluetooth (over USB), NFS, suspend/resume,
> ACPI were tested with success. So I think that once again you did the job
> right till your last release :-)
Great, thanks for testing and letting me know.
greg k-h
^ permalink raw reply [flat|nested] 42+ messages in thread