[PATCH 1/1] staging: media: msi3101: sdr-msi3101.c - replace with time_before_eq()
From: Anil Belur - this fix replaces jiffies interval comparision with safer function to avoid any overflow and wrap around ? Signed-off-by: Anil Belur --- drivers/staging/media/msi3101/sdr-msi3101.c | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/staging/media/msi3101/sdr-msi3101.c b/drivers/staging/media/msi3101/sdr-msi3101.c index 08d0d09..b828857 100644 --- a/drivers/staging/media/msi3101/sdr-msi3101.c +++ b/drivers/staging/media/msi3101/sdr-msi3101.c @@ -180,6 +180,7 @@ static int msi3101_convert_stream_504(struct msi3101_state *s, u8 *dst, { int i, i_max, dst_len = 0; u32 sample_num[3]; + unsigned long expires; /* There could be 1-3 1024 bytes URB frames */ i_max = src_len / 1024; @@ -208,7 +209,8 @@ static int msi3101_convert_stream_504(struct msi3101_state *s, u8 *dst, } /* calculate samping rate and output it in 10 seconds intervals */ - if ((s->jiffies_next + msecs_to_jiffies(1)) <= jiffies) { + expires = s->jiffies_next + msecs_to_jiffies(1); + if (time_before_eq(expires, jiffies)) { unsigned long jiffies_now = jiffies; unsigned long msecs = jiffies_to_msecs(jiffies_now) - jiffies_to_msecs(s->jiffies_next); unsigned int samples = sample_num[i_max - 1] - s->sample; @@ -332,6 +334,7 @@ static int msi3101_convert_stream_384(struct msi3101_state *s, u8 *dst, { int i, i_max, dst_len = 0; u32 sample_num[3]; + unsigned long expires; /* There could be 1-3 1024 bytes URB frames */ i_max = src_len / 1024; @@ -360,7 +363,8 @@ static int msi3101_convert_stream_384(struct msi3101_state *s, u8 *dst, } /* calculate samping rate and output it in 10 seconds intervals */ - if ((s->jiffies_next + msecs_to_jiffies(1)) <= jiffies) { + expires = s->jiffies_next + msecs_to_jiffies(1); + if (time_before_eq(expires, jiffies)) { unsigned long jiffies_now = jiffies; unsigned long msecs = jiffies_to_msecs(jiffies_now) - jiffies_to_msecs(s->jiffies_next); unsigned int samples = sample_num[i_max - 1] - s->sample; @@ -397,6 +401,7 @@ static int msi3101_convert_stream_336(struct msi3101_state *s, u8 *dst, { int i, i_max, dst_len = 0; u32 sample_num[3]; + unsigned long expires; /* There could be 1-3 1024 bytes URB frames */ i_max = src_len / 1024; @@ -425,7 +430,8 @@ static int msi3101_convert_stream_336(struct msi3101_state *s, u8 *dst, } /* calculate samping rate and output it in 10 seconds intervals */ - if ((s->jiffies_next + msecs_to_jiffies(1)) <= jiffies) { + expires = s->jiffies_next + msecs_to_jiffies(1); + if (time_before_eq(expires, jiffies)) { unsigned long jiffies_now = jiffies; unsigned long msecs = jiffies_to_msecs(jiffies_now) - jiffies_to_msecs(s->jiffies_next); unsigned int samples = sample_num[i_max - 1] - s->sample; @@ -460,6 +466,7 @@ static int msi3101_convert_stream_252(struct msi3101_state *s, u8 *dst, { int i, i_max, dst_len = 0; u32 sample_num[3]; + unsigned long expires; /* There could be 1-3 1024 bytes URB frames */ i_max = src_len / 1024; @@ -488,7 +495,8 @@ static int msi3101_convert_stream_252(struct msi3101_state *s, u8 *dst, } /* calculate samping rate and output it in 10 seconds intervals */ - if ((s->jiffies_next + msecs_to_jiffies(1)) <= jiffies) { + expires = s->jiffies_next + msecs_to_jiffies(1); + if (time_before_eq(expires, jiffies)) { unsigned long jiffies_now = jiffies; unsigned long msecs = jiffies_to_msecs(jiffies_now) - jiffies_to_msecs(s->jiffies_next); unsigned int samples = sample_num[i_max - 1] - s->sample; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/4] DRBG: cleanup of preprocessor macros
Am Sonntag, 29. Juni 2014, 12:20:15 schrieb Stephen Rothwell: Hi Stephen, > Hi Stephan, > > On Sat, 28 Jun 2014 22:00:07 +0200 Stephan Mueller wrote: > > diff --git a/crypto/drbg.c b/crypto/drbg.c > > index 6679a26..03a230e 100644 > > --- a/crypto/drbg.c > > +++ b/crypto/drbg.c > > @@ -102,8 +102,13 @@ > > > > #if !defined(CONFIG_CRYPTO_DRBG_HASH) && \ > > > > !defined(CONFIG_CRYPTO_DRBG_HMAC) && \ > > !defined(CONFIG_CRYPTO_DRBG_CTR) > > > > -#warning "The DRBG code is useless without compiling at least one DRBG > > type" -#endif > > +#define CRYPTO_DRBG_NONE_STRING "none " > > +static int __init drbg_init(void) > > +{ > > + pr_warn("DRBG: no DRBG core was compiled!\n"); > > + return -EFAULT; > > +} > > +#else > > Wouldn't this be better handled by Kconfig so that we don't even try to > build this unless one of the required core modules is chosen? I tried that, but it seems that my Kconfig Foo is not too well: adding the DRBG cores to the depends line of CRYPTO_DRBG as indicated in the following, I have a circular dependency. With that circular dependency, the DRBG entries do not show up in make menuconfig. menuconfig CRYTPO_DRBG tristate "NIST SP800-90A DRBG" depends on CRYPTO && (CRYPTO_DRBG_HMAC || CRYPTO_DRBG_CTR || CRYPTO_DRBG_HASH) ... if CRYTPO_DRBG config CRYPTO_DRBG_HMAC bool "Enable HMAC DRBG" default y depends on CRYTPO_DRBG Do you have a working solution in mind? The goal is that once CRYPTO_DRBG is selected, at least one of the DRBG cores must be selected. Thanks Stephan -- | Cui bono? | -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 3/4] DRBG: Fix format string for debugging statements
Am Samstag, 28. Juni 2014, 20:53:19 schrieb Joe Perches: Hi Joe, > On Sun, 2014-06-29 at 05:46 +0200, Stephan Mueller wrote: > > Am Sonntag, 29. Juni 2014, 12:24:02 schrieb Stephen Rothwell: > > > > Hi Stephen, > > > > > Hi Stephan, > > > > > > On Sat, 28 Jun 2014 22:01:46 +0200 Stephan Mueller > > > > wrote: > > > > @@ -1987,8 +1987,9 @@ static int __init drbg_init(void) > > > > > > > > if (ARRAY_SIZE(drbg_cores) * 2 > ARRAY_SIZE(drbg_algs)) { > > > > > > > > pr_info("DRBG: Cannot register all DRBG types" > > > > > > > > - "(slots needed: %lu, slots available: %lu)\n", > > > > - ARRAY_SIZE(drbg_cores) * 2, ARRAY_SIZE(drbg_algs)); > > > > + "(slots needed: %u, slots available: %u)\n", > > > > + (unsigned int)ARRAY_SIZE(drbg_cores) * 2, > > > > + (unsigned int)ARRAY_SIZE(drbg_algs)); > > > > > > Doesn't ARRAY_SIZE() always return a size_t? In which case surely we > > > need no casts, but need to us %zu in the format string. > > > > Unfortunately not at all. On my x86_64, I get the compiler warning that > > ARRAY_SIZE is a long unsigned int without the cast. > > This should fix that. > --- > include/linux/kernel.h | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/include/linux/kernel.h b/include/linux/kernel.h > index 6e3d497..58bc57d 100644 > --- a/include/linux/kernel.h > +++ b/include/linux/kernel.h > @@ -51,7 +51,8 @@ > #define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a))) > #define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0) > > -#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + > __must_be_array(arr)) +#define ARRAY_SIZE(arr) \ > + (sizeof(arr) / sizeof((arr)[0]) + (size_t)__must_be_array(arr)) > > /* > * This looks more complex than it should be. But we need to Sure, that fixes it such that I need to use %zu in the format string. But wouldn't that change have riple effects to all use cases of ARRAY_SIZE at least on 32 bit systems (i.e. current implementation returns a 32 bit integer, but the new version returns a 64 bit integer)? If so, I am wondering whether this change can be made with this oneliner. Ciao Stephan -- | Cui bono? | -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 0/2] ARM: tegra: roth: pinmux fixes
On Sat, Jun 28, 2014 at 7:08 AM, Stephen Warren wrote: > On 06/23/2014 01:32 AM, Alexandre Courbot wrote: >> Two small but important fixes to SHIELD's pinmux configuration. >> The use of invalid properties caused the pinmux to not be applied >> at all. Also the setting for sdmmc clock lines resulted in random >> errors or even the impossibility to probe attached devices. >> >> Alexandre Courbot (2): >> ARM: tegra: roth: fix unsupported pinmux properties >> ARM: tegra: roth: enable input on mmc clock pins > > The series, applied to Tegra's for-3.17/dt branch. > > Sorry for the delay; I'd forgotten that our internal discussion resolved > my questions about patch 2. Thanks! And sorry for not mirroring the discussion on the public list. > Still looking forward to internal bugs files against the Jetson TK1 and > Venice2 board pinmux spreadsheets for the same issue:-) Are the spreadsheets you are talking about the following documents? https://github.com/NVIDIA/tegra-pinmux-scripts/blob/master/configs/jetson-tk1.board Or do we have internal structures we need to update as well? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 5/5] drm/i915: Kick out vga console
On Saturday 28 June 2014 15:28:22 Ed Tomlinson wrote: Resend without html krud which causes list to bounce the message. > Hi > > This commit ( a4de05268e674e8ed31df6348269e22d6c6a1803 ) hangs my boot with > 3.16-git. Reverting it lets the boot proceed. > > I have an i7 with a built-in i915 and an pcie r7 260x. The R7 is the primary > console. The i915 is initialized > but does not have a physical display attached. > > With the patch applied the boot stops at the messages: > > [drm] Memory usable by graphics device = 2048M > [drm] Replacing VGA console driver > > and I need to interrupt or power off the box to get it back. > > (I did not notice messages about the R7 but they could have easily been > missed - this box does not have a serial console) > > Without the patch I get: > > Jun 28 14:53:54 localhost kernel: [2.075351] e1000e: Intel(R) PRO/1000 > Network Driver - 2.3.2-k > Jun 28 14:53:54 localhost kernel: [2.075796] [drm] Initialized drm 1.1.0 > 20060810 > Jun 28 14:53:54 localhost kernel: [2.075958] microcode: CPU0 sig=0x306c3, > pf=0x2, revision=0x17 > Jun 28 14:53:54 localhost kernel: [2.077289] microcode: CPU1 sig=0x306c3, > pf=0x2, revision=0x17 > Jun 28 14:53:54 localhost kernel: [2.077299] microcode: CPU2 sig=0x306c3, > pf=0x2, revision=0x17 > Jun 28 14:53:54 localhost kernel: [2.077307] microcode: CPU3 sig=0x306c3, > pf=0x2, revision=0x17 > Jun 28 14:53:54 localhost kernel: [2.077315] microcode: CPU4 sig=0x306c3, > pf=0x2, revision=0x17 > Jun 28 14:53:54 localhost kernel: [2.077325] microcode: CPU5 sig=0x306c3, > pf=0x2, revision=0x17 > Jun 28 14:53:54 localhost kernel: [2.077335] microcode: CPU6 sig=0x306c3, > pf=0x2, revision=0x17 > Jun 28 14:53:54 localhost kernel: [2.077342] microcode: CPU7 sig=0x306c3, > pf=0x2, revision=0x17 > Jun 28 14:53:54 localhost kernel: [2.077378] microcode: Microcode Update > Driver: v2.00 , Peter Oruba > Jun 28 14:53:54 localhost kernel: [2.079726] input: PC Speaker as > /devices/platform/pcspkr/input/input4 > Jun 28 14:53:54 localhost kernel: [2.083930] e1000e: Copyright(c) 1999 - > 2014 Intel Corporation. > Jun 28 14:53:54 localhost kernel: [2.084787] ACPI Warning: SystemIO range > 0xf040-0xf05f conflicts with OpRegion > 0xf040-0xf04f (\_SB_.PCI0.SBUS.SMBI) > (20140424/utaddress-258) > Jun 28 14:53:54 localhost kernel: [2.084788] ACPI: If an ACPI driver is > available for this device, you should use it instead of the native driver > Jun 28 14:53:54 localhost kernel: [2.084894] e1000e :00:19.0: > Interrupt Throttling Rate (ints/sec) set to dynamic conservative mode > Jun 28 14:53:54 localhost kernel: [2.084905] e1000e :00:19.0: irq 44 > for MSI/MSI-X > Jun 28 14:53:54 localhost kernel: [2.096721] iTCO_vendor_support: > vendor-support=0 > Jun 28 14:53:54 localhost kernel: [2.096780] AVX2 version of gcm_enc/dec > engaged. > Jun 28 14:53:54 localhost kernel: [2.098512] iTCO_wdt: Intel TCO WatchDog > Timer Driver v1.11 > Jun 28 14:53:54 localhost kernel: [2.099042] iTCO_wdt: Found a Lynx Point > TCO device (Version=2, TCOBASE=0x1860) > Jun 28 14:53:54 localhost kernel: [2.099561] iTCO_wdt: initialized. > heartbeat=30 sec (nowayout=0) > Jun 28 14:53:54 localhost kernel: [2.100401] [drm] radeon kernel > modesetting enabled. > Jun 28 14:53:54 localhost kernel: [2.100918] checking generic (e000 > 30) vs hw (e000 1000) > Jun 28 14:53:54 localhost kernel: [2.100919] fb: switching to radeondrmfb > from simple > Jun 28 14:53:54 localhost kernel: [2.101372] Console: switching to colour > dummy device 80x25 > Jun 28 14:53:54 localhost kernel: [2.101527] [drm] initializing kernel > modesetting (BONAIRE 0x1002:0x6658 0x174B:0xE253). > Jun 28 14:53:54 localhost kernel: [2.101534] [drm] register mmio base: > 0xF080 > Jun 28 14:53:54 localhost kernel: [2.101535] [drm] register mmio size: > 262144 > Jun 28 14:53:54 localhost kernel: [2.101540] [drm] doorbell mmio base: > 0xF000 > Jun 28 14:53:54 localhost kernel: [2.101541] [drm] doorbell mmio size: > 8388608 > Jun 28 14:53:54 localhost kernel: [2.101579] ATOM BIOS: Bonaire > Jun 28 14:53:54 localhost kernel: [2.101627] radeon :01:00.0: VRAM: > 2048M 0x - 0x7FFF (2048M used) > Jun 28 14:53:54 localhost kernel: [2.101629] radeon :01:00.0: GTT: > 1024M 0x8000 - 0xBFFF > Jun 28 14:53:54 localhost kernel: [2.101630] [drm] Detected VRAM > RAM=2048M, BAR=256M > Jun 28 14:53:54 localhost kernel: [2.101631] [drm] RAM width 128bits DDR > Jun 28 14:53:54 localhost kernel: [2.101659] [TTM] Zone kernel: > Available graphics memory: 8145364 kiB > Jun 28 14:53:54 localhost kernel: [2.101660] [TTM] Zone dma32: > Available graphics memory: 2097152 kiB > Jun 28 14:53:54 localhost kernel: [2.101662]
Re: [PATCH 3/4] DRBG: Fix format string for debugging statements
On Sun, 2014-06-29 at 05:46 +0200, Stephan Mueller wrote: > Am Sonntag, 29. Juni 2014, 12:24:02 schrieb Stephen Rothwell: > > Hi Stephen, > > > Hi Stephan, > > > > On Sat, 28 Jun 2014 22:01:46 +0200 Stephan Mueller > wrote: > > > @@ -1987,8 +1987,9 @@ static int __init drbg_init(void) > > > > > > if (ARRAY_SIZE(drbg_cores) * 2 > ARRAY_SIZE(drbg_algs)) { > > > > > > pr_info("DRBG: Cannot register all DRBG types" > > > > > > - "(slots needed: %lu, slots available: %lu)\n", > > > - ARRAY_SIZE(drbg_cores) * 2, ARRAY_SIZE(drbg_algs)); > > > + "(slots needed: %u, slots available: %u)\n", > > > + (unsigned int)ARRAY_SIZE(drbg_cores) * 2, > > > + (unsigned int)ARRAY_SIZE(drbg_algs)); > > > > Doesn't ARRAY_SIZE() always return a size_t? In which case surely we > > need no casts, but need to us %zu in the format string. > > Unfortunately not at all. On my x86_64, I get the compiler warning that > ARRAY_SIZE is a long unsigned int without the cast. This should fix that. --- include/linux/kernel.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 6e3d497..58bc57d 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -51,7 +51,8 @@ #define PTR_ALIGN(p, a)((typeof(p))ALIGN((unsigned long)(p), (a))) #define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0) -#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) +#define ARRAY_SIZE(arr)\ + (sizeof(arr) / sizeof((arr)[0]) + (size_t)__must_be_array(arr)) /* * This looks more complex than it should be. But we need to -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 3/4] DRBG: Fix format string for debugging statements
Am Sonntag, 29. Juni 2014, 12:24:02 schrieb Stephen Rothwell: Hi Stephen, > Hi Stephan, > > On Sat, 28 Jun 2014 22:01:46 +0200 Stephan Mueller wrote: > > @@ -1987,8 +1987,9 @@ static int __init drbg_init(void) > > > > if (ARRAY_SIZE(drbg_cores) * 2 > ARRAY_SIZE(drbg_algs)) { > > > > pr_info("DRBG: Cannot register all DRBG types" > > > > - "(slots needed: %lu, slots available: %lu)\n", > > - ARRAY_SIZE(drbg_cores) * 2, ARRAY_SIZE(drbg_algs)); > > + "(slots needed: %u, slots available: %u)\n", > > + (unsigned int)ARRAY_SIZE(drbg_cores) * 2, > > + (unsigned int)ARRAY_SIZE(drbg_algs)); > > Doesn't ARRAY_SIZE() always return a size_t? In which case surely we > need no casts, but need to us %zu in the format string. Unfortunately not at all. On my x86_64, I get the compiler warning that ARRAY_SIZE is a long unsigned int without the cast. Ciao Stephan -- | Cui bono? | -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Cleanup of Kernel Bugzilla
Thanks that's fine , I am new to kernel work , so a list of bugs would be very helpful in my helping out with debugging. Cheers Nick On Sat, Jun 28, 2014 at 3:18 PM, One Thousand Gnomes wrote: > On Fri, 27 Jun 2014 22:45:47 -0400 > Nick Krause wrote: > >> Do any of you use the kernel Bugzilla? If you do I was wondering if we >> can clean it up. > > Developers are generally focussed on fixing bugs. Also the way bugzilla > works a lot of developers don't close the bugs and the originators never > get around to it. > > Now if you want to clean up bugzilla then what would be really useful > (and probably quite tedious) is a list of all the bugs which end either in > > - confirmation it is fixed, but the bug is not closed > > - confirmation that it cannot be reproduced, but the bug is not closed > > - with a question asking for more information which has had no reply in > say 3 months > > Given lists of bugs in those categories I can then go and zap them. > > Alan -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] FIXME of file toploogy.h for alpha cpus
I thought I compiled tested it maybe not. I thought M= would work for alpha directory but maybe I have to enable in on x86. I don't known if there is a way to do this. Cheers Nick On Sat, Jun 28, 2014 at 3:53 PM, Sasha Levin wrote: > On 06/28/2014 12:07 AM, Nicholas Krause wrote: >> This patch fixs the FIXME message in the function *cpumask_of_node >> for using this function multiple times and the issue with recaluting >> the cpu node mask when reusing this function. >> >> Signed-off-by: Nicholas Krause >> --- >> arch/alpha/include/asm/topology.h | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/arch/alpha/include/asm/topology.h >> b/arch/alpha/include/asm/topology.h >> index 9251e13..d301f66 100644 >> --- a/arch/alpha/include/asm/topology.h >> +++ b/arch/alpha/include/asm/topology.h >> @@ -31,6 +31,9 @@ static const struct cpumask *cpumask_of_node(int node) >> if (node == -1) >> return cpu_all_mask; >> >> + else if (node == _to_cpumask_map[node]) >> + return _to_cpumask_map[node]; >> + >> cpumask_clear(_to_cpumask_map[node]); >> >> for_each_online_cpu(cpu) { >> > > Since this patch doesn't even compile, care to tell us how you tested it? > > > Thanks, > Sasha -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] scripts/kernel-doc: handle object-like macros
On 06/23/14 05:15, Horia Geanta wrote: > Object-like macros are different than function-like macros: > https://gcc.gnu.org/onlinedocs/cpp/Object-like-Macros.html > https://gcc.gnu.org/onlinedocs/cpp/Function-like-Macros.html > > They are not parsed correctly, generating invalid intermediate > files (xmls) for cases like: > #define BIT_MASK(0xFF << BIT_SHIFT) > where "OxFF <<" is considered to be parameter type. > > When parsing, we can differentiate beween these two types of macros by > checking whether there is at least one whitespace b/w "#define" and > first opening paranthesis. parenthesis. Where did you see a problem? I tested the patch and all of the Documentation/DocBook/*.xml files are the same without or with the patch. > > Signed-off-by: Horia Geanta > --- > scripts/kernel-doc | 15 --- > 1 file changed, 12 insertions(+), 3 deletions(-) > > diff --git a/scripts/kernel-doc b/scripts/kernel-doc > index da058da413e7..ffd35c9d616a 100755 > --- a/scripts/kernel-doc > +++ b/scripts/kernel-doc > @@ -2073,6 +2073,7 @@ sub check_return_section { > sub dump_function($$) { > my $prototype = shift; > my $file = shift; > +my $noret = 0; > > $prototype =~ s/^static +//; > $prototype =~ s/^extern +//; > @@ -2086,7 +2087,7 @@ sub dump_function($$) { > $prototype =~ s/__init_or_module +//; > $prototype =~ s/__must_check +//; > $prototype =~ s/__weak +//; > -$prototype =~ s/^#\s*define\s+//; #ak added > +my $define = $prototype =~ s/^#\s*define\s+//; #ak added > $prototype =~ s/__attribute__\s*\(\([a-z,]*\)\)//; > > # Yes, this truly is vile. We are looking for: > @@ -2105,7 +2106,15 @@ sub dump_function($$) { > # - atomic_set (macro) > # - pci_match_device, __copy_to_user (long return type) > > -if ($prototype =~ m/^()([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ || > +if ($define && $prototype =~ m/^()([a-zA-Z0-9_~:]+)\s+/) { > +# This is an object-like macro, it has no return type and no > parameter > +# list. > +# Function-like macros are not allowed to have spaces between > +# declaration_name and opening paranthesis (notice the \s+). > +$return_type = $1; > +$declaration_name = $2; > +$noret = 1; > +} elsif ($prototype =~ m/^()([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ || > $prototype =~ m/^(\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ || > $prototype =~ m/^(\w+\s*\*)\s*([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ || > $prototype =~ m/^(\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ || > @@ -2140,7 +2149,7 @@ sub dump_function($$) { > # of warnings goes sufficiently down, the check is only performed in > # verbose mode. > # TODO: always perform the check. > -if ($verbose) { > +if ($verbose && !$noret) { > check_return_section($file, $declaration_name, $return_type); > } > > -- ~Randy -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 3/4] DRBG: Fix format string for debugging statements
Hi Stephan, On Sat, 28 Jun 2014 22:01:46 +0200 Stephan Mueller wrote: > > @@ -1987,8 +1987,9 @@ static int __init drbg_init(void) > > if (ARRAY_SIZE(drbg_cores) * 2 > ARRAY_SIZE(drbg_algs)) { > pr_info("DRBG: Cannot register all DRBG types" > - "(slots needed: %lu, slots available: %lu)\n", > - ARRAY_SIZE(drbg_cores) * 2, ARRAY_SIZE(drbg_algs)); > + "(slots needed: %u, slots available: %u)\n", > + (unsigned int)ARRAY_SIZE(drbg_cores) * 2, > + (unsigned int)ARRAY_SIZE(drbg_algs)); Doesn't ARRAY_SIZE() always return a size_t? In which case surely we need no casts, but need to us %zu in the format string. -- Cheers, Stephen Rothwells...@canb.auug.org.au -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/4] Documentation: use subdir-y to avoid unnecessary built-in.o files
On 04/17/14 07:11, Peter Foley wrote: > Change the Documentation makefiles from obj-m to subdir-y > to avoid generating unnecessary built-in.o files since nothing > in Documentation/ is ever linked in to vmlinux. > > Signed-off-by: Peter Foley Hi Michal, Does this look good to you? I don't have enough makefile fu (or is it foo?) to judge this. Thanks. > --- > Documentation/Makefile | 6 +++--- > Documentation/accounting/Makefile | 3 --- > Documentation/auxdisplay/Makefile | 3 --- > Documentation/filesystems/Makefile | 3 --- > Documentation/ia64/Makefile| 3 --- > Documentation/laptops/Makefile | 3 --- > Documentation/misc-devices/Makefile| 1 + > Documentation/misc-devices/mei/Makefile| 3 --- > Documentation/networking/Makefile | 8 +--- > Documentation/networking/timestamping/Makefile | 3 --- > Documentation/pcmcia/Makefile | 3 --- > Documentation/spi/Makefile | 3 --- > Documentation/timers/Makefile | 3 --- > Documentation/watchdog/Makefile| 1 + > Documentation/watchdog/src/Makefile| 3 --- > 15 files changed, 6 insertions(+), 43 deletions(-) > create mode 100644 Documentation/misc-devices/Makefile > create mode 100644 Documentation/watchdog/Makefile > > diff --git a/Documentation/Makefile b/Documentation/Makefile > index 31d302b..605f84f 100644 > --- a/Documentation/Makefile > +++ b/Documentation/Makefile > @@ -1,3 +1,3 @@ > -obj-m := DocBook/ accounting/ auxdisplay/ connector/ \ > - filesystems/ filesystems/configfs/ ia64/ laptops/ networking/ \ > - pcmcia/ spi/ timers/ watchdog/src/ misc-devices/mei/ > +subdir-y := DocBook accounting auxdisplay connector \ > + filesystems filesystems ia64 laptops networking \ > + pcmcia spi timers watchdog misc-devices > diff --git a/Documentation/accounting/Makefile > b/Documentation/accounting/Makefile > index 31929eb..7e232cb 100644 > --- a/Documentation/accounting/Makefile > +++ b/Documentation/accounting/Makefile > @@ -1,6 +1,3 @@ > -# kbuild trick to avoid linker error. Can be omitted if a module is built. > -obj- := dummy.o > - > # List of programs to build > hostprogs-y := getdelays > > diff --git a/Documentation/auxdisplay/Makefile > b/Documentation/auxdisplay/Makefile > index 51fe233..ada4dac 100644 > --- a/Documentation/auxdisplay/Makefile > +++ b/Documentation/auxdisplay/Makefile > @@ -1,6 +1,3 @@ > -# kbuild trick to avoid linker error. Can be omitted if a module is built. > -obj- := dummy.o > - > # List of programs to build > hostprogs-y := cfag12864b-example > > diff --git a/Documentation/filesystems/Makefile > b/Documentation/filesystems/Makefile > index a5dd114..883010c 100644 > --- a/Documentation/filesystems/Makefile > +++ b/Documentation/filesystems/Makefile > @@ -1,6 +1,3 @@ > -# kbuild trick to avoid linker error. Can be omitted if a module is built. > -obj- := dummy.o > - > # List of programs to build > hostprogs-y := dnotify_test > > diff --git a/Documentation/ia64/Makefile b/Documentation/ia64/Makefile > index b75db69..d493163 100644 > --- a/Documentation/ia64/Makefile > +++ b/Documentation/ia64/Makefile > @@ -1,6 +1,3 @@ > -# kbuild trick to avoid linker error. Can be omitted if a module is built. > -obj- := dummy.o > - > # List of programs to build > hostprogs-y := aliasing-test > > diff --git a/Documentation/laptops/Makefile b/Documentation/laptops/Makefile > index 5cb144a..0abe44f 100644 > --- a/Documentation/laptops/Makefile > +++ b/Documentation/laptops/Makefile > @@ -1,6 +1,3 @@ > -# kbuild trick to avoid linker error. Can be omitted if a module is built. > -obj- := dummy.o > - > # List of programs to build > hostprogs-y := dslm > > diff --git a/Documentation/misc-devices/Makefile > b/Documentation/misc-devices/Makefile > new file mode 100644 > index 000..e2b7aa4 > --- /dev/null > +++ b/Documentation/misc-devices/Makefile > @@ -0,0 +1 @@ > +subdir-y := mei > diff --git a/Documentation/misc-devices/mei/Makefile > b/Documentation/misc-devices/mei/Makefile > index 00e8c3e..d758047 100644 > --- a/Documentation/misc-devices/mei/Makefile > +++ b/Documentation/misc-devices/mei/Makefile > @@ -1,6 +1,3 @@ > -# kbuild trick to avoid linker error. Can be omitted if a module is built. > -obj- := dummy.o > - > # List of programs to build > hostprogs-y := mei-amt-version > HOSTCFLAGS_mei-amt-version.o += -I$(objtree)/usr/include > diff --git a/Documentation/networking/Makefile > b/Documentation/networking/Makefile > index 0aa1ac9..4c5d7c4 100644 > --- a/Documentation/networking/Makefile > +++ b/Documentation/networking/Makefile > @@ -1,7 +1 @@ > -# kbuild trick to avoid linker error. Can be omitted if a module is built. > -obj- := dummy.o > - > -# Tell kbuild to always build the programs > -always := $(hostprogs-y) > - > -obj-m := timestamping/ > +subdir-y :=
Re: [PATCH 2/4] DRBG: cleanup of preprocessor macros
Hi Stephan, On Sat, 28 Jun 2014 22:00:07 +0200 Stephan Mueller wrote: > > diff --git a/crypto/drbg.c b/crypto/drbg.c > index 6679a26..03a230e 100644 > --- a/crypto/drbg.c > +++ b/crypto/drbg.c > @@ -102,8 +102,13 @@ > #if !defined(CONFIG_CRYPTO_DRBG_HASH) && \ > !defined(CONFIG_CRYPTO_DRBG_HMAC) && \ > !defined(CONFIG_CRYPTO_DRBG_CTR) > -#warning "The DRBG code is useless without compiling at least one DRBG type" > -#endif > +#define CRYPTO_DRBG_NONE_STRING "none " > +static int __init drbg_init(void) > +{ > + pr_warn("DRBG: no DRBG core was compiled!\n"); > + return -EFAULT; > +} > +#else Wouldn't this be better handled by Kconfig so that we don't even try to build this unless one of the required core modules is chosen? -- Cheers, Stephen Rothwells...@canb.auug.org.au signature.asc Description: PGP signature
Re: [PATCH v2] Documentation: Rename hpfall.c => freefall.c, fixes for Dell
Hi, This should really be done as 2 separate patches: One to move/rename the file and one to make the changes/additions to it for DELL. Can you resend it as 2 patches like that, please? Thanks... and sorry for the delay. On 06/11/14 01:02, Pali Rohár wrote: > Dell kernel driver dell-smo8800 provides same freefall interface as hp_accel > so > program hpfall.c works also on Dell laptops. So rename it to freefall.c. > > Dell driver does not provide hp::hddprotect led so make sure that freefall.c > works also if hp::hddprotect does not exist in sysfs. > > Additionally write info to syslog. > > Signed-off-by: Pali Rohár > Cc: Sonal Santan > --- > Changes since v1: > * Fixed warnings: Missing a blank line after declarations > --- > Documentation/laptops/00-INDEX |4 +- > Documentation/laptops/freefall.c | 177 > ++ > Documentation/laptops/hpfall.c | 146 --- > 3 files changed, 179 insertions(+), 148 deletions(-) > create mode 100644 Documentation/laptops/freefall.c > delete mode 100644 Documentation/laptops/hpfall.c -- ~Randy -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH RFC net-next 08/14] bpf: add eBPF verifier
On Sat, Jun 28, 2014 at 1:25 PM, Alexei Starovoitov wrote: > On Sat, Jun 28, 2014 at 9:01 AM, Andy Lutomirski wrote: >> On Fri, Jun 27, 2014 at 5:06 PM, Alexei Starovoitov >> wrote: >>> Safety of eBPF programs is statically determined by the verifier, which >>> detects: >> >> This is a very high-level review. I haven't tried to read all the >> code yet, and this is mostly questions rather than real comments. > > These were great questions! I hope I answered them. If not, please > continue asking. I have plenty more questions, but here's one right now: does anything prevent programs from using pointers in comparisons, returning pointers, or otherwise figuring out the value of a pointer? If so, I think it would be worthwhile to prevent that so that eBPF programs can't learn kernel addresses. --Andy -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH RFC net-next 03/14] bpf: introduce syscall(BPF, ...) and BPF maps
On Sat, Jun 28, 2014 at 1:49 PM, Alexei Starovoitov wrote: > On Sat, Jun 28, 2014 at 8:34 AM, Andy Lutomirski wrote: >> On Fri, Jun 27, 2014 at 11:43 PM, Alexei Starovoitov >> wrote: >>> On Fri, Jun 27, 2014 at 11:25 PM, Andy Lutomirski >>> wrote: On Fri, Jun 27, 2014 at 10:55 PM, Alexei Starovoitov wrote: > On Fri, Jun 27, 2014 at 5:16 PM, Andy Lutomirski > wrote: >> On Fri, Jun 27, 2014 at 5:05 PM, Alexei Starovoitov >> wrote: >>> BPF syscall is a demux for different BPF releated commands. >>> >>> 'maps' is a generic storage of different types for sharing data between >>> kernel >>> and userspace. >>> >>> The maps can be created/deleted from user space via BPF syscall: >>> - create a map with given id, type and attributes >>> map_id = bpf_map_create(int map_id, map_type, struct nlattr *attr, >>> int len) >>> returns positive map id or negative error >>> >>> - delete map with given map id >>> err = bpf_map_delete(int map_id) >>> returns zero or negative error >> >> What's the scope of "id"? How is it secured? > > the map and program id space is global and it's cap_sys_admin only. > There is no pressing need to do it with per-user limits. > So the whole thing is root only for now. > Hmm. This may be unpleasant if you ever want to support non-root or namespaced operation. >>> >>> I think it will be easy to extend it per namespace when we lift >>> root-only restriction. It will be seamless without user api changes. >>> >> >> It might be seamless, but I'm not sure it'll be very useful. See below. >> How hard would it be to give these things fds? >>> >>> you mean programs/maps auto-terminate when creator process >>> exits? I thought about it and it's appealing at first glance, but >>> doesn't fit the model of existing tracepoint events which are global. >>> The programs attached to events need to live without 'daemon' >>> hanging around. Therefore I picked 'kernel module'- like method. >> >> Here are some things I'd like to be able to do: >> >> - Load an eBPF program and use it as a seccomp filter. >> >> - Create a read-only map and reference it from a seccomp filter. >> >> - Create a data structure that a seccomp filter can write but that >> the filtered process can only read. >> >> - Create a data structure that a seccomp filter can read but that >> some other trusted process can write. >> >> - Create a network filter of some sort and give permission to >> manipulate a list of ports to an otherwise untrusted process. >> >> The first four of these shouldn't require privilege. >> >> All of this fits nicely into a model where all of the eBPF objects >> (filters and data structures) are represented by fds. Read access to >> the fd lets you read (or execute eBPF programs). Write access to the >> fd lets you write. You can send them around naturally using >> SCM_RIGHTS, and you can create deprivileged versions by reopening the >> objects with less access. > > Sorry I don't like 'fd' direction at all. > 1. it will make the whole thing very socket specific and 'net' dependent. > but the goal here is to be able to use eBPF for tracing in embedded > setups. So it's gotta be net independent. > 2. sockets are already overloaded with all sorts of stuff. Adding more > types of sockets will complicate it a lot. > 3. and most important. read/write operations on sockets are not > done every nanosecond, whereas lookup operations on bpf maps > are done every dozen instructions, so we cannot have any overhead > when accessing maps. > In other words the verifier is done as static analyzer. I moved all > the complexity to verify time, so at run-time the programs are as > fast as possible. I'm strongly against run-time checks in critical path, > since they kill performance and make the whole approach a lot less usable. I may have described my suggestion poorly. I'm suggesting that all of these global ids be replaced *for userspace's benefit* with fds. That is, a map would have an associated struct inode, and, when you load an eBPF program, you'd pass fds into the kernel instead of global ids. The kernel would still compile the eBPF program to use the global ids, though. This should have no effect at all on the execution of eBPF programs. eBPF programs wouldn't be able to look up fds at runtime, and this should work without CONFIG_NET. --Andy -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 3.15 000/139] 3.15.3-stable review
On Sun, Jun 29, 2014 at 09:53:20AM +0900, Satoru Takeuchi wrote: > At Sat, 28 Jun 2014 15:32:53 -0700, > Guenter Roeck wrote: > > > > On 06/28/2014 10:46 AM, Greg Kroah-Hartman wrote: > > > This is the start of the stable review cycle for the 3.15.3 release. > > > There are 139 patches in this series, all will be posted as a response > > > to this one. If anyone has any issues with these being applied, please > > > let me know. > > > > > > Responses should be made by Mon Jun 30 17:45:39 UTC 2014. > > > Anything received after that time might be too late. > > > > > > > Build results: > > total: 144 pass: 136 skipped: 5 fail: 3 > > Failed builds: > > powerpc:allmodconfig > > powerpc:allmodconfig > > unicore32:defconfig > > > > Qemu tests all passed. > > > > Results are as expected. Details are available at > > http://server.roeck-us.net:8010/builders. > > > > Guenter > > > > 3.15.3-rc1, 3.14.10-rc1, 3.10.46-r1, and 3.4.96-rc1 passed my test. > > - Test Cases: >- Build this kernel. >- Boot this kernel. >- Build the latest mainline kernel with this kernel. > > - Test Tool: >https://github.com/satoru-takeuchi/test-linux-stable > > - Test Result (kernel .config, ktest config and test log): >http://satoru-takeuchi.org/test-linux-stable/results/- datetime>.tar.xz > > - Build Environment: >- OS: Debian Jessy x86_64 >- CPU: Intel(R) Core(TM) i5-2400 CPU @ 3.10GHz x 4 >- memory: 8GB > > - Test Target Environment: >- Debian Jessy x86_64 (KVM guest on the Build Environment) >- # of vCPU: 2 >- memory: 2GB Thanks for testing and letting me know. greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Documentation/Changes: cleanup mcelog paragraph
On 06/24/14 05:12, Paul Bolle wrote: > The paragraph on mcelog currently describes kernel v2.6.31. In that > kernel the mce code (for i386, that is) was in transition. Ever since > v2.6.32 the situation is much simpler (eg, mcelog is now needed to > process events on almost all x86 machines, i386 and x86-64). Since this > "document is designed to provide a list of the minimum levels of > software necessary to run the 3.0 kernels" let's just describe that > situation. > > Signed-off-by: Paul Bolle > --- > Documentation/Changes | 9 +++-- > 1 file changed, 3 insertions(+), 6 deletions(-) > > diff --git a/Documentation/Changes b/Documentation/Changes > index 2254db0f00a5..227bec88021e 100644 > --- a/Documentation/Changes > +++ b/Documentation/Changes > @@ -280,12 +280,9 @@ that is possible. > mcelog > -- > > -In Linux 2.6.31+ the i386 kernel needs to run the mcelog utility > -as a regular cronjob similar to the x86-64 kernel to process and log > -machine check events when CONFIG_X86_NEW_MCE is enabled. Machine check > -events are errors reported by the CPU. Processing them is strongly > encouraged. > -All x86-64 kernels since 2.6.4 require the mcelog utility to > -process machine checks. > +On x86 kernels the mcelog utility is needed to process and log machine check > +events when CONFIG_X86_MCE is enabled. Machine check events are errors > reported > +by the CPU. Processing them is strongly encouraged. > > Getting updated software > > Applied with Andi's ack. Thanks. -- ~Randy -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Documentation: devres: Add devm_kmalloc() et al
[adding Tejun Heo] patch OK, Tejun? You want to apply it? On 06/23/14 04:28, Daniel Thompson wrote: > Commit 64c862a83... added new alloc variants to the devres managed > API. These should be included in the list of managed API found in > devres.txt. > > Signed-off-by: Daniel Thompson > Cc: Randy Dunlap > Cc: Grant Likely > Cc: Rob Herring > Cc: Joe Perches > Cc: linux-...@vger.kernel.org > --- > Documentation/driver-model/devres.txt | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/Documentation/driver-model/devres.txt > b/Documentation/driver-model/devres.txt > index 1525e30..91f5633 100644 > --- a/Documentation/driver-model/devres.txt > +++ b/Documentation/driver-model/devres.txt > @@ -234,7 +234,10 @@ certainly invest a bit more effort into libata core > layer). >- > > MEM > + devm_kmalloc() >devm_kzalloc() > + devm_kmalloc_array() > + devm_kcalloc() >devm_kfree() >devm_kmemdup() >devm_get_free_pages() > -- ~Randy -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/4] fs: asus_atk0110: Fix DEFINE_SIMPLE_ATTRIBUTE semicolon definition and use
On 06/28/2014 05:20 PM, Joe Perches wrote: The DEFINE_SIMPLE_ATTRIBUTE macro should not end in a ; Fix the one use in the kernel tree that did not have a semicolon. Signed-off-by: Joe Perches For hwmon: Acked-by: Guenter Roeck -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 3.15 000/139] 3.15.3-stable review
At Sat, 28 Jun 2014 15:32:53 -0700, Guenter Roeck wrote: > > On 06/28/2014 10:46 AM, Greg Kroah-Hartman wrote: > > This is the start of the stable review cycle for the 3.15.3 release. > > There are 139 patches in this series, all will be posted as a response > > to this one. If anyone has any issues with these being applied, please > > let me know. > > > > Responses should be made by Mon Jun 30 17:45:39 UTC 2014. > > Anything received after that time might be too late. > > > > Build results: > total: 144 pass: 136 skipped: 5 fail: 3 > Failed builds: > powerpc:allmodconfig > powerpc:allmodconfig > unicore32:defconfig > > Qemu tests all passed. > > Results are as expected. Details are available at > http://server.roeck-us.net:8010/builders. > > Guenter > 3.15.3-rc1, 3.14.10-rc1, 3.10.46-r1, and 3.4.96-rc1 passed my test. - Test Cases: - Build this kernel. - Boot this kernel. - Build the latest mainline kernel with this kernel. - Test Tool: https://github.com/satoru-takeuchi/test-linux-stable - Test Result (kernel .config, ktest config and test log): http://satoru-takeuchi.org/test-linux-stable/results/-.tar.xz - Build Environment: - OS: Debian Jessy x86_64 - CPU: Intel(R) Core(TM) i5-2400 CPU @ 3.10GHz x 4 - memory: 8GB - Test Target Environment: - Debian Jessy x86_64 (KVM guest on the Build Environment) - # of vCPU: 2 - memory: 2GB Thanks, Satoru -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] ntfs: Drop cast
Hi, Thanks for your patch. Your patch is obviously correct however I actually prefer to have the type casts in place because it clearly shows what the variable type being assigned to is so I find it makes the code more readable to cast void pointers to the target variable type so I don't have to go and look up the type higher up. Having said that I don't feel that strongly about it so I have no real objection to the patch getting applied... Best regards, Anton On 28 Jun 2014, at 14:33, Himangi Saraogi wrote: > This patch removes the cast on data of type void * as it is not needed. > The following Coccinelle semantic patch was used for making the change: > > @r@ > expression x; > void* e; > type T; > identifier f; > @@ > > ( > *((T *)e) > | > ((T *)x)[...] > | > ((T *)x)->f > | > - (T *) > e > ) > > Signed-off-by: Himangi Saraogi > Acked-by: Julia Lawall > --- > fs/ntfs/inode.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c > index f47af5e..b3c55fc 100644 > --- a/fs/ntfs/inode.c > +++ b/fs/ntfs/inode.c > @@ -1817,7 +1817,7 @@ int ntfs_read_inode_mount(struct inode *vi) > i = vol->mft_record_size; > if (i < sb->s_blocksize) > i = sb->s_blocksize; > - m = (MFT_RECORD*)ntfs_malloc_nofs(i); > + m = ntfs_malloc_nofs(i); > if (!m) { > ntfs_error(sb, "Failed to allocate buffer for $MFT record 0."); > goto err_out; -- Anton Altaparmakov (replace at with @) University of Cambridge Information Services, Roger Needham Building 7 JJ Thomson Avenue, Cambridge, CB3 0RB, UK -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/4] fs.h: Kernel style updates
Mostly s/s/w/hitespace cleaning. Joe Perches (4): fs.h: Remove unnecessary extern prototypes fs.h: Whitespace neatening fs.h: A few more whitespace neatenings fs: asus_atk0110: Fix DEFINE_SIMPLE_ATTRIBUTE semicolon definition and use drivers/hwmon/asus_atk0110.c |2 +- include/linux/fs.h | 1185 +- 2 files changed, 598 insertions(+), 589 deletions(-) -- 1.8.1.2.459.gbcd45b4.dirty -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/4] fs.h: Remove unnecessary extern prototypes
This file has a mixture of prototypes with and without extern. Remove the extern uses. Signed-off-by: Joe Perches --- include/linux/fs.h | 636 ++--- 1 file changed, 318 insertions(+), 318 deletions(-) diff --git a/include/linux/fs.h b/include/linux/fs.h index 6cf9693..ad413bf 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -50,12 +50,12 @@ struct seq_file; struct workqueue_struct; struct iov_iter; -extern void __init inode_init(void); -extern void __init inode_init_early(void); -extern void __init files_init(unsigned long); +void __init inode_init(void); +void __init inode_init_early(void); +void __init files_init(unsigned long); extern struct files_stat_struct files_stat; -extern unsigned long get_max_files(void); +unsigned long get_max_files(void); extern int sysctl_nr_open; extern struct inodes_stat_t inodes_stat; extern int leases_enable, lease_break_time; @@ -711,7 +711,7 @@ static inline unsigned imajor(const struct inode *inode) return MAJOR(inode->i_rdev); } -extern struct block_device *I_BDEV(struct inode *inode); +struct block_device *I_BDEV(struct inode *inode); struct fown_struct { rwlock_t lock; /* protects pid, uid, euid fields */ @@ -920,46 +920,46 @@ struct file_lock { #include -extern void send_sigio(struct fown_struct *fown, int fd, int band); +void send_sigio(struct fown_struct *fown, int fd, int band); #ifdef CONFIG_FILE_LOCKING -extern int fcntl_getlk(struct file *, unsigned int, struct flock __user *); -extern int fcntl_setlk(unsigned int, struct file *, unsigned int, +int fcntl_getlk(struct file *, unsigned int, struct flock __user *); +int fcntl_setlk(unsigned int, struct file *, unsigned int, struct flock __user *); #if BITS_PER_LONG == 32 -extern int fcntl_getlk64(struct file *, unsigned int, struct flock64 __user *); -extern int fcntl_setlk64(unsigned int, struct file *, unsigned int, +int fcntl_getlk64(struct file *, unsigned int, struct flock64 __user *); +int fcntl_setlk64(unsigned int, struct file *, unsigned int, struct flock64 __user *); #endif -extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg); -extern int fcntl_getlease(struct file *filp); +int fcntl_setlease(unsigned int fd, struct file *filp, long arg); +int fcntl_getlease(struct file *filp); /* fs/locks.c */ void locks_free_lock(struct file_lock *fl); -extern void locks_init_lock(struct file_lock *); -extern struct file_lock * locks_alloc_lock(void); -extern void locks_copy_lock(struct file_lock *, struct file_lock *); -extern void __locks_copy_lock(struct file_lock *, const struct file_lock *); -extern void locks_remove_posix(struct file *, fl_owner_t); -extern void locks_remove_file(struct file *); -extern void locks_release_private(struct file_lock *); -extern void posix_test_lock(struct file *, struct file_lock *); -extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *); -extern int posix_lock_file_wait(struct file *, struct file_lock *); -extern int posix_unblock_lock(struct file_lock *); -extern int vfs_test_lock(struct file *, struct file_lock *); -extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *); -extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl); -extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl); -extern int __break_lease(struct inode *inode, unsigned int flags, unsigned int type); -extern void lease_get_mtime(struct inode *, struct timespec *time); -extern int generic_setlease(struct file *, long, struct file_lock **); -extern int vfs_setlease(struct file *, long, struct file_lock **); -extern int lease_modify(struct file_lock **, int); -extern int lock_may_read(struct inode *, loff_t start, unsigned long count); -extern int lock_may_write(struct inode *, loff_t start, unsigned long count); +void locks_init_lock(struct file_lock *); +struct file_lock * locks_alloc_lock(void); +void locks_copy_lock(struct file_lock *, struct file_lock *); +void __locks_copy_lock(struct file_lock *, const struct file_lock *); +void locks_remove_posix(struct file *, fl_owner_t); +void locks_remove_file(struct file *); +void locks_release_private(struct file_lock *); +void posix_test_lock(struct file *, struct file_lock *); +int posix_lock_file(struct file *, struct file_lock *, struct file_lock *); +int posix_lock_file_wait(struct file *, struct file_lock *); +int posix_unblock_lock(struct file_lock *); +int vfs_test_lock(struct file *, struct file_lock *); +int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *); +int vfs_cancel_lock(struct file *filp, struct file_lock *fl); +int flock_lock_file_wait(struct file *filp, struct file_lock *fl); +int __break_lease(struct inode *inode, unsigned int flags, unsigned int type); +void lease_get_mtime(struct inode *, struct timespec *time); +int
[PATCH 4/4] fs: asus_atk0110: Fix DEFINE_SIMPLE_ATTRIBUTE semicolon definition and use
The DEFINE_SIMPLE_ATTRIBUTE macro should not end in a ; Fix the one use in the kernel tree that did not have a semicolon. Signed-off-by: Joe Perches --- drivers/hwmon/asus_atk0110.c | 2 +- include/linux/fs.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hwmon/asus_atk0110.c b/drivers/hwmon/asus_atk0110.c index ae208f6..cccef87 100644 --- a/drivers/hwmon/asus_atk0110.c +++ b/drivers/hwmon/asus_atk0110.c @@ -688,7 +688,7 @@ static int atk_debugfs_gitm_get(void *p, u64 *val) DEFINE_SIMPLE_ATTRIBUTE(atk_debugfs_gitm, atk_debugfs_gitm_get, NULL, - "0x%08llx\n") + "0x%08llx\n"); static int atk_acpi_print(char *buf, size_t sz, union acpi_object *obj) { diff --git a/include/linux/fs.h b/include/linux/fs.h index 8a9e7f8..e78e9ac 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2701,7 +2701,7 @@ static const struct file_operations __fops = { \ .read= simple_attr_read,\ .write = simple_attr_write, \ .llseek = generic_file_llseek, \ -}; +} static inline __printf(1, 2) void __simple_attr_check_format(const char *fmt, ...) -- 1.8.1.2.459.gbcd45b4.dirty -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/4] fs.h: Whitespace neatening
Make the whitespace a lot more kernel style conformant. git diff -w shows no differences. Signed-off-by: Joe Perches --- include/linux/fs.h | 450 ++--- 1 file changed, 225 insertions(+), 225 deletions(-) diff --git a/include/linux/fs.h b/include/linux/fs.h index ad413bf..a3e748e 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -64,9 +64,9 @@ extern int sysctl_protected_hardlinks; struct buffer_head; typedef int (get_block_t)(struct inode *inode, sector_t iblock, - struct buffer_head *bh_result, int create); + struct buffer_head *bh_result, int create); typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset, - ssize_t bytes, void *private); + ssize_t bytes, void *private); #define MAY_EXEC 0x0001 #define MAY_WRITE 0x0002 @@ -192,8 +192,8 @@ typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset, #define READ 0 #define WRITE RW_MASK #define READA RWA_MASK -#define KERNEL_READ(READ|REQ_KERNEL) -#define KERNEL_WRITE (WRITE|REQ_KERNEL) +#define KERNEL_READ(READ | REQ_KERNEL) +#define KERNEL_WRITE (WRITE | REQ_KERNEL) #define READ_SYNC (READ | REQ_SYNC) #define WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE) @@ -256,25 +256,25 @@ struct iattr { */ #include -/** +/** * enum positive_aop_returns - aop return codes with specific semantics * * @AOP_WRITEPAGE_ACTIVATE: Informs the caller that page writeback has - * completed, that the page is still locked, and - * should be considered active. The VM uses this hint - * to return the page to the active list -- it won't - * be a candidate for writeback again in the near - * future. Other callers must be careful to unlock - * the page if they get this return. Returned by - * writepage(); + * completed, that the page is still locked, and + * should be considered active. The VM uses this hint + * to return the page to the active list -- it won't + * be a candidate for writeback again in the near + * future. Other callers must be careful to unlock + * the page if they get this return. Returned by + * writepage(); * * @AOP_TRUNCATED_PAGE: The AOP method that was handed a locked page has - * unlocked it and the page might have been truncated. - * The caller should back up to acquiring a new page and - * trying again. The aop will be taking reasonable - * precautions not to livelock. If the caller held a page - * reference, it should drop it before retrying. Returned - * by readpage(). + * unlocked it and the page might have been truncated. + * The caller should back up to acquiring a new page and + * trying again. The aop will be taking reasonable + * precautions not to livelock. If the caller held a page + * reference, it should drop it before retrying. Returned + * by readpage(). * * address_space_operation functions return these large constants to indicate * special semantics to the caller. These are much larger than the bytes in a @@ -320,7 +320,7 @@ typedef struct { } read_descriptor_t; typedef int (*read_actor_t)(read_descriptor_t *, struct page *, - unsigned long, unsigned long); + unsigned long, unsigned long); struct address_space_operations { int (*writepage)(struct page *page, struct writeback_control *wbc); @@ -333,38 +333,38 @@ struct address_space_operations { int (*set_page_dirty)(struct page *page); int (*readpages)(struct file *filp, struct address_space *mapping, - struct list_head *pages, unsigned nr_pages); +struct list_head *pages, unsigned nr_pages); int (*write_begin)(struct file *, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, - struct page **pagep, void **fsdata); + loff_t pos, unsigned len, unsigned flags, + struct page **pagep, void **fsdata); int (*write_end)(struct file *, struct address_space *mapping, - loff_t pos, unsigned len, unsigned copied, - struct page *page, void
[PATCH 3/4] fs.h: A few more whitespace neatenings
Some line removals and line wrapping to 80 columns along with few trivial other whitespace changes. Signed-off-by: Joe Perches --- include/linux/fs.h | 257 +++-- 1 file changed, 133 insertions(+), 124 deletions(-) diff --git a/include/linux/fs.h b/include/linux/fs.h index a3e748e..8a9e7f8 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1,7 +1,6 @@ #ifndef _LINUX_FS_H #define _LINUX_FS_H - #include #include #include @@ -412,25 +411,25 @@ struct request_queue; struct block_device { dev_t bd_dev; /* not a kdev_t - it's a search key */ int bd_openers; - struct inode * bd_inode; /* will die */ - struct super_block *bd_super; + struct inode*bd_inode; /* will die */ + struct super_block *bd_super; struct mutexbd_mutex; /* open/close mutex */ struct list_headbd_inodes; - void * bd_claiming; - void * bd_holder; + void*bd_claiming; + void*bd_holder; int bd_holders; boolbd_write_holder; #ifdef CONFIG_SYSFS struct list_headbd_holder_disks; #endif - struct block_device * bd_contains; + struct block_device *bd_contains; unsignedbd_block_size; - struct hd_struct * bd_part; + struct hd_struct*bd_part; /* number of times partitions within this device have been opened. */ unsignedbd_part_count; int bd_invalidated; - struct gendisk *bd_disk; - struct request_queue * bd_queue; + struct gendisk *bd_disk; + struct request_queue*bd_queue; struct list_headbd_list; /* * Private data. You must have bd_claim'ed the block_device @@ -461,8 +460,8 @@ int mapping_tagged(struct address_space *mapping, int tag); */ static inline int mapping_mapped(struct address_space *mapping) { - return !RB_EMPTY_ROOT(>i_mmap) || - !list_empty(>i_mmap_nonlinear); + return !RB_EMPTY_ROOT(>i_mmap) || + !list_empty(>i_mmap_nonlinear); } /* @@ -609,8 +608,7 @@ static inline int inode_unhashed(struct inode *inode) * The locking order between these classes is * parent -> child -> normal -> xattr -> second non-directory */ -enum inode_i_mutex_lock_class -{ +enum inode_i_mutex_lock_class { I_MUTEX_NORMAL, I_MUTEX_PARENT, I_MUTEX_CHILD, @@ -803,7 +801,7 @@ static inline struct file *get_file(struct file *f) /* Page cache limit. The filesystems should put that into their s_maxbytes limits, otherwise bad things can happen in VM. */ #if BITS_PER_LONG == 32 -#define MAX_LFS_FILESIZE (((loff_t)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1) +#define MAX_LFS_FILESIZE (((loff_t)PAGE_CACHE_SIZE << (BITS_PER_LONG - 1)) - 1) #elif BITS_PER_LONG == 64 #define MAX_LFS_FILESIZE ((loff_t)0x7fffLL) #endif @@ -894,7 +892,7 @@ struct file_lock { loff_t fl_start; loff_t fl_end; - struct fasync_struct * fl_fasync; /* for lease break notifications */ + struct fasync_struct *fl_fasync; /* for lease break notifications */ /* for lease breaks: */ unsigned long fl_break_time; unsigned long fl_downgrade_time; @@ -939,7 +937,7 @@ int fcntl_getlease(struct file *filp); /* fs/locks.c */ void locks_free_lock(struct file_lock *fl); void locks_init_lock(struct file_lock *); -struct file_lock * locks_alloc_lock(void); +struct file_lock *locks_alloc_lock(void); void locks_copy_lock(struct file_lock *, struct file_lock *); void __locks_copy_lock(struct file_lock *, const struct file_lock *); void locks_remove_posix(struct file *, fl_owner_t); @@ -950,7 +948,8 @@ int posix_lock_file(struct file *, struct file_lock *, struct file_lock *); int posix_lock_file_wait(struct file *, struct file_lock *); int posix_unblock_lock(struct file_lock *); int vfs_test_lock(struct file *, struct file_lock *); -int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *); +int vfs_lock_file(struct file *, unsigned int, struct file_lock *, + struct file_lock *); int vfs_cancel_lock(struct file *filp, struct file_lock *fl); int flock_lock_file_wait(struct file *filp, struct file_lock *fl); int __break_lease(struct inode *inode, unsigned int flags, unsigned int type); @@ -998,32 +997,26 @@ static inline int fcntl_getlease(struct file *filp) static inline void locks_init_lock(struct file_lock *fl) { - return; } static inline void __locks_copy_lock(struct file_lock *new, struct file_lock *fl) { - return; } static inline void locks_copy_lock(struct file_lock *new,
hii
Good day Please did you receive the mail i sent to you last time. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] sched.h: Remove useless `const' from function return type
This fixes: cc1: warnings being treated as errors In file included from include/linux/ptrace.h:5, from arch/mips/kernel/cpu-probe.c:16: include/linux/sched.h:1002: warning: type qualifiers ignored on function return type make[2]: *** [arch/mips/kernel/cpu-probe.o] Error 1 This is a regression introduced with commit 143e1e28cb40bed836b0a06567208bd7347c9672 [sched: Rework sched_domain topology definition]. The warning itself is benign except in places like the arch/mips subtree where we use `-Werror' to enforce good coding practices. Apparently the warning is GCC-version specific, some versions produce it and some do not. Signed-off-by: Maciej W. Rozycki --- Vincent, Did you mean: typedef int __attribute__((const)) (*sched_domain_flags_f)(void); by any chance? Maciej linux-sched-domain-flags-type.patch Index: linux-20140623-swarm64/include/linux/sched.h === --- linux-20140623-swarm64.orig/include/linux/sched.h +++ linux-20140623-swarm64/include/linux/sched.h @@ -999,7 +999,7 @@ void free_sched_domains(cpumask_var_t do bool cpus_share_cache(int this_cpu, int that_cpu); typedef const struct cpumask *(*sched_domain_mask_f)(int cpu); -typedef const int (*sched_domain_flags_f)(void); +typedef int (*sched_domain_flags_f)(void); #define SDTL_OVERLAP 0x01 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH rt] Fix latency histogram after "hrtimer: Set expiry time before switch_hrtimer_base()"
In an rt-kernel with CONFIG_MISSED_TIMER_OFFSETS_HIST enabled, __hrtimer_start_range_ns() now crashes, as new_base is not assigned before it is used. Signed-off-by: Ben Hutchings Tested-by: Carsten Emde Cc: stable...@vger.kernel.org --- --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c @@ -1106,6 +1106,11 @@ int __hrtimer_start_range_ns(struct hrti #endif } + hrtimer_set_expires_range_ns(timer, tim, delta_ns); + + /* Switch the timer base, if necessary: */ + new_base = switch_hrtimer_base(timer, base, mode & HRTIMER_MODE_PINNED); + #ifdef CONFIG_MISSED_TIMER_OFFSETS_HIST { ktime_t now = new_base->get_time(); @@ -1117,11 +1122,6 @@ int __hrtimer_start_range_ns(struct hrti } #endif - hrtimer_set_expires_range_ns(timer, tim, delta_ns); - - /* Switch the timer base, if necessary: */ - new_base = switch_hrtimer_base(timer, base, mode & HRTIMER_MODE_PINNED); - timer_stats_hrtimer_set_start_info(timer); leftmost = enqueue_hrtimer(timer, new_base); signature.asc Description: This is a digitally signed message part
Re: [PATCH 3.4 00/43] 3.4.96-stable review
On Sat, Jun 28, 2014 at 03:28:42PM -0700, Guenter Roeck wrote: > On 06/28/2014 10:45 AM, Greg Kroah-Hartman wrote: > >This is the start of the stable review cycle for the 3.4.96 release. > >There are 43 patches in this series, all will be posted as a response > >to this one. If anyone has any issues with these being applied, please > >let me know. > > > >Responses should be made by Mon Jun 30 17:44:34 UTC 2014. > >Anything received after that time might be too late. > > > > Build results: > total: 137 pass: 111 skipped: 20 fail: 6 > Failed builds: > alpha:allmodconfig > arm:spear6xx_defconfig > score:defconfig > sparc64:allmodconfig > unicore32:defconfig > xtensa:allmodconfig > > Qemu tests all passed. > > Results are as expected. Details are available at > http://server.roeck-us.net:8010/builders. Thanks for testing and letting me know. greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 3.15 000/139] 3.15.3-stable review
On 06/28/2014 10:46 AM, Greg Kroah-Hartman wrote: This is the start of the stable review cycle for the 3.15.3 release. There are 139 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know. Responses should be made by Mon Jun 30 17:45:39 UTC 2014. Anything received after that time might be too late. Build results: total: 144 pass: 136 skipped: 5 fail: 3 Failed builds: powerpc:allmodconfig powerpc:allmodconfig unicore32:defconfig Qemu tests all passed. Results are as expected. Details are available at http://server.roeck-us.net:8010/builders. Guenter -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 3.14 000/110] 3.14.10-stable review
On 06/28/2014 10:45 AM, Greg Kroah-Hartman wrote: This is the start of the stable review cycle for the 3.14.10 release. There are 110 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know. Responses should be made by Mon Jun 30 17:45:23 UTC 2014. Anything received after that time might be too late. Build results: total: 144 pass: 137 skipped: 4 fail: 3 Failed builds: powerpc:allmodconfig powerpc:allmodconfig unicore32:defconfig Qemu tests all passed. Results are as expected. Details are available at http://server.roeck-us.net:8010/builders. Guenter -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 3.10 00/77] 3.10.46-stable review
On 06/28/2014 10:45 AM, Greg Kroah-Hartman wrote: This is the start of the stable review cycle for the 3.10.46 release. There are 77 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know. Responses should be made by Mon Jun 30 17:45:02 UTC 2014. Anything received after that time might be too late. Build results: total: 144 pass: 136 skipped: 6 fail: 2 Failed builds: score:defconfig unicore32:defconfig Qemu tests all passed Results are as expected. Details are available at http://server.roeck-us.net:8010/builders. Guenter -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 3.4 00/43] 3.4.96-stable review
On 06/28/2014 10:45 AM, Greg Kroah-Hartman wrote: This is the start of the stable review cycle for the 3.4.96 release. There are 43 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know. Responses should be made by Mon Jun 30 17:44:34 UTC 2014. Anything received after that time might be too late. Build results: total: 137 pass: 111 skipped: 20 fail: 6 Failed builds: alpha:allmodconfig arm:spear6xx_defconfig score:defconfig sparc64:allmodconfig unicore32:defconfig xtensa:allmodconfig Qemu tests all passed. Results are as expected. Details are available at http://server.roeck-us.net:8010/builders. Guenter -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: lib/argv_split.c : should argv be kfree'ed ?
On Sat, Jun 28, 2014 at 11:52:37PM +0200, Toralf Förster wrote: > /me wonders if this patch is needed here : > > > diff --git a/lib/argv_split.c b/lib/argv_split.c > index e927ed0..7de4cb4 100644 > --- a/lib/argv_split.c > +++ b/lib/argv_split.c > @@ -85,6 +85,7 @@ char **argv_split(gfp_t gfp, const char *str, int *argcp) > *argv++ = argv_str; > } > } > + kfree (argv); > *argv = NULL; > > if (argcp) > No, see argv_free. -- Mateusz Guzik -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] gpio_keys, twl4030-pwrbutton: stay awake for 1sec on resume
On Sat, 28 Jun 2014, Pavel Machek wrote: > Hi! > > > >> This gives the userspace (Replicant) a chance to fully handle the > > >> pm_wakeup_event, before autosleep suspends the system alltogether > > >> again. > > >> > > >> This fixes suspend/resume on the OpenPhoenux GTA04, in combination with > > >> the Replicant 4.2.2 userspace, which needs to execute this to stay > > >> awake: 'echo on > /sys/power/state' > > >> > > >> Signed-off-by: Lukas M�rdian > > >> Signed-off-by: H. Nikolaus Schaller > > > > > > I'm sorry, but we should not be doing this. > > > > > > You basically put a delay in driver to work around userspace bug. > > > > Do you think it is a user-space bug if the kernel goes to sleep again > > before giving user space any chance to react to an event? > > Well, who says 1000msec is enough? Some userspace may need > more. ... for example on PC when you keyboard-handling deamon is > swapped out. > > > And the msec parameter is described as: > > > > @msec: Anticipated event processing time (in milliseconds). > > > > Isn't calling pm_wakeup_event() with a non-zero msec the standard > > method to handle this situation? And it is used in other drivers. E.g. in > > _mmc_detect_change() or hub_suspend(). > > * Notify the PM core of a wakeup event whose source is @ws that will >take > * approximately @msec milliseconds to be processed by the kernel. If >@ws is > * not active, activate it. If @msec is nonzero, set up the @ws' >timer to > * execute pm_wakeup_timer_fn() in future. > > > Will take @msec milliseconds to be processed by the _kernel_. Yes, USB > probing takes a lot of time in kernel. But you are using this > parameter to wait for userspace... > > > > There must be better > > > solution > > > > I am not sure how it could look like. > > Rafael, do you have any idea how this is supposed to work? > > Original patch is at https://lkml.org/lkml/2014/4/10/156 . One possibility is not to use autosleep at all. The user program, instead of writing "on" to /sys/power/state to stay awake, would have to write "mem" to go to sleep when no more work remained to be handled. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
lib/argv_split.c : should argv be kfree'ed ?
/me wonders if this patch is needed here : diff --git a/lib/argv_split.c b/lib/argv_split.c index e927ed0..7de4cb4 100644 --- a/lib/argv_split.c +++ b/lib/argv_split.c @@ -85,6 +85,7 @@ char **argv_split(gfp_t gfp, const char *str, int *argcp) *argv++ = argv_str; } } + kfree (argv); *argv = NULL; if (argcp) -- Toralf -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] pinctrl: pinctrl-imx27.c: Cleaning up remove a struct that is unused
Removal of a struct that is never used This was found using a static code analysis program called cppcheck Signed-off-by: Rickard Strandqvist --- drivers/pinctrl/pinctrl-imx27.c |6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/pinctrl/pinctrl-imx27.c b/drivers/pinctrl/pinctrl-imx27.c index 417c992..27ae7ce 100644 --- a/drivers/pinctrl/pinctrl-imx27.c +++ b/drivers/pinctrl/pinctrl-imx27.c @@ -440,12 +440,6 @@ static struct of_device_id imx27_pinctrl_of_match[] = { { /* sentinel */ } }; -struct imx27_pinctrl_private { - int num_gpio_childs; - struct platform_device **gpio_dev; - struct mxc_gpio_platform_data *gpio_pdata; -}; - static int imx27_pinctrl_probe(struct platform_device *pdev) { return imx1_pinctrl_core_probe(pdev, _pinctrl_info); -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: mm: shm: hang in shmem_fallocate
On 06/27/2014 02:03 PM, Hugh Dickins wrote: > On Fri, 27 Jun 2014, Sasha Levin wrote: >> On 06/27/2014 01:59 AM, Hugh Dickins wrote: > First, this: > > [ 681.267487] BUG: unable to handle kernel paging request at > ea0003480048 > [ 681.268621] IP: zap_pte_range (mm/memory.c:1132) >>> Weird, I don't think we've seen anything like that before, have we? >>> I'm pretty sure it's not a consequence of my "index = min(index, end)", >>> but what it portends I don't know. Please confirm mm/memory.c:1132 - >>> that's the "if (PageAnon(page))" line, isn't it? Which indeed matches >>> the code below. So accessing page->mapping is causing an oops... >> >> Right, that's the correct line. >> >> At this point I'm pretty sure that it's somehow related to that one line >> patch since it reproduced fairly quickly after applying it, and when I >> removed it I didn't see it happening again during the overnight fuzzing. > > Oh, I assumed it was a one-off: you're saying that you saw it more than > once with the min(index, end) patch in? But not since removing it (did > you replace that by the newer patch? or by the older? or by nothing?). It reproduced exactly twice, can't say it happens too often. What I did was revert your original fix for the issue and apply the one-liner. I've spent most of yesterday chasing a different bug with a "clean" -next tree (without the revert and the one-line patch) and didn't see any mm/ issues. However, about 2 hours after doing the revert and applying the one-line patch I've encountered the following: [ 3686.797859] BUG: unable to handle kernel paging request at 88028a488f98 [ 3686.805732] IP: do_read_fault.isra.40 (mm/memory.c:2856 mm/memory.c:2889) [ 3686.805732] PGD 12b82067 PUD 704d49067 PMD 704cf6067 PTE 80028a488060 [ 3686.805732] Oops: [#1] PREEMPT SMP DEBUG_PAGEALLOC [ 3686.815852] Dumping ftrace buffer: [ 3686.815852](ftrace buffer empty) [ 3686.815852] Modules linked in: [ 3686.815852] CPU: 10 PID: 8890 Comm: modprobe Not tainted 3.16.0-rc2-next-20140627-sasha-00024-ga284b83-dirty #753 [ 3686.815852] task: 8801d1c2 ti: 8801c6a08000 task.ti: 8801c6a08000 [ 3686.826134] RIP: do_read_fault.isra.40 (mm/memory.c:2856 mm/memory.c:2889) [ 3686.826134] RSP: :8801c6a0bc78 EFLAGS: 00010297 [ 3686.826134] RAX: RBX: 880288531200 RCX: 001f [ 3686.826134] RDX: 0014 RSI: 7f22949f3000 RDI: 88028a488f98 [ 3686.826134] RBP: 8801c6a0bd18 R08: 7f2294a13000 R09: 000c [ 3686.826134] R10: R11: 00a8 R12: 7f2294a07c50 [ 3686.826134] R13: 880279fec4b0 R14: 7f22949f3000 R15: 88028ebbc528 [ 3686.826134] FS: () GS:880292e0() knlGS: [ 3686.826134] CS: 0010 DS: ES: CR0: 8005003b [ 3686.826134] CR2: 88028a488f98 CR3: 00026b766000 CR4: 06a0 [ 3686.826134] Stack: [ 3686.826134] 8801c6a0bc98 0001 880200a8 0014 [ 3686.826134] 88028a489038 88026d40d000 88028eafaee0 [ 3686.826134] 8801c6a0bcd8 8e572715 ea000a292240 0028a489 [ 3686.826134] Call Trace: [ 3686.826134] ? _raw_spin_unlock (./arch/x86/include/asm/preempt.h:98 include/linux/spinlock_api_smp.h:152 kernel/locking/spinlock.c:183) [ 3686.826134] ? __pte_alloc (mm/memory.c:598 mm/memory.c:593) [ 3686.826134] __handle_mm_fault (mm/memory.c:3037 mm/memory.c:3198 mm/memory.c:3322) [ 3686.826134] handle_mm_fault (include/linux/memcontrol.h:124 mm/memory.c:3348) [ 3686.826134] ? __do_page_fault (arch/x86/mm/fault.c:1163) [ 3686.826134] __do_page_fault (arch/x86/mm/fault.c:1230) [ 3686.826134] ? vtime_account_user (kernel/sched/cputime.c:687) [ 3686.826134] ? get_parent_ip (kernel/sched/core.c:2550) [ 3686.826134] ? context_tracking_user_exit (include/linux/vtime.h:89 include/linux/jump_label.h:115 include/trace/events/context_tracking.h:47 kernel/context_tracking.c:180) [ 3686.826134] ? preempt_count_sub (kernel/sched/core.c:2606) [ 3686.826134] ? context_tracking_user_exit (kernel/context_tracking.c:184) [ 3686.826134] ? __this_cpu_preempt_check (lib/smp_processor_id.c:63) [ 3686.826134] ? trace_hardirqs_off_caller (kernel/locking/lockdep.c:2638 (discriminator 2)) [ 3686.826134] trace_do_page_fault (arch/x86/mm/fault.c:1313 include/linux/jump_label.h:115 include/linux/context_tracking_state.h:27 include/linux/context_tracking.h:45 arch/x86/mm/fault.c:1314) [ 3686.826134] do_async_page_fault (arch/x86/kernel/kvm.c:264) [ 3686.826134] async_page_fault (arch/x86/kernel/entry_64.S:1322) [ 3686.826134] Code: 89 c0 4c 8b 43 08 48 8d 4c 08 ff 49 01 c1 49 39 c9 4c 0f 47 c9 4c 89 c1 4c 29 f1 48 c1 e9 0c 49 8d 4c 0a ff 49 39 c9 4c 0f 47 c9 <48> 83 3f 00 74 3c 48 83 c0 01 4c 39 c8 77 74 48 81 c6 00 10 00 All code 0: 89 c0 mov%eax,%eax 2: 4c 8b 43 08
Re: [PATCH] clk: sunxi: fix devm_ioremap_resource error detection code
Hi, El 28/06/14 14:58, Boris BREZILLON escribió: Hello, On 28/06/2014 19:23, Himangi Saraogi wrote: devm_ioremap_resource returns an ERR_PTR value, not NULL, on failure. A simplified version of the semantic match that finds this problem is as follows: // @@ expression e,e1; statement S; @@ *e = devm_ioremap_resource(...); if (!e1) S // Signed-off-by: Himangi Saraogi Acked-by: Julia Lawall --- drivers/clk/sunxi/clk-sun6i-apb0-gates.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/sunxi/clk-sun6i-apb0-gates.c b/drivers/clk/sunxi/clk-sun6i-apb0-gates.c index 44cd27c..670f90d 100644 --- a/drivers/clk/sunxi/clk-sun6i-apb0-gates.c +++ b/drivers/clk/sunxi/clk-sun6i-apb0-gates.c @@ -29,7 +29,7 @@ static int sun6i_a31_apb0_gates_clk_probe(struct platform_device *pdev) r = platform_get_resource(pdev, IORESOURCE_MEM, 0); reg = devm_ioremap_resource(>dev, r); - if (!reg) + if (IS_ERR(reg)) return PTR_ERR(reg); clk_parent = of_clk_get_parent_name(np, 0); Oops, one more mistake in testing devm_ioremap_resource return code (I always mix devm_ioremap_resource and devm_request_and_ioremap behaviours). Sorry for the inconvenience, and of course, you have my: Acked-by Boris BREZILLON Mike, do you want to take this directly for the -rc cycle, or should I queue it for 3.17? Please let me know. Cheers, Emilio -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] mfd: ab8500-debugfs.c: Cleaning up unnecessary to test, unsigned can't be negative.
Unsigned variable can't be negative so it is unnecessary to test it This was found using a static code analysis program called cppcheck Signed-off-by: Rickard Strandqvist --- drivers/mfd/ab8500-debugfs.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mfd/ab8500-debugfs.c b/drivers/mfd/ab8500-debugfs.c index d1a22aa..0793a10 100644 --- a/drivers/mfd/ab8500-debugfs.c +++ b/drivers/mfd/ab8500-debugfs.c @@ -2504,7 +2504,7 @@ static ssize_t ab8500_gpadc_trig_timer_write(struct file *file, if (err) return err; - if ((user_trig_timer >= 0) && (user_trig_timer <= 255)) { + if (user_trig_timer <= 255) { trig_timer = (u8) user_trig_timer; } else { dev_err(dev, "debugfs error input: " -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [Cocci] [PATCH V3] scripts/coccinelle/free: Delete NULL test before freeing functions?
On Sat, 28 Jun 2014, SF Markus Elfring wrote: > > Sorry but I'm not working on coccinelle ; just did a small script for > > kernel tree. > > I would appreciate a more constructive feedback for my update suggestions > around > the topic "Deletion of unnecessary checks before specific function calls". > - Did you look at the concrete patches? > - How do you think about the general approach? > > Examples: > https://systeme.lip6.fr/pipermail/cocci/2014-March/000676.html > http://marc.info/?l=kernel-janitors=139405971927100=2 Regular expressions do not allow taking advantage of the optimizations provided by Coccinelle and are not easy for a reader to understand. > https://systeme.lip6.fr/pipermail/cocci/2014-March/000677.html > http://marc.info/?l=kernel-janitors=139405983727148=2 This is not safe due to the use of when any. You have no guarantee that there is not a dereference of input in the matched region, or that the value of input is still the argument value at the point of the test. julia -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH V3] scripts/coccinelle/free: Delete NULL test before freeing functions?
> Sorry but I'm not working on coccinelle ; just did a small script for kernel > tree. I would appreciate a more constructive feedback for my update suggestions around the topic "Deletion of unnecessary checks before specific function calls". - Did you look at the concrete patches? - How do you think about the general approach? Examples: https://systeme.lip6.fr/pipermail/cocci/2014-March/000676.html http://marc.info/?l=kernel-janitors=139405971927100=2 https://systeme.lip6.fr/pipermail/cocci/2014-March/000677.html http://marc.info/?l=kernel-janitors=139405983727148=2 Regards, Markus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 0/2][RFC] Try to handle hctosys w/ rtc modules
Am 28.06.2014 20:54, schrieb Marc Dietrich: On Sat, 28 Jun 2014 09:32:50 +0200 Alexander Holler wrote: Am 28.06.2014 09:18, schrieb Alexander Holler: Am 27.06.2014 19:27, schrieb John Stultz: Its been pointed out that the RTC hctosys functionality doesn't work well with RTC modules, which may not be loaded until after late_init(). While there have been other attempts to sovle this, this patchset is a very quick 10 minute effort to show how I'd try to resolve this. There likely are still issues here, but I'd be happy to make fixes and adjustments to ensure it works. How long you needed to getthe idea? Feedback and comments always appreciated! And it still uses the non-deterministic and therefor almost unusable rtcN. Well done. Besides that the current hctosys-mechanism doesn't really work with hot-plugable devices at all. Guess what N will be when you unplug and plug in such a RTC again. We have a patch in the kernel which binds the rtc number to the hw device, so this even works for hotpluggable devices (at least on systems supporting device-tree). Not sure what your needs are. First, the number depends on the kernel-configuration and the order how RTCs are detected and might even change between minor kernel versions. Thus it's totally non-deterministic across different kernel builds. Second, I wonder about which hotpluggable devices you are talking. Last time I've dived into that part of the kernel was when I've written my fully working patch set and at that time a usb-rtc (the only really hotpluggable RTC I currently know about) did get a new N whenever it appeared again (e.g. on suspend/resume). So with the proposed non-working clone of my patch, the RTC would be gone after a resume. Anyway, sorry, I won't spend more time on discussing with kernel maintainers. I don't receive any compensations to do so and therefor I absolutely have no reason to accept all the pain and insults which are happening when doing so. I've come to the conclusion that I should not have posted patches at all (not just this one) and really regret that. Alexander Holler -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH RFC net-next 03/14] bpf: introduce syscall(BPF, ...) and BPF maps
On Sat, Jun 28, 2014 at 8:34 AM, Andy Lutomirski wrote: > On Fri, Jun 27, 2014 at 11:43 PM, Alexei Starovoitov > wrote: >> On Fri, Jun 27, 2014 at 11:25 PM, Andy Lutomirski >> wrote: >>> On Fri, Jun 27, 2014 at 10:55 PM, Alexei Starovoitov >>> wrote: On Fri, Jun 27, 2014 at 5:16 PM, Andy Lutomirski wrote: > On Fri, Jun 27, 2014 at 5:05 PM, Alexei Starovoitov > wrote: >> BPF syscall is a demux for different BPF releated commands. >> >> 'maps' is a generic storage of different types for sharing data between >> kernel >> and userspace. >> >> The maps can be created/deleted from user space via BPF syscall: >> - create a map with given id, type and attributes >> map_id = bpf_map_create(int map_id, map_type, struct nlattr *attr, int >> len) >> returns positive map id or negative error >> >> - delete map with given map id >> err = bpf_map_delete(int map_id) >> returns zero or negative error > > What's the scope of "id"? How is it secured? the map and program id space is global and it's cap_sys_admin only. There is no pressing need to do it with per-user limits. So the whole thing is root only for now. >>> >>> Hmm. This may be unpleasant if you ever want to support non-root or >>> namespaced operation. >> >> I think it will be easy to extend it per namespace when we lift >> root-only restriction. It will be seamless without user api changes. >> > > It might be seamless, but I'm not sure it'll be very useful. See below. > >>> How hard would it be to give these things fds? >> >> you mean programs/maps auto-terminate when creator process >> exits? I thought about it and it's appealing at first glance, but >> doesn't fit the model of existing tracepoint events which are global. >> The programs attached to events need to live without 'daemon' >> hanging around. Therefore I picked 'kernel module'- like method. > > Here are some things I'd like to be able to do: > > - Load an eBPF program and use it as a seccomp filter. > > - Create a read-only map and reference it from a seccomp filter. > > - Create a data structure that a seccomp filter can write but that > the filtered process can only read. > > - Create a data structure that a seccomp filter can read but that > some other trusted process can write. > > - Create a network filter of some sort and give permission to > manipulate a list of ports to an otherwise untrusted process. > > The first four of these shouldn't require privilege. > > All of this fits nicely into a model where all of the eBPF objects > (filters and data structures) are represented by fds. Read access to > the fd lets you read (or execute eBPF programs). Write access to the > fd lets you write. You can send them around naturally using > SCM_RIGHTS, and you can create deprivileged versions by reopening the > objects with less access. Sorry I don't like 'fd' direction at all. 1. it will make the whole thing very socket specific and 'net' dependent. but the goal here is to be able to use eBPF for tracing in embedded setups. So it's gotta be net independent. 2. sockets are already overloaded with all sorts of stuff. Adding more types of sockets will complicate it a lot. 3. and most important. read/write operations on sockets are not done every nanosecond, whereas lookup operations on bpf maps are done every dozen instructions, so we cannot have any overhead when accessing maps. In other words the verifier is done as static analyzer. I moved all the complexity to verify time, so at run-time the programs are as fast as possible. I'm strongly against run-time checks in critical path, since they kill performance and make the whole approach a lot less usable. What you want to achieve: > - Load an eBPF program and use it as a seccomp filter. > - Create a read-only map and reference it from a seccomp filter. is very doable in the existing framework. Note I didn't do seccomp+ebpf example, only because you and Kees and messing with this part of code a lot and I didn't want to conflict. > All of this *could* fit in using global ids, but we'd need to answer > questions like "what namespace are they bound to" and "who has access > to a given fd". I'd want to see that these questions *have* good > answers before committing to this type of model. Keep in mind that, > for seccomp in particular, granting access to a specific uid will be > very limiting: part of the point of seccomp is to enable > user-controlled finer-grained permissions than allowed by uids and > gids. filters(bpf programs) is a low level tool that shouldn't be aware of gid/uids at all. Just like classic bpf doesn't care, eBPF programs shouldn't care. Mixing concept of uids/fds into the program is wrong. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please
[PATCH 1/3] MIPS: OCTEON: cvmx-bootinfo: add D-Link DSR-1000N
Add a definition for D-Link DSR-1000N router. The bootloader on this board supplies 20006 in the bootinfo; the enum CVMX_BOARD_TYPE_CUST_DSR1000N comes from the GPL sources of the board. Signed-off-by: Aaro Koskinen --- arch/mips/include/asm/octeon/cvmx-bootinfo.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/mips/include/asm/octeon/cvmx-bootinfo.h b/arch/mips/include/asm/octeon/cvmx-bootinfo.h index 7b7818d..2298199 100644 --- a/arch/mips/include/asm/octeon/cvmx-bootinfo.h +++ b/arch/mips/include/asm/octeon/cvmx-bootinfo.h @@ -228,6 +228,7 @@ enum cvmx_board_types_enum { */ CVMX_BOARD_TYPE_CUST_PRIVATE_MIN = 20001, CVMX_BOARD_TYPE_UBNT_E100 = 20002, + CVMX_BOARD_TYPE_CUST_DSR1000N = 20006, CVMX_BOARD_TYPE_CUST_PRIVATE_MAX = 3, /* The remaining range is reserved for future use. */ @@ -327,6 +328,7 @@ static inline const char *cvmx_board_type_to_string(enum /* Customer private range */ ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_PRIVATE_MIN) ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_UBNT_E100) + ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_DSR1000N) ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_PRIVATE_MAX) } return "Unsupported Board"; -- 2.0.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/3] MIPS: OCTEON: add interface & port definitions for D-Link DSR-1000N
Add interface & port definitions for D-Link DSR-1000N. Signed-off-by: Aaro Koskinen --- .../cavium-octeon/executive/cvmx-helper-board.c | 21 + 1 file changed, 21 insertions(+) diff --git a/arch/mips/cavium-octeon/executive/cvmx-helper-board.c b/arch/mips/cavium-octeon/executive/cvmx-helper-board.c index 6c871a5..5dfef84 100644 --- a/arch/mips/cavium-octeon/executive/cvmx-helper-board.c +++ b/arch/mips/cavium-octeon/executive/cvmx-helper-board.c @@ -186,6 +186,15 @@ int cvmx_helper_board_get_mii_address(int ipd_port) return 7 - ipd_port; else return -1; + case CVMX_BOARD_TYPE_CUST_DSR1000N: + /* +* Port 2 connects to Broadcom PHY (B5081). Other ports (0-1) +* connect to a switch (BCM53115). +*/ + if (ipd_port == 2) + return 8; + else + return -1; } /* Some unknown board. Somebody forgot to update this function... */ @@ -274,6 +283,18 @@ cvmx_helper_link_info_t __cvmx_helper_board_link_get(int ipd_port) return result; } break; + case CVMX_BOARD_TYPE_CUST_DSR1000N: + if (ipd_port == 0 || ipd_port == 1) { + /* Ports 0 and 1 connect to a switch (BCM53115). */ + result.s.link_up = 1; + result.s.full_duplex = 1; + result.s.speed = 1000; + return result; + } else { + /* Port 2 uses a Broadcom PHY (B5081). */ + is_broadcom_phy = 1; + } + break; } phy_addr = cvmx_helper_board_get_mii_address(ipd_port); -- 2.0.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/3] MIPS: OCTEON: add USB clock type for D-Link DSR-1000N
Add USB clock type for D-Link DSR-1000N. Signed-off-by: Aaro Koskinen --- arch/mips/cavium-octeon/executive/cvmx-helper-board.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/mips/cavium-octeon/executive/cvmx-helper-board.c b/arch/mips/cavium-octeon/executive/cvmx-helper-board.c index b764df6..6c871a5 100644 --- a/arch/mips/cavium-octeon/executive/cvmx-helper-board.c +++ b/arch/mips/cavium-octeon/executive/cvmx-helper-board.c @@ -738,6 +738,7 @@ enum cvmx_helper_board_usb_clock_types __cvmx_helper_board_usb_get_clock_type(vo case CVMX_BOARD_TYPE_LANAI2_G: case CVMX_BOARD_TYPE_NIC10E_66: case CVMX_BOARD_TYPE_UBNT_E100: + case CVMX_BOARD_TYPE_CUST_DSR1000N: return USB_CLOCK_TYPE_CRYSTAL_12; case CVMX_BOARD_TYPE_NIC10E: return USB_CLOCK_TYPE_REF_12; -- 2.0.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/3] MIPS: OCTEON: Minimal support for D-Link DSR-1000N
Hi, The following patches add minimal support for D-Link DSR-1000N router. USB and ethernet ports should now work with these patches. (I guess WLAN (PCI/ath9k) should work too; I was able to scan networks, but for some reason it did not connect to my AP.) Aaro Koskinen (3): MIPS: OCTEON: cvmx-bootinfo: add D-Link DSR-1000N MIPS: OCTEON: add USB clock type for D-Link DSR-1000N MIPS: OCTEON: add interface & port definitions for D-Link DSR-1000N .../cavium-octeon/executive/cvmx-helper-board.c| 22 ++ arch/mips/include/asm/octeon/cvmx-bootinfo.h | 2 ++ 2 files changed, 24 insertions(+) -- 2.0.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH RFC net-next 08/14] bpf: add eBPF verifier
On Sat, Jun 28, 2014 at 9:01 AM, Andy Lutomirski wrote: > On Fri, Jun 27, 2014 at 5:06 PM, Alexei Starovoitov wrote: >> Safety of eBPF programs is statically determined by the verifier, which >> detects: > > This is a very high-level review. I haven't tried to read all the > code yet, and this is mostly questions rather than real comments. Great questions! :) Answers below: >> - loops >> - out of range jumps >> - unreachable instructions >> - invalid instructions >> - uninitialized register access >> - uninitialized stack access >> - misaligned stack access >> - out of range stack access >> - invalid calling convention >> >> It checks that >> - R1-R5 registers statisfy function prototype >> - program terminates >> - BPF_LD_ABS|IND instructions are only used in socket filters > > Why are these used in socket filters? Can't ctx along with some > accessor do the trick. ld_abs/ind instructions are legacy instruction that assume that ctx == skb. They're heavily used in classic bpf, so we cannot convert them to anything else without hurting performance of libpcap. So here we have two special instructions that are really wrappers of function calls that can only be used when 'ctx == skb'. bpf_prog_type_socket_filter means that 'ctx==skb', but it doesn't mean that this is for attaching to sockets only. The same type can be used in attaching eBPF programs to cls, xt, etc where input is skb. > It seems to be that this is more or less a type system. On entry to > each instruction, each register has a type, and the instruction might > change the types of the registers. Exactly. > So: what are the rules? If I understand correctly, these are the types: the types of registers change depending on instruction semantics. If instruction is 'mov r1 = r5', then type of r5 is transferred to r1 and so on. >> + INVALID_PTR,/* reg doesn't contain a valid >> pointer */ >> + PTR_TO_CTX, /* reg points to bpf_context */ >> + PTR_TO_MAP, /* reg points to map element value */ >> + PTR_TO_MAP_CONDITIONAL, /* points to map element value or >> NULL */ >> + PTR_TO_STACK, /* reg == frame_pointer */ >> + PTR_TO_STACK_IMM, /* reg == frame_pointer + imm */ >> + PTR_TO_STACK_IMM_MAP_KEY, /* pointer to stack used as map key >> */ >> + PTR_TO_STACK_IMM_MAP_VALUE, /* pointer to stack used as map elem >> */ >> + RET_INTEGER,/* function returns integer */ >> + RET_VOID, /* function returns void */ >> + CONST_ARG, /* function expects integer constant >> argument */ >> + CONST_ARG_MAP_ID, /* int const argument that is used >> as map_id */ >> + /* int const argument indicating number of bytes accessed from stack >> +* previous function argument must be ptr_to_stack_imm >> +*/ >> + CONST_ARG_STACK_IMM_SIZE, >> +}; At the comment on top of this enum says: /* types of values: * - stored in an eBPF register * - passed into helper functions as an argument * - returned from helper functions */ > One confusing thing here is that some of these are types and some are > constraints. I'm not sure this is necessary. For example, RET_VOID exactly. some are type of registers, some are argument constraints, some are definitions of return types like (ret_*) types. All three categories overlap. Therefore they're in one enum. I can split it into three enums, but there will be duplicates and it will not be any easier to read. > is an odd name for VOID, and RET_INTEGER is an odd name for INTEGER. RET_VOID means ' returns void' or as comment says 'function returns void' It never appears as type of register. It's a type of return from a function call. > I think I'd have a much easier time understanding all of this if there > were an explicit table for the transition rules. There are a couple > kinds of transitions. The main one is kind of like a phi node: when > two different control paths reach the same instruction, the types of > each register presumably need to merge. I would imagine rules like: > > VOID, anything -> VOID > PTR_TO_MAP, PTR_TO_MAP_CONDITIONAL -> PTR_TO_MAP_CONDITIONAL > > Then there are arithmetic rules: if you try to add two values, it > might be legal or illegal, and the result type needs to be known. I sounds like you're proposing a large table of [insn_opcode, type_x, type_y] -> type z that won't work. Since many instruction use registers both as source and as destination. So type changes are very specific to logic of the given instructions and cannot be generalized into 'type transition table'. > There are also things that happen on function entry and exit. For > example, unused argument slots presumably all turn into VOID. All Almost. Argument registers R1-R5 after function call turn into INVALID_PTR type. RET_VOID type is a
[PATCH 0/4] DRBG: Fixes for sparse tool reports
Hi, The following patches cover requested changes based on the sparse tool test run and suggestions by peer reviewers. In addition, a patch to make the CTR DRBG more efficient is added. Stephan Mueller (4): DRBG: use of kernel linked list DRBG: cleanup of preprocessor macros DRBG: Fix format string for debugging statements DRBG: Call CTR DRBG DF function only once crypto/drbg.c | 302 -- include/crypto/drbg.h | 7 +- 2 files changed, 174 insertions(+), 135 deletions(-) -- 1.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] serial: 8250_dw: support high baudrates if possible
On 06/28/2014 10:36 AM, One Thousand Gnomes wrote: > On Fri, 27 Jun 2014 12:25:20 -0500 >> +rate = 16 * max(115200U, (unsigned int)baud); >> + > > This assumes an arbitarily configurable clock, which is not I think the > usual case. If the clock's rate can't change, this will return an error, and the recorded rate (p->uartclk) will not be changed. This should only matter when attempting to set a baud rate higher than 115200. It *is* possible that some particular high rate will realize a better signal rate than whatever results from requesting 16 times the baud (or even 16 * 115200). I could make this work *only* for my particular part(s) by relying on a different device tree compatible string and setting a flag. It would be nice if other implementations could benefit from this though. -Alex >> +/* >> + * Request a different clock rate if necessary, and >> + * record it if successful. >> + */ >> +if (rate != p->uartclk) { >> +BUG_ON(!data->clk); >> +if (!clk_set_rate(data->clk, (unsigned long)rate)) >> +p->uartclk = rate; >> +} > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] batman-adv: Use kasprintf
On Sat, 28 Jun 2014, Antonio Quartulli wrote: > Hi all, > > On 28/06/14 21:13, Joe Perches wrote: > > diff --git a/net/batman-adv/sysfs.c b/net/batman-adv/sysfs.c > > index f40cb04..d6fba94 100644 > > --- a/net/batman-adv/sysfs.c > > +++ b/net/batman-adv/sysfs.c > > @@ -896,7 +896,7 @@ int batadv_throw_uevent(struct batadv_priv *bat_priv, > > enum batadv_uev_type type, > > { > > int ret = -ENOMEM; > > struct kobject *bat_kobj; > > - char *uevent_env[4] = { NULL, NULL, NULL, NULL }; > > + char *uevent_env[3]; > > > Joe, why are you shortening this? kobject_uevent_env() expect a > NULL-terminating array (that is the forth cell). > > ... > > > > > ret = kobject_uevent_env(bat_kobj, KOBJ_CHANGE, uevent_env); > > And how is this change reducing the code space? > > For what concerns the labels, we use this pattern mostly all over the > code: one single label/exit-point with the related NULL checks. Do you > think that we can improve something by changing this? (I am not talking > about the fastpath here). Most of the kernel uses specific labels for each possible failure. >From my selfish point of view, it makes the code easier to analyze and understand, because what is done at the exit label is only what needs to be done. julia -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/4] DRBG: use of kernel linked list
The DRBG-style linked list to manage input data that is fed into the cipher invocations is replaced with the kernel linked list implementation. The change is transparent to users of the interfaces offered by the DRBG. Therefore, no changes to the testmgr code is needed. Reported-by: kbuild test robot Signed-off-by: Stephan Mueller --- crypto/drbg.c | 233 +++--- include/crypto/drbg.h | 7 +- 2 files changed, 128 insertions(+), 112 deletions(-) diff --git a/crypto/drbg.c b/crypto/drbg.c index 99fa8f8..6679a26 100644 --- a/crypto/drbg.c +++ b/crypto/drbg.c @@ -370,13 +370,12 @@ static int drbg_fini_sym_kernel(struct drbg_state *drbg); /* BCC function for CTR DRBG as defined in 10.4.3 */ static int drbg_ctr_bcc(struct drbg_state *drbg, unsigned char *out, const unsigned char *key, - struct drbg_string *in) + struct list_head *in) { - int ret = -EFAULT; - struct drbg_string *curr = in; - size_t inpos = curr->len; - const unsigned char *pos = curr->buf; + int ret = 0; + struct drbg_string *curr = NULL; struct drbg_string data; + short cnt = 0; drbg_string_fill(, out, drbg_blocklen(drbg)); @@ -384,39 +383,29 @@ static int drbg_ctr_bcc(struct drbg_state *drbg, memset(out, 0, drbg_blocklen(drbg)); /* 10.4.3 step 2 / 4 */ - while (inpos) { - short cnt = 0; + list_for_each_entry(curr, in, list) { + const unsigned char *pos = curr->buf; + size_t len = curr->len; /* 10.4.3 step 4.1 */ - for (cnt = 0; cnt < drbg_blocklen(drbg); cnt++) { - out[cnt] ^= *pos; - pos++; inpos--; - /* -* The following branch implements the linked list -* iteration of drbg_string *in. If we are at the -* end of the current list member, we have to start -* using the next member if available. The inpos -* value always points to the current byte and will -* be zero if we have processed the last byte of -* the last linked list member. -*/ - if (0 == inpos) { - curr = curr->next; - if (NULL != curr) { - pos = curr->buf; - inpos = curr->len; - } else { - inpos = 0; - break; - } + while (len) { + /* 10.4.3 step 4.2 */ + if (drbg_blocklen(drbg) == cnt) { + cnt = 0; + ret = drbg_kcapi_sym(drbg, key, out, ); + if (ret) + return ret; } + out[cnt] ^= *pos; + pos++; + cnt++; + len--; } - /* 10.4.3 step 4.2 */ - ret = drbg_kcapi_sym(drbg, key, out, ); - if (ret) - return ret; - /* 10.4.3 step 2 */ } - return 0; + /* 10.4.3 step 4.2 for last block */ + if (cnt) + ret = drbg_kcapi_sym(drbg, key, out, ); + + return ret; } /* @@ -453,13 +442,13 @@ static int drbg_ctr_bcc(struct drbg_state *drbg, /* Derivation Function for CTR DRBG as defined in 10.4.2 */ static int drbg_ctr_df(struct drbg_state *drbg, unsigned char *df_data, size_t bytes_to_return, - struct drbg_string *addtl) + struct list_head *seedlist) { int ret = -EFAULT; unsigned char L_N[8]; /* S3 is input */ struct drbg_string S1, S2, S4, cipherin; - struct drbg_string *tempstr = addtl; + LIST_HEAD(bcc_list); unsigned char *pad = df_data + drbg_statelen(drbg); unsigned char *iv = pad + drbg_blocklen(drbg); unsigned char *temp = iv + drbg_blocklen(drbg); @@ -476,6 +465,7 @@ static int drbg_ctr_df(struct drbg_state *drbg, unsigned char *X; size_t generated_len = 0; size_t inputlen = 0; + struct drbg_string *seed = NULL; memset(pad, 0, drbg_blocklen(drbg)); memset(iv, 0, drbg_blocklen(drbg)); @@ -488,8 +478,8 @@ static int drbg_ctr_df(struct drbg_state *drbg, return -EINVAL; /* 10.4.2 step 2 -- calculate the entire length of all input data */ - for (; NULL != tempstr; tempstr = tempstr->next) - inputlen +=
Re: [PATCH] batman-adv: Use kasprintf
On Sat, 2014-06-28 at 21:49 +0200, Antonio Quartulli wrote: > Hi all, > > On 28/06/14 21:13, Joe Perches wrote: > > diff --git a/net/batman-adv/sysfs.c b/net/batman-adv/sysfs.c [] > > @@ -896,7 +896,7 @@ int batadv_throw_uevent(struct batadv_priv *bat_priv, > > enum batadv_uev_type type, > > { > > int ret = -ENOMEM; > > struct kobject *bat_kobj; > > - char *uevent_env[4] = { NULL, NULL, NULL, NULL }; > > + char *uevent_env[3]; > > > Joe, why are you shortening this? kobject_uevent_env() expect a > NULL-terminating array (that is the forth cell). Hi Antonio, sorry, I didn't know about the last NULL being required. It looked to me more like an oversight in the code instead of a required NULL. > And how is this change reducing the code space? Removing unnecessary initializations reduces object code size. > For what concerns the labels, we use this pattern mostly all over the > code: one single label/exit-point with the related NULL checks. Do you > think that we can improve something by changing this? (I am not talking > about the fastpath here). Not calling known unnecessary kfree calls helps a little. Certainly, it'd be more valuable in any fast path area. Other than that, it was an unsigned suggestion not a formal patch submission. Ignore it or improve it as you see fit. cheers, Joe Maybe: --- net/batman-adv/sysfs.c | 18 +++--- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/net/batman-adv/sysfs.c b/net/batman-adv/sysfs.c index f40cb04..90c245e 100644 --- a/net/batman-adv/sysfs.c +++ b/net/batman-adv/sysfs.c @@ -896,7 +896,7 @@ int batadv_throw_uevent(struct batadv_priv *bat_priv, enum batadv_uev_type type, { int ret = -ENOMEM; struct kobject *bat_kobj; - char *uevent_env[4] = { NULL, NULL, NULL, NULL }; + char *uevent_env[4]; bat_kobj = _priv->soft_iface->dev.kobj; @@ -910,22 +910,26 @@ int batadv_throw_uevent(struct batadv_priv *bat_priv, enum batadv_uev_type type, "%s%s", BATADV_UEV_ACTION_VAR, batadv_uev_action_str[action]); if (!uevent_env[1]) - goto out; + goto out0; /* If the event is DEL, ignore the data field */ if (action != BATADV_UEV_DEL) { uevent_env[2] = kasprintf(GFP_ATOMIC, "%s%s", BATADV_UEV_DATA_VAR, data); if (!uevent_env[2]) - goto out; + goto out1; } + uevent_env[3] = NULL; + ret = kobject_uevent_env(bat_kobj, KOBJ_CHANGE, uevent_env); -out: - kfree(uevent_env[0]); - kfree(uevent_env[1]); - kfree(uevent_env[2]); + kfree(uevent_env[2]); +out1: + kfree(uevent_env[1]); +out0: + kfree(uevent_env[0]); +out: if (ret) batadv_dbg(BATADV_DBG_BATMAN, bat_priv, "Impossible to send uevent for (%s,%s,%s) event (err: %d)\n", -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/4] DRBG: cleanup of preprocessor macros
The structure used to construct the module description line was marked problematic by the sparse code analysis tool. The module line description now does not contain any ifdefs to prevent error reports from sparse. The preprocessor warning declaration was reported by sparse. It is replaced in favor of an init function reporting the erroneous built of the DRBG. Lastly, a fix of the use use of CONFIG_CRYPTO_DRBG_HASH has been applied. Reported-by: kbuild test robot Signed-off-by: Stephan Mueller --- crypto/drbg.c | 43 +++ 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/crypto/drbg.c b/crypto/drbg.c index 6679a26..03a230e 100644 --- a/crypto/drbg.c +++ b/crypto/drbg.c @@ -102,8 +102,13 @@ #if !defined(CONFIG_CRYPTO_DRBG_HASH) && \ !defined(CONFIG_CRYPTO_DRBG_HMAC) && \ !defined(CONFIG_CRYPTO_DRBG_CTR) -#warning "The DRBG code is useless without compiling at least one DRBG type" -#endif +#define CRYPTO_DRBG_NONE_STRING "none " +static int __init drbg_init(void) +{ + pr_warn("DRBG: no DRBG core was compiled!\n"); + return -EFAULT; +} +#else /*** * Backend cipher definitions available to DRBG @@ -362,6 +367,7 @@ static inline void drbg_add_buf(unsigned char *dst, size_t dstlen, **/ #ifdef CONFIG_CRYPTO_DRBG_CTR +#define CRYPTO_DRBG_CTR_STRING "CTR " static int drbg_kcapi_sym(struct drbg_state *drbg, const unsigned char *key, unsigned char *outval, const struct drbg_string *in); static int drbg_init_sym_kernel(struct drbg_state *drbg); @@ -715,6 +721,7 @@ static int drbg_fini_hash_kernel(struct drbg_state *drbg); #endif /* (CONFIG_CRYPTO_DRBG_HASH || CONFIG_CRYPTO_DRBG_HMAC) */ #ifdef CONFIG_CRYPTO_DRBG_HMAC +#define CRYPTO_DRBG_HMAC_STRING "HMAC " /* update function of HMAC DRBG as defined in 10.1.2.2 */ static int drbg_hmac_update(struct drbg_state *drbg, struct list_head *seed, int reseed) @@ -834,6 +841,7 @@ static struct drbg_state_ops drbg_hmac_ops = { **/ #ifdef CONFIG_CRYPTO_DRBG_HASH +#define CRYPTO_DRBG_HASH_STRING "HASH " /* * scratchpad usage: as drbg_hash_update and drbg_hash_df are used * interlinked, the scratchpad is used as follows: @@ -1865,7 +1873,7 @@ static inline int __init drbg_healthcheck_sanity(void) #ifdef CONFIG_CRYPTO_DRBG_CTR drbg_convert_tfm_core("drbg_nopr_ctr_aes128", , ); -#elif CONFIG_CRYPTO_DRBG_HASH +#elif defined CONFIG_CRYPTO_DRBG_HASH drbg_convert_tfm_core("drbg_nopr_sha256", , ); #else drbg_convert_tfm_core("drbg_nopr_hmac_sha256", , ); @@ -2005,18 +2013,29 @@ void __exit drbg_exit(void) crypto_unregister_algs(drbg_algs, (ARRAY_SIZE(drbg_cores) * 2)); } -module_init(drbg_init); module_exit(drbg_exit); +#endif /* !defined(CONFIG_CRYPTO_DRBG_HASH) && \ + !defined(CONFIG_CRYPTO_DRBG_HMAC) && \ + !defined(CONFIG_CRYPTO_DRBG_CTR) */ + +module_init(drbg_init); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Stephan Mueller "); -MODULE_DESCRIPTION("NIST SP800-90A Deterministic Random Bit Generator (DRBG) using following cores:" -#ifdef CONFIG_CRYPTO_DRBG_HMAC -"HMAC " +#ifndef CRYPTO_DRBG_NONE_STRING +#define CRYPTO_DRBG_NONE_STRING "" #endif -#ifdef CONFIG_CRYPTO_DRBG_HASH -"Hash " +#ifndef CRYPTO_DRBG_HASH_STRING +#define CRYPTO_DRBG_HASH_STRING "" #endif -#ifdef CONFIG_CRYPTO_DRBG_CTR -"CTR" +#ifndef CRYPTO_DRBG_HMAC_STRING +#define CRYPTO_DRBG_HMAC_STRING "" +#endif +#ifndef CRYPTO_DRBG_CTR_STRING +#define CRYPTO_DRBG_CTR_STRING "" #endif -); +MODULE_DESCRIPTION("NIST SP800-90A Deterministic Random Bit Generator (DRBG) " + "using following cores: " + CRYPTO_DRBG_NONE_STRING + CRYPTO_DRBG_HMAC_STRING + CRYPTO_DRBG_HASH_STRING + CRYPTO_DRBG_CTR_STRING); -- 1.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/4] DRBG: Fix format string for debugging statements
The initial format strings caused warnings on several architectures. The updated format strings now match the variable types. Reported-by: kbuild test robot Reported-by: Randy Dunlap Signed-off-by: Stephan Mueller --- crypto/drbg.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crypto/drbg.c b/crypto/drbg.c index 03a230e..4593b3c 100644 --- a/crypto/drbg.c +++ b/crypto/drbg.c @@ -1109,7 +1109,7 @@ static int drbg_seed(struct drbg_state *drbg, struct drbg_string *pers, /* 9.1 / 9.2 / 9.3.1 step 3 */ if (pers && pers->len > (drbg_max_addtl(drbg))) { - pr_devel("DRBG: personalization string too long %lu\n", + pr_devel("DRBG: personalization string too long %zu\n", pers->len); return -EINVAL; } @@ -1987,8 +1987,9 @@ static int __init drbg_init(void) if (ARRAY_SIZE(drbg_cores) * 2 > ARRAY_SIZE(drbg_algs)) { pr_info("DRBG: Cannot register all DRBG types" - "(slots needed: %lu, slots available: %lu)\n", - ARRAY_SIZE(drbg_cores) * 2, ARRAY_SIZE(drbg_algs)); + "(slots needed: %u, slots available: %u)\n", + (unsigned int)ARRAY_SIZE(drbg_cores) * 2, + (unsigned int)ARRAY_SIZE(drbg_algs)); return ret; } -- 1.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4/4] DRBG: Call CTR DRBG DF function only once
The CTR DRBG requires the update function to be called twice when generating a random number. In both cases, update function must process the additional information string by using the DF function. As the DF produces the same result in both cases, we can save one invocation of the DF function when the first DF function result is reused. The result of the DF function is stored in the scratchpad storage. The patch ensures that the scratchpad is not cleared when we want to reuse the DF result. For achieving this, the CTR DRBG update function must know by whom and in which scenario it is called. This information is provided with the reseed parameter to the update function. Signed-off-by: Stephan Mueller --- crypto/drbg.c | 41 ++--- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/crypto/drbg.c b/crypto/drbg.c index 4593b3c..53ff20d 100644 --- a/crypto/drbg.c +++ b/crypto/drbg.c @@ -565,7 +565,21 @@ out: return ret; } -/* update function of CTR DRBG as defined in 10.2.1.2 */ +/* + * update function of CTR DRBG as defined in 10.2.1.2 + * + * The reseed variable has an enhanced meaning compared to the update + * functions of the other DRBGs as follows: + * 0 => initial seed from initialization + * 1 => reseed via drbg_seed + * 2 => first invocation from drbg_ctr_update when addtl is present. In + * this case, the df_data scratchpad is not deleted so that it is + * available for another calls to prevent calling the DF function + * again. + * 3 => second invocation from drbg_ctr_update. When the update function + * was called with addtl, the df_data memory already contains the + * DFed addtl information and we do not need to call DF again. + */ static int drbg_ctr_update(struct drbg_state *drbg, struct list_head *seed, int reseed) { @@ -580,7 +594,8 @@ static int drbg_ctr_update(struct drbg_state *drbg, struct list_head *seed, unsigned char prefix = DRBG_PREFIX1; memset(temp, 0, drbg_statelen(drbg) + drbg_blocklen(drbg)); - memset(df_data, 0, drbg_statelen(drbg)); + if (3 > reseed) + memset(df_data, 0, drbg_statelen(drbg)); /* 10.2.1.3.2 step 2 and 10.2.1.4.2 step 2 */ if (seed) { @@ -622,7 +637,8 @@ static int drbg_ctr_update(struct drbg_state *drbg, struct list_head *seed, out: memset(temp, 0, drbg_statelen(drbg) + drbg_blocklen(drbg)); - memset(df_data, 0, drbg_statelen(drbg)); + if (2 != reseed) + memset(df_data, 0, drbg_statelen(drbg)); return ret; } @@ -647,7 +663,7 @@ static int drbg_ctr_generate(struct drbg_state *drbg, LIST_HEAD(addtllist); list_add_tail(>list, ); - ret = drbg_ctr_update(drbg, , 1); + ret = drbg_ctr_update(drbg, , 2); if (ret) return 0; } @@ -678,21 +694,8 @@ static int drbg_ctr_generate(struct drbg_state *drbg, drbg_add_buf(drbg->V, drbg_blocklen(drbg), , 1); } - /* -* 10.2.1.5.2 step 6 -* The following call invokes the DF function again which could be -* optimized. In step 2, the "additional_input" after step 2 is the -* output of the DF function. If this result would be saved, the DF -* function would not need to be invoked again at this point. -*/ - if (addtl && 0 < addtl->len) { - LIST_HEAD(addtllist); - - list_add_tail(>list, ); - ret = drbg_ctr_update(drbg, , 1); - } else { - ret = drbg_ctr_update(drbg, NULL, 1); - } + /* 10.2.1.5.2 step 6 */ + ret = drbg_ctr_update(drbg, NULL, 3); if (ret) len = ret; -- 1.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] sched: Transform resched_task() into resched_curr()
We always use resched_task() with rq->curr argument. It's not possible to reschedule any task but rq's current. The patch introduces resched_curr(struct rq *) to replace all of the repeating patterns. The main aim is cleanup, but there is a little size profit too: (before) $ size kernel/sched/built-in.o textdata bss dec hex filename 155274164457042 178761 2ba49 kernel/sched/built-in.o $ size vmlinux textdata bss dec hex filename 7411490 1178376 991232 9581098 92322a vmlinux (after) $ size kernel/sched/built-in.o textdata bss dec hex filename 155130164457042 178617 2b9b9 kernel/sched/built-in.o $ size vmlinux textdata bss dec hex filename 7411362 1178376 991232 9580970 9231aa vmlinux I was choosing between resched_curr() and resched_rq(), and the first name looks better for me. A little lie in Documentation/trace/ftrace.txt. I have not actually collected the tracing again. With a hope the patch won't make execution times much worse :) Signed-off-by: Kirill Tkhai CC: Peter Zijlstra CC: Ingo Molnar --- Documentation/trace/ftrace.txt |2 +- include/linux/sched.h |6 +++--- kernel/sched/core.c| 25 + kernel/sched/deadline.c| 16 kernel/sched/fair.c| 20 ++-- kernel/sched/idle_task.c |2 +- kernel/sched/rt.c | 27 ++- kernel/sched/sched.h |2 +- 8 files changed, 51 insertions(+), 49 deletions(-) diff --git a/Documentation/trace/ftrace.txt b/Documentation/trace/ftrace.txt index 2479b2a..4da4261 100644 --- a/Documentation/trace/ftrace.txt +++ b/Documentation/trace/ftrace.txt @@ -1515,7 +1515,7 @@ Doing the same with chrt -r 5 and function-trace set. -0 3d.h41us+: 0:120:R + [003] 2448: 94:R sleep -0 3d.h42us : ttwu_do_activate.constprop.87 <-try_to_wake_up -0 3d.h33us : check_preempt_curr <-ttwu_do_wakeup - -0 3d.h33us : resched_task <-check_preempt_curr + -0 3d.h33us : resched_curr <-check_preempt_curr -0 3dNh34us : task_woken_rt <-ttwu_do_wakeup -0 3dNh34us : _raw_spin_unlock <-try_to_wake_up -0 3dNh34us : sub_preempt_count <-_raw_spin_unlock diff --git a/include/linux/sched.h b/include/linux/sched.h index 306f4f0..9d177b8 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -2788,7 +2788,7 @@ static inline bool __must_check current_set_polling_and_test(void) /* * Polling state must be visible before we test NEED_RESCHED, -* paired by resched_task() +* paired by resched_curr() */ smp_mb__after_atomic(); @@ -2806,7 +2806,7 @@ static inline bool __must_check current_clr_polling_and_test(void) /* * Polling state must be visible before we test NEED_RESCHED, -* paired by resched_task() +* paired by resched_curr() */ smp_mb__after_atomic(); @@ -2838,7 +2838,7 @@ static inline void current_clr_polling(void) * TIF_NEED_RESCHED and the IPI handler, scheduler_ipi(), will also * fold. */ - smp_mb(); /* paired with resched_task() */ + smp_mb(); /* paired with resched_curr() */ preempt_fold_need_resched(); } diff --git a/kernel/sched/core.c b/kernel/sched/core.c index ceea8d0..8da054f 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -587,30 +587,31 @@ static bool set_nr_if_polling(struct task_struct *p) #endif /* - * resched_task - mark a task 'to be rescheduled now'. + * resched_curr - mark rq's current task 'to be rescheduled now'. * * On UP this means the setting of the need_resched flag, on SMP it * might also involve a cross-CPU call to trigger the scheduler on * the target CPU. */ -void resched_task(struct task_struct *p) +void resched_curr(struct rq *rq) { + struct task_struct *curr = rq->curr; int cpu; - lockdep_assert_held(_rq(p)->lock); + lockdep_assert_held(>lock); - if (test_tsk_need_resched(p)) + if (test_tsk_need_resched(curr)) return; - cpu = task_cpu(p); + cpu = rq->cpu; if (cpu == smp_processor_id()) { - set_tsk_need_resched(p); + set_tsk_need_resched(curr); set_preempt_need_resched(); return; } - if (set_nr_and_not_polling(p)) + if (set_nr_and_not_polling(curr)) smp_send_reschedule(cpu); else trace_sched_wake_idle_without_ipi(cpu); @@ -623,7 +624,7 @@ void resched_cpu(int cpu) if (!raw_spin_trylock_irqsave(>lock, flags)) return; - resched_task(cpu_curr(cpu)); + resched_curr(rq); raw_spin_unlock_irqrestore(>lock, flags); } @@ -1029,7 +1030,7 @@ void
Re: [PATCH] gpio_keys, twl4030-pwrbutton: stay awake for 1sec on resume
Hi! > >> This gives the userspace (Replicant) a chance to fully handle the > >> pm_wakeup_event, before autosleep suspends the system alltogether > >> again. > >> > >> This fixes suspend/resume on the OpenPhoenux GTA04, in combination with > >> the Replicant 4.2.2 userspace, which needs to execute this to stay > >> awake: 'echo on > /sys/power/state' > >> > >> Signed-off-by: Lukas Märdian > >> Signed-off-by: H. Nikolaus Schaller > > > > I'm sorry, but we should not be doing this. > > > > You basically put a delay in driver to work around userspace bug. > > Do you think it is a user-space bug if the kernel goes to sleep again > before giving user space any chance to react to an event? Well, who says 1000msec is enough? Some userspace may need more. ... for example on PC when you keyboard-handling deamon is swapped out. > And the msec parameter is described as: > > @msec: Anticipated event processing time (in milliseconds). > > Isn't calling pm_wakeup_event() with a non-zero msec the standard > method to handle this situation? And it is used in other drivers. E.g. in > _mmc_detect_change() or hub_suspend(). * Notify the PM core of a wakeup event whose source is @ws that will take * approximately @msec milliseconds to be processed by the kernel. If @ws is * not active, activate it. If @msec is nonzero, set up the @ws' timer to * execute pm_wakeup_timer_fn() in future. Will take @msec milliseconds to be processed by the _kernel_. Yes, USB probing takes a lot of time in kernel. But you are using this parameter to wait for userspace... > > There must be better > > solution > > I am not sure how it could look like. Rafael, do you have any idea how this is supposed to work? Original patch is at https://lkml.org/lkml/2014/4/10/156 . Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] FIXME of file toploogy.h for alpha cpus
On 06/28/2014 12:07 AM, Nicholas Krause wrote: > This patch fixs the FIXME message in the function *cpumask_of_node > for using this function multiple times and the issue with recaluting > the cpu node mask when reusing this function. > > Signed-off-by: Nicholas Krause > --- > arch/alpha/include/asm/topology.h | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/arch/alpha/include/asm/topology.h > b/arch/alpha/include/asm/topology.h > index 9251e13..d301f66 100644 > --- a/arch/alpha/include/asm/topology.h > +++ b/arch/alpha/include/asm/topology.h > @@ -31,6 +31,9 @@ static const struct cpumask *cpumask_of_node(int node) > if (node == -1) > return cpu_all_mask; > > + else if (node == _to_cpumask_map[node]) > + return _to_cpumask_map[node]; > + > cpumask_clear(_to_cpumask_map[node]); > > for_each_online_cpu(cpu) { > Since this patch doesn't even compile, care to tell us how you tested it? Thanks, Sasha -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] batman-adv: Use kasprintf
Hi all, On 28/06/14 21:13, Joe Perches wrote: > diff --git a/net/batman-adv/sysfs.c b/net/batman-adv/sysfs.c > index f40cb04..d6fba94 100644 > --- a/net/batman-adv/sysfs.c > +++ b/net/batman-adv/sysfs.c > @@ -896,7 +896,7 @@ int batadv_throw_uevent(struct batadv_priv *bat_priv, > enum batadv_uev_type type, > { > int ret = -ENOMEM; > struct kobject *bat_kobj; > - char *uevent_env[4] = { NULL, NULL, NULL, NULL }; > + char *uevent_env[3]; Joe, why are you shortening this? kobject_uevent_env() expect a NULL-terminating array (that is the forth cell). ... > > ret = kobject_uevent_env(bat_kobj, KOBJ_CHANGE, uevent_env); And how is this change reducing the code space? For what concerns the labels, we use this pattern mostly all over the code: one single label/exit-point with the related NULL checks. Do you think that we can improve something by changing this? (I am not talking about the fastpath here). Cheers, -- Antonio Quartulli signature.asc Description: OpenPGP digital signature
[PATCH 3.4 06/43] usb: gadget: rename CONFIG_USB_GADGET_PXA25X
3.4-stable review patch. If anyone has any objections, please let me know. -- From: Paul Bolle commit d30f2065d6da377cc76771aca5a9850cfca8723b upstream. Commit 193ab2a60700 ("usb: gadget: allow multiple gadgets to be built") basically renamed the Kconfig symbol USB_GADGET_PXA25X to USB_PXA25X. It did not rename the related macros in use at that time. Commit c0a39151a405 ("ARM: pxa: fix inconsistent CONFIG_USB_PXA27X") did so for all but one macro. Rename that last macro too now. Fixes: 193ab2a60700 ("usb: gadget: allow multiple gadgets to be built") Signed-off-by: Paul Bolle Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/inode.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c @@ -1499,7 +1499,7 @@ gadgetfs_setup (struct usb_gadget *gadge } break; -#ifndefCONFIG_USB_GADGET_PXA25X +#ifndefCONFIG_USB_PXA25X /* PXA automagically handles this request too */ case USB_REQ_GET_CONFIGURATION: if (ctrl->bRequestType != 0x80) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.4 05/43] USB: usbtest: add a timeout for scatter-gather tests
3.4-stable review patch. If anyone has any objections, please let me know. -- From: Alan Stern commit 32b36eeae6a859670d2939a7d6136cb5e9ed64f8 upstream. In usbtest, tests 5 - 8 use the scatter-gather library in usbcore without any sort of timeout. If there's a problem in the gadget or host controller being tested, the test can hang. This patch adds a 10-second timeout to the tests, so that they will fail gracefully with an ETIMEDOUT error instead of hanging. Signed-off-by: Alan Stern Reported-by: Huang Rui Tested-by: Huang Rui Signed-off-by: Greg Kroah-Hartman --- drivers/usb/misc/usbtest.c | 16 +++- 1 file changed, 15 insertions(+), 1 deletion(-) --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c @@ -7,7 +7,7 @@ #include #include #include - +#include #include @@ -462,6 +462,14 @@ alloc_sglist(int nents, int max, int var return sg; } +static void sg_timeout(unsigned long _req) +{ + struct usb_sg_request *req = (struct usb_sg_request *) _req; + + req->status = -ETIMEDOUT; + usb_sg_cancel(req); +} + static int perform_sglist( struct usbtest_dev *tdev, unsignediterations, @@ -473,6 +481,9 @@ static int perform_sglist( { struct usb_device *udev = testdev_to_usbdev(tdev); int retval = 0; + struct timer_list sg_timer; + + setup_timer_on_stack(_timer, sg_timeout, (unsigned long) req); while (retval == 0 && iterations-- > 0) { retval = usb_sg_init(req, udev, pipe, @@ -483,7 +494,10 @@ static int perform_sglist( if (retval) break; + mod_timer(_timer, jiffies + + msecs_to_jiffies(SIMPLE_IO_TIMEOUT)); usb_sg_wait(req); + del_timer_sync(_timer); retval = req->status; /* FIXME check resulting data pattern */ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.4 00/43] 3.4.96-stable review
This is the start of the stable review cycle for the 3.4.96 release. There are 43 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know. Responses should be made by Mon Jun 30 17:44:34 UTC 2014. Anything received after that time might be too late. The whole patch series can be found in one patch at: kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.4.96-rc1.gz and the diffstat can be found below. thanks, greg k-h - Pseudo-Shortlog of commits: Greg Kroah-Hartman Linux 3.4.96-rc1 Andy Lutomirski x86_32, entry: Do syscall exit work on badsys (CVE-2014-4508) Roger Quadros usb: usbtest: Add timetout to simple_io() Eric Sandeen btrfs: fix use of uninit "ret" in end_extent_writepage() Liu Bo Btrfs: use right type to get real comparison Rickard Strandqvist fs: btrfs: volumes.c: Fix for possible null pointer dereference Chris Mason Btrfs: fix double free in find_lock_delalloc_range Michael S. Tsirkin skbuff: skb_segment: orphan frags before copying Michael S. Tsirkin skbuff: export skb_copy_ubufs Michael S. Tsirkin skbuff: add an api to orphan frags Thomas Gleixner genirq: Sanitize spurious interrupt detection of threaded irqs Mike Frysinger x86, x32: Use compat shims for io_{setup,submit} H. Peter Anvin x86-32, espfix: Remove filter for espfix32 due to race Nicholas A. Bellinger target: Explicitly clear ramdisk_mcp backend pages Russell King ARM: stacktrace: avoid listing stacktrace functions in stacktrace Lv Zheng ACPI: Fix conflict between customized DSDT and DSDT local copy Johan Hovold USB: sierra: fix remote wakeup Johan Hovold USB: sierra: fix urb and memory leak on disconnect Johan Hovold USB: sierra: fix urb and memory leak in resume error path Johan Hovold USB: sierra: fix use after free at suspend/resume Johan Hovold USB: sierra: fix AA deadlock in open error path Johan Hovold USB: usb_wwan: fix potential blocked I/O after resume Johan Hovold USB: usb_wwan: fix potential NULL-deref at resume Johan Hovold USB: usb_wwan: fix urb leak at shutdown Johan Hovold USB: usb_wwan: fix write and suspend race xiao jin USB: usb_wwan: fix race between write and resume xiao jin USB: usb_wwan: fix urb leak in write error path Mikulas Patocka matroxfb: perform a dummy read of M_STATUS Maurizio Lombardi ext4: fix wrong assert in ext4_mb_normalize_request() Christian Borntraeger s390/lowcore: reserve 96 bytes for IRB in lowcore Johannes Weiner mm: vmscan: clear kswapd's special reclaim powers before exiting Kees Cook HID: core: fix validation of report id 0 Hugh Dickins mm: fix sleeping function warning from __put_anon_vma Tony Luck mm/memory-failure.c: don't let collect_procs() skip over processes for MF_ACTION_REQUIRED Tony Luck mm/memory-failure.c-failure: send right signal code to correct thread Johan Hovold USB: option: fix runtime PM handling Alan Stern USB: EHCI: avoid BIOS handover on the HASEE E200 Felipe Balbi usb: dwc3: gadget: clear stall when disabling endpoint Paul Bolle usb: gadget: rename CONFIG_USB_GADGET_PXA25X Alan Stern USB: usbtest: add a timeout for scatter-gather tests Huang Rui usb: usbtest: fix unlink write error with pattern 1 Dan Carpenter applicom: dereferencing NULL on error path Paul Bolle staging: tidspbridge: check for CONFIG_SND_OMAP_SOC_MCBSP Stephane Grosjean can: peak_pci: prevent use after free at netdev removal - Diffstat: Makefile | 4 +- arch/arm/kernel/stacktrace.c | 18 ++-- arch/s390/include/asm/lowcore.h | 11 +-- arch/x86/kernel/entry_32.S | 15 ++-- arch/x86/syscalls/syscall_64.tbl | 6 +- drivers/acpi/bus.c | 7 ++ drivers/char/applicom.c | 1 - drivers/hid/hid-core.c | 12 ++- drivers/net/can/sja1000/peak_pci.c | 14 +-- drivers/staging/tidspbridge/core/dsp-clock.c | 4 +- drivers/target/target_core_rd.c | 2 +- drivers/usb/dwc3/gadget.c| 4 + drivers/usb/gadget/inode.c | 2 +- drivers/usb/host/pci-quirks.c| 19 - drivers/usb/misc/usbtest.c | 40 - drivers/usb/serial/option.c | 15 +++- drivers/usb/serial/sierra.c | 54 +--- drivers/usb/serial/usb_wwan.c| 123 +++ drivers/video/matrox/matroxfb_base.h | 2 +- fs/btrfs/backref.c | 2 +- fs/btrfs/extent_io.c | 3 +- fs/btrfs/volumes.c | 5 +- fs/ext4/mballoc.c
[PATCH 3.4 07/43] usb: dwc3: gadget: clear stall when disabling endpoint
3.4-stable review patch. If anyone has any objections, please let me know. -- From: Felipe Balbi commit 687ef9817df7ed960d14575b9033dde3d04631fe upstream. so it seems like DWC3 IP doesn't clear stalls automatically when we disable an endpoint, because of that, we _must_ make sure stalls are cleared before clearing the proper bit in DALEPENA register. Reported-by: Johannes Stezenbach Signed-off-by: Felipe Balbi Signed-off-by: Greg Kroah-Hartman --- drivers/usb/dwc3/gadget.c |4 1 file changed, 4 insertions(+) --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -531,6 +531,10 @@ static int __dwc3_gadget_ep_disable(stru dwc3_remove_requests(dwc, dep); + /* make sure HW endpoint isn't stalled */ + if (dep->flags & DWC3_EP_STALL) + __dwc3_gadget_ep_set_halt(dep, 0); + reg = dwc3_readl(dwc->regs, DWC3_DALEPENA); reg &= ~DWC3_DALEPENA_EP(dep->number); dwc3_writel(dwc->regs, DWC3_DALEPENA, reg); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.4 10/43] mm/memory-failure.c-failure: send right signal code to correct thread
3.4-stable review patch. If anyone has any objections, please let me know. -- From: Tony Luck commit a70ffcac741d31a406c1d2b832ae43d658e7e1cf upstream. When a thread in a multi-threaded application hits a machine check because of an uncorrectable error in memory - we want to send the SIGBUS with si.si_code = BUS_MCEERR_AR to that thread. Currently we fail to do that if the active thread is not the primary thread in the process. collect_procs() just finds primary threads and this test: if ((flags & MF_ACTION_REQUIRED) && t == current) { will see that the thread we found isn't the current thread and so send a si.si_code = BUS_MCEERR_AO to the primary (and nothing to the active thread at this time). We can fix this by checking whether "current" shares the same mm with the process that collect_procs() said owned the page. If so, we send the SIGBUS to current (with code BUS_MCEERR_AR). Signed-off-by: Tony Luck Signed-off-by: Naoya Horiguchi Reported-by: Otto Bruggeman Cc: Andi Kleen Cc: Borislav Petkov Cc: Chen Gong Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- mm/memory-failure.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -208,9 +208,9 @@ static int kill_proc(struct task_struct #endif si.si_addr_lsb = compound_trans_order(compound_head(page)) + PAGE_SHIFT; - if ((flags & MF_ACTION_REQUIRED) && t == current) { + if ((flags & MF_ACTION_REQUIRED) && t->mm == current->mm) { si.si_code = BUS_MCEERR_AR; - ret = force_sig_info(SIGBUS, , t); + ret = force_sig_info(SIGBUS, , current); } else { /* * Don't use force here, it's convenient if the signal -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.4 19/43] USB: usb_wwan: fix race between write and resume
3.4-stable review patch. If anyone has any objections, please let me know. -- From: xiao jin commit d9e93c08d8d985e5ef89436ebc9f4aad7e31559f upstream. We find a race between write and resume. usb_wwan_resume run play_delayed() and spin_unlock, but intfdata->suspended still is not set to zero. At this time usb_wwan_write is called and anchor the urb to delay list. Then resume keep running but the delayed urb have no chance to be commit until next resume. If the time of next resume is far away, tty will be blocked in tty_wait_until_sent during time. The race also can lead to writes being reordered. This patch put play_Delayed and intfdata->suspended together in the spinlock, it's to avoid the write race during resume. Fixes: 383cedc3bb43 ("USB: serial: full autosuspend support for the option driver") Signed-off-by: xiao jin Signed-off-by: Zhang, Qi1 Reviewed-by: David Cohen Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/usb_wwan.c |8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) --- a/drivers/usb/serial/usb_wwan.c +++ b/drivers/usb/serial/usb_wwan.c @@ -731,17 +731,15 @@ int usb_wwan_resume(struct usb_serial *s } } + spin_lock_irq(>susp_lock); for (i = 0; i < serial->num_ports; i++) { /* walk all ports */ port = serial->port[i]; portdata = usb_get_serial_port_data(port); /* skip closed ports */ - spin_lock_irq(>susp_lock); - if (!portdata->opened) { - spin_unlock_irq(>susp_lock); + if (!portdata || !portdata->opened) continue; - } for (j = 0; j < N_IN_URB; j++) { urb = portdata->in_urbs[j]; @@ -754,9 +752,7 @@ int usb_wwan_resume(struct usb_serial *s } } play_delayed(port); - spin_unlock_irq(>susp_lock); } - spin_lock_irq(>susp_lock); intfdata->suspended = 0; spin_unlock_irq(>susp_lock); err_out: -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.4 20/43] USB: usb_wwan: fix write and suspend race
3.4-stable review patch. If anyone has any objections, please let me know. -- From: Johan Hovold commit 170fad9e22df0063eba0701adb966786d7a4ec5a upstream. Fix race between write() and suspend() which could lead to writes being dropped (or I/O while suspended) if the device is runtime suspended while a write request is being processed. Specifically, suspend() releases the susp_lock after determining the device is idle but before setting the suspended flag, thus leaving a window where a concurrent write() can submit an urb. Fixes: 383cedc3bb43 ("USB: serial: full autosuspend support for the option driver") Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/usb_wwan.c | 12 +--- 1 file changed, 5 insertions(+), 7 deletions(-) --- a/drivers/usb/serial/usb_wwan.c +++ b/drivers/usb/serial/usb_wwan.c @@ -647,22 +647,20 @@ EXPORT_SYMBOL(usb_wwan_release); int usb_wwan_suspend(struct usb_serial *serial, pm_message_t message) { struct usb_wwan_intf_private *intfdata = serial->private; - int b; dbg("%s entered", __func__); + spin_lock_irq(>susp_lock); if (PMSG_IS_AUTO(message)) { - spin_lock_irq(>susp_lock); - b = intfdata->in_flight; - spin_unlock_irq(>susp_lock); - - if (b) + if (intfdata->in_flight) { + spin_unlock_irq(>susp_lock); return -EBUSY; + } } - spin_lock_irq(>susp_lock); intfdata->suspended = 1; spin_unlock_irq(>susp_lock); + stop_read_write_urbs(serial); return 0; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.4 02/43] staging: tidspbridge: check for CONFIG_SND_OMAP_SOC_MCBSP
3.4-stable review patch. If anyone has any objections, please let me know. -- From: Paul Bolle commit d3921a03a89acb1b9ca599590c0131c89f8737d8 upstream. Commit d0f47ff17f29 ("ASoC: OMAP: Build config cleanup for McBSP") removed the Kconfig symbol OMAP_MCBSP. It left two checks for CONFIG_OMAP_MCBSP untouched. Convert these to checks for CONFIG_SND_OMAP_SOC_MCBSP. That must be correct, since that re-enables calls to functions that are all found in sound/soc/omap/mcbsp.c. And that file is built only if CONFIG_SND_OMAP_SOC_MCBSP is defined. Fixes: d0f47ff17f29 ("ASoC: OMAP: Build config cleanup for McBSP") Signed-off-by: Paul Bolle Signed-off-by: Greg Kroah-Hartman --- drivers/staging/tidspbridge/core/dsp-clock.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/staging/tidspbridge/core/dsp-clock.c +++ b/drivers/staging/tidspbridge/core/dsp-clock.c @@ -213,7 +213,7 @@ int dsp_clk_enable(enum dsp_clk_id clk_i case GPT_CLK: status = omap_dm_timer_start(timer[clk_id - 1]); break; -#ifdef CONFIG_OMAP_MCBSP +#ifdef CONFIG_SND_OMAP_SOC_MCBSP case MCBSP_CLK: omap_mcbsp_request(MCBSP_ID(clk_id)); omap2_mcbsp_set_clks_src(MCBSP_ID(clk_id), MCBSP_CLKS_PAD_SRC); @@ -289,7 +289,7 @@ int dsp_clk_disable(enum dsp_clk_id clk_ case GPT_CLK: status = omap_dm_timer_stop(timer[clk_id - 1]); break; -#ifdef CONFIG_OMAP_MCBSP +#ifdef CONFIG_SND_OMAP_SOC_MCBSP case MCBSP_CLK: omap2_mcbsp_set_clks_src(MCBSP_ID(clk_id), MCBSP_CLKS_PRCM_SRC); omap_mcbsp_free(MCBSP_ID(clk_id)); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.4 03/43] applicom: dereferencing NULL on error path
3.4-stable review patch. If anyone has any objections, please let me know. -- From: Dan Carpenter commit 8bab797c6e5724a43b7666ad70860712365cdb71 upstream. This is a static checker fix. The "dev" variable is always NULL after the while statement so we would be dereferencing a NULL pointer here. Fixes: 819a3eba4233 ('[PATCH] applicom: fix error handling') Signed-off-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/char/applicom.c |1 - 1 file changed, 1 deletion(-) --- a/drivers/char/applicom.c +++ b/drivers/char/applicom.c @@ -345,7 +345,6 @@ out: free_irq(apbs[i].irq, ); iounmap(apbs[i].RamIO); } - pci_disable_device(dev); return ret; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.4 21/43] USB: usb_wwan: fix urb leak at shutdown
3.4-stable review patch. If anyone has any objections, please let me know. -- From: Johan Hovold commit 79eed03e77d481b55d85d1cfe5a1636a0d3897fd upstream. The delayed-write queue was never emptied at shutdown (close), something which could lead to leaked urbs if the port is closed before being runtime resumed due to a write. When this happens the output buffer would not drain on close (closing_wait timeout), and after consecutive opens, writes could be corrupted with previously buffered data, transfered with reduced throughput or completely blocked. Note that unbusy_queued_urb() was simply moved out of CONFIG_PM. Fixes: 383cedc3bb43 ("USB: serial: full autosuspend support for the option driver") Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/usb_wwan.c | 34 ++ 1 file changed, 22 insertions(+), 12 deletions(-) --- a/drivers/usb/serial/usb_wwan.c +++ b/drivers/usb/serial/usb_wwan.c @@ -434,12 +434,26 @@ int usb_wwan_open(struct tty_struct *tty } EXPORT_SYMBOL(usb_wwan_open); +static void unbusy_queued_urb(struct urb *urb, + struct usb_wwan_port_private *portdata) +{ + int i; + + for (i = 0; i < N_OUT_URB; i++) { + if (urb == portdata->out_urbs[i]) { + clear_bit(i, >out_busy); + break; + } + } +} + void usb_wwan_close(struct usb_serial_port *port) { int i; struct usb_serial *serial = port->serial; struct usb_wwan_port_private *portdata; struct usb_wwan_intf_private *intfdata = port->serial->private; + struct urb *urb; dbg("%s", __func__); portdata = usb_get_serial_port_data(port); @@ -450,6 +464,14 @@ void usb_wwan_close(struct usb_serial_po portdata->opened = 0; spin_unlock_irq(>susp_lock); + for (;;) { + urb = usb_get_from_anchor(>delayed); + if (!urb) + break; + unbusy_queued_urb(urb, portdata); + usb_autopm_put_interface_async(serial->interface); + } + for (i = 0; i < N_IN_URB; i++) usb_kill_urb(portdata->in_urbs[i]); for (i = 0; i < N_OUT_URB; i++) @@ -667,18 +689,6 @@ int usb_wwan_suspend(struct usb_serial * } EXPORT_SYMBOL(usb_wwan_suspend); -static void unbusy_queued_urb(struct urb *urb, struct usb_wwan_port_private *portdata) -{ - int i; - - for (i = 0; i < N_OUT_URB; i++) { - if (urb == portdata->out_urbs[i]) { - clear_bit(i, >out_busy); - break; - } - } -} - static void play_delayed(struct usb_serial_port *port) { struct usb_wwan_intf_private *data; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.4 23/43] USB: usb_wwan: fix potential blocked I/O after resume
3.4-stable review patch. If anyone has any objections, please let me know. -- From: Johan Hovold commit fb7ad4f93d9f0f7d49beda32f5e7becb94b29a4d upstream. Keep trying to submit urbs rather than bail out on first read-urb submission error, which would also prevent I/O for any further ports from being resumed. Instead keep an error count, for all types of failed submissions, and let USB core know that something went wrong. Also make sure to always clear the suspended flag. Currently a failed read-urb submission would prevent cached writes as well as any subsequent writes from being submitted until next suspend-resume cycle, something which may not even necessarily happen. Note that USB core currently only logs an error if an interface resume failed. Fixes: 383cedc3bb43 ("USB: serial: full autosuspend support for the option driver") Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/usb_wwan.c | 25 + 1 file changed, 17 insertions(+), 8 deletions(-) --- a/drivers/usb/serial/usb_wwan.c +++ b/drivers/usb/serial/usb_wwan.c @@ -692,12 +692,12 @@ int usb_wwan_suspend(struct usb_serial * } EXPORT_SYMBOL(usb_wwan_suspend); -static void play_delayed(struct usb_serial_port *port) +static int play_delayed(struct usb_serial_port *port) { struct usb_wwan_intf_private *data; struct usb_wwan_port_private *portdata; struct urb *urb; - int err; + int err = 0; portdata = usb_get_serial_port_data(port); data = port->serial->private; @@ -714,6 +714,8 @@ static void play_delayed(struct usb_seri break; } } + + return err; } int usb_wwan_resume(struct usb_serial *serial) @@ -723,7 +725,8 @@ int usb_wwan_resume(struct usb_serial *s struct usb_wwan_intf_private *intfdata = serial->private; struct usb_wwan_port_private *portdata; struct urb *urb; - int err = 0; + int err; + int err_count = 0; dbg("%s entered", __func__); @@ -744,25 +747,31 @@ int usb_wwan_resume(struct usb_serial *s dev_err(>dev, "%s: submit int urb failed: %d\n", __func__, err); + err_count++; } } + err = play_delayed(port); + if (err) + err_count++; + for (j = 0; j < N_IN_URB; j++) { urb = portdata->in_urbs[j]; err = usb_submit_urb(urb, GFP_ATOMIC); if (err < 0) { err("%s: Error %d for bulk URB %d", __func__, err, i); - spin_unlock_irq(>susp_lock); - goto err_out; + err_count++; } } - play_delayed(port); } intfdata->suspended = 0; spin_unlock_irq(>susp_lock); -err_out: - return err; + + if (err_count) + return -EIO; + + return 0; } EXPORT_SYMBOL(usb_wwan_resume); #endif -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.4 24/43] USB: sierra: fix AA deadlock in open error path
3.4-stable review patch. If anyone has any objections, please let me know. -- From: Johan Hovold commit 353fe198602e8b4d1c7bdcceb8e60955087201b1 upstream. Fix AA deadlock in open error path that would call close() and try to grab the already held disc_mutex. Fixes: b9a44bc19f48 ("sierra: driver urb handling improvements") Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/sierra.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c @@ -867,14 +867,9 @@ static int sierra_open(struct tty_struct usb_sndbulkpipe(serial->dev, endpoint) | USB_DIR_IN); err = sierra_submit_rx_urbs(port, GFP_KERNEL); - if (err) { - /* get rid of everything as in close */ - sierra_close(port); - /* restore balance for autopm */ - if (!serial->disconnected) - usb_autopm_put_interface(serial->interface); - return err; - } + if (err) + goto err_submit; + sierra_send_setup(port); serial->interface->needs_remote_wakeup = 1; @@ -884,6 +879,16 @@ static int sierra_open(struct tty_struct usb_autopm_put_interface(serial->interface); return 0; + +err_submit: + sierra_stop_rx_urbs(port); + + for (i = 0; i < portdata->num_in_urbs; i++) { + sierra_release_urb(portdata->in_urbs[i]); + portdata->in_urbs[i] = NULL; + } + + return err; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.4 25/43] USB: sierra: fix use after free at suspend/resume
3.4-stable review patch. If anyone has any objections, please let me know. -- From: Johan Hovold commit 8452727de70f6ad850cd6d0aaa18b5d9050aa63b upstream. Fix use after free or NULL-pointer dereference during suspend and resume. The port data may never have been allocated (port probe failed) or may already have been released by port_remove (e.g. driver is unloaded) when suspend and resume are called. Fixes: e6929a9020ac ("USB: support for autosuspend in sierra while online") Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/sierra.c |6 ++ 1 file changed, 6 insertions(+) --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c @@ -999,6 +999,7 @@ static void sierra_release(struct usb_se portdata = usb_get_serial_port_data(port); if (!portdata) continue; + usb_set_serial_port_data(port, NULL); kfree(portdata); } kfree(serial->private); @@ -1015,6 +1016,8 @@ static void stop_read_write_urbs(struct for (i = 0; i < serial->num_ports; ++i) { port = serial->port[i]; portdata = usb_get_serial_port_data(port); + if (!portdata) + continue; sierra_stop_rx_urbs(port); usb_kill_anchored_urbs(>active); } @@ -1057,6 +1060,9 @@ static int sierra_resume(struct usb_seri port = serial->port[i]; portdata = usb_get_serial_port_data(port); + if (!portdata) + continue; + while ((urb = usb_get_from_anchor(>delayed))) { usb_anchor_urb(urb, >active); intfdata->in_flight++; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.4 04/43] usb: usbtest: fix unlink write error with pattern 1
3.4-stable review patch. If anyone has any objections, please let me know. -- From: Huang Rui commit e4d58f5dcb7d7be45df8def31881ebfae99c75da upstream. TEST 12 and TEST 24 unlinks the URB write request for N times. When host and gadget both initialize pattern 1 (mod 63) data series to transfer, the gadget side will complain the wrong data which is not expected. Because in host side, usbtest doesn't fill the data buffer as mod 63 and this patch fixed it. [20285.488974] dwc3 dwc3.0.auto: ep1out-bulk: Transfer Not Ready [20285.489181] dwc3 dwc3.0.auto: ep1out-bulk: reason Transfer Not Active [20285.489423] dwc3 dwc3.0.auto: ep1out-bulk: req 8800aa6cb480 dma aeb50800 length 512 last [20285.489727] dwc3 dwc3.0.auto: ep1out-bulk: cmd 'Start Transfer' params a9eaf000 [20285.490055] dwc3 dwc3.0.auto: Command Complete --> 0 [20285.490281] dwc3 dwc3.0.auto: ep1out-bulk: Transfer Not Ready [20285.490492] dwc3 dwc3.0.auto: ep1out-bulk: reason Transfer Active [20285.490713] dwc3 dwc3.0.auto: ep1out-bulk: endpoint busy [20285.490909] dwc3 dwc3.0.auto: ep1out-bulk: Transfer Complete [20285.491117] dwc3 dwc3.0.auto: request 8800aa6cb480 from ep1out-bulk completed 512/512 ===> 0 [20285.491431] zero gadget: bad OUT byte, buf[1] = 0 [20285.491605] dwc3 dwc3.0.auto: ep1out-bulk: cmd 'Set Stall' params [20285.491915] dwc3 dwc3.0.auto: Command Complete --> 0 [20285.492099] dwc3 dwc3.0.auto: queing request 8800aa6cb480 to ep1out-bulk length 512 [20285.492387] dwc3 dwc3.0.auto: ep1out-bulk: Transfer Not Ready [20285.492595] dwc3 dwc3.0.auto: ep1out-bulk: reason Transfer Not Active [20285.492830] dwc3 dwc3.0.auto: ep1out-bulk: req 8800aa6cb480 dma aeb51000 length 512 last [20285.493135] dwc3 dwc3.0.auto: ep1out-bulk: cmd 'Start Transfer' params a9eaf000 [20285.493465] dwc3 dwc3.0.auto: Command Complete --> 0 Signed-off-by: Huang Rui Signed-off-by: Greg Kroah-Hartman --- drivers/usb/misc/usbtest.c | 10 ++ 1 file changed, 10 insertions(+) --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c @@ -1135,6 +1135,11 @@ static int unlink1(struct usbtest_dev *d urb->context = urb->complete = unlink1_callback; + if (usb_pipeout(urb->pipe)) { + simple_fill_buf(urb); + urb->transfer_flags |= URB_ZERO_PACKET; + } + /* keep the endpoint busy. there are lots of hc/hcd-internal * states, and testing should get to all of them over time. * @@ -1265,6 +1270,11 @@ static int unlink_queued(struct usbtest_ unlink_queued_callback, ); ctx.urbs[i]->transfer_dma = buf_dma; ctx.urbs[i]->transfer_flags = URB_NO_TRANSFER_DMA_MAP; + + if (usb_pipeout(ctx.urbs[i]->pipe)) { + simple_fill_buf(ctx.urbs[i]); + ctx.urbs[i]->transfer_flags |= URB_ZERO_PACKET; + } } /* Submit all the URBs and then unlink URBs num - 4 and num - 2. */ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.4 22/43] USB: usb_wwan: fix potential NULL-deref at resume
3.4-stable review patch. If anyone has any objections, please let me know. -- From: Johan Hovold commit 9096f1fbba916c2e052651e9de82fcfb98d4bea7 upstream. The interrupt urb was submitted unconditionally at resume, something which could lead to a NULL-pointer dereference in the urb completion handler as resume may be called after the port and port data is gone. Fix this by making sure the interrupt urb is only submitted and active when the port is open. Fixes: 383cedc3bb43 ("USB: serial: full autosuspend support for the option driver") Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/usb_wwan.c | 42 -- 1 file changed, 20 insertions(+), 22 deletions(-) --- a/drivers/usb/serial/usb_wwan.c +++ b/drivers/usb/serial/usb_wwan.c @@ -408,6 +408,14 @@ int usb_wwan_open(struct tty_struct *tty dbg("%s", __func__); + if (port->interrupt_in_urb) { + err = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); + if (err) { + dev_dbg(>dev, "%s: submit int urb failed: %d\n", + __func__, err); + } + } + /* Start reading from the IN endpoint */ for (i = 0; i < N_IN_URB; i++) { urb = portdata->in_urbs[i]; @@ -476,6 +484,7 @@ void usb_wwan_close(struct usb_serial_po usb_kill_urb(portdata->in_urbs[i]); for (i = 0; i < N_OUT_URB; i++) usb_kill_urb(portdata->out_urbs[i]); + usb_kill_urb(port->interrupt_in_urb); /* balancing - important as an error cannot be handled*/ usb_autopm_get_interface_no_resume(serial->interface); serial->interface->needs_remote_wakeup = 0; @@ -551,7 +560,7 @@ static void usb_wwan_setup_urbs(struct u int usb_wwan_startup(struct usb_serial *serial) { - int i, j, err; + int i, j; struct usb_serial_port *port; struct usb_wwan_port_private *portdata; u8 *buffer; @@ -584,12 +593,6 @@ int usb_wwan_startup(struct usb_serial * } usb_set_serial_port_data(port, portdata); - - if (!port->interrupt_in_urb) - continue; - err = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); - if (err) - dbg("%s: submit irq_in urb failed %d", __func__, err); } usb_wwan_setup_urbs(serial); return 0; @@ -723,21 +726,6 @@ int usb_wwan_resume(struct usb_serial *s int err = 0; dbg("%s entered", __func__); - /* get the interrupt URBs resubmitted unconditionally */ - for (i = 0; i < serial->num_ports; i++) { - port = serial->port[i]; - if (!port->interrupt_in_urb) { - dbg("%s: No interrupt URB for port %d", __func__, i); - continue; - } - err = usb_submit_urb(port->interrupt_in_urb, GFP_NOIO); - dbg("Submitted interrupt URB for port %d (result %d)", i, err); - if (err < 0) { - err("%s: Error %d for interrupt URB of port%d", - __func__, err, i); - goto err_out; - } - } spin_lock_irq(>susp_lock); for (i = 0; i < serial->num_ports; i++) { @@ -749,6 +737,16 @@ int usb_wwan_resume(struct usb_serial *s if (!portdata || !portdata->opened) continue; + if (port->interrupt_in_urb) { + err = usb_submit_urb(port->interrupt_in_urb, + GFP_ATOMIC); + if (err) { + dev_err(>dev, + "%s: submit int urb failed: %d\n", + __func__, err); + } + } + for (j = 0; j < N_IN_URB; j++) { urb = portdata->in_urbs[j]; err = usb_submit_urb(urb, GFP_ATOMIC); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.4 27/43] USB: sierra: fix urb and memory leak on disconnect
3.4-stable review patch. If anyone has any objections, please let me know. -- From: Johan Hovold commit 014333f77c0b71123d6ef7d31a9724e0699c9548 upstream. The delayed-write queue was never emptied on disconnect, something which would lead to leaked urbs and transfer buffers if the device is disconnected before being runtime resumed due to a write. Fixes: e6929a9020ac ("USB: support for autosuspend in sierra while online") Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/sierra.c | 12 1 file changed, 12 insertions(+) --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c @@ -801,6 +801,7 @@ static void sierra_close(struct usb_seri struct usb_serial *serial = port->serial; struct sierra_port_private *portdata; struct sierra_intf_private *intfdata = port->serial->private; + struct urb *urb; dev_dbg(>dev, "%s\n", __func__); @@ -825,6 +826,17 @@ static void sierra_close(struct usb_seri portdata->opened = 0; spin_unlock_irq(>susp_lock); + for (;;) { + urb = usb_get_from_anchor(>delayed); + if (!urb) + break; + kfree(urb->transfer_buffer); + usb_free_urb(urb); + usb_autopm_put_interface_async(serial->interface); + spin_lock(>lock); + portdata->outstanding_urbs--; + spin_unlock(>lock); + } /* Stop reading urbs */ sierra_stop_rx_urbs(port); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.4 08/43] USB: EHCI: avoid BIOS handover on the HASEE E200
3.4-stable review patch. If anyone has any objections, please let me know. -- From: Alan Stern commit b0a50e92bda3c4aeb8017d4e6c6e92146ebd5c9b upstream. Leandro Liptak reports that his HASEE E200 computer hangs when we ask the BIOS to hand over control of the EHCI host controller. This definitely sounds like a bug in the BIOS, but at the moment there is no way to fix it. This patch works around the problem by avoiding the handoff whenever the motherboard and BIOS version match those of Leandro's computer. Signed-off-by: Alan Stern Reported-by: Leandro Liptak Tested-by: Leandro Liptak Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/pci-quirks.c | 19 --- 1 file changed, 16 insertions(+), 3 deletions(-) --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c @@ -555,6 +555,14 @@ static const struct dmi_system_id __devi DMI_MATCH(DMI_BIOS_VERSION, "Lucid-"), }, }, + { + /* HASEE E200 */ + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "HASEE"), + DMI_MATCH(DMI_BOARD_NAME, "E210"), + DMI_MATCH(DMI_BIOS_VERSION, "6.00"), + }, + }, { } }; @@ -564,9 +572,14 @@ static void __devinit ehci_bios_handoff( { int try_handoff = 1, tried_handoff = 0; - /* The Pegatron Lucid tablet sporadically waits for 98 seconds trying -* the handoff on its unused controller. Skip it. */ - if (pdev->vendor == 0x8086 && pdev->device == 0x283a) { + /* +* The Pegatron Lucid tablet sporadically waits for 98 seconds trying +* the handoff on its unused controller. Skip it. +* +* The HASEE E200 hangs when the semaphore is set (bugzilla #77021). +*/ + if (pdev->vendor == 0x8086 && (pdev->device == 0x283a || + pdev->device == 0x27cc)) { if (dmi_check_system(ehci_dmi_nohandoff_table)) try_handoff = 0; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.4 26/43] USB: sierra: fix urb and memory leak in resume error path
3.4-stable review patch. If anyone has any objections, please let me know. -- From: Johan Hovold commit 7fdd26a01eb7b6cb6855ff8f69ef4a720720dfcb upstream. Neither the transfer buffer or the urb itself were released in the resume error path for delayed writes. Also on errors, the remainder of the queue was not even processed, which leads to further urb and buffer leaks. The same error path also failed to balance the outstanding-urb counter, something which results in degraded throughput or completely blocked writes. Fix this by releasing urb and buffer and balancing counters on errors, and by always processing the whole queue even when submission of one urb fails. Fixes: e6929a9020ac ("USB: support for autosuspend in sierra while online") Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/sierra.c |8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c @@ -1070,8 +1070,12 @@ static int sierra_resume(struct usb_seri if (err < 0) { intfdata->in_flight--; usb_unanchor_urb(urb); - usb_scuttle_anchored_urbs(>delayed); - break; + kfree(urb->transfer_buffer); + usb_free_urb(urb); + spin_lock(>lock); + portdata->outstanding_urbs--; + spin_unlock(>lock); + continue; } } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.4 14/43] mm: vmscan: clear kswapds special reclaim powers before exiting
3.4-stable review patch. If anyone has any objections, please let me know. -- From: Johannes Weiner commit 71abdc15adf8c702a1dd535f8e30df50758848d2 upstream. When kswapd exits, it can end up taking locks that were previously held by allocating tasks while they waited for reclaim. Lockdep currently warns about this: On Wed, May 28, 2014 at 06:06:34PM +0800, Gu Zheng wrote: > inconsistent {RECLAIM_FS-ON-W} -> {IN-RECLAIM_FS-R} usage. > kswapd2/1151 [HC0[0]:SC0[0]:HE1:SE1] takes: > (>group_rwsem){+?}, at: exit_signals+0x24/0x130 > {RECLAIM_FS-ON-W} state was registered at: > mark_held_locks+0xb9/0x140 > lockdep_trace_alloc+0x7a/0xe0 > kmem_cache_alloc_trace+0x37/0x240 > flex_array_alloc+0x99/0x1a0 > cgroup_attach_task+0x63/0x430 > attach_task_by_pid+0x210/0x280 > cgroup_procs_write+0x16/0x20 > cgroup_file_write+0x120/0x2c0 > vfs_write+0xc0/0x1f0 > SyS_write+0x4c/0xa0 > tracesys+0xdd/0xe2 > irq event stamp: 49 > hardirqs last enabled at (49): _raw_spin_unlock_irqrestore+0x36/0x70 > hardirqs last disabled at (48): _raw_spin_lock_irqsave+0x2b/0xa0 > softirqs last enabled at (0): copy_process.part.24+0x627/0x15f0 > softirqs last disabled at (0):(null) > > other info that might help us debug this: > Possible unsafe locking scenario: > > CPU0 > >lock(>group_rwsem); > > lock(>group_rwsem); > > *** DEADLOCK *** > > no locks held by kswapd2/1151. > > stack backtrace: > CPU: 30 PID: 1151 Comm: kswapd2 Not tainted 3.10.39+ #4 > Call Trace: >dump_stack+0x19/0x1b >print_usage_bug+0x1f7/0x208 >mark_lock+0x21d/0x2a0 >__lock_acquire+0x52a/0xb60 >lock_acquire+0xa2/0x140 >down_read+0x51/0xa0 >exit_signals+0x24/0x130 >do_exit+0xb5/0xa50 >kthread+0xdb/0x100 >ret_from_fork+0x7c/0xb0 This is because the kswapd thread is still marked as a reclaimer at the time of exit. But because it is exiting, nobody is actually waiting on it to make reclaim progress anymore, and it's nothing but a regular thread at this point. Be tidy and strip it of all its powers (PF_MEMALLOC, PF_SWAPWRITE, PF_KSWAPD, and the lockdep reclaim state) before returning from the thread function. Signed-off-by: Johannes Weiner Reported-by: Gu Zheng Cc: Yasuaki Ishimatsu Cc: Tang Chen Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- mm/vmscan.c |3 +++ 1 file changed, 3 insertions(+) --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -3138,7 +3138,10 @@ static int kswapd(void *p) } } + tsk->flags &= ~(PF_MEMALLOC | PF_SWAPWRITE | PF_KSWAPD); current->reclaim_state = NULL; + lockdep_clear_current_reclaim_state(); + return 0; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.4 13/43] HID: core: fix validation of report id 0
3.4-stable review patch. If anyone has any objections, please let me know. -- From: Kees Cook commit 1b15d2e5b8077670b1e6a33250a0d9577efff4a5 upstream. Some drivers use the first HID report in the list instead of using an index. In these cases, validation uses ID 0, which was supposed to mean "first known report". This fixes the problem, which was causing at least the lgff family of devices to stop working since hid_validate_values was being called with ID 0, but the devices used single numbered IDs for their reports: 0x05, 0x01, /* Usage Page (Desktop), */ 0x09, 0x05, /* Usage (Gamepad),*/ 0xA1, 0x01, /* Collection (Application), */ 0xA1, 0x02, /* Collection (Logical), */ 0x85, 0x01, /* Report ID (1), */ ... Reported-by: Simon Wood Signed-off-by: Kees Cook Reviewed-by: Benjamin Tissoires Signed-off-by: Jiri Kosina Signed-off-by: Greg Kroah-Hartman --- drivers/hid/hid-core.c | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -861,7 +861,17 @@ struct hid_report *hid_validate_values(s * ->numbered being checked, which may not always be the case when * drivers go to access report values. */ - report = hid->report_enum[type].report_id_hash[id]; + if (id == 0) { + /* +* Validating on id 0 means we should examine the first +* report in the list. +*/ + report = list_entry( + hid->report_enum[type].report_list.next, + struct hid_report, list); + } else { + report = hid->report_enum[type].report_id_hash[id]; + } if (!report) { hid_err(hid, "missing %s %u\n", hid_report_names[type], id); return NULL; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.4 17/43] matroxfb: perform a dummy read of M_STATUS
3.4-stable review patch. If anyone has any objections, please let me know. -- From: Mikulas Patocka commit 972754cfaee94d6e25acf94a497bc0a864d91b7e upstream. I had occasional screen corruption with the matrox framebuffer driver and I found out that the reason for the corruption is that the hardware blitter accesses the videoram while it is being written to. The matrox driver has a macro WaitTillIdle() that should wait until the blitter is idle, but it sometimes doesn't work. I added a dummy read mga_inl(M_STATUS) to WaitTillIdle() to fix the problem. The dummy read will flush the write buffer in the PCI chipset, and the next read of M_STATUS will return the hardware status. Since applying this patch, I had no screen corruption at all. Signed-off-by: Mikulas Patocka Signed-off-by: Tomi Valkeinen Signed-off-by: Greg Kroah-Hartman --- drivers/video/matrox/matroxfb_base.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/video/matrox/matroxfb_base.h +++ b/drivers/video/matrox/matroxfb_base.h @@ -698,7 +698,7 @@ void matroxfb_unregister_driver(struct m #define mga_fifo(n)do {} while ((mga_inl(M_FIFOSTATUS) & 0xFF) < (n)) -#define WaitTillIdle() do {} while (mga_inl(M_STATUS) & 0x1) +#define WaitTillIdle() do { mga_inl(M_STATUS); do {} while (mga_inl(M_STATUS) & 0x1); } while (0) /* code speedup */ #ifdef CONFIG_FB_MATROX_MILLENIUM -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.4 16/43] ext4: fix wrong assert in ext4_mb_normalize_request()
3.4-stable review patch. If anyone has any objections, please let me know. -- From: Maurizio Lombardi commit b5b60778558cafad17bbcbf63e0310bd3c68eb17 upstream. The variable "size" is expressed as number of blocks and not as number of clusters, this could trigger a kernel panic when using ext4 with the size of a cluster different from the size of a block. Signed-off-by: Maurizio Lombardi Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/mballoc.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -3015,7 +3015,7 @@ ext4_mb_normalize_request(struct ext4_al } BUG_ON(start + size <= ac->ac_o_ex.fe_logical && start > ac->ac_o_ex.fe_logical); - BUG_ON(size <= 0 || size > EXT4_CLUSTERS_PER_GROUP(ac->ac_sb)); + BUG_ON(size <= 0 || size > EXT4_BLOCKS_PER_GROUP(ac->ac_sb)); /* now prepare goal request */ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.4 15/43] s390/lowcore: reserve 96 bytes for IRB in lowcore
3.4-stable review patch. If anyone has any objections, please let me know. -- From: Christian Borntraeger commit 993072ee67aa179c48c85eb19869804e68887d86 upstream. The IRB might be 96 bytes if the extended-I/O-measurement facility is used. This feature is currently not used by Linux, but struct irb already has the emw defined. So let's make the irb in lowcore match the size of the internal data structure to be future proof. We also have to add a pad, to correctly align the paste. The bigger irb field also circumvents a bug in some QEMU versions that always write the emw field on test subchannel and therefore destroy the paste definitions of this CPU. Running under these QEMU version broke some timing functions in the VDSO and all users of these functions, e.g. some JREs. Signed-off-by: Christian Borntraeger Signed-off-by: Martin Schwidefsky Cc: Heiko Carstens Cc: Sebastian Ott Cc: Cornelia Huck Signed-off-by: Greg Kroah-Hartman --- arch/s390/include/asm/lowcore.h | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) --- a/arch/s390/include/asm/lowcore.h +++ b/arch/s390/include/asm/lowcore.h @@ -142,9 +142,9 @@ struct _lowcore { __u8pad_0x02fc[0x0300-0x02fc]; /* 0x02fc */ /* Interrupt response block */ - __u8irb[64];/* 0x0300 */ + __u8irb[96];/* 0x0300 */ - __u8pad_0x0340[0x0e00-0x0340]; /* 0x0340 */ + __u8pad_0x0360[0x0e00-0x0360]; /* 0x0360 */ /* * 0xe00 contains the address of the IPL Parameter Information @@ -288,12 +288,13 @@ struct _lowcore { __u8pad_0x03a0[0x0400-0x03a0]; /* 0x03a0 */ /* Interrupt response block. */ - __u8irb[64];/* 0x0400 */ + __u8irb[96];/* 0x0400 */ + __u8pad_0x0460[0x0480-0x0460]; /* 0x0460 */ /* Per cpu primary space access list */ - __u32 paste[16]; /* 0x0440 */ + __u32 paste[16]; /* 0x0480 */ - __u8pad_0x0480[0x0e00-0x0480]; /* 0x0480 */ + __u8pad_0x04c0[0x0e00-0x04c0]; /* 0x04c0 */ /* * 0xe00 contains the address of the IPL Parameter Information -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.4 29/43] ACPI: Fix conflict between customized DSDT and DSDT local copy
3.4-stable review patch. If anyone has any objections, please let me know. -- From: Lv Zheng commit 73577d1df8e1f31f6b1a5eebcdbc334eb0330e47 upstream. This patch fixes the following issue: If DSDT is customized, no local DSDT copy is needed. References: https://bugzilla.kernel.org/show_bug.cgi?id=69711 Signed-off-by: Enrico Etxe Arte Signed-off-by: Lv Zheng [rjw: Subject] Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman --- drivers/acpi/bus.c |7 +++ 1 file changed, 7 insertions(+) --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -57,6 +57,12 @@ EXPORT_SYMBOL(acpi_root_dir); #ifdef CONFIG_X86 +#ifdef CONFIG_ACPI_CUSTOM_DSDT +static inline int set_copy_dsdt(const struct dmi_system_id *id) +{ + return 0; +} +#else static int set_copy_dsdt(const struct dmi_system_id *id) { printk(KERN_NOTICE "%s detected - " @@ -64,6 +70,7 @@ static int set_copy_dsdt(const struct dm acpi_gbl_copy_dsdt_locally = 1; return 0; } +#endif static struct dmi_system_id dsdt_dmi_table[] __initdata = { /* -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.4 12/43] mm: fix sleeping function warning from __put_anon_vma
3.4-stable review patch. If anyone has any objections, please let me know. -- From: Hugh Dickins commit 7f39dda9d86fb4f4f17af0de170decf125726f8c upstream. Trinity reports BUG: sleeping function called from invalid context at kernel/locking/rwsem.c:47 in_atomic(): 0, irqs_disabled(): 0, pid: 5787, name: trinity-c27 __might_sleep < down_write < __put_anon_vma < page_get_anon_vma < migrate_pages < compact_zone < compact_zone_order < try_to_compact_pages .. Right, since conversion to mutex then rwsem, we should not put_anon_vma() from inside an rcu_read_lock()ed section: fix the two places that did so. And add might_sleep() to anon_vma_free(), as suggested by Peter Zijlstra. Fixes: 88c22088bf23 ("mm: optimize page_lock_anon_vma() fast-path") Reported-by: Dave Jones Signed-off-by: Hugh Dickins Cc: Peter Zijlstra Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- mm/rmap.c |8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/mm/rmap.c +++ b/mm/rmap.c @@ -103,6 +103,7 @@ static inline void anon_vma_free(struct * LOCK should suffice since the actual taking of the lock must * happen _before_ what follows. */ + might_sleep(); if (mutex_is_locked(_vma->root->mutex)) { anon_vma_lock(anon_vma); anon_vma_unlock(anon_vma); @@ -476,8 +477,9 @@ struct anon_vma *page_get_anon_vma(struc * above cannot corrupt). */ if (!page_mapped(page)) { + rcu_read_unlock(); put_anon_vma(anon_vma); - anon_vma = NULL; + return NULL; } out: rcu_read_unlock(); @@ -527,9 +529,9 @@ struct anon_vma *page_lock_anon_vma(stru } if (!page_mapped(page)) { + rcu_read_unlock(); put_anon_vma(anon_vma); - anon_vma = NULL; - goto out; + return NULL; } /* we pinned the anon_vma, its safe to sleep */ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.4 18/43] USB: usb_wwan: fix urb leak in write error path
3.4-stable review patch. If anyone has any objections, please let me know. -- From: xiao jin commit db0904737947d509844e171c9863ecc5b4534005 upstream. When enable usb serial for modem data, sometimes the tty is blocked in tty_wait_until_sent because portdata->out_busy always is set and have no chance to be cleared. We find a bug in write error path. usb_wwan_write set portdata->out_busy firstly, then try autopm async with error. No out urb submit and no usb_wwan_outdat_callback to this write, portdata->out_busy can't be cleared. This patch clear portdata->out_busy if usb_wwan_write try autopm async with error. Fixes: 383cedc3bb43 ("USB: serial: full autosuspend support for the option driver") Signed-off-by: xiao jin Signed-off-by: Zhang, Qi1 Reviewed-by: David Cohen Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/usb_wwan.c |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/usb/serial/usb_wwan.c +++ b/drivers/usb/serial/usb_wwan.c @@ -236,8 +236,10 @@ int usb_wwan_write(struct tty_struct *tt usb_pipeendpoint(this_urb->pipe), i); err = usb_autopm_get_interface_async(port->serial->interface); - if (err < 0) + if (err < 0) { + clear_bit(i, >out_busy); break; + } /* send the data */ memcpy(this_urb->transfer_buffer, buf, todo); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.4 38/43] Btrfs: fix double free in find_lock_delalloc_range
3.4-stable review patch. If anyone has any objections, please let me know. -- From: Chris Mason commit 7d78874273463a784759916fc3e0b4e2eb141c70 upstream. We need to NULL the cached_state after freeing it, otherwise we might free it again if find_delalloc_range doesn't find anything. Signed-off-by: Chris Mason Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/extent_io.c |1 + 1 file changed, 1 insertion(+) --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -1551,6 +1551,7 @@ again: * shortening the size of the delalloc range we're searching */ free_extent_state(cached_state); + cached_state = NULL; if (!loops) { unsigned long offset = (*start) & (PAGE_CACHE_SIZE - 1); max_bytes = PAGE_CACHE_SIZE - offset; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.4 09/43] USB: option: fix runtime PM handling
3.4-stable review patch. If anyone has any objections, please let me know. -- From: Johan Hovold commit acf47d4f9c39b1cba467aa9442fc2efe0b1da741 upstream. Fix potential I/O while runtime suspended due to missing PM operations in send_setup. Fixes: 383cedc3bb43 ("USB: serial: full autosuspend support for the option driver") Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/option.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c @@ -1930,6 +1930,7 @@ static int option_send_setup(struct usb_ struct usb_wwan_port_private *portdata; int ifNum = serial->interface->cur_altsetting->desc.bInterfaceNumber; int val = 0; + int res; dbg("%s", __func__); if (is_blacklisted(ifNum, OPTION_BLACKLIST_SENDSETUP, @@ -1945,9 +1946,17 @@ static int option_send_setup(struct usb_ if (portdata->rts_state) val |= 0x02; - return usb_control_msg(serial->dev, - usb_rcvctrlpipe(serial->dev, 0), - 0x22, 0x21, val, ifNum, NULL, 0, USB_CTRL_SET_TIMEOUT); + res = usb_autopm_get_interface(serial->interface); + if (res) + return res; + + res = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), + 0x22, 0x21, val, ifNum, NULL, + 0, USB_CTRL_SET_TIMEOUT); + + usb_autopm_put_interface(serial->interface); + + return res; } MODULE_AUTHOR(DRIVER_AUTHOR); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.4 41/43] btrfs: fix use of uninit "ret" in end_extent_writepage()
3.4-stable review patch. If anyone has any objections, please let me know. -- From: Eric Sandeen commit 3e2426bd0eb980648449e7a2f5a23e3cd3c7725c upstream. If this condition in end_extent_writepage() is false: if (tree->ops && tree->ops->writepage_end_io_hook) we will then test an uninitialized "ret" at: ret = ret < 0 ? ret : -EIO; The test for ret is for the case where ->writepage_end_io_hook failed, and we'd choose that ret as the error; but if there is no ->writepage_end_io_hook, nothing sets ret. Initializing ret to 0 should be sufficient; if writepage_end_io_hook wasn't set, (!uptodate) means non-zero err was passed in, so we choose -EIO in that case. Signed-of-by: Eric Sandeen Signed-off-by: Chris Mason Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/extent_io.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -2245,7 +2245,7 @@ int end_extent_writepage(struct page *pa { int uptodate = (err == 0); struct extent_io_tree *tree; - int ret; + int ret = 0; tree = _I(page->mapping->host)->io_tree; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.4 42/43] usb: usbtest: Add timetout to simple_io()
3.4-stable review patch. If anyone has any objections, please let me know. -- From: Roger Quadros commit e5e4746510d140261918aecce2e5e3aa4456f7e9 upstream. Without a timetout some tests e.g. test_halt() can remain stuck forever. Signed-off-by: Roger Quadros Reviewed-by: Felipe Balbi Signed-off-by: Greg Kroah-Hartman --- drivers/usb/misc/usbtest.c | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c @@ -10,6 +10,7 @@ #include #include +#define SIMPLE_IO_TIMEOUT 1 /* in milliseconds */ /*-*/ @@ -355,6 +356,7 @@ static int simple_io( int max = urb->transfer_buffer_length; struct completion completion; int retval = 0; + unsigned long expire; urb->context = while (retval == 0 && iterations-- > 0) { @@ -367,9 +369,15 @@ static int simple_io( if (retval != 0) break; - /* NOTE: no timeouts; can't be broken out of by interrupt */ - wait_for_completion(); - retval = urb->status; + expire = msecs_to_jiffies(SIMPLE_IO_TIMEOUT); + if (!wait_for_completion_timeout(, expire)) { + usb_kill_urb(urb); + retval = (urb->status == -ENOENT ? + -ETIMEDOUT : urb->status); + } else { + retval = urb->status; + } + urb->dev = udev; if (retval == 0 && usb_pipein(urb->pipe)) retval = simple_check_buf(tdev, urb); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.4 30/43] ARM: stacktrace: avoid listing stacktrace functions in stacktrace
3.4-stable review patch. If anyone has any objections, please let me know. -- From: Russell King commit 3683f44c42e991d313dc301504ee0fca1aeb8580 upstream. While debugging the FEC ethernet driver using stacktrace, it was noticed that the stacktraces always begin as follows: [] save_stack_trace_tsk+0x0/0x98 [] save_stack_trace+0x24/0x28 ... This is because the stack trace code includes the stack frames for itself. This is incorrect behaviour, and also leads to "skip" doing the wrong thing (which is the number of stack frames to avoid recording.) Perversely, it does the right thing when passed a non-current thread. Fix this by ensuring that we have a known constant number of frames above the main stack trace function, and always skip these. Signed-off-by: Russell King Signed-off-by: Greg Kroah-Hartman --- arch/arm/kernel/stacktrace.c | 18 +- 1 file changed, 13 insertions(+), 5 deletions(-) --- a/arch/arm/kernel/stacktrace.c +++ b/arch/arm/kernel/stacktrace.c @@ -83,13 +83,16 @@ static int save_trace(struct stackframe return trace->nr_entries >= trace->max_entries; } -void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace) +/* This must be noinline to so that our skip calculation works correctly */ +static noinline void __save_stack_trace(struct task_struct *tsk, + struct stack_trace *trace, unsigned int nosched) { struct stack_trace_data data; struct stackframe frame; data.trace = trace; data.skip = trace->skip; + data.no_sched_functions = nosched; if (tsk != current) { #ifdef CONFIG_SMP @@ -102,7 +105,6 @@ void save_stack_trace_tsk(struct task_st trace->entries[trace->nr_entries++] = ULONG_MAX; return; #else - data.no_sched_functions = 1; frame.fp = thread_saved_fp(tsk); frame.sp = thread_saved_sp(tsk); frame.lr = 0; /* recovered from the stack */ @@ -111,11 +113,12 @@ void save_stack_trace_tsk(struct task_st } else { register unsigned long current_sp asm ("sp"); - data.no_sched_functions = 0; + /* We don't want this function nor the caller */ + data.skip += 2; frame.fp = (unsigned long)__builtin_frame_address(0); frame.sp = current_sp; frame.lr = (unsigned long)__builtin_return_address(0); - frame.pc = (unsigned long)save_stack_trace_tsk; + frame.pc = (unsigned long)__save_stack_trace; } walk_stackframe(, save_trace, ); @@ -123,9 +126,14 @@ void save_stack_trace_tsk(struct task_st trace->entries[trace->nr_entries++] = ULONG_MAX; } +void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace) +{ + __save_stack_trace(tsk, trace, 1); +} + void save_stack_trace(struct stack_trace *trace) { - save_stack_trace_tsk(current, trace); + __save_stack_trace(current, trace, 0); } EXPORT_SYMBOL_GPL(save_stack_trace); #endif -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.4 40/43] Btrfs: use right type to get real comparison
3.4-stable review patch. If anyone has any objections, please let me know. -- From: Liu Bo commit cd857dd6bc2ae9ecea14e75a34e8a8fdc158e307 upstream. We want to make sure the point is still within the extent item, not to verify the memory it's pointing to. Signed-off-by: Liu Bo Signed-off-by: Chris Mason Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/backref.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c @@ -1033,7 +1033,7 @@ static int __get_extent_inline_ref(unsig *out_eiref = (struct btrfs_extent_inline_ref *)(ei + 1); } *ptr = (unsigned long)*out_eiref; - if ((void *)*ptr >= (void *)ei + item_size) + if ((unsigned long)(*ptr) >= (unsigned long)ei + item_size) return -ENOENT; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.4 39/43] fs: btrfs: volumes.c: Fix for possible null pointer dereference
3.4-stable review patch. If anyone has any objections, please let me know. -- From: Rickard Strandqvist commit 8321cf2596d283821acc466377c2b85bcd3422b7 upstream. There is otherwise a risk of a possible null pointer dereference. Was largely found by using a static code analysis program called cppcheck. Signed-off-by: Rickard Strandqvist Signed-off-by: Chris Mason Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/volumes.c |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -1446,11 +1446,12 @@ int btrfs_rm_device(struct btrfs_root *r struct btrfs_fs_devices *fs_devices; fs_devices = root->fs_info->fs_devices; while (fs_devices) { - if (fs_devices->seed == cur_devices) + if (fs_devices->seed == cur_devices) { + fs_devices->seed = cur_devices->seed; break; + } fs_devices = fs_devices->seed; } - fs_devices->seed = cur_devices->seed; cur_devices->seed = NULL; lock_chunks(root); __btrfs_close_devices(cur_devices); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.4 31/43] [PATCH] target: Explicitly clear ramdisk_mcp backend pages
3.4-stable review patch. If anyone has any objections, please let me know. -- [Note that a different patch to address the same issue went in during v3.15-rc1 (commit 4442dc8a), but includes a bunch of other changes that don't strictly apply to fixing the bug] This patch changes rd_allocate_sgl_table() to explicitly clear ramdisk_mcp backend memory pages by passing __GFP_ZERO into alloc_pages(). This addresses a potential security issue where reading from a ramdisk_mcp could return sensitive information, and follows what >= v3.15 does to explicitly clear ramdisk_mcp memory at backend device initialization time. Reported-by: Jorge Daniel Sequeira Matias Cc: Jorge Daniel Sequeira Matias Signed-off-by: Nicholas Bellinger Signed-off-by: Greg Kroah-Hartman --- drivers/target/target_core_rd.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/target/target_core_rd.c +++ b/drivers/target/target_core_rd.c @@ -177,7 +177,7 @@ static int rd_build_device_space(struct - 1; for (j = 0; j < sg_per_table; j++) { - pg = alloc_pages(GFP_KERNEL, 0); + pg = alloc_pages(GFP_KERNEL | __GFP_ZERO, 0); if (!pg) { pr_err("Unable to allocate scatterlist" " pages for struct rd_dev_sg_table\n"); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.4 33/43] x86, x32: Use compat shims for io_{setup,submit}
3.4-stable review patch. If anyone has any objections, please let me know. -- From: Mike Frysinger commit 7fd44dacdd803c0bbf38bf478d51d280902bb0f1 upstream. The io_setup takes a pointer to a context id of type aio_context_t. This in turn is typed to a __kernel_ulong_t. We could tweak the exported headers to define this as a 64bit quantity for specific ABIs, but since we already have a 32bit compat shim for the x86 ABI, let's just re-use that logic. The libaio package is also written to expect this as a pointer type, so a compat shim would simplify that. The io_submit func operates on an array of pointers to iocb structs. Padding out the array to be 64bit aligned is a huge pain, so convert it over to the existing compat shim too. We don't convert io_getevents to the compat func as its only purpose is to handle the timespec struct, and the x32 ABI uses 64bit times. With this change, the libaio package can now pass its testsuite when built for the x32 ABI. Signed-off-by: Mike Frysinger Link: http://lkml.kernel.org/r/1399250595-5005-1-git-send-email-vap...@gentoo.org Cc: H.J. Lu Signed-off-by: H. Peter Anvin Signed-off-by: Greg Kroah-Hartman --- arch/x86/syscalls/syscall_64.tbl |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/arch/x86/syscalls/syscall_64.tbl +++ b/arch/x86/syscalls/syscall_64.tbl @@ -212,10 +212,10 @@ 203common sched_setaffinity sys_sched_setaffinity 204common sched_getaffinity sys_sched_getaffinity 20564 set_thread_area -206common io_setupsys_io_setup +20664 io_setupsys_io_setup 207common io_destroy sys_io_destroy 208common io_geteventssys_io_getevents -209common io_submit sys_io_submit +20964 io_submit sys_io_submit 210common io_cancel sys_io_cancel 21164 get_thread_area 212common lookup_dcookie sys_lookup_dcookie @@ -353,3 +353,5 @@ 540x32 process_vm_writev compat_sys_process_vm_writev 541x32 setsockopt compat_sys_setsockopt 542x32 getsockopt compat_sys_getsockopt +543x32 io_setupcompat_sys_io_setup +544x32 io_submit compat_sys_io_submit -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.4 37/43] skbuff: skb_segment: orphan frags before copying
3.4-stable review patch. If anyone has any objections, please let me know. -- From: "Michael S. Tsirkin" commit 1fd819ecb90cc9b822cd84d3056ddba315d3340f upstream. skb_segment copies frags around, so we need to copy them carefully to avoid accessing user memory after reporting completion to userspace through a callback. skb_segment doesn't normally happen on datapath: TSO needs to be disabled - so disabling zero copy in this case does not look like a big deal. Signed-off-by: Michael S. Tsirkin Acked-by: Herbert Xu Signed-off-by: David S. Miller [bwh: Backported to 3.2. As skb_segment() only supports page-frags *or* a frag list, there is no need for the additional frag_skb pointer or the preparatory renaming.] Signed-off-by: Ben Hutchings Signed-off-by: Greg Kroah-Hartman --- net/core/skbuff.c |3 +++ 1 file changed, 3 insertions(+) --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -2777,6 +2777,9 @@ struct sk_buff *skb_segment(struct sk_bu skb_put(nskb, hsize), hsize); while (pos < offset + len && i < nfrags) { + if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC))) + goto err; + *frag = skb_shinfo(skb)->frags[i]; __skb_frag_ref(frag); size = skb_frag_size(frag); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.4 36/43] skbuff: export skb_copy_ubufs
3.4-stable review patch. If anyone has any objections, please let me know. -- From: "Michael S. Tsirkin" commit dcc0fb782b3a6e2abfeaaeb45dd88ed09596be0f upstream. Export skb_copy_ubufs so that modules can orphan frags. Signed-off-by: Michael S. Tsirkin Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/core/skbuff.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -733,7 +733,7 @@ int skb_copy_ubufs(struct sk_buff *skb, skb_shinfo(skb)->tx_flags &= ~SKBTX_DEV_ZEROCOPY; return 0; } - +EXPORT_SYMBOL_GPL(skb_copy_ubufs); /** * skb_clone - duplicate an sk_buff -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/