<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/edac, branch v5.6</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v5.6</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v5.6'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2020-02-27T15:44:25Z</updated>
<entry>
<title>EDAC/synopsys: Do not print an error with back-to-back snprintf() calls</title>
<updated>2020-02-27T15:44:25Z</updated>
<author>
<name>Sherry Sun</name>
<email>sherry.sun@nxp.com</email>
</author>
<published>2020-02-27T08:34:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=dfc6014e3b60713f375d0601d7549eed224c4615'/>
<id>urn:sha1:dfc6014e3b60713f375d0601d7549eed224c4615</id>
<content type='text'>
handle_error() currently calls snprintf() a couple of times in
succession to output the message for a CE/UE, therefore overwriting each
part of the message which was formatted with the previous snprintf()
call. As a result, only the part of the message from the last snprintf()
call will be printed.

The simplest and most effective way to fix this problem is to combine
the whole string into one which to supply to a single snprintf() call.

 [ bp: Massage. ]

Fixes: b500b4a029d57 ("EDAC, synopsys: Add ECC support for ZynqMP DDR controller")
Signed-off-by: Sherry Sun &lt;sherry.sun@nxp.com&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Reviewed-by: James Morse &lt;james.morse@arm.com&gt;
Cc: Manish Narani &lt;manish.narani@xilinx.com&gt;
Link: https://lkml.kernel.org/r/1582792452-32575-1-git-send-email-sherry.sun@nxp.com
</content>
</entry>
<entry>
<title>EDAC/sysfs: Remove csrow objects on errors</title>
<updated>2020-02-13T12:29:41Z</updated>
<author>
<name>Robert Richter</name>
<email>rrichter@marvell.com</email>
</author>
<published>2020-02-12T12:03:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4d59588c09f2a2daedad2a544d4d1b602ab3a8af'/>
<id>urn:sha1:4d59588c09f2a2daedad2a544d4d1b602ab3a8af</id>
<content type='text'>
All created csrow objects must be removed in the error path of
edac_create_csrow_objects(). The objects have been added as devices.

They need to be removed by doing a device_del() *and* put_device() call
to also free their memory. The missing put_device() leaves a memory
leak. Use device_unregister() instead of device_del() which properly
unregisters the device doing both.

Fixes: 7adc05d2dc3a ("EDAC/sysfs: Drop device references properly")
Signed-off-by: Robert Richter &lt;rrichter@marvell.com&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Tested-by: John Garry &lt;john.garry@huawei.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Link: https://lkml.kernel.org/r/20200212120340.4764-4-rrichter@marvell.com
</content>
</entry>
<entry>
<title>EDAC/mc: Fix use-after-free and memleaks during device removal</title>
<updated>2020-02-13T12:28:52Z</updated>
<author>
<name>Robert Richter</name>
<email>rrichter@marvell.com</email>
</author>
<published>2020-02-12T17:25:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=216aa145aaf379a50b17afc812db71d893bd6683'/>
<id>urn:sha1:216aa145aaf379a50b17afc812db71d893bd6683</id>
<content type='text'>
A test kernel with the options DEBUG_TEST_DRIVER_REMOVE, KASAN and
DEBUG_KMEMLEAK set, revealed several issues when removing an mci device:

1) Use-after-free:

On 27.11.19 17:07:33, John Garry wrote:
&gt; [   22.104498] BUG: KASAN: use-after-free in
&gt; edac_remove_sysfs_mci_device+0x148/0x180

The use-after-free is caused by the mci_for_each_dimm() macro called in
edac_remove_sysfs_mci_device(). The iterator was introduced with

  c498afaf7df8 ("EDAC: Introduce an mci_for_each_dimm() iterator").

The iterator loop calls device_unregister(&amp;dimm-&gt;dev), which removes
the sysfs entry of the device, but also frees the dimm struct in
dimm_attr_release(). When incrementing the loop in mci_for_each_dimm(),
the dimm struct is accessed again, after having been freed already.

The fix is to free all the mci device's subsequent dimm and csrow
objects at a later point, in _edac_mc_free(), when the mci device itself
is being freed.

This keeps the data structures intact and the mci device can be
fully used until its removal. The change allows the safe usage of
mci_for_each_dimm() to release dimm devices from sysfs.

2) Memory leaks:

Following memory leaks have been detected:

 # grep edac /sys/kernel/debug/kmemleak | sort | uniq -c
       1     [&lt;000000003c0f58f9&gt;] edac_mc_alloc+0x3bc/0x9d0      # mci-&gt;csrows
      16     [&lt;00000000bb932dc0&gt;] edac_mc_alloc+0x49c/0x9d0      # csr-&gt;channels
      16     [&lt;00000000e2734dba&gt;] edac_mc_alloc+0x518/0x9d0      # csr-&gt;channels[chn]
       1     [&lt;00000000eb040168&gt;] edac_mc_alloc+0x5c8/0x9d0      # mci-&gt;dimms
      34     [&lt;00000000ef737c29&gt;] ghes_edac_register+0x1c8/0x3f8 # see edac_mc_alloc()

All leaks are from memory allocated by edac_mc_alloc().

Note: The test above shows that edac_mc_alloc() was called here from
ghes_edac_register(), thus both functions show up in the stack trace
but the module causing the leaks is edac_mc. The comments with the data
structures involved were made manually by analyzing the objdump.

The data structures listed above and created by edac_mc_alloc() are
not properly removed during device removal, which is done in
edac_mc_free().

There are two paths implemented to remove the device depending on device
registration, _edac_mc_free() is called if the device is not registered
and edac_unregister_sysfs() otherwise.

The implemenations differ. For the sysfs case, the mci device removal
lacks the removal of subsequent data structures (csrows, channels,
dimms). This causes the memory leaks (see mci_attr_release()).

 [ bp: Massage commit message. ]

Fixes: c498afaf7df8 ("EDAC: Introduce an mci_for_each_dimm() iterator")
Fixes: faa2ad09c01c ("edac_mc: edac_mc_free() cannot assume mem_ctl_info is registered in sysfs.")
Fixes: 7a623c039075 ("edac: rewrite the sysfs code to use struct device")
Reported-by: John Garry &lt;john.garry@huawei.com&gt;
Signed-off-by: Robert Richter &lt;rrichter@marvell.com&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Tested-by: John Garry &lt;john.garry@huawei.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Link: https://lkml.kernel.org/r/20200212120340.4764-3-rrichter@marvell.com
</content>
</entry>
<entry>
<title>Merge tag 'ioremap-5.6' of git://git.infradead.org/users/hch/ioremap</title>
<updated>2020-01-27T21:03:00Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2020-01-27T21:03:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6a1000bd27035bba17ede9dc915166276a811edb'/>
<id>urn:sha1:6a1000bd27035bba17ede9dc915166276a811edb</id>
<content type='text'>
Pull ioremap updates from Christoph Hellwig:
 "Remove the ioremap_nocache API (plus wrappers) that are always
  identical to ioremap"

* tag 'ioremap-5.6' of git://git.infradead.org/users/hch/ioremap:
  remove ioremap_nocache and devm_ioremap_nocache
  MIPS: define ioremap_nocache to ioremap
</content>
</entry>
<entry>
<title>Merge branch 'ras-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip</title>
<updated>2020-01-27T17:19:35Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2020-01-27T17:19:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=30f5a75640998900d995e099e060e920e72790b2'/>
<id>urn:sha1:30f5a75640998900d995e099e060e920e72790b2</id>
<content type='text'>
Pull RAS updates from Borislav Petkov:

 - Misc fixes to the MCE code all over the place, by Jan H. Schönherr.

 - Initial support for AMD F19h and other cleanups to amd64_edac, by
   Yazen Ghannam.

 - Other small cleanups.

* 'ras-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  EDAC/mce_amd: Make fam_ops static global
  EDAC/amd64: Drop some family checks for newer systems
  EDAC/amd64: Add family ops for Family 19h Models 00h-0Fh
  x86/amd_nb: Add Family 19h PCI IDs
  EDAC/mce_amd: Always load on SMCA systems
  x86/MCE/AMD, EDAC/mce_amd: Add new Load Store unit McaType
  x86/mce: Fix use of uninitialized MCE message string
  x86/mce: Fix mce=nobootlog
  x86/mce: Take action on UCNA/Deferred errors again
  x86/mce: Remove mce_inject_log() in favor of mce_log()
  x86/mce: Pass MCE message to mce_panic() on failed kernel recovery
  x86/mce/therm_throt: Mark throttle_active_work() as __maybe_unused
</content>
</entry>
<entry>
<title>Merge tag 'edac_for_5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras</title>
<updated>2020-01-27T17:16:22Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2020-01-27T17:16:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b62061b82a6e6783bed5f9052326694ba1418bba'/>
<id>urn:sha1:b62061b82a6e6783bed5f9052326694ba1418bba</id>
<content type='text'>
Pull EDAC updates from Borislav Petkov:
 "A totally boring branch this time around: a garden variety of small
  fixes all over the place"

* tag 'edac_for_5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras:
  EDAC/amd64: Do not warn when removing instances
  EDAC/sifive: Fix return value check in ecc_register()
  EDAC/aspeed: Remove unneeded semicolon
  EDAC: remove set but not used variable 'ecc_loc'
  EDAC: skx_common: downgrade message importance on missing PCI device
  EDAC/Kconfig: Fix Kconfig indentation
</content>
</entry>
<entry>
<title>EDAC/amd64: Do not warn when removing instances</title>
<updated>2020-01-17T12:00:06Z</updated>
<author>
<name>Borislav Petkov</name>
<email>bp@suse.de</email>
</author>
<published>2020-01-17T11:30:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7e5d6cf35329c8b232a1e97114545c1745d79083'/>
<id>urn:sha1:7e5d6cf35329c8b232a1e97114545c1745d79083</id>
<content type='text'>
On machines which do not populate all nodes with DIMMs, the driver
doesn't initialize an instance there. However, the instance removal
remove_one_instance() path will warn unconditionally, which is wrong.

Remove the WARN_ON() even if the warning is innocent because it causes a
splat in dmesg.

Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Link: https://lkml.kernel.org/r/20200117115939.5524-1-bp@alien8.de
</content>
</entry>
<entry>
<title>EDAC/sifive: Fix return value check in ecc_register()</title>
<updated>2020-01-17T00:37:51Z</updated>
<author>
<name>Wei Yongjun</name>
<email>weiyongjun1@huawei.com</email>
</author>
<published>2020-01-15T15:03:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6cd18453b68942913fd3b1913b707646e544c2ac'/>
<id>urn:sha1:6cd18453b68942913fd3b1913b707646e544c2ac</id>
<content type='text'>
In case of error, the function edac_device_alloc_ctl_info() returns a
NULL pointer, not ERR_PTR(). Replace the IS_ERR() test in the return
value check with a NULL test.

Fixes: 91abaeaaff35 ("EDAC/sifive: Add EDAC platform driver for SiFive SoCs")
Signed-off-by: Wei Yongjun &lt;weiyongjun1@huawei.com&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Link: https://lkml.kernel.org/r/20200115150303.112627-1-weiyongjun1@huawei.com
</content>
</entry>
<entry>
<title>EDAC/mce_amd: Make fam_ops static global</title>
<updated>2020-01-16T20:52:48Z</updated>
<author>
<name>Borislav Petkov</name>
<email>bp@suse.de</email>
</author>
<published>2020-01-16T16:28:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=86e9f9d60eb5e0c5d99ddf6b79f4d308d6453bd0'/>
<id>urn:sha1:86e9f9d60eb5e0c5d99ddf6b79f4d308d6453bd0</id>
<content type='text'>
... and do not kmalloc a three-pointer struct. Which simplifies
mce_amd_init() a bit.

No functional changes.

Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Link: https://lkml.kernel.org/r/20200116163403.GF27148@zn.tnic
</content>
</entry>
<entry>
<title>EDAC/amd64: Drop some family checks for newer systems</title>
<updated>2020-01-16T16:09:29Z</updated>
<author>
<name>Yazen Ghannam</name>
<email>yazen.ghannam@amd.com</email>
</author>
<published>2020-01-10T01:56:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=dcd01394ce7cd7d25bb15c81ad2e804d8090611f'/>
<id>urn:sha1:dcd01394ce7cd7d25bb15c81ad2e804d8090611f</id>
<content type='text'>
In general, "pvt-&gt;umc != NULL" is used to check if the system is Family
17h+. However, there are a few places that are using direct family
checks.

Replace the remaining family checks with a check for "pvt-&gt;umc != NULL".

Signed-off-by: Yazen Ghannam &lt;yazen.ghannam@amd.com&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Link: https://lkml.kernel.org/r/20200110015651.14887-6-Yazen.Ghannam@amd.com
</content>
</entry>
</feed>
