4.9.38-stable review
Greg Kroah-Hartman
maintainercover 4.9.38-stable review
This is the start of the stable review cycle for the 4.9.38 release. There are 25 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 Sat Jul 15 15:39:46 UTC 2017. 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/v4.x/stable-review/patch-4.9.38-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.9.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.9.38-rc1
Maciej S. Szmigiero <[email protected]>
saa7134: fix warm Medion 7134 EEPROM read
Mikulas Patocka <[email protected]>
x86/mm/pat: Don't report PAT on CPUs that don't support it
Chao Yu <[email protected]>
ext4: check return value of kstrtoull correctly in reserved_clusters_store
Jason A. Donenfeld <[email protected]>
crypto: rsa-pkcs1pad - use constant time memory comparison for MACs
Horia Geantă <[email protected]>
crypto: caam - fix gfp allocation flags (part I)
Ian Abbott <[email protected]>
staging: comedi: fix clean-up of comedi_class in comedi_init()
Malcolm Priestley <[email protected]>
staging: vt6556: vnt_start Fix missing call to vnt_key_init_table.
Kirill Tkhai <[email protected]>
locking/rwsem-spinlock: Fix EINTR branch in __down_write_common()
Jason Yan <[email protected]>
md: fix super_offset endianness in super_1_rdev_size_change
Jason Yan <[email protected]>
md: fix incorrect use of lexx_to_cpu in does_sb_need_changing
Masami Hiramatsu <[email protected]>
perf probe: Add error checks to offline probe post-processing
Masami Hiramatsu <[email protected]>
perf probe: Fix to probe on gcc generated symbols for offline kernel
Wang YanQing <[email protected]>
perf scripting perl: Fix compile error with some perl5 versions
Arnaldo Carvalho de Melo <[email protected]>
perf header: Fix handling of PERF_EVENT_UPDATE__SCALE
Arnaldo Carvalho de Melo <[email protected]>
perf bench numa: Avoid possible truncation when using snprintf()
Arnaldo Carvalho de Melo <[email protected]>
perf tests: Avoid possible truncation with dirent->d_name + snprintf
Arnaldo Carvalho de Melo <[email protected]>
perf intel-pt: Use __fallthrough
Arnaldo Carvalho de Melo <[email protected]>
perf thread_map: Correctly size buffer used with dirent->dt_name
Arnaldo Carvalho de Melo <[email protected]>
perf top: Use __fallthrough
Arnaldo Carvalho de Melo <[email protected]>
tools strfilter: Use __fallthrough
Arnaldo Carvalho de Melo <[email protected]>
tools string: Use __fallthrough in perf_atoll()
Arnaldo Carvalho de Melo <[email protected]>
tools include: Add a __fallthrough statement
Josh Zimmerman <[email protected]>
tpm: Issue a TPM2_Shutdown for TPM2 devices.
Josh Zimmerman <[email protected]>
Add "shutdown" to "struct class".
Cong Wang <[email protected]>
mqueue: fix a use-after-free in sys_mq_notify()
-------------
Diffstat:
Makefile | 4 +- arch/x86/include/asm/pat.h | 1 + arch/x86/kernel/setup.c | 7 +++ arch/x86/mm/pat.c | 28 ++++------ crypto/rsa-pkcs1pad.c | 2 +- drivers/base/core.c | 6 +- drivers/char/tpm/tpm-chip.c | 36 ++++++++++++ drivers/char/tpm/tpm-sysfs.c | 5 ++ drivers/crypto/caam/caamalg.c | 3 +- drivers/md/md.c | 4 +- drivers/media/pci/saa7134/saa7134-i2c.c | 31 +++++++++++ drivers/staging/comedi/comedi_fops.c | 1 + drivers/staging/vt6656/main_usb.c | 3 + fs/ext4/sysfs.c | 2 +- include/linux/device.h | 2 + ipc/mqueue.c | 4 +- kernel/locking/rwsem-spinlock.c | 4 +- tools/include/linux/compiler.h | 9 +++ tools/perf/bench/numa.c | 6 +- tools/perf/builtin-top.c | 2 +- tools/perf/tests/parse-events.c | 8 +-- tools/perf/util/header.c | 1 + .../perf/util/intel-pt-decoder/intel-pt-decoder.c | 5 ++ .../util/intel-pt-decoder/intel-pt-pkt-decoder.c | 2 + tools/perf/util/probe-event.c | 64 +++++++++++++++++++++- tools/perf/util/scripting-engines/Build | 2 +- tools/perf/util/strfilter.c | 1 + tools/perf/util/string.c | 2 + tools/perf/util/thread_map.c | 2 +- 29 files changed, 207 insertions(+), 40 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/25 mqueue: fix a use-after-free in sys_mq_notify()
4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cong Wang <[email protected]>
commit f991af3daabaecff34684fd51fac80319d1baad1 upstream.
The retry logic for netlink_attachskb() inside sys_mq_notify() is nasty and vulnerable:
1) The sock refcnt is already released when retry is needed
2) The fd is controllable by user-space because we already release the file refcnt
so we when retry but the fd has been just closed by user-space during this small window, we end up calling netlink_detachskb() on the error path which releases the sock again, later when the user-space closes this socket a use-after-free could be triggered.
Setting 'sock' to NULL here should be sufficient to fix it.
--- ipc/mqueue.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
ipc/mqueue.c +3 -1
@@ -1249,8 +1249,10 @@ retry: timeo =MAX_SCHEDULE_TIMEOUT ; ret =netlink_attachskb (sock, nc, &timeo,NULL ); -if (ret ==1 ) +if (ret ==1 ) { + sock =NULL ; goto retry; + }if (ret) { sock =NULL ; nc =NULL ;
Greg Kroah-Hartman
maintainerPATCH 2/25 Add "shutdown" to "struct class".
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Zimmerman <[email protected]>
commit f77af15165847406b15d8f70c382c4cb15846b2a upstream.
The TPM class has some common shutdown code that must be executed for all drivers. This adds some needed functionality for that.
--- drivers/base/core.c | 6 +++++- include/linux/device.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/base/core.c +5 -1
@@ -2095,7 +2095,11 @@ void device_shutdown(void)pm_runtime_get_noresume (dev);pm_runtime_barrier (dev); -if (dev->bus && dev->bus->shutdown) { +if (dev->class && dev->class->shutdown) { +if (initcall_debug) +dev_info (dev,"shutdown\n" ); + dev->class->shutdown (dev); + }else if (dev->bus && dev->bus->shutdown) {if (initcall_debug)dev_info (dev,"shutdown\n" ); dev->bus->shutdown (dev);
include/linux/device.h +2 -0
@@ -373,6 +373,7 @@ int subsys_virtual_register(struct bus_t* @suspend: Used to put the device to sleep mode, usually to a low power * state. * @resume: Used to bring the device from the sleep mode. +* @shutdown: Called at shut-down time to quiesce the device. * @ns_type: Callbacks so sysfs can detemine namespaces. * @namespace: Namespace of the device belongs to this class. * @pm: The default device power management operations of this class.
@@ -401,6 +402,7 @@ struct class {int (*suspend)(struct device *dev,pm_message_t state);int (*resume)(struct device *dev); +int (*shutdown)(struct device *dev);const struct kobj_ns_type_operations *ns_type;const void *(*namespace)(struct device *dev);
Greg Kroah-Hartman
maintainerPATCH 3/25 tpm: Issue a TPM2_Shutdown for TPM2 devices.
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Zimmerman <[email protected]>
commit d1bd4a792d3961a04e6154118816b00167aad91a upstream.
If a TPM2 loses power without a TPM2_Shutdown command being issued (a "disorderly reboot"), it may lose some state that has yet to be persisted to NVRam, and will increment the DA counter. After the DA counter gets sufficiently large, the TPM will lock the user out.
NOTE: This only changes behavior on TPM2 devices. Since TPM1 uses sysfs, and sysfs relies on implicit locking on chip->ops, it is not safe to allow this code to run in TPM1, or to add sysfs support to TPM2, until that locking is made explicit.
--- drivers/char/tpm/tpm-chip.c | 36 ++++++++++++++++++++++++++++++++++++ drivers/char/tpm/tpm-sysfs.c | 5 +++++ 2 files changed, 41 insertions(+)
drivers/char/tpm/tpm-chip.c +36 -0
@@ -130,6 +130,41 @@ static void tpm_dev_release(struct devickfree (chip); } + +/** +* tpm_class_shutdown() - prepare the TPM device for loss of power. +* @dev: device to which the chip is associated. +* +* Issues a TPM2_Shutdown command prior to loss of power, as required by the +* TPM 2.0 spec. +* Then, calls bus- and device- specific shutdown code. +* +* XXX: This codepath relies on the fact that sysfs is not enabled for +* TPM2: sysfs uses an implicit lock on chip->ops, so this could race if TPM2 +* has sysfs support enabled before TPM sysfs's implicit locking is fixed. +*/ +static int tpm_class_shutdown (struct device *dev) +{ + struct tpm_chip *chip = container_of(dev, struct tpm_chip, dev); + +if (chip->flags &TPM_CHIP_FLAG_TPM2 ) { +down_write (&chip->ops_sem); +tpm2_shutdown (chip,TPM2_SU_CLEAR ); + chip->ops =NULL ; +up_write (&chip->ops_sem); + } +/* Allow bus- and device-specific code to run. Note: since chip->ops +* is NULL, more-specific shutdown code will not be able to issue TPM +* commands. +*/ +if (dev->bus && dev->bus->shutdown) + dev->bus->shutdown (dev); +else if (dev->driver && dev->driver->shutdown) + dev->driver->shutdown (dev); +return 0 ; +} + +/** * tpm_chip_alloc() - allocate a new struct tpm_chip instance * @pdev: device to which the chip is associated
@@ -168,6 +203,7 @@ struct tpm_chip *tpm_chip_alloc(struct ddevice_initialize (&chip->dev); chip->dev.class = tpm_class; + chip->dev.class->shutdown = tpm_class_shutdown; chip->dev.release = tpm_dev_release; chip->dev.parent = pdev; chip->dev.groups = chip->groups;
drivers/char/tpm/tpm-sysfs.c +5 -0
@@ -285,6 +285,11 @@ static const struct attribute_group tpm_void tpm_sysfs_add_device (struct tpm_chip *chip) { +/* XXX: If you wish to remove this restriction, you must first update +* tpm_sysfs to explicitly lock chip->ops. +*/ +if (chip->flags &TPM_CHIP_FLAG_TPM2 ) +return ;/* The sysfs routines rely on an implicit tpm_try_get_ops, device_del * is called before ops is null'd and the sysfs core synchronizes this * removal so that no callbacks are running or can run again
Greg Kroah-Hartman
maintainerPATCH 4/25 tools include: Add a __fallthrough statement
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
commit b5bf1733d6a391c4e90ea8f8468d83023be74a2a upstream.
For cases where implicit fall through case labels are intended, to let us inform that to gcc >= 7:
CC /tmp/build/perf/util/string.o
util/string.c: In function 'perf_atoll':
util/string.c:22:7: error: this statement may fall through [-Werror=implicit-fallthrough=]
if (*p)
^
util/string.c:24:3: note: here
case '\0':
^~~~So we introduce:
#define __fallthrough __attribute__ ((fallthrough))
And use it in such cases.
--- tools/include/linux/compiler.h | 9 +++++++++ 1 file changed, 9 insertions(+)
tools/include/linux/compiler.h +9 -0
@@ -126,4 +126,13 @@ static __always_inline void __write_once#define WRITE_ONCE (x, val) \ ({ union { typeof(x) __val; char __c[1]; } __u = { .__val = (val) }; __write_once_size(&(x), __u.__c, sizeof(x)); __u.__val; }) + +#ifndef __fallthrough +# if defined(__GNUC__) && __GNUC__ >=7 +# define __fallthrough __attribute__ ((fallthrough)) +# else +# define __fallthrough +# endif +#endif +#endif /* _TOOLS_LINUX_COMPILER_H */
Greg Kroah-Hartman
maintainerPATCH 5/25 tools string: Use __fallthrough in perf_atoll()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
commit 94bdd5edb34e472980d1e18b4600d6fb92bd6b0a upstream.
The implicit fall through case label here is intended, so let us inform that to gcc >= 7:
CC /tmp/build/perf/util/string.o
util/string.c: In function 'perf_atoll':
util/string.c:22:7: error: this statement may fall through [-Werror=implicit-fallthrough=]
if (*p)
^
util/string.c:24:3: note: here
case '\0':
^~~~--- tools/perf/util/string.c | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/util/string.c +2 -0
@@ -21,6 +21,8 @@ s64 perf_atoll(const char *str)case 'b' :case 'B' :if (*p) goto out_err; + + __fallthrough;case '\0' :return length;default :
Greg Kroah-Hartman
maintainerPATCH 6/25 tools strfilter: Use __fallthrough
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
commit d64b721d27aef3fbeb16ecda9dd22ee34818ff70 upstream.
The implicit fall through case label here is intended, so let us inform that to gcc >= 7:
util/strfilter.c: In function 'strfilter_node__sprint':
util/strfilter.c:270:6: error: this statement may fall through [-Werror=implicit-fallthrough=]
if (len < 0)
^
util/strfilter.c:272:2: note: here
case '!':
^~~~cc1: all warnings being treated as errors
--- tools/perf/util/strfilter.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/util/strfilter.c +1 -0
@@ -269,6 +269,7 @@ static int strfilter_node__sprint(struct len =strfilter_node__sprint_pt (node->l, buf);if (len <0 )return len; + __fallthrough;case '!' :if (buf) { *(buf + len++) = *node->p;
Greg Kroah-Hartman
maintainerPATCH 7/25 perf top: Use __fallthrough
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
commit 7b0214b702ad8e124e039a317beeebb3f020d125 upstream.
The implicit fall through case label here is intended, so let us inform that to gcc >= 7:
CC /tmp/build/perf/builtin-top.o
builtin-top.c: In function 'display_thread':
builtin-top.c:644:7: error: this statement may fall through [-Werror=implicit-fallthrough=]
if (errno == EINTR)
^ builtin-top.c:647:3: note: here
default:
^~~~~~~
--- tools/perf/builtin-top.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-top.c +1 -1
@@ -643,7 +643,7 @@ repeat:case -1 :if (errno ==EINTR )continue ; -/* Fall trhu */ + __fallthrough;default : c =getc (stdin);tcsetattr (0 ,TCSAFLUSH , &save);
Greg Kroah-Hartman
maintainerPATCH 8/25 perf thread_map: Correctly size buffer used with dirent->dt_name
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
commit bdf23a9a190d7ecea092fd5c4aabb7d4bd0a9980 upstream.
The size of dirent->dt_name is NAME_MAX + 1, but the size for the 'path' buffer is hard coded at 256, which may truncate it because we also prepend "/proc/", so that all that into account and thank gcc 7 for this warning:
/git/linux/tools/perf/util/thread_map.c: In function 'thread_map__new_by_uid':
/git/linux/tools/perf/util/thread_map.c:119:39: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size 250 [-Werror=format-truncation=]
snprintf(path, sizeof(path), "/proc/%s", dirent->d_name);
^~
In file included from /usr/include/stdio.h:939:0,
from /git/linux/tools/perf/util/thread_map.c:5:
/usr/include/bits/stdio2.h:64:10: note: '__builtin___snprintf_chk' output between 7 and 262 bytes into a destination of size 256
return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__bos (__s), __fmt, __va_arg_pack ());
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--- tools/perf/util/thread_map.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/thread_map.c +1 -1
@@ -93,7 +93,7 @@ struct thread_map *thread_map__new_by_ui {DIR *proc;int max_threads =32 , items, i; -char path[256 ]; +char path[NAME_MAX +1 +6 ];struct dirent *dirent, **namelist =NULL ;struct thread_map *threads =thread_map__alloc (max_threads);
Greg Kroah-Hartman
maintainerPATCH 9/25 perf intel-pt: Use __fallthrough
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
commit 7ea6856d6f5629d742edc23b8b76e6263371ef45 upstream.
To address new warnings emmited by gcc 7, e.g.::
CC /tmp/build/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.o
CC /tmp/build/perf/tests/parse-events.o
util/intel-pt-decoder/intel-pt-pkt-decoder.c: In function 'intel_pt_pkt_desc':
util/intel-pt-decoder/intel-pt-pkt-decoder.c:499:6: error: this statement may fall through [-Werror=implicit-fallthrough=]
if (!(packet->count))
^
util/intel-pt-decoder/intel-pt-pkt-decoder.c:501:2: note: here
case INTEL_PT_CYC:
^~~~
CC /tmp/build/perf/util/intel-pt-decoder/intel-pt-decoder.occ1: all warnings being treated as errors
--- tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | 5 +++++ tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c | 2 ++ 2 files changed, 7 insertions(+)
tools/perf/util/intel-pt-decoder/intel-pt-decoder.c +5 -0
@@ -22,6 +22,7 @@#include <errno.h> #include <stdint.h> #include <inttypes.h> +#include <linux/compiler.h> #include "../cache.h" #include "../util.h"
@@ -1744,6 +1745,7 @@ static int intel_pt_walk_psb(struct inteswitch (decoder->packet.type) {case INTEL_PT_TIP_PGD : decoder->continuous_period = false; + __fallthrough;case INTEL_PT_TIP_PGE :case INTEL_PT_TIP :intel_pt_log ("ERROR: Unexpected packet\n" );
@@ -1797,6 +1799,8 @@ static int intel_pt_walk_psb(struct inte decoder->pge = false; decoder->continuous_period = false;intel_pt_clear_tx_flags (decoder); + __fallthrough; +case INTEL_PT_TNT : decoder->have_tma = false;intel_pt_log ("ERROR: Unexpected packet\n" );
@@ -1837,6 +1841,7 @@ static int intel_pt_walk_to_ip(struct inswitch (decoder->packet.type) {case INTEL_PT_TIP_PGD : decoder->continuous_period = false; + __fallthrough;case INTEL_PT_TIP_PGE :case INTEL_PT_TIP : decoder->pge = decoder->packet.type !=INTEL_PT_TIP_PGD ;
tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c +2 -0
@@ -17,6 +17,7 @@#include <string.h> #include <endian.h> #include <byteswap.h> +#include <linux/compiler.h> #include "intel-pt-pkt-decoder.h"
@@ -498,6 +499,7 @@ int intel_pt_pkt_desc(const struct intelcase INTEL_PT_FUP :if (!(packet->count))return snprintf (buf, buf_len,"%s no ip" , name); + __fallthrough;case INTEL_PT_CYC :case INTEL_PT_VMCS :case INTEL_PT_MTC :
Greg Kroah-Hartman
maintainerPATCH 10/25 perf tests: Avoid possible truncation with dirent->d_name + snprintf
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
commit 2e2bbc039fad9eabad6c4c1a473c8b2554cdd2d4 upstream.
Addressing a few cases spotted by a new warning in gcc 7:
tests/parse-events.c: In function 'test_pmu_events':
tests/parse-events.c:1790:39: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size 90 [-Werror=format-truncation=]
snprintf(name, MAX_NAME, "cpu/event=%s/u", ent->d_name);
^~
In file included from /usr/include/stdio.h:939:0,
from /git/linux/tools/perf/util/map.h:9,
from /git/linux/tools/perf/util/symbol.h:7,
from /git/linux/tools/perf/util/evsel.h:10,
from tests/parse-events.c:3:
/usr/include/bits/stdio2.h:64:10: note: '__builtin___snprintf_chk' output between 13 and 268 bytes into a destination of size 100
return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__bos (__s), __fmt, __va_arg_pack ());
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tests/parse-events.c:1798:29: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size 100 [-Werror=format-truncation=]
snprintf(name, MAX_NAME, "%s:u,cpu/event=%s/u", ent->d_name, ent->d_name);--- tools/perf/tests/parse-events.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
tools/perf/tests/parse-events.c +3 -5
@@ -1779,15 +1779,14 @@ static int test_pmu_events(void) }while (!ret && (ent =readdir (dir))) { -#define MAX_NAME 100struct evlist_test e; -char name[MAX_NAME ]; +char name[2 *NAME_MAX +1 +12 +3 ];/* Names containing . are special and cannot be used directly */ if (strchr (ent->d_name,'.' ))continue ; -snprintf (name,MAX_NAME ,"cpu/event=%s/u" , ent->d_name); +snprintf (name,sizeof (name),"cpu/event=%s/u" , ent->d_name); e.name = name; e.check = test__checkevent_pmu_events;
@@ -1795,11 +1794,10 @@ static int test_pmu_events(void) ret =test_event (&e);if (ret)break ; -snprintf (name,MAX_NAME ,"%s:u,cpu/event=%s/u" , ent->d_name, ent->d_name); +snprintf (name,sizeof (name),"%s:u,cpu/event=%s/u" , ent->d_name, ent->d_name); e.name = name; e.check = test__checkevent_pmu_events_mix; ret =test_event (&e); -#undef MAX_NAME }closedir (dir);
Greg Kroah-Hartman
maintainerPATCH 11/25 perf bench numa: Avoid possible truncation when using snprintf()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
commit 3aff8ba0a4c9c9191bb788171a1c54778e1246a2 upstream.
Addressing this warning from gcc 7:
CC /tmp/build/perf/bench/numa.o
bench/numa.c: In function '__bench_numa':
bench/numa.c:1582:42: error: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size between 8 and 17 [-Werror=format-truncation=]
snprintf(tname, 32, "process%d:thread%d", p, t);
^~
bench/numa.c:1582:25: note: directive argument in the range [0, 2147483647]
snprintf(tname, 32, "process%d:thread%d", p, t);
^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/stdio.h:939:0,
from bench/../util/util.h:47,
from bench/../builtin.h:4,
from bench/numa.c:11:
/usr/include/bits/stdio2.h:64:10: note: '__builtin___snprintf_chk' output between 17 and 35 bytes into a destination of size 32
return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__bos (__s), __fmt, __va_arg_pack ());
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~cc1: all warnings being treated as errors
--- tools/perf/bench/numa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/perf/bench/numa.c +3 -3
@@ -1573,13 +1573,13 @@ static int __bench_numa(const char *name "GB/sec,", "total-speed", "GB/sec total speed");if (g->p.show_details >=2 ) { -char tname[32 ]; +char tname[14 +2 *10 +1 ];struct thread_data *td;for (p =0 ; p < g->p.nr_proc; p++) {for (t =0 ; t < g->p.nr_threads; t++) { -memset (tname,0 ,32 ); +memset (tname,0 ,sizeof (tname)); td = g->threads + p*g->p.nr_threads + t; -snprintf (tname,32 ,"process%d:thread%d" , p, t); +snprintf (tname,sizeof (tname),"process%d:thread%d" , p, t);print_res (tname, td->speed_gbs,"GB/sec" ,"thread-speed" ,"GB/sec/thread speed" ); print_res(tname, td->system_time_ns / NSEC_PER_SEC,
Greg Kroah-Hartman
maintainerPATCH 12/25 perf header: Fix handling of PERF_EVENT_UPDATE__SCALE
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
commit 8434a2ec13d5c8cb25716950bfbf7c9d7b64628a upstream.
In commit daeecbc0c431 ("perf tools: Add event_update event scale type"), the handling of PERF_EVENT_UPDATE__SCALE cast struct event_update_event->data to a pointer to event_update_event_scale, uses some field from this casted struct and then ends up falling through to the handling of another event type, PERF_EVENT_UPDATE__CPUS were it casts that ev->data to yet another type, oops, fix it by inserting the missing break.
Noticed when building perf using gcc 7 on Fedora Rawhide:
util/header.c: In function 'perf_event__process_event_update':
util/header.c:3207:16: error: this statement may fall through [-Werror=implicit-fallthrough=]
evsel->scale = ev_scale->scale;
~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
util/header.c:3208:2: note: here
case PERF_EVENT_UPDATE__CPUS:
^~~~This wasn't noticed because probably PERF_EVENT_UPDATE__CPUS comes after PERF_EVENT_UPDATE__SCALE, so we would just create a bogus evsel->own_cpus when processing a PERF_EVENT_UPDATE__SCALE to then leak it and create a new cpu map with the correct data.
--- tools/perf/util/header.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/util/header.c +1 -0
@@ -3184,6 +3184,7 @@ int perf_event__process_event_update(strcase PERF_EVENT_UPDATE__SCALE : ev_scale = (struct event_update_event_scale *) ev->data; evsel->scale = ev_scale->scale; +break ;case PERF_EVENT_UPDATE__CPUS : ev_cpus = (struct event_update_event_cpus *) ev->data;
Greg Kroah-Hartman
maintainerPATCH 13/25 perf scripting perl: Fix compile error with some perl5 versions
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wang YanQing <[email protected]>
commit d7dd112ea5cacf91ae72c0714c3b911eb6016fea upstream.
Fix below compile error:
CC util/scripting-engines/trace-event-perl.o
In file included from /usr/lib/perl5/5.22.2/i686-linux/CORE/perl.h:5673:0,
from util/scripting-engines/trace-event-perl.c:31:
/usr/lib/perl5/5.22.2/i686-linux/CORE/inline.h: In function 'S__is_utf8_char_slow':
/usr/lib/perl5/5.22.2/i686-linux/CORE/inline.h:270:5: error: nested extern declaration of 'Perl___notused' [-Werror=nested-externs]
dTHX; /* The function called below requires thread context */
^
cc1: all warnings being treated as errors
After digging perl5 repository, I find out that we will meet this compile error with perl from v5.21.1 to v5.25.4
--- tools/perf/util/scripting-engines/Build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/scripting-engines/Build +1 -1
@@ -1,6 +1,6 @@ libperf-$(CONFIG_LIBPERL) += trace-event-perl.o libperf-$(CONFIG_LIBPYTHON) += trace-event-python.o -CFLAGS_trace-event-perl.o += $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow -Wno-undef -Wno-switch-default +CFLAGS_trace-event-perl.o += $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow -Wno-nested-externs -Wno-undef -Wno-switch-default CFLAGS_trace-event-python.o += $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow
Greg Kroah-Hartman
maintainerPATCH 14/25 perf probe: Fix to probe on gcc generated symbols for offline kernel
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu <[email protected]>
commit 8a937a25a7e3c19d5fb3f9d92f605cf5fda219d8 upstream.
Fix perf-probe to show probe definition on gcc generated symbols for offline kernel (including cross-arch kernel image).
gcc sometimes optimizes functions and generate new symbols with suffixes such as ".constprop.N" or ".isra.N" etc. Since those symbol names are not recorded in DWARF, we have to find correct generated symbols from offline ELF binary to probe on it (kallsyms doesn't correct it). For online kernel or uprobes we don't need it because those are rebased on _text, or a section relative address.
E.g. Without this:
$ perf probe -k build-arm/vmlinux -F __slab_alloc* __slab_alloc.constprop.9 $ perf probe -k build-arm/vmlinux -D __slab_alloc p:probe/__slab_alloc __slab_alloc+0
If you put above definition on target machine, it should fail because there is no __slab_alloc in kallsyms.
With this fix, perf probe shows correct probe definition on __slab_alloc.constprop.9:
$ perf probe -k build-arm/vmlinux -D __slab_alloc p:probe/__slab_alloc __slab_alloc.constprop.9+0
--- tools/perf/util/probe-event.c | 48 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-)
tools/perf/util/probe-event.c +47 -1
@@ -618,6 +618,51 @@ error:return ret ? : -ENOENT ; } +/* +* Rename DWARF symbols to ELF symbols -- gcc sometimes optimizes functions +* and generate new symbols with suffixes such as .constprop.N or .isra.N +* etc. Since those symbols are not recorded in DWARF, we have to find +* correct generated symbols from offline ELF binary. +* For online kernel or uprobes we don't need this because those are +* rebased on _text, or already a section relative address. +*/ +static int +post_process_offline_probe_trace_events (struct probe_trace_event *tevs, +int ntevs,const char *pathname) +{ +struct symbol *sym; +struct map *map; +unsigned long stext =0 ; +u64 addr; +int i; + +/* Prepare a map for offline binary */ + map =dso__new_map (pathname); +if (!map ||get_text_start_address (pathname, &stext) <0 ) { +pr_warning ("Failed to get ELF symbols for %s\n" , pathname); +return -EINVAL ; + } + +for (i =0 ; i < ntevs; i++) { + addr = tevs[i].point.address + tevs[i].point.offset - stext; + sym =map__find_symbol (map, addr); +if (!sym) +continue ; +if (!strcmp (sym->name, tevs[i].point.symbol)) +continue ; +/* If we have no realname, use symbol for it */ +if (!tevs[i].point.realname) + tevs[i].point.realname = tevs[i].point.symbol; +else +free (tevs[i].point.symbol); + tevs[i].point.symbol =strdup (sym->name); + tevs[i].point.offset = addr - sym->start; + } +map__put (map); + +return 0 ; +} +static int add_exec_to_probe_trace_events (struct probe_trace_event *tevs,int ntevs,const char *exec) {
@@ -694,7 +739,8 @@ post_process_kernel_probe_trace_events(s/* Skip post process if the target is an offline kernel */ if (symbol_conf.ignore_vmlinux_buildid) -return 0 ; +return post_process_offline_probe_trace_events (tevs, ntevs, + symbol_conf.vmlinux_name); reloc_sym =kernel_get_ref_reloc_sym ();if (!reloc_sym) {
Greg Kroah-Hartman
maintainerPATCH 15/25 perf probe: Add error checks to offline probe post-processing
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu <[email protected]>
commit 3e96dac7c956089d3f23aca98c4dfca57b6aaf8a upstream.
Add error check codes on post processing and improve it for offline probe events as:
- post processing fails if no matched symbol found in map(-ENOENT) or strdup() failed(-ENOMEM).
- Even if the symbol name is the same, it updates symbol address and offset.
--- tools/perf/util/probe-event.c | 50 +++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 17 deletions(-)
tools/perf/util/probe-event.c +33 -17
@@ -618,6 +618,33 @@ error:return ret ? : -ENOENT ; } +/* Adjust symbol name and address */ +static int post_process_probe_trace_point (struct probe_trace_point *tp, +struct map *map,unsigned long offs) +{ +struct symbol *sym; +u64 addr = tp->address + tp->offset - offs; + + sym =map__find_symbol (map, addr); +if (!sym) +return -ENOENT ; + +if (strcmp (sym->name, tp->symbol)) { +/* If we have no realname, use symbol for it */ +if (!tp->realname) + tp->realname = tp->symbol; +else +free (tp->symbol); + tp->symbol =strdup (sym->name); +if (!tp->symbol) +return -ENOMEM ; + } + tp->offset = addr - sym->start; + tp->address -= offs; + +return 0 ; +} +/* * Rename DWARF symbols to ELF symbols -- gcc sometimes optimizes functions * and generate new symbols with suffixes such as .constprop.N or .isra.N
@@ -630,11 +657,9 @@ static int post_process_offline_probe_trace_events(struct probe_trace_event *tevs, int ntevs, const char *pathname) { - struct symbol *sym; struct map *map;unsigned long stext =0 ; -u64 addr; -int i; +int i, ret =0 ;/* Prepare a map for offline binary */ map =dso__new_map (pathname);
@@ -644,23 +669,14 @@ post_process_offline_probe_trace_events( }for (i =0 ; i < ntevs; i++) { - addr = tevs[i].point.address + tevs[i].point.offset - stext; - sym =map__find_symbol (map, addr); -if (!sym) -continue ; -if (!strcmp (sym->name, tevs[i].point.symbol)) -continue ; -/* If we have no realname, use symbol for it */ -if (!tevs[i].point.realname) - tevs[i].point.realname = tevs[i].point.symbol; -else -free (tevs[i].point.symbol); - tevs[i].point.symbol =strdup (sym->name); - tevs[i].point.offset = addr - sym->start; + ret =post_process_probe_trace_point (&tevs[i].point, + map, stext); +if (ret <0 ) +break ; }map__put (map); -return 0 ; +return ret; } static int add_exec_to_probe_trace_events(struct probe_trace_event *tevs,
Greg Kroah-Hartman
maintainerPATCH 16/25 md: fix incorrect use of lexx_to_cpu in does_sb_need_changing
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Yan <[email protected]>
commit 1345921393ba23b60d3fcf15933e699232ad25ae upstream.
The sb->layout is of type __le32, so we shoud use le32_to_cpu.
--- drivers/md/md.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/md.c +1 -1
@@ -2270,7 +2270,7 @@ static bool does_sb_need_changing(struct/* Check if any mddev parameters have changed */ if ((mddev->dev_sectors !=le64_to_cpu (sb->size)) || (mddev->reshape_position !=le64_to_cpu (sb->reshape_position)) || - (mddev->layout !=le64_to_cpu (sb->layout)) || + (mddev->layout !=le32_to_cpu (sb->layout)) || (mddev->raid_disks !=le32_to_cpu (sb->raid_disks)) || (mddev->chunk_sectors !=le32_to_cpu (sb->chunksize)))return true;
Greg Kroah-Hartman
maintainerPATCH 17/25 md: fix super_offset endianness in super_1_rdev_size_change
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Yan <[email protected]>
commit 3fb632e40d7667d8bedfabc28850ac06d5493f54 upstream.
The sb->super_offset should be big-endian, but the rdev->sb_start is in host byte order, so fix this by adding cpu_to_le64.
--- drivers/md/md.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/md.c +1 -1
@@ -1861,7 +1861,7 @@ super_1_rdev_size_change(struct md_rdev } sb =page_address (rdev->sb_page); sb->data_size =cpu_to_le64 (num_sectors); - sb->super_offset = rdev->sb_start; + sb->super_offset =cpu_to_le64 (rdev->sb_start); sb->sb_csum =calc_sb_1_csum (sb);md_super_write (rdev->mddev, rdev, rdev->sb_start, rdev->sb_size, rdev->sb_page);
Greg Kroah-Hartman
maintainerPATCH 18/25 locking/rwsem-spinlock: Fix EINTR branch in __down_write_common()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kirill Tkhai <[email protected]>
commit a0c4acd2c220376b4e9690e75782d0c0afdaab9f upstream.
If a writer could been woken up, the above branch
if (sem->count == 0) break;
would have moved us to taking the sem. So, it's
not the time to wake a writer now, and only readers are allowed now. Thus, 0 must be passed to __rwsem_do_wake().
Next, __rwsem_do_wake() wakes readers unconditionally. But we mustn't do that if the sem is owned by writer in the moment. Otherwise, writer and reader own the sem the same time, which leads to memory corruption in callers.
rwsem-xadd.c does not need that, as:
1) the similar check is made lockless there,
2) in __rwsem_mark_wake::try_reader_grant we test,
that sem is not owned by writer.
--- kernel/locking/rwsem-spinlock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/locking/rwsem-spinlock.c +2 -2
@@ -233,8 +233,8 @@ int __sched __down_write_common(struct r out_nolock:list_del (&waiter.list); -if (!list_empty (&sem->wait_list)) -__rwsem_do_wake (sem,1 ); +if (!list_empty (&sem->wait_list) && sem->count >=0 ) +__rwsem_do_wake (sem,0 );raw_spin_unlock_irqrestore (&sem->wait_lock, flags);return -EINTR ;
Greg Kroah-Hartman
maintainerPATCH 19/25 staging: vt6556: vnt_start Fix missing call to vnt_key_init_table.
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Malcolm Priestley <[email protected]>
commit dc32190f2cd41c7dba25363ea7d618d4f5172b4e upstream.
The key table is not intialized correctly without this call.
--- drivers/staging/vt6656/main_usb.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/staging/vt6656/main_usb.c +3 -0
@@ -522,6 +522,9 @@ static int vnt_start(struct ieee80211_hw goto free_all; } +if (vnt_key_init_table (priv)) + goto free_all; + priv->int_interval =1 ;/* bInterval is set to 1 */ vnt_int_start_interrupt (priv);
Greg Kroah-Hartman
maintainerPATCH 20/25 staging: comedi: fix clean-up of comedi_class in comedi_init()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Abbott <[email protected]>
commit a9332e9ad09c2644c99058fcf6ae2f355e93ce74 upstream.
There is a clean-up bug in the core comedi module initialization functions, comedi_init(). If the comedi_num_legacy_minors module parameter is non-zero (and valid), it creates that many "legacy" devices and registers them in SysFS. A failure causes the function to clean up and return an error. Unfortunately, it fails to destroy the "comedi" class that was created earlier. Fix it by adding a call to class_destroy(comedi_class) at the appropriate place in the clean-up sequence.
--- drivers/staging/comedi/comedi_fops.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/comedi/comedi_fops.c +1 -0
@@ -2908,6 +2908,7 @@ static int __init comedi_init(void) dev =comedi_alloc_board_minor (NULL );if (IS_ERR (dev)) {comedi_cleanup_board_minors (); +class_destroy (comedi_class);cdev_del (&comedi_cdev);unregister_chrdev_region (MKDEV (COMEDI_MAJOR ,0 ),COMEDI_NUM_MINORS );
Greg Kroah-Hartman
maintainerPATCH 23/25 ext4: check return value of kstrtoull correctly in reserved_clusters_store
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
commit 1ea1516fbbab2b30bf98c534ecaacba579a35208 upstream.
kstrtoull returns 0 on success, however, in reserved_clusters_store we will return -EINVAL if kstrtoull returns 0, it makes us fail to update reserved_clusters value through sysfs.
--- fs/ext4/sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/sysfs.c +1 -1
@@ -100,7 +100,7 @@ static ssize_t reserved_clusters_store(sint ret; ret =kstrtoull (skip_spaces (buf),0 , &val); -if (!ret || val >= clusters) +if (ret || val >= clusters)return -EINVAL ;atomic64_set (&sbi->s_resv_clusters, val);
Greg Kroah-Hartman
maintainerPATCH 24/25 x86/mm/pat: Dont report PAT on CPUs that dont support it
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 99c13b8c8896d7bcb92753bf0c63a8de4326e78d upstream.
The pat_enabled() logic is broken on CPUs which do not support PAT and where the initialization code fails to call pat_init(). Due to that the enabled flag stays true and pat_enabled() returns true wrongfully.
As a consequence the mappings, e.g. for Xorg, are set up with the wrong caching mode and the required MTRR setups are omitted.
To cure this the following changes are required:
1) Make pat_enabled() return true only if PAT initialization was invoked and successful.
2) Invoke init_cache_modes() unconditionally in setup_arch() and remove the extra callsites in pat_disable() and the pat disabled code path in pat_init().
Also rename __pat_enabled to pat_disabled to reflect the real purpose of this variable.
--- arch/x86/include/asm/pat.h | 1 + arch/x86/kernel/setup.c | 7 +++++++ arch/x86/mm/pat.c | 28 ++++++++++++---------------- 3 files changed, 20 insertions(+), 16 deletions(-)
arch/x86/include/asm/pat.h +1 -0
@@ -7,6 +7,7 @@bool pat_enabled (void );void pat_disable (const char *reason);extern void pat_init (void ); +extern void init_cache_modes (void );extern int reserve_memtype (u64 start,u64 end,enum page_cache_mode req_pcm,enum page_cache_mode *ret_pcm);
arch/x86/kernel/setup.c +7 -0
@@ -1054,6 +1054,13 @@ void __init setup_arch(char **cmdline_p) max_possible_pfn = max_pfn;/* +* This call is required when the CPU does not support PAT. If +* mtrr_bp_init() invoked it already via pat_init() the call has no +* effect. +*/ +init_cache_modes (); + +/* * Define random base addresses for memory sections after max_pfn is * defined and before each memory section base is used. */
arch/x86/mm/pat.c +12 -16
@@ -36,14 +36,14 @@#undef pr_fmt#define pr_fmt (fmt) "" fmt -static bool boot_cpu_done; - -static int __read_mostly __pat_enabled =IS_ENABLED (CONFIG_X86_PAT ); -static void init_cache_modes (void ); +static bool __read_mostly boot_cpu_done; +static bool __read_mostly pat_disabled = !IS_ENABLED (CONFIG_X86_PAT ); +static bool __read_mostly pat_initialized; +static bool __read_mostly init_cm_done;void pat_disable (const char *reason) { -if (!__pat_enabled) +if (pat_disabled)return ;if (boot_cpu_done) {
@@ -51,10 +51,8 @@ void pat_disable(const char *reason)return ; } - __pat_enabled =0 ; + pat_disabled = true;pr_info ("x86/PAT: %s\n" , reason); - -init_cache_modes (); }static int __init nopat (char *str)
@@ -66,7 +64,7 @@ early_param("nopat", nopat);bool pat_enabled (void ) { -return !!__pat_enabled; +return pat_initialized; }EXPORT_SYMBOL_GPL (pat_enabled);
@@ -204,6 +202,8 @@ static void __init_cache_modes(u64 pat)update_cache_mode_entry (i, cache); }pr_info ("x86/PAT: Configuration [0-7]: %s\n" , pat_msg); + + init_cm_done = true; }#define PAT (x, y) ((u64)PAT_ ## y << ((x)*8))
@@ -224,6 +224,7 @@ static void pat_bsp_init(u64 pat) }wrmsrl (MSR_IA32_CR_PAT , pat); + pat_initialized = true;__init_cache_modes (pat); }
@@ -241,10 +242,9 @@ static void pat_ap_init(u64 pat)wrmsrl (MSR_IA32_CR_PAT , pat); } -static void init_cache_modes (void ) +void init_cache_modes (void ) {u64 pat =0 ; -static int init_cm_done;if (init_cm_done)return ;
@@ -286,8 +286,6 @@ static void init_cache_modes(void) }__init_cache_modes (pat); - - init_cm_done =1 ; }/**
@@ -305,10 +303,8 @@ void pat_init(void)u64 pat;struct cpuinfo_x86 *c = &boot_cpu_data; -if (!pat_enabled ()) { -init_cache_modes (); +if (pat_disabled)return ; - } if ((c->x86_vendor == X86_VENDOR_INTEL) && (((c->x86 == 0x6) && (c->x86_model <= 0xd)) ||
Greg Kroah-Hartman
maintainerPATCH 25/25 saa7134: fix warm Medion 7134 EEPROM read
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maciej S. Szmigiero <[email protected]>
commit 5a91206ff0d0548939f3e85a65fb76b400fb0e89 upstream.
When saa7134 module driving a Medion 7134 card is reloaded reads of this card EEPROM (required for automatic detection of tuner model) will be corrupted due to I2C gate in DVB-T demod being left closed. This sometimes also happens on first saa7134 module load after a warm reboot.
Fix this by opening this I2C gate before doing EEPROM read during i2c initialization.
--- drivers/media/pci/saa7134/saa7134-i2c.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
drivers/media/pci/saa7134/saa7134-i2c.c +31 -0
@@ -355,12 +355,43 @@ static struct i2c_client saa7134_client_/* ----------------------------------------------------------- */ +/* On Medion 7134 reading EEPROM needs DVB-T demod i2c gate open */ +static void saa7134_i2c_eeprom_md7134_gate (struct saa7134_dev *dev) +{ +u8 subaddr =0x7 , dmdregval; +u8 data[2 ]; +int ret; +struct i2c_msg i2cgatemsg_r[] = { {.addr =0x08 , .flags =0 , + .buf = &subaddr, .len =1 }, + {.addr =0x08 , + .flags =I2C_M_RD , + .buf = &dmdregval, .len =1 } + }; +struct i2c_msg i2cgatemsg_w[] = { {.addr =0x08 , .flags =0 , + .buf = data, .len =2 } }; + + ret =i2c_transfer (&dev->i2c_adap, i2cgatemsg_r,2 ); +if ((ret ==2 ) && (dmdregval &0x2 )) { +pr_debug ("%s: DVB-T demod i2c gate was left closed\n" , + dev->name); + + data[0 ] = subaddr; + data[1 ] = (dmdregval & ~0x2 ); +if (i2c_transfer (&dev->i2c_adap, i2cgatemsg_w,1 ) !=1 ) +pr_err ("%s: EEPROM i2c gate open failure\n" , + dev->name); + } +} +static int saa7134_i2c_eeprom (struct saa7134_dev *dev,unsigned char *eedata,int len) {unsigned char buf;int i,err; +if (dev->board ==SAA7134_BOARD_MD7134 ) +saa7134_i2c_eeprom_md7134_gate (dev); + dev->i2c_client.addr =0xa0 >>1 ; buf =0 ;if (1 != (err =i2c_master_send (&dev->i2c_client,&buf,1 ))) {
Hi Greg,
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.38 release. There are 25 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.
Quoted 9 lines
Responses should be made by Sat Jul 15 15:39:46 UTC 2017. 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/v4.x/stable-review/patch-4.9.38-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.9.y
and the diffstat can be found below.
For arm64, Build and boot-tested with arm64 defconfig on hikey - no regressions noted.
Quoted 4 lines
thanks,
greg k-h
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.38 release. There are 25 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 Sat Jul 15 15:39:46 UTC 2017. Anything received after that time might be too late.
Build results:
total: 145 pass: 145 fail: 0 Qemu test results: total: 122 pass: 122 fail: 0
Details are available at http://kerneltests.org/builders.
Guenter
A message that is not in the archive (sent off-list or not yet received): [email protected]
Greg Kroah-Hartman
maintainerQuoted 1 line · kernelci.org bot
stable-rc/linux-4.9.y boot: 246 boots: 6 failed, 237 passed with 2 offline, 1 conflict (v4.9.37-26-g996828f64cac)
Are these 6 failures "ok" to ignore?
thanks,
greg k-h