4.19.164-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainerPATCH 212/346 scsi: fnic: Fix error return code in fnic_probe()
In reply to Greg Kroah-HartmanFrom: Zhang Changzhong <[email protected]>
[ Upstream commit d4fc94fe65578738ded138e9fce043db6bfc3241 ]
Return a negative error code from the error handling case instead of 0 as done elsewhere in this function.
--- drivers/scsi/fnic/fnic_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/fnic/fnic_main.c +1 -0
@@ -746,6 +746,7 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)for (i =0 ; i <FNIC_IO_LOCKS ; i++)spin_lock_init (&fnic->io_req_lock[i]); + err = -ENOMEM ; fnic->io_req_pool =mempool_create_slab_pool (2 , fnic_io_req_cache);if (!fnic->io_req_pool) goto err_out_free_resources;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 251/346 kconfig: fix return value of do_error_if()
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
[ Upstream commit 135b4957eac43af2aedf8e2a277b9540f33c2558 ]
$(error-if,...) is expanded to an empty string. Currently, it relies on eval_clause() returning xstrdup("") when all attempts for expansion fail, but the correct implementation is to make do_error_if() return xstrdup("").
--- scripts/kconfig/preprocess.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kconfig/preprocess.c +1 -1
@@ -111,7 +111,7 @@ static char *do_error_if(int argc, char *argv[])if (!strcmp (argv[0 ],"y" ))pperror ("%s" , argv[1 ]); -return NULL ; +return xstrdup ("" ); }static char *do_filename (int argc,char *argv[])
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 270/346 ACPI: PNP: compare the string length in the matching_id()
In reply to Greg Kroah-HartmanFrom: Hui Wang <[email protected]>
commit b08221c40febcbda9309dd70c61cf1b0ebb0e351 upstream.
Recently we met a touchscreen problem on some Thinkpad machines, the touchscreen driver (i2c-hid) is not loaded and the touchscreen can't work.
An i2c ACPI device with the name WACF2200 is defined in the BIOS, with the current rule in matching_id(), this device will be regarded as a PNP device since there is WACFXXX in the acpi_pnp_device_ids[] and this PNP device is attached to the acpi device as the 1st physical_node, this will make the i2c bus match fail when i2c bus calls acpi_companion_match() to match the acpi_id_table in the i2c-hid driver.
WACF2200 is an i2c device instead of a PNP device, after adding the string length comparing, the matching_id() will return false when matching WACF2200 and WACFXXX, and it is reasonable to compare the string length when matching two IDs.
--- drivers/acpi/acpi_pnp.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/acpi/acpi_pnp.c +3 -0
@@ -320,6 +320,9 @@ static bool matching_id(const char *idst {int i; +if (strlen (idstr) !=strlen (list_id)) +return false; +if (memcmp (idstr, list_id,3 ))return false;
Greg Kroah-Hartman
maintainerPATCH 273/346 ALSA: hda/realtek - Enable headset mic of ASUS Q524UQK with ALC255
In reply to Greg Kroah-HartmanFrom: Chris Chiu <[email protected]>
commit 7e413528474d5895e3e315c019fb0c43522eb6d9 upstream.
The ASUS laptop Q524UQK with ALC255 codec can't detect the headset microphone until ALC255_FIXUP_ASUS_MIC_NO_PRESENCE quirk applied.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -7101,6 +7101,7 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x1043 ,0x1b13 ,"Asus U41SV" ,ALC269_FIXUP_INV_DMIC ),SND_PCI_QUIRK (0x1043 ,0x1bbd ,"ASUS Z550MA" ,ALC255_FIXUP_ASUS_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1043 ,0x1c23 ,"Asus X55U" ,ALC269_FIXUP_LIMIT_INT_MIC_BOOST ), +SND_PCI_QUIRK (0x1043 ,0x125e ,"ASUS Q524UQK" ,ALC255_FIXUP_ASUS_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1043 ,0x1ccd ,"ASUS X555UB" ,ALC256_FIXUP_ASUS_MIC ),SND_PCI_QUIRK (0x1043 ,0x3030 ,"ASUS ZN270IE" ,ALC256_FIXUP_ASUS_AIO_GPIO2 ), SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
Greg Kroah-Hartman
maintainerPATCH 279/346 s390/smp: perform initial CPU reset also for SMT siblings
In reply to Greg Kroah-HartmanFrom: Sven Schnelle <[email protected]>
commit b5e438ebd7e808d1d2435159ac4742e01a94b8da upstream.
Not resetting the SMT siblings might leave them in unpredictable state. One of the observed problems was that the CPU timer wasn't reset and therefore large system time values where accounted during CPU bringup.
--- arch/s390/kernel/smp.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-)
arch/s390/kernel/smp.c +3 -15
@@ -863,24 +863,12 @@ static void smp_start_secondary(void *cp/* Upping and downing of CPUs */ int __cpu_up (unsigned int cpu,struct task_struct *tidle) { -struct pcpu *pcpu; -int base, i, rc; +struct pcpu *pcpu = pcpu_devices + cpu; +int rc; - pcpu = pcpu_devices + cpu;if (pcpu->state !=CPU_STATE_CONFIGURED )return -EIO ; - base =smp_get_base_cpu (cpu); -for (i =0 ; i <= smp_cpu_mtid; i++) { -if (base + i < nr_cpu_ids) -if (cpu_online (base + i)) -break ; - } -/* -* If this is the first CPU of the core to get online -* do an initial CPU reset. -*/ -if (i > smp_cpu_mtid && -pcpu_sigp_retry (pcpu_devices + base,SIGP_INITIAL_CPU_RESET ,0 ) != +if (pcpu_sigp_retry (pcpu,SIGP_INITIAL_CPU_RESET ,0 ) !=SIGP_CC_ORDER_CODE_ACCEPTED )return -EIO ;
Greg Kroah-Hartman
maintainerPATCH 271/346 ALSA: hda: Fix regressions on clear and reconfig sysfs
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 2506318e382c4c7daa77bdc48f80a0ee82804588 upstream.
It seems that the HD-audio clear and reconfig sysfs don't work any longer after the recent driver core change. There are multiple issues around that: the linked list corruption and the dead device handling. The former issue is fixed by another patch for the driver core itself, while the latter patch needs to be addressed in HD-audio side.
This patch corresponds to the latter, it recovers those broken functions by replacing the device detach and attach actions with the standard core API functions, which are almost equivalent with unbind and bind actions.
--- sound/pci/hda/hda_codec.c | 2 +- sound/pci/hda/hda_sysfs.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
sound/pci/hda/hda_codec.c +1 -1
@@ -1782,7 +1782,7 @@ int snd_hda_codec_reset(struct hda_codecreturn -EBUSY ;/* OK, let it free */ -snd_hdac_device_unregister (&codec->core); +device_release_driver (hda_codec_dev (codec));/* allow device access again */ snd_hda_unlock_devices (bus);
sound/pci/hda/hda_sysfs.c +1 -1
@@ -138,7 +138,7 @@ static int reconfig_codec(struct hda_cod "The codec is being used, can't reconfigure.\n"); goto error; } - err =snd_hda_codec_configure (codec); + err =device_reprobe (hda_codec_dev (codec));if (err <0 ) goto error; err =snd_card_register (codec->card);
Greg Kroah-Hartman
maintainerPATCH 276/346 ALSA: hda/realtek: Apply jack fixup for Quanta NL3
In reply to Greg Kroah-HartmanFrom: Chris Chiu <[email protected]>
commit 6ca653e3f73a1af0f30dbf9c2c79d2897074989f upstream.
The Quanta NL3 laptop has both a headphone output jack and a headset jack, on the right edge of the chassis.
The pin information suggests that both of these are at the Front. The PulseAudio is confused to differentiate them so one of the jack can neither get the jack sense working nor the audio output.
The ALC269_FIXUP_LIFEBOOK chained with ALC269_FIXUP_QUANTA_MUTE can help to differentiate 2 jacks and get the 'Auto-Mute Mode' working correctly.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -7129,6 +7129,7 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x1458 ,0xfa53 ,"Gigabyte BXBT-2807" ,ALC283_FIXUP_HEADSET_MIC ),SND_PCI_QUIRK (0x1462 ,0xb120 ,"MSI Cubi MS-B120" ,ALC283_FIXUP_HEADSET_MIC ),SND_PCI_QUIRK (0x1462 ,0xb171 ,"Cubi N 8GL (MS-B171)" ,ALC283_FIXUP_HEADSET_MIC ), +SND_PCI_QUIRK (0x152d ,0x1082 ,"Quanta NL3" ,ALC269_FIXUP_LIFEBOOK ),SND_PCI_QUIRK (0x1558 ,0x1323 ,"Clevo N130ZU" ,ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1558 ,0x1325 ,"System76 Darter Pro (darp5)" ,ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE ), SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Greg Kroah-Hartman
maintainerPATCH 241/346 libnvdimm/label: Return -ENXIO for no slot in __blk_label_update
In reply to Greg Kroah-HartmanFrom: Zhang Qilong <[email protected]>
[ Upstream commit 4c46764733c85b82c07e9559b39da4d00a7dd659 ]
Forget to set error code when nd_label_alloc_slot failed, and we add it to avoid overwritten error code.
--- drivers/nvdimm/label.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/nvdimm/label.c +3 -1
@@ -880,8 +880,10 @@ static int __blk_label_update(struct nd_region *nd_region,if (is_old_resource (res, old_res_list, old_num_resources))continue ;/* carry-over */ slot =nd_label_alloc_slot (ndd); -if (slot ==UINT_MAX ) +if (slot ==UINT_MAX ) { + rc = -ENXIO ; goto abort; + }dev_dbg (ndd->dev,"allocated: %d\n" , slot); nd_label =to_label (ndd, slot);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 280/346 s390/kexec_file: fix diag308 subcode when loading crash kernel
In reply to Greg Kroah-HartmanFrom: Philipp Rudo <[email protected]>
commit 613775d62ec60202f98d2c5f520e6e9ba6dd4ac4 upstream.
diag308 subcode 0 performes a clear reset which inlcudes the reset of all registers in the system. While this is the preferred behavior when loading a normal kernel via kexec it prevents the crash kernel to store the register values in the dump. To prevent this use subcode 1 when loading a crash kernel instead.
--- arch/s390/purgatory/head.S | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
arch/s390/purgatory/head.S +5 -4
@@ -61,14 +61,15 @@ jh 10b .endm -.macro START_NEXT_KERNEL base +.macro START_NEXT_KERNEL base subcode lg %r4,kernel_entry-\base(%r13) lg %r5,load_psw_mask-\base(%r13) ogr %r4,%r5 stg %r4,0(%r0) xgr %r0,%r0 - diag %r0,%r0,0x308 + lghi %r1,\subcode + diag %r0,%r1,0x308 .endm .text
@@ -123,7 +124,7 @@ ENTRY(purgatory_start) je .start_crash_kernel /* start normal kernel */ - START_NEXT_KERNEL .base_crash + START_NEXT_KERNEL .base_crash 0 .return_old_kernel: lmg %r6,%r15,gprregs-.base_crash(%r13)
@@ -227,7 +228,7 @@ ENTRY(purgatory_start) MEMCPY %r9,%r10,%r11 /* start crash kernel */ - START_NEXT_KERNEL .base_dst + START_NEXT_KERNEL .base_dst 1 load_psw_mask:
Greg Kroah-Hartman
maintainerPATCH 214/346 powerpc/pseries/hibernation: drop pseries_suspend_begin() from suspend ops
In reply to Greg Kroah-HartmanFrom: Nathan Lynch <[email protected]>
[ Upstream commit 52719fce3f4c7a8ac9eaa191e8d75a697f9fbcbc ]
There are three ways pseries_suspend_begin() can be reached:
1. When "mem" is written to /sys/power/state:
kobj_attr_store()
-> state_store()
-> pm_suspend()
-> suspend_devices_and_enter()
-> pseries_suspend_begin()This never works because there is no way to supply a valid stream id using this interface, and H_VASI_STATE is called with a stream id of zero. So this call path is useless at best.
2. When a stream id is written to /sys/devices/system/power/hibernate. pseries_suspend_begin() is polled directly from store_hibernate() until the stream is in the "Suspending" state (i.e. the platform is ready for the OS to suspend execution):
dev_attr_store()
-> store_hibernate()
-> pseries_suspend_begin()
3. When a stream id is written to /sys/devices/system/power/hibernate (continued). After #2, pseries_suspend_begin() is called once again from the pm core:
dev_attr_store()
-> store_hibernate()
-> pm_suspend()
-> suspend_devices_and_enter()
-> pseries_suspend_begin()This is redundant because the VASI suspend state is already known to be Suspending.
The begin() callback of platform_suspend_ops is optional, so we can simply remove that assignment with no loss of function.
--- arch/powerpc/platforms/pseries/suspend.c | 1 - 1 file changed, 1 deletion(-)
arch/powerpc/platforms/pseries/suspend.c +0 -1
@@ -223,7 +223,6 @@ static struct bus_type suspend_subsys = {static const struct platform_suspend_ops pseries_suspend_ops = { .valid = suspend_valid_only_mem, - .begin = pseries_suspend_begin, .prepare_late = pseries_prepare_late, .enter = pseries_suspend_enter, };
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 249/346 clk: s2mps11: Fix a resource leak in error handling paths in the probe function
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit d2d94fc567624f96187e8b52083795620f93e69f ]
Some resource should be released in the error handling path of the probe function, as already done in the remove function.
The remove function was fixed in commit bf416bd45738 ("clk: s2mps11: Add missing of_node_put and of_clk_del_provider")
--- drivers/clk/clk-s2mps11.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/clk-s2mps11.c +1 -0
@@ -211,6 +211,7 @@ static int s2mps11_clk_probe(struct platform_device *pdev)return ret; err_reg: +of_node_put (s2mps11_clks[0 ].clk_np);while (--i >=0 )clkdev_drop (s2mps11_clks[i].lookup);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 253/346 cfg80211: initialize rekey_data
In reply to Greg Kroah-HartmanFrom: Sara Sharon <[email protected]>
[ Upstream commit f495acd8851d7b345e5f0e521b2645b1e1f928a0 ]
In case we have old supplicant, the akm field is uninitialized.
--- net/wireless/nl80211.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/wireless/nl80211.c +1 -1
@@ -11502,7 +11502,7 @@ static int nl80211_set_rekey_data(struct sk_buff *skb, struct genl_info *info)struct net_device *dev = info->user_ptr[1 ];struct wireless_dev *wdev = dev->ieee80211_ptr;struct nlattr *tb[NUM_NL80211_REKEY_DATA ]; -struct cfg80211_gtk_rekey_data rekey_data; +struct cfg80211_gtk_rekey_data rekey_data = {};int err;if (!info->attrs[NL80211_ATTR_REKEY_DATA ])
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 269/346 Revert "ACPI / resources: Use AE_CTRL_TERMINATE to terminate resources walks"
In reply to Greg Kroah-HartmanFrom: Daniel Scally <[email protected]>
commit 12fc4dad94dfac25599f31257aac181c691ca96f upstream.
This reverts commit 8a66790b7850a6669129af078768a1d42076a0ef.
Switching this function to AE_CTRL_TERMINATE broke the documented behaviour of acpi_dev_get_resources() - AE_CTRL_TERMINATE does not, in fact, terminate the resource walk because acpi_walk_resource_buffer() ignores it (specifically converting it to AE_OK), referring to that value as "an OK termination by the user function". This means that acpi_dev_get_resources() does not abort processing when the preproc function returns a negative value.
--- drivers/acpi/resource.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/resource.c +1 -1
@@ -549,7 +549,7 @@ static acpi_status acpi_dev_process_reso ret = c->preproc (ares, c->preproc_data);if (ret <0 ) { c->error = ret; -return AE_CTRL_TERMINATE ; +return AE_ABORT_METHOD ; }else if (ret >0 ) {return AE_OK ; }
Greg Kroah-Hartman
maintainerPATCH 272/346 ALSA: hda/realtek - Enable headset mic of ASUS X430UN with ALC256
In reply to Greg Kroah-HartmanFrom: Chris Chiu <[email protected]>
commit 5cfca59604e423f720297e30a9dc493eea623493 upstream.
The ASUS laptop X430UN with ALC256 can't detect the headset microphone until ALC256_FIXUP_ASUS_MIC_NO_PRESENCE quirk applied.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -7084,6 +7084,7 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x1043 ,0x10d0 ,"ASUS X540LA/X540LJ" ,ALC255_FIXUP_ASUS_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1043 ,0x115d ,"Asus 1015E" ,ALC269_FIXUP_LIMIT_INT_MIC_BOOST ),SND_PCI_QUIRK (0x1043 ,0x11c0 ,"ASUS X556UR" ,ALC255_FIXUP_ASUS_MIC_NO_PRESENCE ), +SND_PCI_QUIRK (0x1043 ,0x1271 ,"ASUS X430UN" ,ALC256_FIXUP_ASUS_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1043 ,0x1290 ,"ASUS X441SA" ,ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1043 ,0x12a0 ,"ASUS X441UV" ,ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE ), SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
Greg Kroah-Hartman
maintainerPATCH 254/346 fix namespaced fscaps when !CONFIG_SECURITY
In reply to Greg Kroah-HartmanFrom: Serge Hallyn <[email protected]>
[ Upstream commit ed9b25d1970a4787ac6a39c2091e63b127ecbfc1 ]
Namespaced file capabilities were introduced in 8db6c34f1dbc . When userspace reads an xattr for a namespaced capability, a virtualized representation of it is returned if the caller is in a user namespace owned by the capability's owning rootid. The function which performs this virtualization was not hooked up if CONFIG_SECURITY=n. Therefore in that case the original xattr was shown instead of the virtualized one.
To test this using libcap-bin (*1),
$ v=$(mktemp) $ unshare -Ur setcap cap_sys_admin-eip $v $ unshare -Ur setcap -v cap_sys_admin-eip $v /tmp/tmp.lSiIFRvt8Y: OK
"setcap -v" verifies the values instead of setting them, and will check whether the rootid value is set. Therefore, with this bug un-fixed, and with CONFIG_SECURITY=n, setcap -v will fail:
$ v=$(mktemp) $ unshare -Ur setcap cap_sys_admin=eip $v $ unshare -Ur setcap -v cap_sys_admin=eip $v nsowner[got=1000, want=0],/tmp/tmp.HHDiOOl9fY differs in []
Fix this bug by calling cap_inode_getsecurity() in security_inode_getsecurity() instead of returning -EOPNOTSUPP, when CONFIG_SECURITY=n.
*1 - note, if libcap is too old for getcap to have the '-n' option, then use verify-caps instead.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=209689
--- include/linux/security.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/security.h +1 -1
@@ -787,7 +787,7 @@ static inline int security_inode_killpriv(struct dentry *dentry)static inline int security_inode_getsecurity (struct inode *inode,const char *name,void **buffer,bool alloc) { -return -EOPNOTSUPP ; +return cap_inode_getsecurity (inode, name, buffer, alloc); }static inline int security_inode_setsecurity (struct inode *inode,const char *name,const void *value,size_t size,int flags)
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 277/346 ALSA: usb-audio: Add VID to support native DSD reproduction on FiiO devices
In reply to Greg Kroah-HartmanFrom: Amadej Kastelic <[email protected]>
commit 725124d10d00b2f56bb5bd08b431cc74ab3b3ace upstream.
Add VID to support native DSD reproduction on FiiO devices.
--- sound/usb/quirks.c | 1 + 1 file changed, 1 insertion(+)
sound/usb/quirks.c +1 -0
@@ -1465,6 +1465,7 @@ u64 snd_usb_interface_dsd_format_quirks(case 0x25ce :/* Mytek devices */ case 0x278b :/* Rotel? */ case 0x292b :/* Gustard/Ess based devices */ +case 0x2972 :/* FiiO devices */ case 0x2ab6 :/* T+A devices */ case 0x3353 :/* Khadas devices */ case 0x3842 :/* EVGA */
Greg Kroah-Hartman
maintainerPATCH 295/346 USB: serial: keyspan_pda: fix tx-unthrottle use-after-free
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 49fbb8e37a961396a5b6c82937c70df91de45e9d upstream.
The driver's transmit-unthrottle work was never flushed on disconnect, something which could lead to the driver port data being freed while the unthrottle work is still scheduled.
Fix this by cancelling the unthrottle work when shutting down the port.
--- drivers/usb/serial/keyspan_pda.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/usb/serial/keyspan_pda.c +4 -0
@@ -647,8 +647,12 @@ error: }static void keyspan_pda_close (struct usb_serial_port *port) { +struct keyspan_pda_private *priv =usb_get_serial_port_data (port); +usb_kill_urb (port->write_urb);usb_kill_urb (port->interrupt_in_urb); + +cancel_work_sync (&priv->unthrottle_work); }
Greg Kroah-Hartman
maintainerPATCH 304/346 powerpc/xmon: Change printk() to pr_cont()
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
commit 7c6c86b36a36dd4a13d30bba07718e767aa2e7a1 upstream.
Since some time now, printk() adds carriage return, leading to unusable xmon output if there is no udbg backend available:
[ 54.288722] sysrq: Entering xmon [ 54.292209] Vector: 0 at [cace3d2c] [ 54.292274] pc: [ 54.292331] c0023650 [ 54.292468] : xmon+0x28/0x58 [ 54.292519] [ 54.292574] lr: [ 54.292630] c0023724 [ 54.292749] : sysrq_handle_xmon+0xa4/0xfc [ 54.292801] [ 54.292867] sp: cace3de8 [ 54.292931] msr: 9032 [ 54.292999] current = 0xc28d0000 [ 54.293072] pid = 377, comm = sh [ 54.293157] Linux version 5.10.0-rc6-s3k-dev-01364-gedf13f0ccd76-dirty ([email protected]) (powerpc64-linux-gcc (GCC) 10.1.0, GNU ld (GNU Binutils) 2.34) #4211 PREEMPT Fri Dec 4 09:32:11 UTC 2020 [ 54.293287] enter ? for help [ 54.293470] [cace3de8] [ 54.293532] c0023724 [ 54.293654] sysrq_handle_xmon+0xa4/0xfc [ 54.293711] (unreliable) ... [ 54.296002] [ 54.296159] --- Exception: c01 (System Call) at [ 54.296217] 0fd4e784 [ 54.296303] [ 54.296375] SP (7fca6ff0) is in userspace [ 54.296431] mon> [ 54.296484] <no input ...>
Use pr_cont() instead.
--- arch/powerpc/xmon/nonstdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/xmon/nonstdio.c +1 -1
@@ -182,7 +182,7 @@ void xmon_printf(const char *format, ...if (n && rc ==0 ) {/* No udbg hooks, fallback to printk() - dangerous */ -printk ("%s" , xmon_outbuf); +pr_cont ("%s" , xmon_outbuf); } }
Greg Kroah-Hartman
maintainerPATCH 284/346 s390/dasd: fix list corruption of lcu list
In reply to Greg Kroah-HartmanFrom: Stefan Haberland <[email protected]>
commit 53a7f655834c7c335bf683f248208d4fbe4b47bc upstream.
In dasd_alias_disconnect_device_from_lcu the device is removed from any list on the LCU. Afterwards the LCU is removed from the lcu list if it does not contain devices any longer.
The lcu->lock protects the lcu from parallel updates. But to cancel all workers and wait for completion the lcu->lock has to be unlocked.
If two devices are removed in parallel and both are removed from the LCU the first device that takes the lcu->lock again will delete the LCU because it is already empty but the second device also tries to free the LCU which leads to a list corruption of the lcu list.
Fix by removing the device right before the lcu is checked without unlocking the lcu->lock in between.
--- drivers/s390/block/dasd_alias.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/s390/block/dasd_alias.c +1 -1
@@ -256,7 +256,6 @@ void dasd_alias_disconnect_device_from_lreturn ; device->discipline->get_uid (device, &uid);spin_lock_irqsave (&lcu->lock, flags); -list_del_init (&device->alias_list);/* make sure that the workers don't use this device */ if (device == lcu->suc_data.device) {spin_unlock_irqrestore (&lcu->lock, flags);
@@ -283,6 +282,7 @@ void dasd_alias_disconnect_device_from_lspin_lock_irqsave (&aliastree.lock, flags);spin_lock (&lcu->lock); +list_del_init (&device->alias_list);if (list_empty (&lcu->grouplist) &&list_empty (&lcu->active_devices) &&list_empty (&lcu->inactive_devices)) {
Greg Kroah-Hartman
maintainerPATCH 294/346 USB: serial: keyspan_pda: fix write-wakeup use-after-free
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 37faf50615412947868c49aee62f68233307f4e4 upstream.
The driver's deferred write wakeup was never flushed on disconnect, something which could lead to the driver port data being freed while the wakeup work is still scheduled.
Fix this by using the usb-serial write wakeup which gets cancelled properly on disconnect.
--- drivers/usb/serial/keyspan_pda.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-)
drivers/usb/serial/keyspan_pda.c +3 -14
@@ -43,8 +43,7 @@struct keyspan_pda_private {int tx_room;int tx_throttled; -struct work_struct wakeup_work; -struct work_struct unthrottle_work; +struct work_struct unthrottle_work;struct usb_serial *serial;struct usb_serial_port *port; };
@@ -97,15 +96,6 @@ static const struct usb_device_id id_tab };#endif -static void keyspan_pda_wakeup_write (struct work_struct *work) -{ -struct keyspan_pda_private *priv = - container_of(work, struct keyspan_pda_private, wakeup_work); -struct usb_serial_port *port = priv->port; - -tty_port_tty_wakeup (&port->port); -} -static void keyspan_pda_request_unthrottle (struct work_struct *work) { struct keyspan_pda_private *priv =
@@ -183,7 +173,7 @@ static void keyspan_pda_rx_interrupt(strcase 2 :/* tx unthrottle interrupt */ priv->tx_throttled =0 ;/* queue up a wakeup at scheduler time */ -schedule_work (&priv->wakeup_work); +usb_serial_port_softint (port);break ;default :break ;
@@ -563,7 +553,7 @@ static void keyspan_pda_write_bulk_callb priv =usb_get_serial_port_data (port);/* queue up a wakeup at scheduler time */ -schedule_work (&priv->wakeup_work); +usb_serial_port_softint (port); }
@@ -716,7 +706,6 @@ static int keyspan_pda_port_probe(structif (!priv)return -ENOMEM ; -INIT_WORK (&priv->wakeup_work, keyspan_pda_wakeup_write);INIT_WORK (&priv->unthrottle_work, keyspan_pda_request_unthrottle); priv->serial = port->serial; priv->port = port;
Greg Kroah-Hartman
maintainerPATCH 297/346 ext4: fix a memory leak of ext4_free_data
In reply to Greg Kroah-HartmanFrom: Chunguang Xu <[email protected]>
commit cca415537244f6102cbb09b5b90db6ae2c953bdd upstream.
When freeing metadata, we will create an ext4_free_data and insert it into the pending free list. After the current transaction is committed, the object will be freed.
ext4_mb_free_metadata() will check whether the area to be freed overlaps with the pending free list. If true, return directly. At this time, ext4_free_data is leaked. Fortunately, the probability of this problem is small, since it only occurs if the file system is corrupted such that a block is claimed by more one inode and those inodes are deleted within a single jbd2 transaction.
--- fs/ext4/mballoc.c | 1 + 1 file changed, 1 insertion(+)
fs/ext4/mballoc.c +1 -0
@@ -4690,6 +4690,7 @@ ext4_mb_free_metadata(handle_t *handle,ext4_group_first_block_no (sb, group) +EXT4_C2B (sbi, cluster), "Block already on to-be-freed list"); +kmem_cache_free (ext4_free_data_cachep, new_entry);return 0 ; } }
Greg Kroah-Hartman
maintainerPATCH 298/346 ext4: fix deadlock with fs freezing and EA inodes
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
commit 46e294efc355c48d1dd4d58501aa56dac461792a upstream.
Xattr code using inodes with large xattr data can end up dropping last inode reference (and thus deleting the inode) from places like ext4_xattr_set_entry(). That function is called with transaction started and so ext4_evict_inode() can deadlock against fs freezing like:
CPU1 CPU2
removexattr() freeze_super()
vfs_removexattr()
ext4_xattr_set()
handle = ext4_journal_start()
...
ext4_xattr_set_entry()
iput(old_ea_inode)
ext4_evict_inode(old_ea_inode)
sb->s_writers.frozen = SB_FREEZE_FS;
sb_wait_write(sb, SB_FREEZE_FS);
ext4_freeze()
jbd2_journal_lock_updates()
-> blocks waiting for all
handles to stop
sb_start_intwrite()
-> blocks as sb is already in SB_FREEZE_FS stateGenerally it is advisable to delete inodes from a separate transaction as it can consume quite some credits however in this case it would be quite clumsy and furthermore the credits for inode deletion are quite limited and already accounted for. So just tweak ext4_evict_inode() to avoid freeze protection if we have transaction already started and thus it is not really needed anyway.
--- fs/ext4/inode.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
fs/ext4/inode.c +15 -6
@@ -203,6 +203,7 @@ void ext4_evict_inode(struct inode *inod*/ int extra_credits =6 ;struct ext4_xattr_inode_array *ea_inode_array =NULL ; +bool freeze_protected = false;trace_ext4_evict_inode (inode);
@@ -250,9 +251,14 @@ void ext4_evict_inode(struct inode *inod/* * Protect us against freezing - iput() caller didn't have to have any -* protection against it -*/ -sb_start_intwrite (inode->i_sb); +* protection against it. When we are in a running transaction though, +* we are already protected against freezing and we cannot grab further +* protection due to lock ordering constraints. +*/ +if (!ext4_journal_current_handle ()) { +sb_start_intwrite (inode->i_sb); + freeze_protected = true; + }if (!IS_NOQUOTA (inode)) extra_credits +=EXT4_MAXQUOTAS_DEL_BLOCKS (inode->i_sb);
@@ -271,7 +277,8 @@ void ext4_evict_inode(struct inode *inod* cleaned up. */ ext4_orphan_del (NULL , inode); -sb_end_intwrite (inode->i_sb); +if (freeze_protected) +sb_end_intwrite (inode->i_sb); goto no_delete; }
@@ -312,7 +319,8 @@ void ext4_evict_inode(struct inode *inod stop_handle:ext4_journal_stop (handle);ext4_orphan_del (NULL , inode); -sb_end_intwrite (inode->i_sb); +if (freeze_protected) +sb_end_intwrite (inode->i_sb);ext4_xattr_inode_array_free (ea_inode_array); goto no_delete; }
@@ -341,7 +349,8 @@ stop_handle:else ext4_free_inode (handle, inode);ext4_journal_stop (handle); -sb_end_intwrite (inode->i_sb); +if (freeze_protected) +sb_end_intwrite (inode->i_sb);ext4_xattr_inode_array_free (ea_inode_array);return ; no_delete:
Greg Kroah-Hartman
maintainerPATCH 299/346 KVM: arm64: Introduce handling of AArch32 TTBCR2 traps
In reply to Greg Kroah-HartmanFrom: Marc Zyngier <[email protected]>
commit ca4e514774930f30b66375a974b5edcbebaf0e7e upstream.
ARMv8.2 introduced TTBCR2, which shares TCR_EL1 with TTBCR. Gracefully handle traps to this register when HCR_EL2.TVM is set.
--- arch/arm64/include/asm/kvm_host.h | 1 + arch/arm64/kvm/sys_regs.c | 1 + 2 files changed, 2 insertions(+)
arch/arm64/include/asm/kvm_host.h +1 -0
@@ -165,6 +165,7 @@ enum vcpu_sysreg {#define c2_TTBR1 (TTBR1_EL1 * 2)/* Translation Table Base Register 1 */ #define c2_TTBR1_high (c2_TTBR1 + 1)/* TTBR1 top 32 bits */ #define c2_TTBCR (TCR_EL1 * 2)/* Translation Table Base Control R. */ +#define c2_TTBCR2 (c2_TTBCR + 1)/* Translation Table Base Control R. 2 */ #define c3_DACR (DACR32_EL2 * 2)/* Domain Access Control Register */ #define c5_DFSR (ESR_EL1 * 2)/* Data Fault Status Register */ #define c5_IFSR (IFSR32_EL2 * 2)/* Instruction Fault Status Register */
arch/arm64/kvm/sys_regs.c +1 -0
@@ -1661,6 +1661,7 @@ static const struct sys_reg_desc cp15_re { Op1( 0), CRn( 2), CRm( 0), Op2( 0), access_vm_reg, NULL, c2_TTBR0 }, { Op1( 0), CRn( 2), CRm( 0), Op2( 1), access_vm_reg, NULL, c2_TTBR1 }, { Op1( 0), CRn( 2), CRm( 0), Op2( 2), access_vm_reg, NULL, c2_TTBCR }, + { Op1( 0), CRn( 2), CRm( 0), Op2( 3), access_vm_reg, NULL, c2_TTBCR2 }, { Op1( 0), CRn( 3), CRm( 0), Op2( 0), access_vm_reg, NULL, c3_DACR }, { Op1( 0), CRn( 5), CRm( 0), Op2( 0), access_vm_reg, NULL, c5_DFSR }, { Op1( 0), CRn( 5), CRm( 0), Op2( 1), access_vm_reg, NULL, c5_IFSR },
Greg Kroah-Hartman
maintainerPATCH 312/346 jffs2: Fix GC exit abnormally
In reply to Greg Kroah-HartmanFrom: Zhe Li <[email protected]>
commit 9afc9a8a4909fece0e911e72b1060614ba2f7969 upstream.
The log of this problem is:
jffs2: Error garbage collecting node at 0x***!
jffs2: No space for garbage collection. Aborting GC thread
This is because GC believe that it do nothing, so it abort.
After going over the image of jffs2, I find a scene that can trigger this problem stably.
The scene is: there is a normal dirent node at summary-area, but abnormal at corresponding not-summary-area with error name_crc.
The reason that GC exit abnormally is because it find that abnormal dirent node to GC, but when it goes to function jffs2_add_fd_to_list, it cannot meet the condition listed below:
if ((*prev)->nhash == new->nhash && !strcmp((*prev)->name, new->name))
So no node is marked obsolete, statistical information of erase_block do not change, which cause GC exit abnormally.
The root cause of this problem is: we do not check the name_crc of the abnormal dirent node with summary is enabled.
Noticed that in function jffs2_scan_dirent_node, we use function jffs2_scan_dirty_space to deal with the dirent node with error name_crc. So this patch add a checking code in function read_direntry to ensure the correctness of dirent node. If checked failed, the dirent node will be marked obsolete so GC will pass this node and this problem will be fixed.
--- fs/jffs2/readinode.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
fs/jffs2/readinode.c +16 -0
@@ -672,6 +672,22 @@ static inline int read_direntry(struct jjffs2_free_full_dirent (fd);return -EIO ; } + +#ifdef CONFIG_JFFS2_SUMMARY +/* +* we use CONFIG_JFFS2_SUMMARY because without it, we +* have checked it while mounting +*/ + crc =crc32 (0 , fd->name, rd->nsize); +if (unlikely (crc !=je32_to_cpu (rd->name_crc))) { +JFFS2_NOTICE ("name CRC failed on dirent node at" +"%#08x: read %#08x,calculated %#08x\n" , +ref_offset (ref),je32_to_cpu (rd->node_crc), crc); +jffs2_mark_node_obsolete (c, ref); +jffs2_free_full_dirent (fd); +return 0 ; + } +#endif } fd->nhash =full_name_hash (NULL , fd->name, rd->nsize);
Greg Kroah-Hartman
maintainerPATCH 309/346 SMB3: avoid confusing warning message on mount to Azure
In reply to Greg Kroah-HartmanFrom: Steve French <[email protected]>
commit ebcd6de98754d9b6a5f89d7835864b1c365d432f upstream.
Mounts to Azure cause an unneeded warning message in dmesg
"CIFS: VFS: parse_server_interfaces: incomplete interface info"
Azure rounds up the size (by 8 additional bytes, to a 16 byte boundary) of the structure returned on the query of the server interfaces at mount time. This is permissible even though different than other servers so do not log a warning if query network interfaces response is only rounded up by 8 bytes or fewer.
--- fs/cifs/smb2ops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/cifs/smb2ops.c +2 -1
@@ -366,7 +366,8 @@ parse_server_interfaces(struct network_i goto out; } -if (bytes_left || p->Next) +/* Azure rounds the buffer size up 8, to a 16 byte boundary */ +if ((bytes_left >8 ) || p->Next)cifs_dbg (VFS ,"%s: incomplete interface info\n" , __func__);
Greg Kroah-Hartman
maintainerPATCH 308/346 ceph: fix race in concurrent __ceph_remove_cap invocations
In reply to Greg Kroah-HartmanFrom: Luis Henriques <[email protected]>
commit e5cafce3ad0f8652d6849314d951459c2bff7233 upstream.
A NULL pointer dereference may occur in __ceph_remove_cap with some of the callbacks used in ceph_iterate_session_caps, namely trim_caps_cb and remove_session_caps_cb. Those callers hold the session->s_mutex, so they are prevented from concurrent execution, but ceph_evict_inode does not.
Since the callers of this function hold the i_ceph_lock, the fix is simply a matter of returning immediately if caps->ci is NULL.
Cc: [email protected]
URL: https://tracker.ceph.com/issues/43272
--- fs/ceph/caps.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
fs/ceph/caps.c +9 -2
@@ -1047,12 +1047,19 @@ void __ceph_remove_cap(struct ceph_cap * {struct ceph_mds_session *session = cap->session;struct ceph_inode_info *ci = cap->ci; -struct ceph_mds_client *mdsc = -ceph_sb_to_client (ci->vfs_inode.i_sb)->mdsc; +struct ceph_mds_client *mdsc;int removed =0 ; +/* 'ci' being NULL means the remove have already occurred */ +if (!ci) { +dout ("%s: cap inode is NULL\n" , __func__); +return ; + } +dout ("__ceph_remove_cap %p from %p\n" , cap, &ci->vfs_inode); + mdsc =ceph_inode_to_client (&ci->vfs_inode)->mdsc; +/* remove from inode's cap rbtree, and clear auth cap */ rb_erase (&cap->ci_node, &ci->i_caps);if (ci->i_auth_cap == cap)
Greg Kroah-Hartman
maintainerPATCH 310/346 SMB3.1.1: do not log warning message if server doesnt populate salt
In reply to Greg Kroah-HartmanFrom: Steve French <[email protected]>
commit 7955f105afb6034af344038d663bc98809483cdd upstream.
In the negotiate protocol preauth context, the server is not required to populate the salt (although it is done by most servers) so do not warn on mount.
We retain the checks (warn) that the preauth context is the minimum size and that the salt does not exceed DataLength of the SMB response. Although we use the defaults in the case that the preauth context response is invalid, these checks may be useful in the future as servers add support for additional mechanisms.
--- fs/cifs/smb2pdu.c | 7 +++++-- fs/cifs/smb2pdu.h | 14 +++++++++++--- 2 files changed, 16 insertions(+), 5 deletions(-)
fs/cifs/smb2pdu.c +5 -2
@@ -406,8 +406,8 @@ build_preauth_ctxt(struct smb2_preauth_n pneg_ctxt->ContextType =SMB2_PREAUTH_INTEGRITY_CAPABILITIES ; pneg_ctxt->DataLength =cpu_to_le16 (38 ); pneg_ctxt->HashAlgorithmCount =cpu_to_le16 (1 ); - pneg_ctxt->SaltLength =cpu_to_le16 (SMB311_SALT_SIZE ); -get_random_bytes (pneg_ctxt->Salt,SMB311_SALT_SIZE ); + pneg_ctxt->SaltLength =cpu_to_le16 (SMB311_LINUX_CLIENT_SALT_SIZE ); +get_random_bytes (pneg_ctxt->Salt,SMB311_LINUX_CLIENT_SALT_SIZE ); pneg_ctxt->HashAlgorithms =SMB2_PREAUTH_INTEGRITY_SHA512 ; }
@@ -461,6 +461,9 @@ static void decode_preauth_context(strucif (len <MIN_PREAUTH_CTXT_DATA_LEN ) {printk_once (KERN_WARNING "server sent bad preauth context\n" );return ; + }else if (len <MIN_PREAUTH_CTXT_DATA_LEN +le16_to_cpu (ctxt->SaltLength)) { +pr_warn_once ("server sent invalid SaltLength\n" ); +return ; }if (le16_to_cpu (ctxt->HashAlgorithmCount) !=1 )printk_once (KERN_WARNING "illegal SMB3 hash algorithm count\n" );
fs/cifs/smb2pdu.h +11 -3
@@ -257,12 +257,20 @@ struct smb2_neg_context {/* Followed by array of data */ } __packed; -#define SMB311_SALT_SIZE 32 +#define SMB311_LINUX_CLIENT_SALT_SIZE 32/* Hash Algorithm Types */ #define SMB2_PREAUTH_INTEGRITY_SHA512 cpu_to_le16(0x0001)#define SMB2_PREAUTH_HASH_SIZE 64 -#define MIN_PREAUTH_CTXT_DATA_LEN (SMB311_SALT_SIZE + 6) +/* +* SaltLength that the server send can be zero, so the only three required +* fields (all __le16) end up six bytes total, so the minimum context data len +* in the response is six bytes which accounts for +* +* HashAlgorithmCount, SaltLength, and 1 HashAlgorithm. +*/ +#define MIN_PREAUTH_CTXT_DATA_LEN 6 +struct smb2_preauth_neg_context {__le16 ContextType;/* 1 */ __le16 DataLength;
@@ -270,7 +278,7 @@ struct smb2_preauth_neg_context {__le16 HashAlgorithmCount;/* 1 */ __le16 SaltLength;__le16 HashAlgorithms;/* HashAlgorithms[0] since only one defined */ -__u8 Salt[SMB311_SALT_SIZE ]; +__u8 Salt[SMB311_LINUX_CLIENT_SALT_SIZE ]; } __packed;/* Encryption Algorithms Ciphers */
Greg Kroah-Hartman
maintainerPATCH 311/346 ubifs: wbuf: Dont leak kernel memory to flash
In reply to Greg Kroah-HartmanFrom: Richard Weinberger <[email protected]>
commit 20f1431160c6b590cdc269a846fc5a448abf5b98 upstream.
Write buffers use a kmalloc()'ed buffer, they can leak up to seven bytes of kernel memory to flash if writes are not aligned.
So use ubifs_pad() to fill these gaps with padding bytes. This was never a problem while scanning because the scanner logic manually aligns node lengths and skips over these gaps.
--- fs/ubifs/io.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
fs/ubifs/io.c +11 -2
@@ -331,7 +331,7 @@ void ubifs_pad(const struct ubifs_info * {uint32_t crc; -ubifs_assert (c, pad >=0 && !(pad &7 )); +ubifs_assert (c, pad >=0 );if (pad >=UBIFS_PAD_NODE_SZ ) {struct ubifs_ch *ch = buf;
@@ -728,6 +728,10 @@ int ubifs_wbuf_write_nolock(struct ubifs* write-buffer. */ memcpy (wbuf->buf + wbuf->used, buf, len); +if (aligned_len > len) { +ubifs_assert (c, aligned_len - len <8 ); +ubifs_pad (c, wbuf->buf + wbuf->used + len, aligned_len - len); + }if (aligned_len == wbuf->avail) { dbg_io("flush jhead %s wbuf to LEB %d:%d",
@@ -820,13 +824,18 @@ int ubifs_wbuf_write_nolock(struct ubifs }spin_lock (&wbuf->lock); -if (aligned_len) +if (aligned_len) {/* * And now we have what's left and what does not take whole * max. write unit, so write it to the write-buffer and we are * done. */ memcpy (wbuf->buf, buf + written, len); +if (aligned_len > len) { +ubifs_assert (c, aligned_len - len <8 ); +ubifs_pad (c, wbuf->buf + len, aligned_len - len); + } + }if (c->leb_size - wbuf->offs >= c->max_write_size) wbuf->size = c->max_write_size;
Greg Kroah-Hartman
maintainerPATCH 305/346 powerpc/powernv/memtrace: Dont leak kernel memory to user space
In reply to Greg Kroah-HartmanFrom: David Hildenbrand <[email protected]>
commit c74cf7a3d59a21b290fe0468f5b470d0b8ee37df upstream.
We currently leak kernel memory to user space, because memory offlining doesn't do any implicit clearing of memory and we are missing explicit clearing of memory.
Let's keep it simple and clear pages before removing the linear mapping.
Reproduced in QEMU/TCG with 10 GiB of main memory:
[root@localhost ~]# dd obs=9G if=/dev/urandom of=/dev/null
[... wait until "free -m" used counter no longer changes and cancel] 19665802+0 records in
1+0 records out
9663676416 bytes (9.7 GB, 9.0 GiB) copied, 135.548 s, 71.3 MB/s [root@localhost ~]# cat /sys/devices/system/memory/block_size_bytes 40000000
[root@localhost ~]# echo 0x40000000 > /sys/kernel/debug/powerpc/memtrace/enable
[ 402.978663][ T1086] page:000000001bc4bc74 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x24900 [ 402.980063][ T1086] flags: 0x7ffff000001000(reserved) [ 402.980415][ T1086] raw: 007ffff000001000 c00c000000924008 c00c000000924008 0000000000000000 [ 402.980627][ T1086] raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000 [ 402.980845][ T1086] page dumped because: unmovable page [ 402.989608][ T1086] Offlined Pages 16384 [ 403.324155][ T1086] memtrace: Allocated trace memory on node 0 at 0x0000000200000000
Before this patch:
[root@localhost ~]# hexdump -C /sys/kernel/debug/powerpc/memtrace/00000000/trace | head
00000000 c8 25 72 51 4d 26 36 c5 5c c2 56 15 d5 1a cd 10 |.%rQM&6.\.V.....|
00000010 19 b9 50 b2 cb e3 60 b8 ec 0a f3 ec 4b 3c 39 f0 |..P...`.....K<9.|$
00000020 4e 5a 4c cf bd 26 19 ff 37 79 13 67 24 b7 b8 57 |NZL..&..7y.g$..W|$
00000030 98 3e f5 be 6f 14 6a bd a4 52 bc 6e e9 e0 c1 5d |.>..o.j..R.n...]|$
00000040 76 b3 ae b5 88 d7 da e3 64 23 85 2c 10 88 07 b6 |v.......d#.,....|$
00000050 9a d8 91 de f7 50 27 69 2e 64 9c 6f d3 19 45 79 |.....P'i.d.o..Ey|$
00000060 6a 6f 8a 61 71 19 1f c7 f1 df 28 26 ca 0f 84 55 |jo.aq.....(&...U|$
00000070 01 3f be e4 e2 e1 da ff 7b 8c 8e 32 37 b4 24 53 |.?......{..27.$S|$
00000080 1b 70 30 45 56 e6 8c c4 0e b5 4c fb 9f dd 88 06 |.p0EV.....L.....|$
00000090 ef c4 18 79 f1 60 b1 5c 79 59 4d f4 36 d7 4a 5c |...y.`.\yYM.6.J\|$After this patch:
[root@localhost ~]# hexdump -C /sys/kernel/debug/powerpc/memtrace/00000000/trace | head 00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| *
40000000
--- arch/powerpc/platforms/powernv/memtrace.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
arch/powerpc/platforms/powernv/memtrace.c +22 -0
@@ -70,6 +70,23 @@ static int change_memblock_state(structreturn 0 ; } +static void memtrace_clear_range (unsigned long start_pfn, +unsigned long nr_pages) +{ +unsigned long pfn; + +/* +* As pages are offline, we cannot trust the memmap anymore. As HIGHMEM +* does not apply, avoid passing around "struct page" and use +* clear_page() instead directly. +*/ +for (pfn = start_pfn; pfn < start_pfn + nr_pages; pfn++) { +if (IS_ALIGNED (pfn,PAGES_PER_SECTION )) +cond_resched (); +clear_page (__va (PFN_PHYS (pfn))); + } +} +/* called with device_hotplug_lock held */ static bool memtrace_offline_pages (u32 nid,u64 start_pfn,u64 nr_pages) {
@@ -115,6 +132,11 @@ static u64 memtrace_alloc_node(u32 nid,for (base_pfn = end_pfn; base_pfn > start_pfn; base_pfn -= nr_pages) {if (memtrace_offline_pages (nid, base_pfn, nr_pages) == true) {/* +* Clear the range while we still have a linear +* mapping. +*/ +memtrace_clear_range (base_pfn, nr_pages); +/* * Remove memory in memory block size chunks so that * iomem resources are always split to the same size and * we never try to remove memory that spans two iomem
Greg Kroah-Hartman
maintainerPATCH 307/346 ima: Dont modify file descriptor mode on the fly
In reply to Greg Kroah-HartmanFrom: Roberto Sassu <[email protected]>
commit 207cdd565dfc95a0a5185263a567817b7ebf5467 upstream.
Commit a408e4a86b36b ("ima: open a new file instance if no read permissions") already introduced a second open to measure a file when the original file descriptor does not allow it. However, it didn't remove the existing method of changing the mode of the original file descriptor, which is still necessary if the current process does not have enough privileges to open a new one.
Changing the mode isn't really an option, as the filesystem might need to do preliminary steps to make the read possible. Thus, this patch removes the code and keeps the second open as the only option to measure a file when it is unreadable with the original file descriptor.
--- security/integrity/ima/ima_crypto.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-)
security/integrity/ima/ima_crypto.c +5 -15
@@ -415,7 +415,7 @@ int ima_calc_file_hash(struct file *fileloff_t i_size;int rc;struct file *f = file; -bool new_file_instance = false, modified_mode = false; +bool new_file_instance = false;/* * For consistency, fail file's opened with the O_DIRECT flag on
@@ -433,18 +433,10 @@ int ima_calc_file_hash(struct file *file O_TRUNC | O_CREAT | O_NOCTTY | O_EXCL); flags |=O_RDONLY ; f =dentry_open (&file->f_path, flags, file->f_cred); -if (IS_ERR (f)) { -/* -* Cannot open the file again, lets modify f_mode -* of original and continue -*/ -pr_info_ratelimited ("Unable to reopen file for reading.\n" ); - f = file; - f->f_mode |=FMODE_READ ; - modified_mode = true; - }else { - new_file_instance = true; - } +if (IS_ERR (f)) +return PTR_ERR (f); + + new_file_instance = true; } i_size =i_size_read (file_inode (f));
@@ -459,8 +451,6 @@ int ima_calc_file_hash(struct file *file out:if (new_file_instance)fput (f); -else if (modified_mode) - f->f_mode &= ~FMODE_READ ;return rc; }
Greg Kroah-Hartman
maintainerPATCH 314/346 drm/dp_aux_dev: check aux_dev before use in drm_dp_aux_dev_get_by_minor()
In reply to Greg Kroah-HartmanFrom: Zwane Mwaikambo <[email protected]>
commit 73b62cdb93b68d7e2c1d373c6a411bc00c53e702 upstream.
I observed this when unplugging a DP monitor whilst a computer is asleep and then waking it up. This left DP chardev nodes still being present on the filesystem and accessing these device nodes caused an oops because drm_dp_aux_dev_get_by_minor() assumes a device exists if it is opened. This can also be reproduced by creating a device node with mknod(1) and issuing an open(2)
[166164.933198] BUG: kernel NULL pointer dereference, address: 0000000000000018 [166164.933202] #PF: supervisor read access in kernel mode [166164.933204] #PF: error_code(0x0000) - not-present page [166164.933205] PGD 0 P4D 0 [166164.933208] Oops: 0000 [#1] PREEMPT SMP NOPTI [166164.933211] CPU: 4 PID: 99071 Comm: fwupd Tainted: G W 5.8.0-rc6+ #1 [166164.933213] Hardware name: LENOVO 20RD002VUS/20RD002VUS, BIOS R16ET25W (1.11 ) 04/21/2020 [166164.933232] RIP: 0010:drm_dp_aux_dev_get_by_minor+0x29/0x70 [drm_kms_helper] [166164.933234] Code: 00 0f 1f 44 00 00 55 48 89 e5 41 54 41 89 fc 48 c7 c7 60 01 a4 c0 e8 26 ab 30 d7 44 89 e6 48 c7 c7 80 01 a4 c0 e8 47 94 d6 d6 <8b> 50 18 49 89 c4 48 8d 78 18 85 d2 74 33 8d 4a 01 89 d0 f0 0f b1 [166164.933236] RSP: 0018:ffffb7d7c41cbbf0 EFLAGS: 00010246 [166164.933237] RAX: 0000000000000000 RBX: ffff8a90001fe900 RCX: 0000000000000000 [166164.933238] RDX: 0000000000000000 RSI: 0000000000000003 RDI: ffffffffc0a40180 [166164.933239] RBP: ffffb7d7c41cbbf8 R08: 0000000000000000 R09: ffff8a93e157d6d0 [166164.933240] R10: 0000000000000000 R11: ffffffffc0a40188 R12: 0000000000000003 [166164.933241] R13: ffff8a9402200e80 R14: ffff8a90001fe900 R15: 0000000000000000 [166164.933244] FS: 00007f7fb041eb00(0000) GS:ffff8a9411500000(0000) knlGS:0000000000000000 [166164.933245] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [166164.933246] CR2: 0000000000000018 CR3: 00000000352c2003 CR4: 00000000003606e0 [166164.933247] Call Trace: [166164.933264] auxdev_open+0x1b/0x40 [drm_kms_helper] [166164.933278] chrdev_open+0xa7/0x1c0 [166164.933282] ? cdev_put.part.0+0x20/0x20 [166164.933287] do_dentry_open+0x161/0x3c0 [166164.933291] vfs_open+0x2d/0x30 [166164.933297] path_openat+0xb27/0x10e0 [166164.933306] ? atime_needs_update+0x73/0xd0 [166164.933309] do_filp_open+0x91/0x100 [166164.933313] ? __alloc_fd+0xb2/0x150 [166164.933316] do_sys_openat2+0x210/0x2d0 [166164.933318] do_sys_open+0x46/0x80 [166164.933320] __x64_sys_openat+0x20/0x30 [166164.933328] do_syscall_64+0x52/0xc0 [166164.933336] entry_SYSCALL_64_after_hwframe+0x44/0xa9
(gdb) disassemble drm_dp_aux_dev_get_by_minor+0x29 Dump of assembler code for function drm_dp_aux_dev_get_by_minor:
0x0000000000017b10 <+0>: callq 0x17b15 <drm_dp_aux_dev_get_by_minor+5> 0x0000000000017b15 <+5>: push %rbp 0x0000000000017b16 <+6>: mov %rsp,%rbp 0x0000000000017b19 <+9>: push %r12 0x0000000000017b1b <+11>: mov %edi,%r12d 0x0000000000017b1e <+14>: mov $0x0,%rdi 0x0000000000017b25 <+21>: callq 0x17b2a <drm_dp_aux_dev_get_by_minor+26> 0x0000000000017b2a <+26>: mov %r12d,%esi 0x0000000000017b2d <+29>: mov $0x0,%rdi 0x0000000000017b34 <+36>: callq 0x17b39 <drm_dp_aux_dev_get_by_minor+41> 0x0000000000017b39 <+41>: mov 0x18(%rax),%edx <========= 0x0000000000017b3c <+44>: mov %rax,%r12 0x0000000000017b3f <+47>: lea 0x18(%rax),%rdi 0x0000000000017b43 <+51>: test %edx,%edx 0x0000000000017b45 <+53>: je 0x17b7a <drm_dp_aux_dev_get_by_minor+106> 0x0000000000017b47 <+55>: lea 0x1(%rdx),%ecx 0x0000000000017b4a <+58>: mov %edx,%eax 0x0000000000017b4c <+60>: lock cmpxchg %ecx,(%rdi) 0x0000000000017b50 <+64>: jne 0x17b76 <drm_dp_aux_dev_get_by_minor+102> 0x0000000000017b52 <+66>: test %edx,%edx 0x0000000000017b54 <+68>: js 0x17b6d <drm_dp_aux_dev_get_by_minor+93> 0x0000000000017b56 <+70>: test %ecx,%ecx 0x0000000000017b58 <+72>: js 0x17b6d <drm_dp_aux_dev_get_by_minor+93> 0x0000000000017b5a <+74>: mov $0x0,%rdi 0x0000000000017b61 <+81>: callq 0x17b66 <drm_dp_aux_dev_get_by_minor+86> 0x0000000000017b66 <+86>: mov %r12,%rax 0x0000000000017b69 <+89>: pop %r12 0x0000000000017b6b <+91>: pop %rbp 0x0000000000017b6c <+92>: retq 0x0000000000017b6d <+93>: xor %esi,%esi 0x0000000000017b6f <+95>: callq 0x17b74 <drm_dp_aux_dev_get_by_minor+100> 0x0000000000017b74 <+100>: jmp 0x17b5a <drm_dp_aux_dev_get_by_minor+74> 0x0000000000017b76 <+102>: mov %eax,%edx 0x0000000000017b78 <+104>: jmp 0x17b43 <drm_dp_aux_dev_get_by_minor+51> 0x0000000000017b7a <+106>: xor %r12d,%r12d 0x0000000000017b7d <+109>: jmp 0x17b5a <drm_dp_aux_dev_get_by_minor+74>
End of assembler dump.
(gdb) list *drm_dp_aux_dev_get_by_minor+0x290x17b39 is in drm_dp_aux_dev_get_by_minor (drivers/gpu/drm/drm_dp_aux_dev.c:65).
60 static struct drm_dp_aux_dev *drm_dp_aux_dev_get_by_minor(unsigned index)
61 {
62 struct drm_dp_aux_dev *aux_dev = NULL;
63
64 mutex_lock(&aux_idr_mutex); 65 aux_dev = idr_find(&aux_idr, index); 66 if (!kref_get_unless_zero(&aux_dev->refcount))
67 aux_dev = NULL;
68 mutex_unlock(&aux_idr_mutex);
69
(gdb) p/x &((struct drm_dp_aux_dev *)(0x0))->refcount $8 = 0x18
Looking at the caller, checks on the minor are pushed down to drm_dp_aux_dev_get_by_minor()
static int auxdev_open(struct inode *inode, struct file *file)
{
unsigned int minor = iminor(inode);
struct drm_dp_aux_dev *aux_dev;
aux_dev = drm_dp_aux_dev_get_by_minor(minor); <====
if (!aux_dev)
return -ENODEV;
file->private_data = aux_dev;
return 0;
}--- drivers/gpu/drm/drm_dp_aux_dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_dp_aux_dev.c +1 -1
@@ -60,7 +60,7 @@ static struct drm_dp_aux_dev *drm_dp_auxmutex_lock (&aux_idr_mutex); aux_dev =idr_find (&aux_idr, index); -if (!kref_get_unless_zero (&aux_dev->refcount)) +if (aux_dev && !kref_get_unless_zero (&aux_dev->refcount)) aux_dev =NULL ;mutex_unlock (&aux_idr_mutex);
Greg Kroah-Hartman
maintainerPATCH 287/346 crypto: ecdh - avoid unaligned accesses in ecdh_set_secret()
In reply to Greg Kroah-HartmanFrom: Ard Biesheuvel <[email protected]>
commit 17858b140bf49961b71d4e73f1c3ea9bc8e7dda0 upstream.
ecdh_set_secret() casts a void* pointer to a const u64* in order to feed it into ecc_is_key_valid(). This is not generally permitted by the C standard, and leads to actual misalignment faults on ARMv6 cores. In some cases, these are fixed up in software, but this still leads to performance hits that are entirely avoidable.
So let's copy the key into the ctx buffer first, which we will do anyway in the common case, and which guarantees correct alignment.
--- crypto/ecdh.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
crypto/ecdh.c +5 -4
@@ -57,12 +57,13 @@ static int ecdh_set_secret(struct cryptoreturn ecc_gen_privkey (ctx->curve_id, ctx->ndigits, ctx->private_key); -if (ecc_is_key_valid (ctx->curve_id, ctx->ndigits, - (const u64 *)params.key, params.key_size) <0 ) -return -EINVAL ; -memcpy (ctx->private_key, params.key, params.key_size); +if (ecc_is_key_valid (ctx->curve_id, ctx->ndigits, + ctx->private_key, params.key_size) <0 ) { +memzero_explicit (ctx->private_key, params.key_size); +return -EINVAL ; + }return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 286/346 powerpc/perf: Exclude kernel samples while counting events in user space.
In reply to Greg Kroah-HartmanFrom: Athira Rajeev <[email protected]>
commit aa8e21c053d72b6639ea5a7f1d3a1d0209534c94 upstream.
Perf event attritube supports exclude_kernel flag to avoid sampling/profiling in supervisor state (kernel). Based on this event attr flag, Monitor Mode Control Register bit is set to freeze on supervisor state. But sometimes (due to hardware limitation), Sampled Instruction Address Register (SIAR) locks on to kernel address even when freeze on supervisor is set. Patch here adds a check to drop those samples.
--- arch/powerpc/perf/core-book3s.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/powerpc/perf/core-book3s.c +10 -0
@@ -2059,6 +2059,16 @@ static void record_and_restart(struct peperf_event_update_userpage (event);/* +* Due to hardware limitation, sometimes SIAR could sample a kernel +* address even when freeze on supervisor state (kernel) is set in +* MMCR2. Check attr.exclude_kernel and address to drop the sample in +* these cases. +*/ +if (event->attr.exclude_kernel && record) +if (is_kernel_addr (mfspr (SPRN_SIAR ))) + record =0 ; + +/* * Finally record data if requested. */ if (record) {
Greg Kroah-Hartman
maintainerPATCH 289/346 USB: serial: mos7720: fix parallel-port state restore
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 975323ab8f116667676c30ca3502a6757bd89e8d upstream.
The parallel-port restore operations is called when a driver claims the port and is supposed to restore the provided state (e.g. saved when releasing the port).
--- drivers/usb/serial/mos7720.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/serial/mos7720.c +2 -0
@@ -638,6 +638,8 @@ static void parport_mos7715_restore_statspin_unlock (&release_lock);return ; } + mos_parport->shadowDCR = s->u.pc.ctr; + mos_parport->shadowECR = s->u.pc.ecr;write_parport_reg_nonblock (mos_parport,MOS7720_DCR , mos_parport->shadowDCR); write_parport_reg_nonblock(mos_parport, MOS7720_ECR,
Greg Kroah-Hartman
maintainerPATCH 291/346 USB: serial: keyspan_pda: fix dropped unthrottle interrupts
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 696c541c8c6cfa05d65aa24ae2b9e720fc01766e upstream.
Commit c528fcb116e6 ("USB: serial: keyspan_pda: fix receive sanity checks") broke write-unthrottle handling by dropping well-formed unthrottle-interrupt packets which are precisely two bytes long. This could lead to blocked writers not being woken up when buffer space again becomes available.
Instead, stop unconditionally printing the third byte which is (presumably) only valid on modem-line changes.
--- drivers/usb/serial/keyspan_pda.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/serial/keyspan_pda.c +2 -2
@@ -172,11 +172,11 @@ static void keyspan_pda_rx_interrupt(strbreak ;case 1 :/* status interrupt */ -if (len <3 ) { +if (len <2 ) {dev_warn (&port->dev,"short interrupt message received\n" );break ; } -dev_dbg (&port->dev,"rx int, d1=%d, d2=%d\n" , data[1 ], data[2 ]); +dev_dbg (&port->dev,"rx int, d1=%d\n" , data[1 ]);switch (data[1 ]) {case 1 :/* modemline change */ break ;
Greg Kroah-Hartman
maintainerPATCH 313/346 jfs: Fix array index bounds check in dbAdjTree
In reply to Greg Kroah-HartmanFrom: Dave Kleikamp <[email protected]>
commit c61b3e4839007668360ed8b87d7da96d2e59fc6c upstream.
Bounds checking tools can flag a bug in dbAdjTree() for an array index out of bounds in dmt_stree. Since dmt_stree can refer to the stree in both structures dmaptree and dmapctl, use the larger array to eliminate the false positive.
--- fs/jfs/jfs_dmap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/jfs/jfs_dmap.h +1 -1
@@ -196,7 +196,7 @@ typedef union dmtree {#define dmt_leafidx t1.leafidx#define dmt_height t1.height#define dmt_budmin t1.budmin -#define dmt_stree t1.stree +#define dmt_stree t2.stree/* * on-disk aggregate disk allocation map descriptor.
Greg Kroah-Hartman
maintainerPATCH 326/346 scsi: lpfc: Fix invalid sleeping context in lpfc_sli4_nvmet_alloc()
In reply to Greg Kroah-HartmanFrom: James Smart <[email protected]>
commit 62e3a931db60daf94fdb3159d685a5bc6ad4d0cf upstream.
The following calltrace was seen:
BUG: sleeping function called from invalid context at mm/slab.h:494 ... Call Trace: dump_stack+0x9a/0xf0 ___might_sleep.cold.63+0x13d/0x178 slab_pre_alloc_hook+0x6a/0x90 kmem_cache_alloc_trace+0x3a/0x2d0 lpfc_sli4_nvmet_alloc+0x4c/0x280 [lpfc] lpfc_post_rq_buffer+0x2e7/0xa60 [lpfc] lpfc_sli4_hba_setup+0x6b4c/0xa4b0 [lpfc] lpfc_pci_probe_one_s4.isra.15+0x14f8/0x2280 [lpfc] lpfc_pci_probe_one+0x260/0x2880 [lpfc] local_pci_probe+0xd4/0x180 work_for_cpu_fn+0x51/0xa0 process_one_work+0x8f0/0x17b0 worker_thread+0x536/0xb50 kthread+0x30c/0x3d0 ret_from_fork+0x3a/0x50
A prior patch introduced a spin_lock_irqsave(hbalock) in the lpfc_post_rq_buffer() routine. Call trace is seen as the hbalock is held with interrupts disabled during a GFP_KERNEL allocation in lpfc_sli4_nvmet_alloc().
Fix by reordering locking so that hbalock not held when calling sli4_nvmet_alloc() (aka rqb_buf_list()).
--- drivers/scsi/lpfc/lpfc_mem.c | 4 +--- drivers/scsi/lpfc/lpfc_sli.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 5 deletions(-)
drivers/scsi/lpfc/lpfc_mem.c +1 -3
@@ -560,8 +560,6 @@ lpfc_els_hbq_free(struct lpfc_hba *phba,* Description: Allocates a DMA-mapped receive buffer from the lpfc_hrb_pool PCI * pool along a non-DMA-mapped container for it. * -* Notes: Not interrupt-safe. Must be called with no locks held. -* * Returns: * pointer to HBQ on success * NULL on failure
@@ -631,7 +629,7 @@ lpfc_sli4_nvmet_alloc(struct lpfc_hba *p {struct rqb_dmabuf *dma_buf; - dma_buf =kzalloc (sizeof (struct rqb_dmabuf ),GFP_KERNEL ); + dma_buf =kzalloc (sizeof (*dma_buf),GFP_KERNEL );if (!dma_buf)return NULL ;
drivers/scsi/lpfc/lpfc_sli.c +8 -2
@@ -6755,12 +6755,16 @@ lpfc_post_rq_buffer(struct lpfc_hba *phbstruct rqb_dmabuf *rqb_buffer;LIST_HEAD (rqb_buf_list); -spin_lock_irqsave (&phba->hbalock, flags); rqbp = hrq->rqbp;for (i =0 ; i < count; i++) { +spin_lock_irqsave (&phba->hbalock, flags);/* IF RQ is already full, don't bother */ -if (rqbp->buffer_count + i >= rqbp->entry_count -1 ) +if (rqbp->buffer_count + i >= rqbp->entry_count -1 ) { +spin_unlock_irqrestore (&phba->hbalock, flags);break ; + } +spin_unlock_irqrestore (&phba->hbalock, flags); + rqb_buffer = rqbp->rqb_alloc_buffer (phba);if (!rqb_buffer)break ;
@@ -6769,6 +6773,8 @@ lpfc_post_rq_buffer(struct lpfc_hba *phb rqb_buffer->idx = idx;list_add_tail (&rqb_buffer->hbuf.list, &rqb_buf_list); } + +spin_lock_irqsave (&phba->hbalock, flags);while (!list_empty (&rqb_buf_list)) { list_remove_head(&rqb_buf_list, rqb_buffer, struct rqb_dmabuf, hbuf.list);
Greg Kroah-Hartman
maintainerPATCH 327/346 scsi: lpfc: Re-fix use after free in lpfc_rq_buf_free()
In reply to Greg Kroah-HartmanFrom: James Smart <[email protected]>
commit e5785d3ec32f5f44dd88cd7b398e496742630469 upstream.
Commit 9816ef6ecbc1 ("scsi: lpfc: Use after free in lpfc_rq_buf_free()") was made to correct a use after free condition in lpfc_rq_buf_free(). Unfortunately, a subsequent patch cut on a tree without the fix inadvertently reverted the fix.
Put the fix back: Move the freeing of the rqb_entry to after the print function that references it.
--- drivers/scsi/lpfc/lpfc_mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_mem.c +1 -1
@@ -752,7 +752,6 @@ lpfc_rq_buf_free(struct lpfc_hba *phba, drqe.address_hi =putPaddrHigh (rqb_entry->dbuf.phys); rc =lpfc_sli4_rq_put (rqb_entry->hrq, rqb_entry->drq, &hrqe, &drqe);if (rc <0 ) { - (rqbp->rqb_free_buffer)(phba, rqb_entry); lpfc_printf_log(phba, KERN_ERR, LOG_INIT, "6409 Cannot post to HRQ %d: %x %x %x " "DRQ %x %x\n",
@@ -762,6 +761,7 @@ lpfc_rq_buf_free(struct lpfc_hba *phba, rqb_entry->hrq->entry_count, rqb_entry->drq->host_index, rqb_entry->drq->hba_index); + (rqbp->rqb_free_buffer)(phba, rqb_entry); }else {list_add_tail (&rqb_entry->hbuf.list, &rqbp->rqb_buffer_list); rqbp->buffer_count++;
Greg Kroah-Hartman
maintainerPATCH 328/346 iio: buffer: Fix demux update
In reply to Greg Kroah-HartmanFrom: Nuno Sá <[email protected]>
commit 19ef7b70ca9487773c29b449adf0c70f540a0aab upstream.
When updating the buffer demux, we will skip a scan element from the device in the case in_ind != out_ind and we enter the while loop. in_ind should only be refreshed with find_next_bit() in the end of the loop.
Note, to cause problems we need a situation where we are skippig over an element (channel not enabled) that happens to not have the same size
as the next element. Whilst this is a possible situation we haven't
actually identified any cases in mainline where it happens as most drivers have consistent channel storage sizes with the exception of the timestamp which is the last element and hence never skipped over.
--- drivers/iio/industrialio-buffer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iio/industrialio-buffer.c +3 -3
@@ -850,12 +850,12 @@ static int iio_buffer_update_demux(struc indio_dev->masklength, in_ind + 1);while (in_ind != out_ind) { - in_ind =find_next_bit (indio_dev->active_scan_mask, - indio_dev->masklength, - in_ind +1 ); length =iio_storage_bytes_for_si (indio_dev, in_ind);/* Make sure we are aligned */ in_loc =roundup (in_loc, length) + length; + in_ind =find_next_bit (indio_dev->active_scan_mask, + indio_dev->masklength, + in_ind +1 ); } length =iio_storage_bytes_for_si (indio_dev, in_ind); out_loc =roundup (out_loc, length);
Greg Kroah-Hartman
maintainerPATCH 330/346 iio:light:rpr0521: Fix timestamp alignment and prevent data leak.
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
commit a61817216bcc755eabbcb1cf281d84ccad267ed1 upstream.
One of a class of bugs pointed out by Lars in a recent review. iio_push_to_buffers_with_timestamp() assumes the buffer used is aligned to the size of the timestamp (8 bytes). This is not guaranteed in this driver which uses an array of smaller elements on the stack. As Lars also noted this anti pattern can involve a leak of data to userspace and that indeed can happen here. We close both issues by moving to a suitable structure in the iio_priv().
This data is allocated with kzalloc() so no data can leak apart from previous readings and in this case the status byte from the device.
The forced alignment of ts is not necessary in this case but it potentially makes the code less fragile.
Quoted 1 line
From personal communications with Mikko:
We could probably split the reading of the int register, but it would mean a significant performance cost of 20 i2c clock cycles.
--- drivers/iio/light/rpr0521.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
drivers/iio/light/rpr0521.c +13 -4
@@ -197,6 +197,17 @@ struct rpr0521_data {bool pxs_need_dis;struct regmap *regmap; + +/* +* Ensure correct naturally aligned timestamp. +* Note that the read will put garbage data into +* the padding but this should not be a problem +*/ +struct { +__le16 channels[3 ]; +u8 garbage; +s64 ts__aligned(8) ; + } scan; }; static IIO_CONST_ATTR(in_intensity_scale_available, RPR0521_ALS_SCALE_AVAIL);
@@ -452,8 +463,6 @@ static irqreturn_t rpr0521_trigger_consustruct rpr0521_data *data =iio_priv (indio_dev);int err; -u8 buffer[16 ];/* 3 16-bit channels + padding + ts */ -/* Use irq timestamp when reasonable. */ if (iio_trigger_using_own (indio_dev) && data->irq_timestamp) { pf->timestamp = data->irq_timestamp;
@@ -464,11 +473,11 @@ static irqreturn_t rpr0521_trigger_consu pf->timestamp =iio_get_time_ns (indio_dev); err =regmap_bulk_read (data->regmap,RPR0521_REG_PXS_DATA , - &buffer, + data->scan.channels, (3 *2 ) +1 );/* 3 * 16-bit + (discarded) int clear reg. */ if (!err)iio_push_to_buffers_with_timestamp (indio_dev, - buffer, pf->timestamp); + &data->scan, pf->timestamp);else dev_err (&data->client->dev,"Trigger consumer can't read from sensor.\n" );
Greg Kroah-Hartman
maintainerPATCH 334/346 md/cluster: block reshape with remote resync job
In reply to Greg Kroah-HartmanFrom: Zhao Heming <[email protected]>
commit a8da01f79c89755fad55ed0ea96e8d2103242a72 upstream.
Reshape request should be blocked with ongoing resync job. In cluster env, a node can start resync job even if the resync cmd isn't executed on it, e.g., user executes "mdadm --grow" on node A, sometimes node B will start resync job. However, current update_raid_disks() only check local recovery status, which is incomplete. As a result, we see user will execute "mdadm --grow" successfully on local, while the remote node deny to do reshape job when it doing resync job. The inconsistent handling cause array enter unexpected status. If user doesn't observe this issue and continue executing mdadm cmd, the array doesn't work at last.
Fix this issue by blocking reshape request. When node executes "--grow" and detects ongoing resync, it should stop and report error to user.
The following script reproduces the issue with ~100% probability. (two nodes share 3 iSCSI luns: sdg/sdh/sdi. Each lun size is 1GB)
```
# on node1, node2 is the remote node.
ssh root@node2 "mdadm -S --scan"
mdadm -S --scan
for i in {g,h,i};do dd if=/dev/zero of=/dev/sd$i oflag=direct bs=1M \
count=20; done
mdadm -C /dev/md0 -b clustered -e 1.2 -n 2 -l mirror /dev/sdg /dev/sdh
ssh root@node2 "mdadm -A /dev/md0 /dev/sdg /dev/sdh"
sleep 5
mdadm --manage --add /dev/md0 /dev/sdi
mdadm --wait /dev/md0
mdadm --grow --raid-devices=3 /dev/md0
mdadm /dev/md0 --fail /dev/sdg
mdadm /dev/md0 --remove /dev/sdg
mdadm --grow --raid-devices=2 /dev/md0
```--- drivers/md/md.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/md/md.c +6 -2
@@ -6895,6 +6895,7 @@ static int update_raid_disks(struct mddereturn -EINVAL ;if (mddev->sync_thread ||test_bit (MD_RECOVERY_RUNNING , &mddev->recovery) || +test_bit (MD_RESYNCING_REMOTE , &mddev->recovery) || mddev->reshape_position != MaxSector)return -EBUSY ;
@@ -9241,8 +9242,11 @@ static void check_sb_changes(struct mdde } } -if (mddev->raid_disks !=le32_to_cpu (sb->raid_disks)) -update_raid_disks (mddev,le32_to_cpu (sb->raid_disks)); +if (mddev->raid_disks !=le32_to_cpu (sb->raid_disks)) { + ret =update_raid_disks (mddev,le32_to_cpu (sb->raid_disks)); +if (ret) +pr_warn ("md: updating array disks failed. %d\n" , ret); + }/* Finally set the event to be up to date */ mddev->events =le64_to_cpu (sb->events);
Greg Kroah-Hartman
maintainerPATCH 335/346 md/cluster: fix deadlock when node is doing resync job
In reply to Greg Kroah-HartmanFrom: Zhao Heming <[email protected]>
commit bca5b0658020be90b6b504ca514fd80110204f71 upstream.
md-cluster uses MD_CLUSTER_SEND_LOCK to make node can exclusively send msg. During sending msg, node can concurrently receive msg from another node. When node does resync job, grab token_lockres:EX may trigger a deadlock:
```
nodeA nodeB
-------------------- --------------------
a.
send METADATA_UPDATED
held token_lockres:EX
b.
md_do_sync
resync_info_update
send RESYNCING
+ set MD_CLUSTER_SEND_LOCK
+ wait for holding token_lockres:EX
c.
mdadm /dev/md0 --remove /dev/sdg
+ held reconfig_mutex
+ send REMOVE
+ wait_event(MD_CLUSTER_SEND_LOCK)
d.
recv_daemon //METADATA_UPDATED from A
process_metadata_update
+ (mddev_trylock(mddev) ||
MD_CLUSTER_HOLDING_MUTEX_FOR_RECVD)
//this time, both return false forever
```Explaination:
a. A send METADATA_UPDATED
This will block another node to send msg
b. B does sync jobs, which will send RESYNCING at intervals.
This will be block for holding token_lockres:EX lock.
c. B do "mdadm --remove", which will send REMOVE.
This will be blocked by step <b>: MD_CLUSTER_SEND_LOCK is 1.
d. B recv METADATA_UPDATED msg, which send from A in step <a>.
This will be blocked by step <c>: holding mddev lock, it makes wait_event can't hold mddev lock. (btw, MD_CLUSTER_HOLDING_MUTEX_FOR_RECVD keep ZERO in this scenario.)
There is a similar deadlock in commit 0ba959774e93 ("md-cluster: use sync way to handle METADATA_UPDATED msg") In that commit, step c is "update sb". This patch step c is "mdadm --remove".
For fixing this issue, we can refer the solution of function:metadata_update_start. Which does the same grab lock_token action. lock_comm can use the same steps to avoid deadlock. By moving MD_CLUSTER_HOLDING_MUTEX_FOR_RECVD from lock_token to lock_comm. It enlarge a little bit window of MD_CLUSTER_HOLDING_MUTEX_FOR_RECVD, but it is safe & can break deadlock.
Repro steps (I only triggered 3 times with hundreds tests):
two nodes share 3 iSCSI luns: sdg/sdh/sdi. Each lun size is 1GB.
```
ssh root@node2 "mdadm -S --scan"
mdadm -S --scan
for i in {g,h,i};do dd if=/dev/zero of=/dev/sd$i oflag=direct bs=1M \
count=20; done
mdadm -C /dev/md0 -b clustered -e 1.2 -n 2 -l mirror /dev/sdg /dev/sdh \
--bitmap-chunk=1M
ssh root@node2 "mdadm -A /dev/md0 /dev/sdg /dev/sdh"
sleep 5
mkfs.xfs /dev/md0
mdadm --manage --add /dev/md0 /dev/sdi
mdadm --wait /dev/md0
mdadm --grow --raid-devices=3 /dev/md0
mdadm /dev/md0 --fail /dev/sdg
mdadm /dev/md0 --remove /dev/sdg
mdadm --grow --raid-devices=2 /dev/md0
```test script will hung when executing "mdadm --remove".
``` # dump stacks by "echo t > /proc/sysrq-trigger" md0_cluster_rec D 0 5329 2 0x80004000 Call Trace: __schedule+0x1f6/0x560 ? _cond_resched+0x2d/0x40 ? schedule+0x4a/0xb0 ? process_metadata_update.isra.0+0xdb/0x140 [md_cluster] ? wait_woken+0x80/0x80 ? process_recvd_msg+0x113/0x1d0 [md_cluster] ? recv_daemon+0x9e/0x120 [md_cluster] ? md_thread+0x94/0x160 [md_mod] ? wait_woken+0x80/0x80 ? md_congested+0x30/0x30 [md_mod] ? kthread+0x115/0x140 ? __kthread_bind_mask+0x60/0x60 ? ret_from_fork+0x1f/0x40 mdadm D 0 5423 1 0x00004004 Call Trace: __schedule+0x1f6/0x560 ? __schedule+0x1fe/0x560 ? schedule+0x4a/0xb0 ? lock_comm.isra.0+0x7b/0xb0 [md_cluster] ? wait_woken+0x80/0x80 ? remove_disk+0x4f/0x90 [md_cluster] ? hot_remove_disk+0xb1/0x1b0 [md_mod] ? md_ioctl+0x50c/0xba0 [md_mod] ? wait_woken+0x80/0x80 ? blkdev_ioctl+0xa2/0x2a0 ? block_ioctl+0x39/0x40 ? ksys_ioctl+0x82/0xc0 ? __x64_sys_ioctl+0x16/0x20 ? do_syscall_64+0x5f/0x150 ? entry_SYSCALL_64_after_hwframe+0x44/0xa9 md0_resync D 0 5425 2 0x80004000 Call Trace: __schedule+0x1f6/0x560 ? schedule+0x4a/0xb0 ? dlm_lock_sync+0xa1/0xd0 [md_cluster] ? wait_woken+0x80/0x80 ? lock_token+0x2d/0x90 [md_cluster] ? resync_info_update+0x95/0x100 [md_cluster] ? raid1_sync_request+0x7d3/0xa40 [raid1] ? md_do_sync.cold+0x737/0xc8f [md_mod] ? md_thread+0x94/0x160 [md_mod] ? md_congested+0x30/0x30 [md_mod] ? kthread+0x115/0x140 ? __kthread_bind_mask+0x60/0x60 ? ret_from_fork+0x1f/0x40 ```
At last, thanks for Xiao's solution.
--- drivers/md/md-cluster.c | 67 +++++++++++++++++++++++++++--------------------- drivers/md/md.c | 6 ++-- 2 files changed, 42 insertions(+), 31 deletions(-)
drivers/md/md-cluster.c +38 -29
@@ -669,9 +669,27 @@ out:* Takes the lock on the TOKEN lock resource so no other * node can communicate while the operation is underway. */ -static int lock_token (struct md_cluster_info *cinfo,bool mddev_locked) +static int lock_token (struct md_cluster_info *cinfo) { -int error, set_bit =0 ; +int error; + + error =dlm_lock_sync (cinfo->token_lockres,DLM_LOCK_EX ); +if (error) { +pr_err ("md-cluster(%s:%d): failed to get EX on TOKEN (%d)\n" , + __func__, __LINE__, error); + }else { +/* Lock the receive sequence */ +mutex_lock (&cinfo->recv_mutex); + } +return error; +} + +/* lock_comm() +* Sets the MD_CLUSTER_SEND_LOCK bit to lock the send channel. +*/ +static int lock_comm (struct md_cluster_info *cinfo,bool mddev_locked) +{ +int rv, set_bit =0 ;struct mddev *mddev = cinfo->mddev;/*
@@ -682,34 +700,19 @@ static int lock_token(struct md_cluster_*/ if (mddev_locked && !test_bit (MD_CLUSTER_HOLDING_MUTEX_FOR_RECVD , &cinfo->state)) { - error =test_and_set_bit_lock (MD_CLUSTER_HOLDING_MUTEX_FOR_RECVD , + rv =test_and_set_bit_lock (MD_CLUSTER_HOLDING_MUTEX_FOR_RECVD , &cinfo->state); -WARN_ON_ONCE (error); +WARN_ON_ONCE (rv);md_wakeup_thread (mddev->thread); set_bit =1 ; } - error =dlm_lock_sync (cinfo->token_lockres,DLM_LOCK_EX ); -if (set_bit) -clear_bit_unlock (MD_CLUSTER_HOLDING_MUTEX_FOR_RECVD , &cinfo->state); -if (error) -pr_err ("md-cluster(%s:%d): failed to get EX on TOKEN (%d)\n" , - __func__, __LINE__, error); - -/* Lock the receive sequence */ -mutex_lock (&cinfo->recv_mutex); -return error; -} - -/* lock_comm() -* Sets the MD_CLUSTER_SEND_LOCK bit to lock the send channel. -*/ -static int lock_comm (struct md_cluster_info *cinfo,bool mddev_locked) -{wait_event (cinfo->wait, !test_and_set_bit (MD_CLUSTER_SEND_LOCK , &cinfo->state)); - -return lock_token (cinfo, mddev_locked); + rv =lock_token (cinfo); +if (set_bit) +clear_bit_unlock (MD_CLUSTER_HOLDING_MUTEX_FOR_RECVD , &cinfo->state); +return rv; }static void unlock_comm (struct md_cluster_info *cinfo)
@@ -789,9 +792,11 @@ static int sendmsg(struct md_cluster_inf {int ret; -lock_comm (cinfo, mddev_locked); - ret =__sendmsg (cinfo, cmsg); -unlock_comm (cinfo); + ret =lock_comm (cinfo, mddev_locked); +if (!ret) { + ret =__sendmsg (cinfo, cmsg); +unlock_comm (cinfo); + }return ret; }
@@ -1063,7 +1068,7 @@ static int metadata_update_start(structreturn 0 ; } - ret =lock_token (cinfo,1 ); + ret =lock_token (cinfo);clear_bit_unlock (MD_CLUSTER_HOLDING_MUTEX_FOR_RECVD , &cinfo->state);return ret; }
@@ -1181,7 +1186,10 @@ static void update_size(struct mddev *mdint raid_slot =-1 ;md_update_sb (mddev,1 ); -lock_comm (cinfo,1 ); +if (lock_comm (cinfo,1 )) { +pr_err ("%s: lock_comm failed\n" , __func__); +return ; + }memset (&cmsg,0 ,sizeof (cmsg)); cmsg.type =cpu_to_le32 (METADATA_UPDATED );
@@ -1330,7 +1338,8 @@ static int add_new_disk(struct mddev *md cmsg.type =cpu_to_le32 (NEWDISK );memcpy (cmsg.uuid, uuid,16 ); cmsg.raid_slot =cpu_to_le32 (rdev->desc_nr); -lock_comm (cinfo,1 ); +if (lock_comm (cinfo,1 )) +return -EAGAIN ; ret =__sendmsg (cinfo, &cmsg);if (ret) {unlock_comm (cinfo);
drivers/md/md.c +4 -2
@@ -6564,8 +6564,10 @@ static int hot_remove_disk(struct mddev goto busy; kick_rdev: -if (mddev_is_clustered (mddev)) - md_cluster_ops->remove_disk (mddev, rdev); +if (mddev_is_clustered (mddev)) { +if (md_cluster_ops->remove_disk (mddev, rdev)) + goto busy; + }md_kick_rdev_from_array (rdev);set_bit (MD_SB_CHANGE_DEVS , &mddev->sb_flags);
Greg Kroah-Hartman
maintainerPATCH 342/346 xen/xenbus: Count pending messages for each watch
In reply to Greg Kroah-HartmanFrom: SeongJae Park <[email protected]>
commit 3dc86ca6b4c8cfcba9da7996189d1b5a358a94fc upstream.
This commit adds a counter of pending messages for each watch in the struct. It is used to skip unnecessary pending messages lookup in 'unregister_xenbus_watch()'. It could also be used in 'will_handle' callback.
This is part of XSA-349
--- drivers/xen/xenbus/xenbus_xs.c | 29 ++++++++++++++++++----------- include/xen/xenbus.h | 2 ++ 2 files changed, 20 insertions(+), 11 deletions(-)
drivers/xen/xenbus/xenbus_xs.c +18 -11
@@ -711,6 +711,7 @@ int xs_watch_msg(struct xs_watch_event * event->path, event->token))) {spin_lock (&watch_events_lock);list_add_tail (&event->list, &watch_events); + event->handle->nr_pending++;wake_up (&watch_events_waitq);spin_unlock (&watch_events_lock); } else
@@ -768,6 +769,8 @@ int register_xenbus_watch(struct xenbus_sprintf (token,"%lX" , (long )watch); + watch->nr_pending =0 ; +down_read (&xs_watch_rwsem);spin_lock (&watches_lock);
@@ -817,11 +820,14 @@ void unregister_xenbus_watch(struct xenb/* Cancel pending watch events. */ spin_lock (&watch_events_lock); -list_for_each_entry_safe (event, tmp, &watch_events, list) { -if (event->handle != watch) -continue ; -list_del (&event->list); -kfree (event); +if (watch->nr_pending) { +list_for_each_entry_safe (event, tmp, &watch_events, list) { +if (event->handle != watch) +continue ; +list_del (&event->list); +kfree (event); + } + watch->nr_pending =0 ; }spin_unlock (&watch_events_lock);
@@ -868,7 +874,6 @@ void xs_suspend_cancel(void)static int xenwatch_thread (void *unused) { -struct list_head *ent;struct xs_watch_event *event; xenwatch_pid = current->pid;
@@ -883,13 +888,15 @@ static int xenwatch_thread(void *unused)mutex_lock (&xenwatch_mutex);spin_lock (&watch_events_lock); - ent = watch_events.next; -if (ent != &watch_events) -list_del (ent); + event =list_first_entry_or_null (&watch_events, + struct xs_watch_event, list); +if (event) { +list_del (&event->list); + event->handle->nr_pending--; + }spin_unlock (&watch_events_lock); -if (ent != &watch_events) { - event = list_entry(ent, struct xs_watch_event, list); +if (event) { event->handle->callback (event->handle, event->path, event->token);kfree (event);
include/xen/xenbus.h +2 -0
@@ -59,6 +59,8 @@ struct xenbus_watch/* Path being watched. */ const char *node; +unsigned int nr_pending; +/* * Called just before enqueing new event while a spinlock is held. * The event will be discarded if this callback returns false.
Greg Kroah-Hartman
maintainerPATCH 337/346 clk: mvebu: a3700: fix the XTAL MODE pin to MPP1_9
In reply to Greg Kroah-HartmanFrom: Terry Zhou <[email protected]>
commit 6f37689cf6b38fff96de52e7f0d3e78f22803ba0 upstream.
There is an error in the current code that the XTAL MODE pin was set to NB MPP1_31 which should be NB MPP1_9. The latch register of NB MPP1_9 has different offset of 0x8.
--- drivers/clk/mvebu/armada-37xx-xtal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/mvebu/armada-37xx-xtal.c +2 -2
@@ -15,8 +15,8 @@#include <linux/platform_device.h> #include <linux/regmap.h> -#define NB_GPIO1_LATCH 0xC -#define XTAL_MODE BIT(31) +#define NB_GPIO1_LATCH 0x8 +#define XTAL_MODE BIT(9)static int armada_3700_xtal_clock_probe (struct platform_device *pdev) {
Greg Kroah-Hartman
maintainerPATCH 338/346 xen-blkback: set ring->xenblkd to NULL after kthread_stop()
In reply to Greg Kroah-HartmanFrom: Pawel Wieczorkiewicz <[email protected]>
commit 1c728719a4da6e654afb9cc047164755072ed7c9 upstream.
When xen_blkif_disconnect() is called, the kernel thread behind the block interface is stopped by calling kthread_stop(ring->xenblkd). The ring->xenblkd thread pointer being non-NULL determines if the thread has been already stopped.
Normally, the thread's function xen_blkif_schedule() sets the ring->xenblkd to NULL, when the thread's main loop ends.
However, when the thread has not been started yet (i.e. wake_up_process() has not been called on it), the xen_blkif_schedule() function would not be called yet.
In such case the kthread_stop() call returns -EINTR and the ring->xenblkd remains dangling.
When this happens, any consecutive call to xen_blkif_disconnect (for example in frontend_changed() callback) leads to a kernel crash in kthread_stop() (e.g. NULL pointer dereference in exit_creds()).
This is XSA-350.
--- drivers/block/xen-blkback/xenbus.c | 1 + 1 file changed, 1 insertion(+)
drivers/block/xen-blkback/xenbus.c +1 -0
@@ -264,6 +264,7 @@ static int xen_blkif_disconnect(struct xif (ring->xenblkd) {kthread_stop (ring->xenblkd); + ring->xenblkd =NULL ;wake_up (&ring->shutdown_wq); }
Greg Kroah-Hartman
maintainerPATCH 339/346 xen/xenbus: Allow watches discard events before queueing
In reply to Greg Kroah-HartmanFrom: SeongJae Park <[email protected]>
commit fed1755b118147721f2c87b37b9d66e62c39b668 upstream.
If handling logics of watch events are slower than the events enqueue logic and the events can be created from the guests, the guests could trigger memory pressure by intensively inducing the events, because it will create a huge number of pending events that exhausting the memory.
Fortunately, some watch events could be ignored, depending on its handler callback. For example, if the callback has interest in only one single path, the watch wouldn't want multiple pending events. Or, some watches could ignore events to same path.
To let such watches to volutarily help avoiding the memory pressure situation, this commit introduces new watch callback, 'will_handle'. If it is not NULL, it will be called for each new event just before enqueuing it. Then, if the callback returns false, the event will be discarded. No watch is using the callback for now, though.
This is part of XSA-349
--- drivers/net/xen-netback/xenbus.c | 4 ++++ drivers/xen/xenbus/xenbus_client.c | 1 + drivers/xen/xenbus/xenbus_xs.c | 5 ++++- include/xen/xenbus.h | 7 +++++++ 4 files changed, 16 insertions(+), 1 deletion(-)
drivers/net/xen-netback/xenbus.c +4 -0
@@ -777,12 +777,14 @@ static int xen_register_credit_watch(strreturn -ENOMEM ;snprintf (node, maxlen,"%s/rate" , dev->nodename); vif->credit_watch.node = node; + vif->credit_watch.will_handle =NULL ; vif->credit_watch.callback = xen_net_rate_changed; err =register_xenbus_watch (&vif->credit_watch);if (err) {pr_err ("Failed to set watcher %s\n" , vif->credit_watch.node);kfree (node); vif->credit_watch.node =NULL ; + vif->credit_watch.will_handle =NULL ; vif->credit_watch.callback =NULL ; }return err;
@@ -829,6 +831,7 @@ static int xen_register_mcast_ctrl_watchsnprintf (node, maxlen,"%s/request-multicast-control" , dev->otherend); vif->mcast_ctrl_watch.node = node; + vif->mcast_ctrl_watch.will_handle =NULL ; vif->mcast_ctrl_watch.callback = xen_mcast_ctrl_changed; err =register_xenbus_watch (&vif->mcast_ctrl_watch);if (err) {
@@ -836,6 +839,7 @@ static int xen_register_mcast_ctrl_watch vif->mcast_ctrl_watch.node);kfree (node); vif->mcast_ctrl_watch.node =NULL ; + vif->mcast_ctrl_watch.will_handle =NULL ; vif->mcast_ctrl_watch.callback =NULL ; }return err;
drivers/xen/xenbus/xenbus_client.c +1 -0
@@ -120,6 +120,7 @@ int xenbus_watch_path(struct xenbus_deviint err; watch->node = path; + watch->will_handle =NULL ; watch->callback = callback; err =register_xenbus_watch (watch);
drivers/xen/xenbus/xenbus_xs.c +4 -1
@@ -705,7 +705,10 @@ int xs_watch_msg(struct xs_watch_event *spin_lock (&watches_lock); event->handle =find_watch (event->token); -if (event->handle !=NULL ) { +if (event->handle !=NULL && + (!event->handle->will_handle || + event->handle->will_handle (event->handle, + event->path, event->token))) {spin_lock (&watch_events_lock);list_add_tail (&event->list, &watch_events);wake_up (&watch_events_waitq);
include/xen/xenbus.h +7 -0
@@ -59,6 +59,13 @@ struct xenbus_watch/* Path being watched. */ const char *node; +/* +* Called just before enqueing new event while a spinlock is held. +* The event will be discarded if this callback returns false. +*/ +bool (*will_handle)(struct xenbus_watch *, +const char *path,const char *token); +/* Callback (executed in a process context with no locks held). */ void (*callback)(struct xenbus_watch *,const char *path,const char *token);
Greg Kroah-Hartman
maintainerPATCH 340/346 xen/xenbus: Add will_handle callback support in xenbus_watch_path()
In reply to Greg Kroah-HartmanFrom: SeongJae Park <[email protected]>
commit 2e85d32b1c865bec703ce0c962221a5e955c52c2 upstream.
Some code does not directly make 'xenbus_watch' object and call 'register_xenbus_watch()' but use 'xenbus_watch_path()' instead. This commit adds support of 'will_handle' callback in the 'xenbus_watch_path()' and it's wrapper, 'xenbus_watch_pathfmt()'.
This is part of XSA-349
--- drivers/block/xen-blkback/xenbus.c | 3 ++- drivers/net/xen-netback/xenbus.c | 2 +- drivers/xen/xen-pciback/xenbus.c | 2 +- drivers/xen/xenbus/xenbus_client.c | 9 +++++++-- drivers/xen/xenbus/xenbus_probe.c | 2 +- include/xen/xenbus.h | 6 +++++- 6 files changed, 17 insertions(+), 7 deletions(-)
drivers/block/xen-blkback/xenbus.c +2 -1
@@ -652,7 +652,8 @@ static int xen_blkbk_probe(struct xenbus/* setup back pointer */ be->blkif->be = be; - err =xenbus_watch_pathfmt (dev, &be->backend_watch, backend_changed, + err =xenbus_watch_pathfmt (dev, &be->backend_watch,NULL , + backend_changed,"%s/%s" , dev->nodename,"physical-device" );if (err) goto fail;
drivers/net/xen-netback/xenbus.c +1 -1
@@ -1043,7 +1043,7 @@ static void connect(struct backend_infoxenvif_carrier_on (be->vif);unregister_hotplug_status_watch (be); - err =xenbus_watch_pathfmt (dev, &be->hotplug_status_watch, + err =xenbus_watch_pathfmt (dev, &be->hotplug_status_watch,NULL , hotplug_status_changed,"%s/%s" , dev->nodename,"hotplug-status" );if (!err)
drivers/xen/xen-pciback/xenbus.c +1 -1
@@ -688,7 +688,7 @@ static int xen_pcibk_xenbus_probe(struct/* watch the backend node for backend configuration information */ err =xenbus_watch_path (dev, dev->nodename, &pdev->be_watch, - xen_pcibk_be_watch); +NULL , xen_pcibk_be_watch);if (err) goto out;
drivers/xen/xenbus/xenbus_client.c +7 -2
@@ -114,19 +114,22 @@ EXPORT_SYMBOL_GPL(xenbus_strstate);*/ int xenbus_watch_path (struct xenbus_device *dev,const char *path,struct xenbus_watch *watch, +bool (*will_handle)(struct xenbus_watch *, +const char *,const char *),void (*callback)(struct xenbus_watch *,const char *,const char *)) {int err; watch->node = path; - watch->will_handle =NULL ; + watch->will_handle = will_handle; watch->callback = callback; err =register_xenbus_watch (watch);if (err) { watch->node =NULL ; + watch->will_handle =NULL ; watch->callback =NULL ;xenbus_dev_fatal (dev, err,"adding watch on %s" , path); }
@@ -153,6 +156,8 @@ EXPORT_SYMBOL_GPL(xenbus_watch_path);*/ int xenbus_watch_pathfmt (struct xenbus_device *dev,struct xenbus_watch *watch, +bool (*will_handle)(struct xenbus_watch *, +const char *,const char *),void (*callback)(struct xenbus_watch *,const char *,const char *),const char *pathfmt, ...)
@@ -169,7 +174,7 @@ int xenbus_watch_pathfmt(struct xenbus_dxenbus_dev_fatal (dev, -ENOMEM ,"allocating path for watch" );return -ENOMEM ; } - err =xenbus_watch_path (dev, path, watch, callback); + err =xenbus_watch_path (dev, path, watch, will_handle, callback);if (err)kfree (path);
drivers/xen/xenbus/xenbus_probe.c +1 -1
@@ -136,7 +136,7 @@ static int watch_otherend(struct xenbus_ container_of(dev->dev.bus, struct xen_bus_type, bus);return xenbus_watch_pathfmt (dev, &dev->otherend_watch, - bus->otherend_changed, +NULL , bus->otherend_changed,"%s/%s" , dev->otherend,"state" ); }
include/xen/xenbus.h +5 -1
@@ -199,10 +199,14 @@ void xenbus_probe(struct work_struct *);int xenbus_watch_path (struct xenbus_device *dev,const char *path,struct xenbus_watch *watch, +bool (*will_handle)(struct xenbus_watch *, +const char *,const char *),void (*callback)(struct xenbus_watch *,const char *,const char *)); -__printf(4, 5) +__printf(5, 6)int xenbus_watch_pathfmt (struct xenbus_device *dev,struct xenbus_watch *watch, +bool (*will_handle)(struct xenbus_watch *, +const char *,const char *),void (*callback)(struct xenbus_watch *,const char *,const char *),const char *pathfmt, ...);
Greg Kroah-Hartman
maintainerPATCH 346/346 PCI: Fix pci_slot_release() NULL pointer dereference
In reply to Greg Kroah-HartmanFrom: Jubin Zhong <[email protected]>
commit 4684709bf81a2d98152ed6b610e3d5c403f9bced upstream.
If kobject_init_and_add() fails, pci_slot_release() is called to delete slot->list from parent->slots. But slot->list hasn't been initialized yet, so we dereference a NULL pointer:
Unable to handle kernel NULL pointer dereference at virtual address 00000000 ... CPU: 10 PID: 1 Comm: swapper/0 Not tainted 4.4.240 #197 task: ffffeb398a45ef10 task.stack: ffffeb398a470000 PC is at __list_del_entry_valid+0x5c/0xb0 LR is at pci_slot_release+0x84/0xe4 ... __list_del_entry_valid+0x5c/0xb0 pci_slot_release+0x84/0xe4 kobject_put+0x184/0x1c4 pci_create_slot+0x17c/0x1b4 __pci_hp_initialize+0x68/0xa4 pciehp_probe+0x1a4/0x2fc pcie_port_probe_service+0x58/0x84 driver_probe_device+0x320/0x470
Initialize slot->list before calling kobject_init_and_add() to avoid this.
--- drivers/pci/slot.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/pci/slot.c +3 -3
@@ -307,6 +307,9 @@ placeholder: goto err; } +INIT_LIST_HEAD (&slot->list); +list_add (&slot->list, &parent->slots); + err =kobject_init_and_add (&slot->kobj, &pci_slot_ktype,NULL ,"%s" , slot_name);if (err) {
@@ -314,9 +317,6 @@ placeholder: goto err; } -INIT_LIST_HEAD (&slot->list); -list_add (&slot->list, &parent->slots); -down_read (&pci_bus_sem);list_for_each_entry (dev, &parent->devices, bus_list)if (PCI_SLOT (dev->devfn) == slot_nr)
Greg Kroah-Hartman
maintainerPATCH 283/346 s390/dasd: fix list corruption of pavgroup group list
In reply to Greg Kroah-HartmanFrom: Stefan Haberland <[email protected]>
commit 0ede91f83aa335da1c3ec68eb0f9e228f269f6d8 upstream.
dasd_alias_add_device() moves devices to the active_devices list in case of a scheduled LCU update regardless if they have previously been in a pavgroup or not.
Example: device A and B are in the same pavgroup.
Device A has already been in a pavgroup and the private->pavgroup pointer is set and points to a valid pavgroup. While going through dasd_add_device it is moved from the pavgroup to the active_devices list.
In parallel device B might be removed from the same pavgroup in remove_device_from_lcu() which in turn checks if the group is empty and deletes it accordingly because device A has already been removed from there.
When now device A enters remove_device_from_lcu() it is tried to remove it from the pavgroup again because the pavgroup pointer is still set and again the empty group will be cleaned up which leads to a list corruption.
Fix by setting private->pavgroup to NULL in dasd_add_device.
If the device has been the last device on the pavgroup an empty pavgroup remains but this will be cleaned up by the scheduled lcu_update which iterates over all existing pavgroups.
--- drivers/s390/block/dasd_alias.c | 1 + 1 file changed, 1 insertion(+)
drivers/s390/block/dasd_alias.c +1 -0
@@ -642,6 +642,7 @@ int dasd_alias_add_device(struct dasd_de }if (lcu->flags &UPDATE_PENDING ) {list_move (&device->alias_list, &lcu->active_devices); + private->pavgroup =NULL ;_schedule_lcu_update (lcu, device); }spin_unlock_irqrestore (&lcu->lock, flags);
Greg Kroah-Hartman
maintainerPATCH 316/346 spi: davinci: Fix use-after-free on unbind
In reply to Greg Kroah-HartmanFrom: Lukas Wunner <[email protected]>
commit 373afef350a93519b4b8d636b0895da8650b714b upstream.
davinci_spi_remove() accesses the driver's private data after it's been freed with spi_master_put().
Fix by moving the spi_master_put() to the end of the function.
--- drivers/spi/spi-davinci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-davinci.c +1 -1
@@ -1086,13 +1086,13 @@ static int davinci_spi_remove(struct plaspi_bitbang_stop (&dspi->bitbang);clk_disable_unprepare (dspi->clk); -spi_master_put (master);if (dspi->dma_rx) {dma_release_channel (dspi->dma_rx);dma_release_channel (dspi->dma_tx); } +spi_master_put (master);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 320/346 spi: st-ssc4: Fix unbalanced pm_runtime_disable() in probe error path
In reply to Greg Kroah-HartmanFrom: Lukas Wunner <[email protected]>
commit 5ef76dac0f2c26aeae4ee79eb830280f16d5aceb upstream.
If the calls to devm_platform_ioremap_resource(), irq_of_parse_and_map() or devm_request_irq() fail on probe of the ST SSC4 SPI driver, the runtime PM disable depth is incremented even though it was not decremented before. Fix it.
--- drivers/spi/spi-st-ssc4.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/spi/spi-st-ssc4.c +3 -2
@@ -379,13 +379,14 @@ static int spi_st_probe(struct platform_ ret =devm_spi_register_master (&pdev->dev, master);if (ret) {dev_err (&pdev->dev,"Failed to register master\n" ); - goto clk_disable; + goto rpm_disable; }return 0 ; -clk_disable: +rpm_disable:pm_runtime_disable (&pdev->dev); +clk_disable:clk_disable_unprepare (spi_st->clk); put_master:spi_master_put (master);
Greg Kroah-Hartman
maintainerPATCH 332/346 iio:pressure:mpl3115: Force alignment of buffer
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
commit 198cf32f0503d2ad60d320b95ef6fb8243db857f upstream.
Whilst this is another case of the issue Lars reported with an array of elements of smaller than 8 bytes being passed to iio_push_to_buffers_with_timestamp(), the solution here is a bit different from the other cases and relies on __aligned working on the stack (true since 4.6?)
This one is unusual. We have to do an explicit memset() each time as we are reading 3 bytes into a potential 4 byte channel which may sometimes be a 2 byte channel depending on what is enabled. As such, moving the buffer to the heap in the iio_priv structure doesn't save us much. We can't use a nice explicit structure on the stack either as the data channels have different storage sizes and are all separately controlled.
--- drivers/iio/pressure/mpl3115.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/iio/pressure/mpl3115.c +8 -1
@@ -147,7 +147,14 @@ static irqreturn_t mpl3115_trigger_handlstruct iio_poll_func *pf = p;struct iio_dev *indio_dev = pf->indio_dev;struct mpl3115_data *data =iio_priv (indio_dev); -u8 buffer[16 ];/* 32-bit channel + 16-bit channel + padding + ts */ +/* +* 32-bit channel + 16-bit channel + padding + ts +* Note that it is possible for only one of the first 2 +* channels to be enabled. If that happens, the first element +* of the buffer may be either 16 or 32-bits. As such we cannot +* use a simple structure definition to express this data layout. +*/ +u8 buffer[16 ]__aligned(8) ;int ret, pos =0 ;mutex_lock (&data->lock);
Greg Kroah-Hartman
maintainerPATCH 319/346 spi: sc18is602: Dont leak SPI master in probe error path
In reply to Greg Kroah-HartmanFrom: Lukas Wunner <[email protected]>
commit 5b8c88462d83331dacb48aeaec8388117fef82e0 upstream.
If the call to devm_gpiod_get_optional() fails on probe of the NXP SC18IS602/603 SPI driver, the spi_master struct is erroneously not freed.
Fix by switching over to the new devm_spi_alloc_master() helper.
--- drivers/spi/spi-sc18is602.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
drivers/spi/spi-sc18is602.c +2 -11
@@ -248,13 +248,12 @@ static int sc18is602_probe(struct i2c_clstruct sc18is602_platform_data *pdata =dev_get_platdata (dev);struct sc18is602 *hw;struct spi_master *master; -int error;if (!i2c_check_functionality (client->adapter,I2C_FUNC_I2C |I2C_FUNC_SMBUS_WRITE_BYTE_DATA ))return -EINVAL ; - master =spi_alloc_master (dev,sizeof (struct sc18is602 )); + master =devm_spi_alloc_master (dev,sizeof (struct sc18is602 ));if (!master)return -ENOMEM ;
@@ -308,15 +307,7 @@ static int sc18is602_probe(struct i2c_cl master->min_speed_hz = hw->freq /128 ; master->max_speed_hz = hw->freq /4 ; - error =devm_spi_register_master (dev, master); -if (error) - goto error_reg; - -return 0 ; - -error_reg: -spi_master_put (master); -return error; +return devm_spi_register_master (dev, master); }static const struct i2c_device_id sc18is602_id[] = {
Greg Kroah-Hartman
maintainerPATCH 323/346 mtd: spinand: Fix OOB read
In reply to Greg Kroah-HartmanFrom: Miquel Raynal <[email protected]>
commit 868cbe2a6dcee451bd8f87cbbb2a73cf463b57e5 upstream.
So far OOB have never been used in SPI-NAND, add the missing memcpy to make it work properly.
--- drivers/mtd/nand/spi/core.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/mtd/nand/spi/core.c +4 -0
@@ -378,6 +378,10 @@ static int spinand_write_to_cache_op(str } } +if (req->ooblen) +memcpy (req->oobbuf.in, spinand->oobbuf + req->ooboffs, + req->ooblen); +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 333/346 iio:imu:bmi160: Fix too large a buffer.
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
commit dc7de42d6b50a07b37feeba4c6b5136290fcee81 upstream.
The comment implies this device has 3 sensor types, but it only has an accelerometer and a gyroscope (both 3D). As such the buffer does not need to be as long as stated.
Note I've separated this from the following patch which fixes the alignment for passing to iio_push_to_buffers_with_timestamp() as they are different issues even if they affect the same line of code.
--- drivers/iio/imu/bmi160/bmi160_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/imu/bmi160/bmi160_core.c +2 -2
@@ -385,8 +385,8 @@ static irqreturn_t bmi160_trigger_handlestruct iio_poll_func *pf = p;struct iio_dev *indio_dev = pf->indio_dev;struct bmi160_data *data =iio_priv (indio_dev); -__le16 buf[16 ]; -/* 3 sens x 3 axis x __le16 + 3 x __le16 pad + 4 x __le16 tstamp */ +__le16 buf[12 ]; +/* 2 sens x 3 axis x __le16 + 2 x __le16 pad + 4 x __le16 tstamp */ int i, ret, j =0 , base =BMI160_REG_DATA_MAGN_XOUT_L ;__le16 sample;
Greg Kroah-Hartman
maintainerPATCH 322/346 soc: qcom: smp2p: Safely acquire spinlock without IRQs
In reply to Greg Kroah-HartmanFrom: Evan Green <[email protected]>
commit fc3e62e25c3896855b7c3d72df19ca6be3459c9f upstream.
smp2p_update_bits() should disable interrupts when it acquires its spinlock. This is important because without the _irqsave, a priority inversion can occur.
This function is called both with interrupts enabled in qcom_q6v5_request_stop(), and with interrupts disabled in ipa_smp2p_panic_notifier(). IRQ handling of spinlocks should be consistent to avoid the panic notifier deadlocking because it's sitting on the thread that's already got the lock via _request_stop().
Found via lockdep.
--- drivers/soc/qcom/smp2p.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/soc/qcom/smp2p.c +3 -2
@@ -326,15 +326,16 @@ static int qcom_smp2p_inbound_entry(strustatic int smp2p_update_bits (void *data,u32 mask,u32 value) {struct smp2p_entry *entry = data; +unsigned long flags;u32 orig;u32 val; -spin_lock (&entry->lock); +spin_lock_irqsave (&entry->lock, flags); val = orig =readl (entry->value); val &= ~mask; val |= value;writel (val, entry->value); -spin_unlock (&entry->lock); +spin_unlock_irqrestore (&entry->lock, flags);if (val != orig)qcom_smp2p_kick (entry->smp2p);
Greg Kroah-Hartman
maintainerPATCH 336/346 pinctrl: sunxi: Always call chained_irq_{enter, exit} in sunxi_pinctrl_irq_handler
In reply to Greg Kroah-HartmanFrom: Yangtao Li <[email protected]>
commit a1158e36f876f6269978a4176e3a1d48d27fe7a1 upstream.
It is found on many allwinner soc that there is a low probability that the interrupt status cannot be read in sunxi_pinctrl_irq_handler. This will cause the interrupt status of a gpio bank to always be active on gic, preventing gic from responding to other spi interrupts correctly.
So we should call the chained_irq_* each time enter sunxi_pinctrl_irq_handler().
--- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/pinctrl/sunxi/pinctrl-sunxi.c +4 -2
@@ -1001,20 +1001,22 @@ static void sunxi_pinctrl_irq_handler(stif (bank == pctl->desc->irq_banks)return ; +chained_irq_enter (chip, desc); + reg =sunxi_irq_status_reg_from_bank (pctl->desc, bank); val =readl (pctl->membase + reg);if (val) {int irqoffset; -chained_irq_enter (chip, desc);for_each_set_bit (irqoffset, &val,IRQ_PER_BANK ) {int pin_irq =irq_find_mapping (pctl->domain, bank *IRQ_PER_BANK + irqoffset);generic_handle_irq (pin_irq); } -chained_irq_exit (chip, desc); } + +chained_irq_exit (chip, desc); } static int sunxi_pinctrl_add_function(struct sunxi_pinctrl *pctl,
Greg Kroah-Hartman
maintainerPATCH 324/346 mtd: parser: cmdline: Fix parsing of part-names with colons
In reply to Greg Kroah-HartmanFrom: Sven Eckelmann <[email protected]>
commit 639a82434f16a6df0ce0e7c8595976f1293940fd upstream.
Some devices (especially QCA ones) are already using hardcoded partition names with colons in it. The OpenMesh A62 for example provides following mtd relevant information via cmdline:
root=31:11 mtdparts=spi0.0:256k(0:SBL1),128k(0:MIBIB),384k(0:QSEE),64k(0:CDT),64k(0:DDRPARAMS),64k(0:APPSBLENV),512k(0:APPSBL),64k(0:ART),64k(custom),64k(0:KEYS),0x002b0000(kernel),0x00c80000(rootfs),15552k(inactive) rootfsname=rootfs rootwait
The change to split only on the last colon between mtd-id and partitions will cause newpart to see following string for the first partition:
KEYS),0x002b0000(kernel),0x00c80000(rootfs),15552k(inactive)
Such a partition list cannot be parsed and thus the device fails to boot.
Avoid this behavior by making sure that the start of the first part-name ("(") will also be the last byte the mtd-id split algorithm is using for its colon search.
--- drivers/mtd/cmdlinepart.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/mtd/cmdlinepart.c +13 -1
@@ -231,7 +231,7 @@ static int mtdpart_setup_real(char *s)struct cmdline_mtd_partition *this_mtd;struct mtd_partition *parts;int mtd_id_len, num_parts; -char *p, *mtd_id, *semicol; +char *p, *mtd_id, *semicol, *open_parenth;/* * Replace the first ';' by a NULL char so strrchr can work
@@ -241,6 +241,14 @@ static int mtdpart_setup_real(char *s)if (semicol) *semicol ='\0' ; +/* +* make sure that part-names with ":" will not be handled as +* part of the mtd-id with an ":" +*/ + open_parenth =strchr (s,'(' ); +if (open_parenth) + *open_parenth ='\0' ; + mtd_id = s;/*
@@ -250,6 +258,10 @@ static int mtdpart_setup_real(char *s)*/ p =strrchr (s,':' ); +/* Restore the '(' now. */ +if (open_parenth) + *open_parenth ='(' ; +/* Restore the ';' now. */ if (semicol) *semicol =';' ;
Greg Kroah-Hartman
maintainerPATCH 345/346 platform/x86: intel-vbtn: Allow switch events on Acer Switch Alpha 12
In reply to Greg Kroah-HartmanFrom: Carlos Garnacho <[email protected]>
commit fe6000990394639ed374cb76c313be3640714f47 upstream.
This 2-in-1 model (Product name: Switch SA5-271) features a SW_TABLET_MODE that works as it would be expected, both when detaching the keyboard and when folding it behind the tablet body.
It used to work until the introduction of the allow list at commit 8169bd3e6e193 ("platform/x86: intel-vbtn: Switch to an allow-list for SW_TABLET_MODE reporting"). Add this model to it, so that the Virtual Buttons device announces the EV_SW features again.
--- drivers/platform/x86/intel-vbtn.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/platform/x86/intel-vbtn.c +6 -0
@@ -203,6 +203,12 @@ static const struct dmi_system_id dmi_sw DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion 13 x360 PC"), }, }, + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Acer"), + DMI_MATCH(DMI_PRODUCT_NAME, "Switch SA5-271"), + }, + }, {}/* Array terminator */ };
Greg Kroah-Hartman
maintainerPATCH 344/346 libnvdimm/namespace: Fix reaping of invalidated block-window-namespace labels
In reply to Greg Kroah-HartmanFrom: Dan Williams <[email protected]>
commit 2dd2a1740ee19cd2636d247276cf27bfa434b0e2 upstream.
A recent change to ndctl to attempt to reconfigure namespaces in place uncovered a label accounting problem in block-window-type namespaces. The ndctl "create.sh" test is able to trigger this signature:
WARNING: CPU: 34 PID: 9167 at drivers/nvdimm/label.c:1100 __blk_label_update+0x9a3/0xbc0 [libnvdimm] [..] RIP: 0010:__blk_label_update+0x9a3/0xbc0 [libnvdimm] [..] Call Trace: uuid_store+0x21b/0x2f0 [libnvdimm] kernfs_fop_write+0xcf/0x1c0 vfs_write+0xcc/0x380 ksys_write+0x68/0xe0
When allocated capacity for a namespace is renamed (new UUID) the labels with the old UUID need to be deleted. The ndctl behavior to always destroy namespaces on reconfiguration hid this problem.
The immediate impact of this bug is limited since block-window-type namespaces only seem to exist in the specification and not in any shipping products. However, the label handling code is being reused for other technologies like CXL region labels, so there is a benefit to making sure both vertical labels sets (block-window) and horizontal label sets (pmem) have a functional reference implementation in libnvdimm.
--- drivers/nvdimm/label.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/nvdimm/label.c +9 -0
@@ -861,6 +861,15 @@ static int __blk_label_update(struct nd_ } } +/* release slots associated with any invalidated UUIDs */ +mutex_lock (&nd_mapping->lock); +list_for_each_entry_safe (label_ent, e, &nd_mapping->labels, list) +if (test_and_clear_bit (ND_LABEL_REAP , &label_ent->flags)) { +reap_victim (nd_mapping, label_ent); +list_move (&label_ent->list, &list); + } +mutex_unlock (&nd_mapping->lock); +/* * Find the resource associated with the first label in the set * per the v1.2 namespace specification.
Greg Kroah-Hartman
maintainerPATCH 325/346 mtd: rawnand: qcom: Fix DMA sync on FLASH_STATUS register read
In reply to Greg Kroah-HartmanFrom: Praveenkumar I <[email protected]>
commit bc3686021122de953858a5be4cbf6e3f1d821e79 upstream.
After each codeword NAND_FLASH_STATUS is read for possible operational failures. But there is no DMA sync for CPU operation before reading it and this leads to incorrect or older copy of DMA buffer in reg_read_buf.
This patch adds the DMA sync on reg_read_buf for CPU before reading it.
--- drivers/mtd/nand/raw/qcom_nandc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/mtd/nand/raw/qcom_nandc.c +2 -0
@@ -1578,6 +1578,8 @@ static int check_flash_errors(struct qcostruct qcom_nand_controller *nandc =get_qcom_nand_controller (chip);int i; +nandc_read_buffer_sync (nandc, true); +for (i =0 ; i < cw_cnt; i++) {u32 flash =le32_to_cpu (nandc->reg_read_buf[i]);
Greg Kroah-Hartman
maintainerPATCH 343/346 xenbus/xenbus_backend: Disallow pending watch messages
In reply to Greg Kroah-HartmanFrom: SeongJae Park <[email protected]>
commit 9996bd494794a2fe393e97e7a982388c6249aa76 upstream.
'xenbus_backend' watches 'state' of devices, which is writable by guests. Hence, if guests intensively updates it, dom0 will have lots of pending events that exhausting memory of dom0. In other words, guests can trigger dom0 memory pressure. This is known as XSA-349. However, the watch callback of it, 'frontend_changed()', reads only 'state', so doesn't need to have the pending events.
To avoid the problem, this commit disallows pending watch messages for 'xenbus_backend' using the 'will_handle()' watch callback.
This is part of XSA-349
--- drivers/xen/xenbus/xenbus_probe_backend.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/xen/xenbus/xenbus_probe_backend.c +7 -0
@@ -180,6 +180,12 @@ static int xenbus_probe_backend(struct xreturn err; } +static bool frontend_will_handle (struct xenbus_watch *watch, +const char *path,const char *token) +{ +return watch->nr_pending ==0 ; +} +static void frontend_changed (struct xenbus_watch *watch,const char *path,const char *token) {
@@ -191,6 +197,7 @@ static struct xen_bus_type xenbus_backen .levels = 3, /* backend/type/<frontend>/<id> */ .get_bus_id = backend_bus_id, .probe = xenbus_probe_backend, + .otherend_will_handle = frontend_will_handle, .otherend_changed = frontend_changed, .bus = { .name = "xen-backend",
Greg Kroah-Hartman
maintainerPATCH 321/346 spi: mt7621: fix missing clk_disable_unprepare() on error in mt7621_spi_probe
In reply to Greg Kroah-HartmanFrom: Qinglang Miao <[email protected]>
commit 702b15cb97123cedcec56a39d9a21c5288eb9ae1 upstream.
Fix the missing clk_disable_unprepare() before return from mt7621_spi_probe in the error handling case.
--- drivers/staging/mt7621-spi/spi-mt7621.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/staging/mt7621-spi/spi-mt7621.c +2 -0
@@ -455,6 +455,7 @@ static int mt7621_spi_probe(struct platf master =spi_alloc_master (&pdev->dev,sizeof (*rs));if (master ==NULL ) {dev_info (&pdev->dev,"master allocation failed\n" ); +clk_disable_unprepare (clk);return -ENOMEM ; }
@@ -480,6 +481,7 @@ static int mt7621_spi_probe(struct platf ret =device_reset (&pdev->dev);if (ret) {dev_err (&pdev->dev,"SPI reset failed!\n" ); +clk_disable_unprepare (clk);return ret; }
Greg Kroah-Hartman
maintainerPATCH 318/346 spi: rb4xx: Dont leak SPI master in probe error path
In reply to Greg Kroah-HartmanFrom: Lukas Wunner <[email protected]>
commit a4729c3506c3eb1a6ca5c0289f4e7cafa4115065 upstream.
If the calls to devm_clk_get(), devm_spi_register_master() or clk_prepare_enable() fail on probe of the Mikrotik RB4xx SPI driver, the spi_master struct is erroneously not freed.
Fix by switching over to the new devm_spi_alloc_master() helper.
--- drivers/spi/spi-rb4xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-rb4xx.c +1 -1
@@ -148,7 +148,7 @@ static int rb4xx_spi_probe(struct platfoif (IS_ERR (spi_base))return PTR_ERR (spi_base); - master =spi_alloc_master (&pdev->dev,sizeof (*rbspi)); + master =devm_spi_alloc_master (&pdev->dev,sizeof (*rbspi));if (!master)return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 329/346 iio: adc: rockchip_saradc: fix missing clk_disable_unprepare() on error in rockchip_saradc_resume
In reply to Greg Kroah-HartmanFrom: Qinglang Miao <[email protected]>
commit 560c6b914c6ec7d9d9a69fddbb5bf3bf71433e8b upstream.
Fix the missing clk_disable_unprepare() of info->pclk before return from rockchip_saradc_resume in the error handling case when fails to prepare and enable info->clk.
--- drivers/iio/adc/rockchip_saradc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/rockchip_saradc.c +1 -1
@@ -383,7 +383,7 @@ static int rockchip_saradc_resume(struct ret =clk_prepare_enable (info->clk);if (ret) -return ret; +clk_disable_unprepare (info->pclk);return ret; }
Greg Kroah-Hartman
maintainerPATCH 341/346 xen/xenbus/xen_bus_type: Support will_handle watch callback
In reply to Greg Kroah-HartmanFrom: SeongJae Park <[email protected]>
commit be987200fbaceaef340872841d4f7af2c5ee8dc3 upstream.
This commit adds support of the 'will_handle' watch callback for 'xen_bus_type' users.
This is part of XSA-349
--- drivers/xen/xenbus/xenbus.h | 2 ++ drivers/xen/xenbus/xenbus_probe.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/xen/xenbus/xenbus.h +2 -0
@@ -44,6 +44,8 @@ struct xen_bus_type {int (*get_bus_id)(char bus_id[XEN_BUS_ID_SIZE ],const char *nodename);int (*probe)(struct xen_bus_type *bus,const char *type,const char *dir); +bool (*otherend_will_handle)(struct xenbus_watch *watch, +const char *path,const char *token);void (*otherend_changed)(struct xenbus_watch *watch,const char *path,const char *token);struct bus_type bus;
drivers/xen/xenbus/xenbus_probe.c +2 -1
@@ -136,7 +136,8 @@ static int watch_otherend(struct xenbus_ container_of(dev->dev.bus, struct xen_bus_type, bus);return xenbus_watch_pathfmt (dev, &dev->otherend_watch, -NULL , bus->otherend_changed, + bus->otherend_will_handle, + bus->otherend_changed,"%s/%s" , dev->otherend,"state" ); }
Greg Kroah-Hartman
maintainerPATCH 292/346 USB: serial: keyspan_pda: fix write deadlock
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 7353cad7ee4deaefc16e94727e69285563e219f6 upstream.
The write() callback can be called in interrupt context (e.g. when used as a console) so interrupts must be disabled while holding the port lock to prevent a possible deadlock.
--- drivers/usb/serial/keyspan_pda.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/usb/serial/keyspan_pda.c +4 -3
@@ -443,6 +443,7 @@ static int keyspan_pda_write(struct tty_int request_unthrottle =0 ;int rc =0 ;struct keyspan_pda_private *priv; +unsigned long flags; priv =usb_get_serial_port_data (port);/* guess how much room is left in the device's ring buffer, and if we
@@ -462,13 +463,13 @@ static int keyspan_pda_write(struct tty_the TX urb is in-flight (wait until it completes) the device is full (wait until it says there is room) */ -spin_lock_bh (&port->lock); +spin_lock_irqsave (&port->lock, flags);if (!test_bit (0 , &port->write_urbs_free) || priv->tx_throttled) { -spin_unlock_bh (&port->lock); +spin_unlock_irqrestore (&port->lock, flags);return 0 ; }clear_bit (0 , &port->write_urbs_free); -spin_unlock_bh (&port->lock); +spin_unlock_irqrestore (&port->lock, flags);/* At this point the URB is in our control, nobody else can submit it again (the only sudden transition was the one from EINPROGRESS to
Greg Kroah-Hartman
maintainerPATCH 331/346 iio:light:st_uvis25: Fix timestamp alignment and prevent data leak.
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
commit d837a996f57c29a985177bc03b0e599082047f27 upstream.
One of a class of bugs pointed out by Lars in a recent review. iio_push_to_buffers_with_timestamp() assumes the buffer used is aligned to the size of the timestamp (8 bytes). This is not guaranteed in this driver which uses an array of smaller elements on the stack. As Lars also noted this anti pattern can involve a leak of data to userspace and that indeed can happen here. We close both issues by moving to a suitable structure in the iio_priv()
This data is allocated with kzalloc() so no data can leak apart from previous readings.
A local unsigned int variable is used for the regmap call so it is clear there is no potential issue with writing into the padding of the structure.
--- drivers/iio/light/st_uvis25.h | 5 +++++ drivers/iio/light/st_uvis25_core.c | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-)
drivers/iio/light/st_uvis25.h +5 -0
@@ -28,6 +28,11 @@ struct st_uvis25_hw {struct iio_trigger *trig;bool enabled;int irq; +/* Ensure timestamp is naturally aligned */ +struct { +u8 chan; +s64 ts__aligned(8) ; + } scan; };extern const struct dev_pm_ops st_uvis25_pm_ops;
drivers/iio/light/st_uvis25_core.c +5 -3
@@ -235,17 +235,19 @@ static const struct iio_buffer_setup_opsstatic irqreturn_t st_uvis25_buffer_handler_thread (int irq,void *p) { -u8 buffer[ALIGN (sizeof (u8),sizeof (s64)) +sizeof (s64)];struct iio_poll_func *pf = p;struct iio_dev *iio_dev = pf->indio_dev;struct st_uvis25_hw *hw =iio_priv (iio_dev); +unsigned int val;int err; - err =regmap_read (hw->regmap,ST_UVIS25_REG_OUT_ADDR , (int *)buffer); + err =regmap_read (hw->regmap,ST_UVIS25_REG_OUT_ADDR , &val);if (err <0 ) goto out; -iio_push_to_buffers_with_timestamp (iio_dev, buffer, + hw->scan.chan = val; + +iio_push_to_buffers_with_timestamp (iio_dev, &hw->scan,iio_get_time_ns (iio_dev)); out:
Greg Kroah-Hartman
maintainerPATCH 302/346 powerpc: Fix incorrect stw{, ux, u, x} instructions in __set_pte_at
In reply to Greg Kroah-HartmanFrom: Mathieu Desnoyers <[email protected]>
commit d85be8a49e733dcd23674aa6202870d54bf5600d upstream.
The placeholder for instruction selection should use the second argument's operand, which is %1, not %0. This could generate incorrect assembly code if the memory addressing of operand %0 is a different form from that of operand %1.
Also remove the %Un placeholder because having %Un placeholders for two operands which are based on the same local var (ptep) doesn't make much sense. By the way, it doesn't change the current behaviour because "<>" constraint is missing for the associated "=m".
[chleroy: revised commit log iaw segher's comments and removed %U0]
--- arch/powerpc/include/asm/book3s/32/pgtable.h | 4 ++-- arch/powerpc/include/asm/nohash/pgtable.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
arch/powerpc/include/asm/book3s/32/pgtable.h +2 -2
@@ -434,9 +434,9 @@ static inline void __set_pte_at(struct mif (pte_val (*ptep) & _PAGE_HASHPTE)flush_hash_entry (mm, ptep, addr); __asm__ __volatile__("\ -stw%U0%X0 %2,%0\n\ +stw%X0 %2,%0\n\ eieio\n\ -stw%U0%X0 %L2,%1" +stw%X1 %L2,%1" :"=m" (*ptep),"=m" (*((unsigned char *)ptep+4 )) :"r" (pte) :"memory" );
arch/powerpc/include/asm/nohash/pgtable.h +2 -2
@@ -151,9 +151,9 @@ static inline void __set_pte_at(struct m*/ if (IS_ENABLED (CONFIG_PPC32 ) &&IS_ENABLED (CONFIG_PTE_64BIT ) && !percpu) { __asm__ __volatile__("\ -stw%U0%X0 %2,%0\n\ +stw%X0 %2,%0\n\ eieio\n\ -stw%U0%X0 %L2,%1" +stw%X1 %L2,%1" :"=m" (*ptep),"=m" (*((unsigned char *)ptep+4 )) :"r" (pte) :"memory" );return ;
Greg Kroah-Hartman
maintainerPATCH 290/346 USB: serial: digi_acceleport: fix write-wakeup deadlocks
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 5098e77962e7c8947f87bd8c5869c83e000a522a upstream.
The driver must not call tty_wakeup() while holding its private lock as line disciplines are allowed to call back into write() from write_wakeup(), leading to a deadlock.
Also remove the unneeded work struct that was used to defer wakeup in order to work around a possible race in ancient times (see comment about n_tty write_chan() in commit 14b54e39b412 ("USB: serial: remove changelogs and old todo entries")).
--- drivers/usb/serial/digi_acceleport.c | 45 ++++++++++------------------------- 1 file changed, 13 insertions(+), 32 deletions(-)
drivers/usb/serial/digi_acceleport.c +13 -32
@@ -19,7 +19,6 @@#include <linux/tty_flip.h> #include <linux/module.h> #include <linux/spinlock.h> -#include <linux/workqueue.h> #include <linux/uaccess.h> #include <linux/usb.h> #include <linux/wait.h>
@@ -198,14 +197,12 @@ struct digi_port {int dp_throttle_restart;wait_queue_head_t dp_flush_wait;wait_queue_head_t dp_close_wait;/* wait queue for close */ -struct work_struct dp_wakeup_work;struct usb_serial_port *dp_port; };/* Local Function Declarations */ -static void digi_wakeup_write_lock (struct work_struct *work);static int digi_write_oob_command (struct usb_serial_port *port,unsigned char *buf,int count,int interruptible); static int digi_write_inb_command(struct usb_serial_port *port,
@@ -356,26 +353,6 @@ __releases(lock)return timeout; } - -/* -* Digi Wakeup Write -* -* Wake up port, line discipline, and tty processes sleeping -* on writes. -*/ - -static void digi_wakeup_write_lock (struct work_struct *work) -{ -struct digi_port *priv = - container_of(work, struct digi_port, dp_wakeup_work); -struct usb_serial_port *port = priv->dp_port; -unsigned long flags; - -spin_lock_irqsave (&priv->dp_port_lock, flags); -tty_port_tty_wakeup (&port->port); -spin_unlock_irqrestore (&priv->dp_port_lock, flags); -} -/* * Digi Write OOB Command *
@@ -987,6 +964,7 @@ static void digi_write_bulk_callback(strunsigned long flags;int ret =0 ;int status = urb->status; +bool wakeup;/* port and serial sanity check */ if (port ==NULL || (priv =usb_get_serial_port_data (port)) ==NULL ) {
@@ -1013,6 +991,7 @@ static void digi_write_bulk_callback(str }/* try to send any buffered data on this port */ + wakeup = true;spin_lock_irqsave (&priv->dp_port_lock, flags); priv->dp_write_urb_in_use =0 ;if (priv->dp_out_buf_len >0 ) {
@@ -1028,19 +1007,18 @@ static void digi_write_bulk_callback(strif (ret ==0 ) { priv->dp_write_urb_in_use =1 ; priv->dp_out_buf_len =0 ; + wakeup = false; } } -/* wake up processes sleeping on writes immediately */ -tty_port_tty_wakeup (&port->port); -/* also queue up a wakeup at scheduler time, in case we */ -/* lost the race in write_chan(). */ -schedule_work (&priv->dp_wakeup_work); -spin_unlock_irqrestore (&priv->dp_port_lock, flags); +if (ret && ret != -EPERM )dev_err_console (port,"%s: usb_submit_urb failed, ret=%d, port=%d\n" , __func__, ret, priv->dp_port_num); + +if (wakeup) +tty_port_tty_wakeup (&port->port); }static int digi_write_room (struct tty_struct *tty)
@@ -1240,7 +1218,6 @@ static int digi_port_init(struct usb_serinit_waitqueue_head (&priv->dp_transmit_idle_wait);init_waitqueue_head (&priv->dp_flush_wait);init_waitqueue_head (&priv->dp_close_wait); -INIT_WORK (&priv->dp_wakeup_work, digi_wakeup_write_lock); priv->dp_port = port;init_waitqueue_head (&port->write_wait);
@@ -1509,13 +1486,14 @@ static int digi_read_oob_callback(struct rts =C_CRTSCTS (tty);if (tty && opcode ==DIGI_CMD_READ_INPUT_SIGNALS ) { +bool wakeup = false; +spin_lock_irqsave (&priv->dp_port_lock, flags);/* convert from digi flags to termiox flags */ if (val &DIGI_READ_INPUT_SIGNALS_CTS ) { priv->dp_modem_signals |=TIOCM_CTS ; -/* port must be open to use tty struct */ if (rts) -tty_port_tty_wakeup (&port->port); + wakeup = true; }else { priv->dp_modem_signals &= ~TIOCM_CTS ;/* port must be open to use tty struct */
@@ -1534,6 +1512,9 @@ static int digi_read_oob_callback(struct priv->dp_modem_signals &= ~TIOCM_CD ;spin_unlock_irqrestore (&priv->dp_port_lock, flags); + +if (wakeup) +tty_port_tty_wakeup (&port->port); }else if (opcode ==DIGI_CMD_TRANSMIT_IDLE ) {spin_lock_irqsave (&priv->dp_port_lock, flags); priv->dp_transmit_idle =1 ;
Greg Kroah-Hartman
maintainerPATCH 315/346 spi: spi-sh: Fix use-after-free on unbind
In reply to Greg Kroah-HartmanFrom: Lukas Wunner <[email protected]>
commit e77df3eca12be4b17f13cf9f215cff248c57d98f upstream.
spi_sh_remove() accesses the driver's private data after calling spi_unregister_master() even though that function releases the last reference on the spi_master and thereby frees the private data.
Fix by switching over to the new devm_spi_alloc_master() helper which keeps the private data accessible until the driver has unbound.
--- drivers/spi/spi-sh.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/spi/spi-sh.c +4 -9
@@ -450,7 +450,7 @@ static int spi_sh_probe(struct platform_return irq; } - master =spi_alloc_master (&pdev->dev,sizeof (struct spi_sh_data )); + master =devm_spi_alloc_master (&pdev->dev,sizeof (struct spi_sh_data ));if (master ==NULL ) {dev_err (&pdev->dev,"spi_alloc_master error.\n" );return -ENOMEM ;
@@ -468,16 +468,14 @@ static int spi_sh_probe(struct platform_break ;default :dev_err (&pdev->dev,"No support width\n" ); - ret = -ENODEV ; - goto error1; +return -ENODEV ; } ss->irq = irq; ss->master = master; ss->addr =devm_ioremap (&pdev->dev, res->start,resource_size (res));if (ss->addr ==NULL ) {dev_err (&pdev->dev,"ioremap error.\n" ); - ret = -ENOMEM ; - goto error1; +return -ENOMEM ; }INIT_LIST_HEAD (&ss->queue);spin_lock_init (&ss->lock);
@@ -487,7 +485,7 @@ static int spi_sh_probe(struct platform_ ret =request_irq (irq, spi_sh_irq,0 ,"spi_sh" , ss);if (ret <0 ) {dev_err (&pdev->dev,"request_irq error\n" ); - goto error1; +return ret; } master->num_chipselect =2 ;
@@ -506,9 +504,6 @@ static int spi_sh_probe(struct platform_ error3:free_irq (irq, ss); - error1: -spi_master_put (master); -return ret; }
Greg Kroah-Hartman
maintainerPATCH 317/346 spi: pic32: Dont leak DMA channels in probe error path
In reply to Greg Kroah-HartmanFrom: Lukas Wunner <[email protected]>
commit c575e9113bff5e024d75481613faed5ef9d465b2 upstream.
If the calls to devm_request_irq() or devm_spi_register_master() fail on probe of the PIC32 SPI driver, the DMA channels requested by pic32_spi_dma_prep() are erroneously not released. Plug the leak.
--- drivers/spi/spi-pic32.c | 1 + 1 file changed, 1 insertion(+)
drivers/spi/spi-pic32.c +1 -0
@@ -839,6 +839,7 @@ static int pic32_spi_probe(struct platforeturn 0 ; err_bailout: +pic32_spi_dma_unprep (pic32s);clk_disable_unprepare (pic32s->clk); err_master:spi_master_put (master);
Greg Kroah-Hartman
maintainerPATCH 306/346 powerpc/powernv/memtrace: Fix crashing the kernel when enabling concurrently
In reply to Greg Kroah-HartmanFrom: David Hildenbrand <[email protected]>
commit d6718941a2767fb383e105d257d2105fe4f15f0e upstream.
It's very easy to crash the kernel right now by simply trying to enable memtrace concurrently, hammering on the "enable" interface
loop.sh:
#!/bin/bash
dmesg --console-off
while true; do
echo 0x40000000 > /sys/kernel/debug/powerpc/memtrace/enable
done
[root@localhost ~]# loop.sh &
[root@localhost ~]# loop.sh &
Resulting quickly in a kernel crash. Let's properly protect using a mutex.
--- arch/powerpc/platforms/powernv/memtrace.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)
arch/powerpc/platforms/powernv/memtrace.c +15 -7
@@ -33,6 +33,7 @@ struct memtrace_entry {char name[16 ]; }; +static DEFINE_MUTEX (memtrace_mutex);static u64 memtrace_size;static struct memtrace_entry *memtrace_array;
@@ -294,6 +295,7 @@ static int memtrace_online(void)static int memtrace_enable_set (void *data,u64 val) { +int rc = -EAGAIN ;u64 bytes;/*
@@ -306,25 +308,31 @@ static int memtrace_enable_set(void *datreturn -EINVAL ; } +mutex_lock (&memtrace_mutex); +/* Re-add/online previously removed/offlined memory */ if (memtrace_size) {if (memtrace_online ()) -return -EAGAIN ; + goto out_unlock; } -if (!val) -return 0 ; +if (!val) { + rc =0 ; + goto out_unlock; + }/* Offline and remove memory */ if (memtrace_init_regions_runtime (val)) -return -EINVAL ; + goto out_unlock;if (memtrace_init_debugfs ()) -return -EINVAL ; + goto out_unlock; memtrace_size = val; - -return 0 ; + rc =0 ; +out_unlock: +mutex_unlock (&memtrace_mutex); +return rc; }static int memtrace_enable_get (void *data,u64 *val)
Greg Kroah-Hartman
maintainerPATCH 301/346 ARM: dts: at91: sama5d2: fix CAN message ram offset and size
In reply to Greg Kroah-HartmanFrom: Nicolas Ferre <[email protected]>
commit 85b8350ae99d1300eb6dc072459246c2649a8e50 upstream.
CAN0 and CAN1 instances share the same message ram configured at 0x210000 on sama5d2 Linux systems.
According to current configuration of CAN0, we need 0x1c00 bytes so that the CAN1 don't overlap its message ram:
64 x RX FIFO0 elements => 64 x 72 bytes
32 x TXE (TX Event FIFO) elements => 32 x 8 bytes
32 x TXB (TX Buffer) elements => 32 x 72 bytes
So a total of 7168 bytes (0x1C00).
Fix offset to match this needed size.
Make the CAN0 message ram ioremap match exactly this size so that is easily understandable. Adapt CAN1 size accordingly.
--- arch/arm/boot/dts/sama5d2.dtsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/sama5d2.dtsi +3 -3
@@ -1298,7 +1298,7 @@ can0: can@f8054000 { compatible = "bosch,m_can"; - reg = <0xf8054000 0x4000>, <0x210000 0x4000>; + reg = <0xf8054000 0x4000>, <0x210000 0x1c00>; reg-names = "m_can", "message_ram"; interrupts = <56 IRQ_TYPE_LEVEL_HIGH 7>, <64 IRQ_TYPE_LEVEL_HIGH 7>;
@@ -1491,7 +1491,7 @@ can1: can@fc050000 { compatible = "bosch,m_can"; - reg = <0xfc050000 0x4000>, <0x210000 0x4000>; + reg = <0xfc050000 0x4000>, <0x210000 0x3800>; reg-names = "m_can", "message_ram"; interrupts = <57 IRQ_TYPE_LEVEL_HIGH 7>, <65 IRQ_TYPE_LEVEL_HIGH 7>;
@@ -1501,7 +1501,7 @@ assigned-clocks = <&can1_gclk>; assigned-clock-parents = <&utmi>; assigned-clock-rates = <40000000>; - bosch,mram-cfg = <0x1100 0 0 64 0 0 32 32>; + bosch,mram-cfg = <0x1c00 0 0 64 0 0 32 32>; status = "disabled"; };
Greg Kroah-Hartman
maintainerPATCH 288/346 EDAC/amd64: Fix PCI component registration
In reply to Greg Kroah-HartmanFrom: Borislav Petkov <[email protected]>
commit 706657b1febf446a9ba37dc51b89f46604f57ee9 upstream.
In order to setup its PCI component, the driver needs any node private instance in order to get a reference to the PCI device and hand that into edac_pci_create_generic_ctl(). For convenience, it uses the 0th memory controller descriptor under the assumption that if any, the 0th will be always present.
However, this assumption goes wrong when the 0th node doesn't have memory and the driver doesn't initialize an instance for it:
EDAC amd64: F17h detected (node 0).
...
EDAC amd64: Node 0: No DIMMs detected.
But looking up node instances is not really needed - all one needs is the pointer to the proper device which gets discovered during instance init.
So stash that pointer into a variable and use it when setting up the EDAC PCI component.
Clear that variable when the driver needs to unwind due to some instances failing init to avoid any registration imbalance.
--- drivers/edac/amd64_edac.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-)
drivers/edac/amd64_edac.c +14 -12
@@ -18,6 +18,9 @@ static struct msr __percpu *msrs;/* Per-node stuff */ static struct ecc_settings **ecc_stngs; +/* Device for the PCI component */ +static struct device *pci_ctl_dev; +/* * Valid scrub rates for the K8 hardware memory scrubber. We map the scrubbing * bandwidth to a valid bit pattern. The 'set' operation finds the 'matching-
@@ -2563,6 +2566,9 @@ reserve_mc_sibling_devs(struct amd64_pvtreturn -ENODEV ; } +if (!pci_ctl_dev) + pci_ctl_dev = &pvt->F0->dev; +edac_dbg (1 ,"F0: %s\n" ,pci_name (pvt->F0));edac_dbg (1 ,"F3: %s\n" ,pci_name (pvt->F3));edac_dbg (1 ,"F6: %s\n" ,pci_name (pvt->F6));
@@ -2587,6 +2593,9 @@ reserve_mc_sibling_devs(struct amd64_pvtreturn -ENODEV ; } +if (!pci_ctl_dev) + pci_ctl_dev = &pvt->F2->dev; +edac_dbg (1 ,"F1: %s\n" ,pci_name (pvt->F1));edac_dbg (1 ,"F2: %s\n" ,pci_name (pvt->F2));edac_dbg (1 ,"F3: %s\n" ,pci_name (pvt->F3));
@@ -3441,21 +3450,10 @@ static void remove_one_instance(unsignedstatic void setup_pci_device (void ) { -struct mem_ctl_info *mci; -struct amd64_pvt *pvt; -if (pci_ctl)return ; - mci =edac_mc_find (0 ); -if (!mci) -return ; - - pvt = mci->pvt_info; -if (pvt->umc) - pci_ctl =edac_pci_create_generic_ctl (&pvt->F0->dev,EDAC_MOD_STR ); -else - pci_ctl =edac_pci_create_generic_ctl (&pvt->F2->dev,EDAC_MOD_STR ); + pci_ctl =edac_pci_create_generic_ctl (pci_ctl_dev,EDAC_MOD_STR );if (!pci_ctl) {pr_warn ("%s(): Unable to create PCI control\n" , __func__);pr_warn ("%s(): PCI error report via EDAC not set\n" , __func__);
@@ -3535,6 +3533,8 @@ static int __init amd64_edac_init(void)return 0 ; err_pci: + pci_ctl_dev =NULL ; +msrs_free (msrs); msrs =NULL ;
@@ -3566,6 +3566,8 @@ static void __exit amd64_edac_exit(void)kfree (ecc_stngs); ecc_stngs =NULL ; + pci_ctl_dev =NULL ; +msrs_free (msrs); msrs =NULL ; }
Greg Kroah-Hartman
maintainerPATCH 285/346 staging: comedi: mf6x4: Fix AI end-of-conversion detection
In reply to Greg Kroah-HartmanFrom: Ian Abbott <[email protected]>
commit 56c90457ebfe9422496aac6ef3d3f0f0ea8b2ec2 upstream.
I have had reports from two different people that attempts to read the analog input channels of the MF624 board fail with an ETIMEDOUT error.
After triggering the conversion, the code calls comedi_timeout() with mf6x4_ai_eoc() as the callback function to check if the conversion is complete. The callback returns 0 if complete or -EBUSY if not yet complete. comedi_timeout() returns -ETIMEDOUT if it has not completed within a timeout period which is propagated as an error to the user application.
The existing code considers the conversion to be complete when the EOLC bit is high. However, according to the user manuals for the MF624 and MF634 boards, this test is incorrect because EOLC is an active low signal that goes high when the conversion is triggered, and goes low when the conversion is complete. Fix the problem by inverting the test of the EOLC bit state.
--- drivers/staging/comedi/drivers/mf6x4.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/comedi/drivers/mf6x4.c +2 -1
@@ -112,8 +112,9 @@ static int mf6x4_ai_eoc(struct comedi_destruct mf6x4_private *devpriv = dev->private;unsigned int status; +/* EOLC goes low at end of conversion. */ status =ioread32 (devpriv->gpioc_reg); -if (status &MF6X4_GPIOC_EOLC ) +if ((status &MF6X4_GPIOC_EOLC ) ==0 )return 0 ;return -EBUSY ; }
Greg Kroah-Hartman
maintainerPATCH 300/346 ARM: dts: pandaboard: fix pinmux for gpio user button of Pandaboard ES
In reply to Greg Kroah-HartmanFrom: H. Nikolaus Schaller <[email protected]>
commit df9dbaf2c415cd94ad520067a1eccfee62f00a33 upstream.
The pinmux control register offset passed to OMAP4_IOPAD is odd.
--- arch/arm/boot/dts/omap4-panda-es.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/omap4-panda-es.dts +1 -1
@@ -49,7 +49,7 @@ button_pins: pinmux_button_pins { pinctrl-single,pins = < - OMAP4_IOPAD(0x11b, PIN_INPUT_PULLUP | MUX_MODE3) /* gpio_113 */ + OMAP4_IOPAD(0x0fc, PIN_INPUT_PULLUP | MUX_MODE3) /* gpio_113 */ >; }; };
Greg Kroah-Hartman
maintainerPATCH 303/346 powerpc/rtas: Fix typo of ibm,open-errinjct in RTAS filter
In reply to Greg Kroah-HartmanFrom: Tyrel Datwyler <[email protected]>
commit f10881a46f8914428110d110140a455c66bdf27b upstream.
Commit bd59380c5ba4 ("powerpc/rtas: Restrict RTAS requests from userspace") introduced the following error when invoking the errinjct userspace tool:
[root@ltcalpine2-lp5 librtas]# errinjct open
[327884.071171] sys_rtas: RTAS call blocked - exploit attempt? [327884.071186] sys_rtas: token=0x26, nargs=0 (called by errinjct) errinjct: Could not open RTAS error injection facility errinjct: librtas: open: Unexpected I/O error
The entry for ibm,open-errinjct in rtas_filter array has a typo where the "j" is omitted in the rtas call name. After fixing this typo the errinjct tool functions again as expected.
[root@ltcalpine2-lp5 linux]# errinjct open
RTAS error injection facility open, token = 1
--- arch/powerpc/kernel/rtas.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/rtas.c +1 -1
@@ -1095,7 +1095,7 @@ static struct rtas_filter rtas_filters[] { "ibm,display-message", -1, 0, -1, -1, -1 }, { "ibm,errinjct", -1, 2, -1, -1, -1, 1024 }, { "ibm,close-errinjct", -1, -1, -1, -1, -1 }, - { "ibm,open-errinct", -1, -1, -1, -1, -1 }, + { "ibm,open-errinjct", -1, -1, -1, -1, -1 }, { "ibm,get-config-addr-info2", -1, -1, -1, -1, -1 }, { "ibm,get-dynamic-sensor-state", -1, 1, -1, -1, -1 }, { "ibm,get-indices", -1, 2, 3, -1, -1 },
Greg Kroah-Hartman
maintainerPATCH 257/346 Input: goodix - add upside-down quirk for Teclast X98 Pro tablet
In reply to Greg Kroah-HartmanFrom: Simon Beginn <[email protected]>
[ Upstream commit cffdd6d90482316e18d686060a4397902ea04bd2 ]
The touchscreen on the Teclast x98 Pro is also mounted upside-down in relation to the display orientation.
--- drivers/input/touchscreen/goodix.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/input/touchscreen/goodix.c +12 -0
@@ -136,6 +136,18 @@ static const struct dmi_system_id rotated_screen[] = { DMI_MATCH(DMI_BIOS_DATE, "12/19/2014"), }, }, + { + .ident = "Teclast X98 Pro", + .matches = { +/* +* Only match BIOS date, because the manufacturers +* BIOS does not report the board name at all +* (sometimes)... +*/ +DMI_MATCH (DMI_BOARD_VENDOR ,"TECLAST" ), + DMI_MATCH(DMI_BIOS_DATE, "10/28/2015"), + }, + }, { .ident ="WinBook TW100" , .matches = {
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 296/346 USB: serial: keyspan_pda: fix write unthrottling
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 320f9028c7873c3c7710e8e93e5c979f4c857490 upstream.
The driver did not update its view of the available device buffer space until write() was called in task context. This meant that write_room() would return 0 even after the device had sent a write-unthrottle notification, something which could lead to blocked writers not being woken up (e.g. when using OPOST).
Note that we must also request an unthrottle notification is case a write() request fills the device buffer exactly.
--- drivers/usb/serial/keyspan_pda.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-)
drivers/usb/serial/keyspan_pda.c +20 -9
@@ -40,6 +40,8 @@#define DRIVER_AUTHOR "Brian Warner <[email protected]>"#define DRIVER_DESC "USB Keyspan PDA Converter driver" +#define KEYSPAN_TX_THRESHOLD 16 +struct keyspan_pda_private {int tx_room;int tx_throttled;
@@ -110,7 +112,7 @@ static void keyspan_pda_request_unthrott7 ,/* request_unthrottle */ USB_TYPE_VENDOR |USB_RECIP_INTERFACE |USB_DIR_OUT , -16 ,/* value: threshold */ +KEYSPAN_TX_THRESHOLD ,0 ,/* index */ NULL , 0,
@@ -129,6 +131,8 @@ static void keyspan_pda_rx_interrupt(strint retval;int status = urb->status;struct keyspan_pda_private *priv; +unsigned long flags; + priv =usb_get_serial_port_data (port);switch (status) {
@@ -171,7 +175,10 @@ static void keyspan_pda_rx_interrupt(strcase 1 :/* modemline change */ break ;case 2 :/* tx unthrottle interrupt */ +spin_lock_irqsave (&port->lock, flags); priv->tx_throttled =0 ; + priv->tx_room =max (priv->tx_room,KEYSPAN_TX_THRESHOLD ); +spin_unlock_irqrestore (&port->lock, flags);/* queue up a wakeup at scheduler time */ usb_serial_port_softint (port);break ;
@@ -505,7 +512,8 @@ static int keyspan_pda_write(struct tty_ goto exit; } } -if (count > priv->tx_room) { + +if (count >= priv->tx_room) {/* we're about to completely fill the Tx buffer, so we'll be throttled afterwards. */ count = priv->tx_room;
@@ -560,14 +568,17 @@ static void keyspan_pda_write_bulk_callbstatic int keyspan_pda_write_room (struct tty_struct *tty) {struct usb_serial_port *port = tty->driver_data; -struct keyspan_pda_private *priv; - priv =usb_get_serial_port_data (port); -/* used by n_tty.c for processing of tabs and such. Giving it our -conservative guess is probably good enough, but needs testing by -running a console through the device. */ -return priv->tx_room; -} +struct keyspan_pda_private *priv =usb_get_serial_port_data (port); +unsigned long flags; +int room =0 ; + +spin_lock_irqsave (&port->lock, flags); +if (test_bit (0 , &port->write_urbs_free) && !priv->tx_throttled) + room = priv->tx_room; +spin_unlock_irqrestore (&port->lock, flags); +return room; +}static int keyspan_pda_chars_in_buffer (struct tty_struct *tty) {
Greg Kroah-Hartman
maintainerPATCH 293/346 USB: serial: keyspan_pda: fix stalled writes
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit c01d2c58698f710c9e13ba3e2d296328606f74fd upstream.
Make sure to clear the write-busy flag also in case no new data was submitted due to lack of device buffer space so that writing is resumed once space again becomes available.
--- drivers/usb/serial/keyspan_pda.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/serial/keyspan_pda.c +1 -1
@@ -548,7 +548,7 @@ static int keyspan_pda_write(struct tty_ rc = count; exit: -if (rc <0 ) +if (rc <=0 )set_bit (0 , &port->write_urbs_free);return rc; }
Greg Kroah-Hartman
maintainerPATCH 281/346 s390/dasd: fix hanging device offline processing
In reply to Greg Kroah-HartmanFrom: Stefan Haberland <[email protected]>
commit 658a337a606f48b7ebe451591f7681d383fa115e upstream.
For an LCU update a read unit address configuration IO is required. This is started using sleep_on(), which has early exit paths in case the device is not usable for IO. For example when it is in offline processing.
In those cases the LCU update should fail and not be retried. Therefore lcu_update_work checks if EOPNOTSUPP is returned or not.
Commit 41995342b40c ("s390/dasd: fix endless loop after read unit address configuration") accidentally removed the EOPNOTSUPP return code from read_unit_address_configuration(), which in turn might lead to an endless loop of the LCU update in offline processing.
Fix by returning EOPNOTSUPP again if the device is not able to perform the request.
--- drivers/s390/block/dasd_alias.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/s390/block/dasd_alias.c +9 -1
@@ -462,11 +462,19 @@ static int read_unit_address_configuratispin_unlock_irqrestore (&lcu->lock, flags); rc =dasd_sleep_on (cqr); -if (rc && !suborder_not_supported (cqr)) { +if (!rc) + goto out; + +if (suborder_not_supported (cqr)) { +/* suborder not supported or device unusable for IO */ + rc = -EOPNOTSUPP ; + }else { +/* IO failed but should be retried */ spin_lock_irqsave (&lcu->lock, flags); lcu->flags |=NEED_UAC_UPDATE ;spin_unlock_irqrestore (&lcu->lock, flags); } +out:dasd_sfree_request (cqr, cqr->memdev);return rc; }
Greg Kroah-Hartman
maintainerPATCH 256/346 Input: cros_ec_keyb - send scancodes in addition to key events
In reply to Greg Kroah-HartmanFrom: Dmitry Torokhov <[email protected]>
[ Upstream commit 80db2a087f425b63f0163bc95217abd01c637cb5 ]
To let userspace know what 'scancodes' should be used in EVIOCGKEYCODE and EVIOCSKEYCODE ioctls, we should send EV_MSC/MSC_SCAN events in addition to EV_KEY/KEY_* events. The driver already declared MSC_SCAN capability, so it is only matter of actually sending the events.
--- drivers/input/keyboard/cros_ec_keyb.c | 1 + 1 file changed, 1 insertion(+)
drivers/input/keyboard/cros_ec_keyb.c +1 -0
@@ -183,6 +183,7 @@ static void cros_ec_keyb_process(struct cros_ec_keyb *ckdev,"changed: [r%d c%d]: byte %02x\n" , row, col, new_state); +input_event (idev,EV_MSC ,MSC_SCAN , pos);input_report_key (idev, keycodes[pos], new_state); }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 258/346 media: gspca: Fix memory leak in probe
In reply to Greg Kroah-HartmanFrom: Alan Stern <[email protected]>
commit e469d0b09a19496e1972a20974bbf55b728151eb upstream.
The gspca driver leaks memory when a probe fails. gspca_dev_probe2() calls v4l2_device_register(), which takes a reference to the underlying device node (in this case, a USB interface). But the failure pathway neglects to call v4l2_device_unregister(), the routine responsible for dropping this reference. Consequently the memory for the USB interface and its device never gets released.
This patch adds the missing function call.
--- drivers/media/usb/gspca/gspca.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/usb/gspca/gspca.c +1 -0
@@ -1585,6 +1585,7 @@ out:input_unregister_device (gspca_dev->input_dev);#endif v4l2_ctrl_handler_free (gspca_dev->vdev.ctrl_handler); +v4l2_device_unregister (&gspca_dev->v4l2_dev);kfree (gspca_dev->usb_buf);kfree (gspca_dev);return ret;
Greg Kroah-Hartman
maintainerPATCH 267/346 ALSA: hda/ca0132 - Change Input Source enum strings.
In reply to Greg Kroah-HartmanFrom: Connor McAdams <[email protected]>
commit 7079f785b50055a32b72eddcb7d9ba5688db24d0 upstream.
Change the Input Source enumerated control's strings to make it play nice with pulseaudio.
--- sound/pci/hda/patch_ca0132.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/hda/patch_ca0132.c +1 -1
@@ -106,7 +106,7 @@ enum { };/* Strings for Input Source Enum Control */ -static const char *const in_src_str[3 ] = {"Rear Mic" ,"Line" ,"Front Mic" }; +static const char *const in_src_str[3 ] = {"Microphone" ,"Line In" ,"Front Microphone" };#define IN_SRC_NUM_OF_INPUTS 3enum {REAR_MIC ,
Greg Kroah-Hartman
maintainerPATCH 255/346 lwt: Disable BH too in run_lwt_bpf()
In reply to Greg Kroah-HartmanFrom: Dongdong Wang <[email protected]>
[ Upstream commit d9054a1ff585ba01029584ab730efc794603d68f ]
The per-cpu bpf_redirect_info is shared among all skb_do_redirect() and BPF redirect helpers. Callers on RX path are all in BH context, disabling preemption is not sufficient to prevent BH interruption.
In production, we observed strange packet drops because of the race condition between LWT xmit and TC ingress, and we verified this issue is fixed after we disable BH.
Although this bug was technically introduced from the beginning, that is commit 3a0af8fd61f9 ("bpf: BPF for lightweight tunnel infrastructure"), at that time call_rcu() had to be call_rcu_bh() to match the RCU context. So this patch may not work well before RCU flavor consolidation has been completed around v5.0.
Update the comments above the code too, as call_rcu() is now BH friendly.
--- net/core/lwt_bpf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
net/core/lwt_bpf.c +4 -4
@@ -44,12 +44,11 @@ static int run_lwt_bpf(struct sk_buff *skb, struct bpf_lwt_prog *lwt, {int ret; -/* Preempt disable is needed to protect per-cpu redirect_info between -* BPF prog and skb_do_redirect(). The call_rcu in bpf_prog_put() and -* access to maps strictly require a rcu_read_lock() for protection, -* mixing with BH RCU lock doesn't work. +/* Preempt disable and BH disable are needed to protect per-cpu +* redirect_info between BPF prog and skb_do_redirect(). */ preempt_disable (); +local_bh_disable ();bpf_compute_data_pointers (skb); ret =bpf_prog_run_save_cb (lwt->prog, skb);
@@ -82,6 +81,7 @@ static int run_lwt_bpf(struct sk_buff *skb, struct bpf_lwt_prog *lwt,break ; } +local_bh_enable ();preempt_enable ();return ret;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 274/346 ALSA: pcm: oss: Fix a few more UBSAN fixes
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 11cb881bf075cea41092a20236ba708b18e1dbb2 upstream.
There are a few places that call round{up|down}_pow_of_two() with the value zero, and this causes undefined behavior warnings. Avoid calling those macros if such a nonsense value is passed; it's a minor optimization as well, as we handle it as either an error or a value to be skipped, instead.
--- sound/core/oss/pcm_oss.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-)
sound/core/oss/pcm_oss.c +14 -8
@@ -708,6 +708,8 @@ static int snd_pcm_oss_period_size(struc oss_buffer_size =snd_pcm_plug_client_size (substream,snd_pcm_hw_param_value_max (slave_params,SNDRV_PCM_HW_PARAM_BUFFER_SIZE ,NULL )) * oss_frame_size; +if (!oss_buffer_size) +return -EINVAL ; oss_buffer_size =rounddown_pow_of_two (oss_buffer_size);if (atomic_read (&substream->mmap_count)) {if (oss_buffer_size > runtime->oss.mmap_bytes)
@@ -743,17 +745,21 @@ static int snd_pcm_oss_period_size(struc min_period_size =snd_pcm_plug_client_size (substream,snd_pcm_hw_param_value_min (slave_params,SNDRV_PCM_HW_PARAM_PERIOD_SIZE ,NULL )); - min_period_size *= oss_frame_size; - min_period_size =roundup_pow_of_two (min_period_size); -if (oss_period_size < min_period_size) - oss_period_size = min_period_size; +if (min_period_size) { + min_period_size *= oss_frame_size; + min_period_size =roundup_pow_of_two (min_period_size); +if (oss_period_size < min_period_size) + oss_period_size = min_period_size; + } max_period_size =snd_pcm_plug_client_size (substream,snd_pcm_hw_param_value_max (slave_params,SNDRV_PCM_HW_PARAM_PERIOD_SIZE ,NULL )); - max_period_size *= oss_frame_size; - max_period_size =rounddown_pow_of_two (max_period_size); -if (oss_period_size > max_period_size) - oss_period_size = max_period_size; +if (max_period_size) { + max_period_size *= oss_frame_size; + max_period_size =rounddown_pow_of_two (max_period_size); +if (oss_period_size > max_period_size) + oss_period_size = max_period_size; + } oss_periods = oss_buffer_size / oss_period_size;
Greg Kroah-Hartman
maintainerPATCH 282/346 s390/dasd: prevent inconsistent LCU device data
In reply to Greg Kroah-HartmanFrom: Stefan Haberland <[email protected]>
commit a29ea01653493b94ea12bb2b89d1564a265081b6 upstream.
Prevent _lcu_update from adding a device to a pavgroup if the LCU still requires an update. The data is not reliable any longer and in parallel devices might have been moved on the lists already.
This might lead to list corruptions or invalid PAV grouping. Only add devices to a pavgroup if the LCU is up to date. Additional steps are taken by the scheduled lcu update.
--- drivers/s390/block/dasd_alias.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/s390/block/dasd_alias.c +9 -0
@@ -511,6 +511,14 @@ static int _lcu_update(struct dasd_devicreturn rc;spin_lock_irqsave (&lcu->lock, flags); +/* +* there is another update needed skip the remaining handling +* the data might already be outdated +* but especially do not add the device to an LCU with pending +* update +*/ +if (lcu->flags &NEED_UAC_UPDATE ) + goto out; lcu->pav =NO_PAV ;for (i =0 ; i <MAX_DEVICES_PER_LCU ; ++i) {switch (lcu->uac->unit[i].ua_type) {
@@ -529,6 +537,7 @@ static int _lcu_update(struct dasd_devic alias_list) {_add_device_to_lcu (lcu, device, refdev); } +out:spin_unlock_irqrestore (&lcu->lock, flags);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 252/346 ARM: sunxi: Add machine match for the Allwinner V3 SoC
In reply to Greg Kroah-HartmanFrom: Paul Kocialkowski <[email protected]>
[ Upstream commit ad2091f893bd5dfe2824f0d6819600d120698e9f ]
The Allwinner V3 SoC shares the same base as the V3s but comes with extra pins and features available. As a result, it has its dedicated compatible string (already used in device trees), which is added here.
--- arch/arm/mach-sunxi/sunxi.c | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-sunxi/sunxi.c +1 -0
@@ -66,6 +66,7 @@ static const char * const sun8i_board_dt_compat[] = {"allwinner,sun8i-h2-plus" ,"allwinner,sun8i-h3" ,"allwinner,sun8i-r40" , +"allwinner,sun8i-v3" ,"allwinner,sun8i-v3s" , NULL, };
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 278/346 ALSA: usb-audio: Disable sample read check if firmware doesnt give back
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 9df28edce7c6ab38050235f6f8b43dd7ccd01b6d upstream.
Some buggy firmware don't give the current sample rate but leaves zero. Handle this case more gracefully without warning but just skip the current rate verification from the next time.
--- sound/usb/clock.c | 6 ++++++ 1 file changed, 6 insertions(+)
sound/usb/clock.c +6 -0
@@ -508,6 +508,12 @@ static int set_sample_rate_v1(struct snd } crate = data[0 ] | (data[1 ] <<8 ) | (data[2 ] <<16 ); +if (!crate) { +dev_info (&dev->dev,"failed to read current rate; disabling the check\n" ); + chip->sample_rate_read_error =3 ;/* three strikes, see above */ +return 0 ; + } +if (crate != rate) {dev_warn (&dev->dev,"current rate %d is different from the runtime rate %d\n" , crate, rate);// runtime->rate = crate;
Greg Kroah-Hartman
maintainerPATCH 216/346 usb: ehci-omap: Fix PM disable depth umbalance in ehci_hcd_omap_probe
In reply to Greg Kroah-HartmanFrom: Zhang Qilong <[email protected]>
[ Upstream commit d6ff32478d7e95d6ca199b5c852710d6964d5811 ]
The pm_runtime_enable will decrement the power disable depth. Imbalance depth will resulted in enabling runtime PM of device fails later. Thus a pairing decrement must be needed on the error handling path to keep it balanced.
--- drivers/usb/host/ehci-omap.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/host/ehci-omap.c +1 -0
@@ -222,6 +222,7 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) err_pm_runtime:pm_runtime_put_sync (dev); +pm_runtime_disable (dev); err_phy:for (i =0 ; i < omap->nports; i++) {
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 259/346 media: sunxi-cir: ensure IR is handled when it is continuous
In reply to Greg Kroah-HartmanFrom: Sean Young <[email protected]>
commit 3f56df4c8ffeb120ed41906d3aae71799b7e726a upstream.
If a user holds a button down on a remote, then no ir idle interrupt will be generated until the user releases the button, depending on how quickly the remote repeats. No IR is processed until that point, which means that holding down a button may not do anything.
This also resolves an issue on a Cubieboard 1 where the IR receiver is picking up ambient infrared as IR and spews out endless
"rc rc0: IR event FIFO is full!" messages unless you choose to live in the dark.
--- drivers/media/rc/sunxi-cir.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/rc/sunxi-cir.c +2 -0
@@ -129,6 +129,8 @@ static irqreturn_t sunxi_ir_irq(int irqn }else if (status ®_RXINT_RPEI_EN ) {ir_raw_event_set_idle (ir->rc, true);ir_raw_event_handle (ir->rc); + }else { +ir_raw_event_handle (ir->rc); }spin_unlock (&ir->ir_lock);
Greg Kroah-Hartman
maintainerPATCH 261/346 media: ipu3-cio2: Remove traces of returned buffers
In reply to Greg Kroah-HartmanFrom: Sakari Ailus <[email protected]>
commit 61e7f892b5ee1dd10ea8bff805f3c3fe6e535959 upstream.
If starting a video buffer queue fails, the buffers are returned to videobuf2. Remove the reference to the buffer from the driver's queue as well.
--- drivers/media/pci/intel/ipu3/ipu3-cio2.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/pci/intel/ipu3/ipu3-cio2.c +1 -0
@@ -801,6 +801,7 @@ static void cio2_vb2_return_all_buffers(atomic_dec (&q->bufs_queued);vb2_buffer_done (&q->bufs[i]->vbb.vb2_buf, state); + q->bufs[i] =NULL ; } } }
Greg Kroah-Hartman
maintainerPATCH 224/346 extcon: max77693: Fix modalias string
In reply to Greg Kroah-HartmanFrom: Marek Szyprowski <[email protected]>
[ Upstream commit e1efdb604f5c9903a5d92ef42244009d3c04880f ]
The platform device driver name is "max77693-muic", so advertise it properly in the modalias string. This fixes automated module loading when this driver is compiled as a module.
--- drivers/extcon/extcon-max77693.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/extcon/extcon-max77693.c +1 -1
@@ -1275,4 +1275,4 @@ module_platform_driver(max77693_muic_driver);MODULE_DESCRIPTION ("Maxim MAX77693 Extcon driver" );MODULE_AUTHOR ("Chanwoo Choi <[email protected]>" );MODULE_LICENSE ("GPL" ); -MODULE_ALIAS ("platform:extcon-max77693" ); +MODULE_ALIAS ("platform:max77693-muic" );
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 265/346 media: ipu3-cio2: Make the field on subdev format V4L2_FIELD_NONE
In reply to Greg Kroah-HartmanFrom: Sakari Ailus <[email protected]>
commit 219a8b9c04e54872f9a4d566633fb42f08bcbe2a upstream.
The ipu3-cio2 doesn't make use of the field and this is reflected in V4L2 buffers as well as the try format. Do this in active format, too.
--- drivers/media/pci/intel/ipu3/ipu3-cio2.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/pci/intel/ipu3/ipu3-cio2.c +1 -0
@@ -1299,6 +1299,7 @@ static int cio2_subdev_set_fmt(struct v4 fmt->format.width =min_t (u32, fmt->format.width,CIO2_IMAGE_MAX_WIDTH ); fmt->format.height =min_t (u32, fmt->format.height,CIO2_IMAGE_MAX_LENGTH ); + fmt->format.field =V4L2_FIELD_NONE ;mutex_lock (&q->subdev_lock); *mbus = fmt->format;
Greg Kroah-Hartman
maintainerPATCH 223/346 clk: tegra: Fix duplicated SE clock entry
In reply to Greg Kroah-HartmanFrom: Dmitry Osipenko <[email protected]>
[ Upstream commit 5bf5861d6ea6c3f4b38fc8fda2062b2dc44ac63d ]
The periph_clks[] array contains duplicated entry for Security Engine clock which was meant to be defined for T210, but it wasn't added properly. This patch corrects the T210 SE entry and fixes the following error message on T114/T124: "Tegra clk 127: register failed with -17".
Tested-by Nicolas Chauvet <[email protected]>
Reported-by Nicolas Chauvet <[email protected]>
--- drivers/clk/tegra/clk-id.h | 1 + drivers/clk/tegra/clk-tegra-periph.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/clk/tegra/clk-id.h +1 -0
@@ -233,6 +233,7 @@ enum clk_id { tegra_clk_sdmmc4, tegra_clk_sdmmc4_8, tegra_clk_se, + tegra_clk_se_10, tegra_clk_soc_therm, tegra_clk_soc_therm_8, tegra_clk_sor0,
drivers/clk/tegra/clk-tegra-periph.c +1 -1
@@ -650,7 +650,7 @@ static struct tegra_periph_init_data periph_clks[] = {INT8 ("host1x" , mux_pllm_pllc2_c_c3_pllp_plla,CLK_SOURCE_HOST1X ,28 ,0 , tegra_clk_host1x_8),INT8 ("host1x" , mux_pllc4_out1_pllc_pllc4_out2_pllp_clkm_plla_pllc4_out0,CLK_SOURCE_HOST1X ,28 ,0 , tegra_clk_host1x_9),INT8 ("se" , mux_pllp_pllc2_c_c3_pllm_clkm,CLK_SOURCE_SE ,127 ,TEGRA_PERIPH_ON_APB , tegra_clk_se), -INT8 ("se" , mux_pllp_pllc2_c_c3_clkm,CLK_SOURCE_SE ,127 ,TEGRA_PERIPH_ON_APB , tegra_clk_se), +INT8 ("se" , mux_pllp_pllc2_c_c3_clkm,CLK_SOURCE_SE ,127 ,TEGRA_PERIPH_ON_APB , tegra_clk_se_10),INT8 ("2d" , mux_pllm_pllc2_c_c3_pllp_plla,CLK_SOURCE_2D ,21 ,0 , tegra_clk_gr2d_8),INT8 ("3d" , mux_pllm_pllc2_c_c3_pllp_plla,CLK_SOURCE_3D ,24 ,0 , tegra_clk_gr3d_8), INT8("vic03", mux_pllm_pllc_pllp_plla_pllc2_c3_clkm, CLK_SOURCE_VIC03, 178, 0, tegra_clk_vic03),
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 240/346 net: korina: fix return value
In reply to Greg Kroah-HartmanFrom: Vincent Stehlé <[email protected]>
[ Upstream commit 7eb000bdbe7c7da811ef51942b356f6e819b13ba ]
The ndo_start_xmit() method must not attempt to free the skb to transmit when returning NETDEV_TX_BUSY. Therefore, make sure the korina_send_packet() function returns NETDEV_TX_OK when it frees a packet.
--- drivers/net/ethernet/korina.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/korina.c +1 -1
@@ -219,7 +219,7 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev)dev_kfree_skb_any (skb);spin_unlock_irqrestore (&lp->lock, flags); -return NETDEV_TX_BUSY ; +return NETDEV_TX_OK ; } }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 222/346 bus: fsl-mc: fix error return code in fsl_mc_object_allocate()
In reply to Greg Kroah-HartmanFrom: Zhang Changzhong <[email protected]>
[ Upstream commit 3d70fb03711c37bc64e8e9aea5830f498835f6bf ]
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.
--- drivers/bus/fsl-mc/fsl-mc-allocator.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/bus/fsl-mc/fsl-mc-allocator.c +3 -1
@@ -292,8 +292,10 @@ int __must_check fsl_mc_object_allocate(struct fsl_mc_device *mc_dev, goto error; mc_adev = resource->data; -if (!mc_adev) +if (!mc_adev) { + error = -EINVAL ; goto error; + } *new_mc_adev = mc_adev;return 0 ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 221/346 x86/kprobes: Restore BTF if the single-stepping is cancelled
In reply to Greg Kroah-HartmanFrom: Masami Hiramatsu <[email protected]>
[ Upstream commit 78ff2733ff352175eb7f4418a34654346e1b6cd2 ]
Fix to restore BTF if single-stepping causes a page fault and it is cancelled.
Usually the BTF flag was restored when the single stepping is done (in resume_execution()). However, if a page fault happens on the single stepping instruction, the fault handler is invoked and the single stepping is cancelled. Thus, the BTF flag is not restored.
--- arch/x86/kernel/kprobes/core.c | 5 +++++ 1 file changed, 5 insertions(+)
arch/x86/kernel/kprobes/core.c +5 -0
@@ -1041,6 +1041,11 @@ int kprobe_fault_handler(struct pt_regs *regs, int trapnr)* So clear it by resetting the current kprobe: */ regs->flags &= ~X86_EFLAGS_TF ; +/* +* Since the single step (trap) has been cancelled, +* we need to restore BTF here. +*/ +restore_btf ();/* * If the TF flag was set before the kprobe hit,
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 225/346 mac80211: dont set set TDLS STA bandwidth wider than possible
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit f65607cdbc6b0da356ef5a22552ddd9313cf87a0 ]
When we set up a TDLS station, we set sta->sta.bandwidth solely based on the capabilities, because the "what's the current bandwidth" check is bypassed and only applied for other types of stations.
This leads to the unfortunate scenario that the sta->sta.bandwidth is 160 MHz if both stations support it, but we never actually configure this bandwidth unless the AP is already using 160 MHz; even for wider bandwidth support we only go up to 80 MHz (at least right now.)
For iwlwifi, this can also lead to firmware asserts, telling us that we've configured the TX rates for a higher bandwidth than is actually available due to the PHY configuration.
For non-TDLS, we check against the interface's requested bandwidth, but we explicitly skip this check for TDLS to cope with the wider BW case. Change this to
(a) still limit to the TDLS peer's own chandef, which gets factored into the overall PHY configuration we request from the driver, and
(b) limit it to when the TDLS peer is authorized, because it's only factored into the channel context in this case.
--- net/mac80211/vht.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
net/mac80211/vht.c +10 -4
@@ -421,12 +421,18 @@ enum ieee80211_sta_rx_bandwidth ieee80211_sta_cur_vht_bw(struct sta_info *sta)* IEEE80211-2016 specification makes higher bandwidth operation * possible on the TDLS link if the peers have wider bandwidth * capability. +* +* However, in this case, and only if the TDLS peer is authorized, +* limit to the tdls_chandef so that the configuration here isn't +* wider than what's actually requested on the channel context. */ if (test_sta_flag (sta,WLAN_STA_TDLS_PEER ) && -test_sta_flag (sta,WLAN_STA_TDLS_WIDER_BW )) -return bw; - - bw =min (bw,ieee80211_chan_width_to_rx_bw (bss_width)); +test_sta_flag (sta,WLAN_STA_TDLS_WIDER_BW ) && +test_sta_flag (sta,WLAN_STA_AUTHORIZED ) && + sta->tdls_chandef.chan) + bw =min (bw,ieee80211_chan_width_to_rx_bw (sta->tdls_chandef.width)); +else + bw =min (bw,ieee80211_chan_width_to_rx_bw (bss_width));return bw; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 248/346 qlcnic: Fix error code in probe
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 0d52848632a357948028eab67ff9b7cc0c12a0fb ]
Return -EINVAL if we can't find the correct device. Currently it returns success.
--- drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +1 -0
@@ -2508,6 +2508,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)qlcnic_sriov_vf_register_map (ahw);break ;default : + err = -EINVAL ; goto err_out_free_hw_res; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 219/346 nfsd: Fix message level for normal termination
In reply to Greg Kroah-HartmanFrom: kazuo ito <[email protected]>
[ Upstream commit 4420440c57892779f265108f46f83832a88ca795 ]
The warning message from nfsd terminating normally can confuse system adminstrators or monitoring software.
Though it's not exactly fair to pin-point a commit where it originated, the current form in the current place started to appear in:
--- fs/nfsd/nfssvc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/nfsd/nfssvc.c +1 -2
@@ -417,8 +417,7 @@ static void nfsd_last_thread(struct svc_serv *serv, struct net *net)return ;nfsd_shutdown_net (net); -printk (KERN_WARNING "nfsd: last server has exited, flushing export " -"cache\n" ); +pr_info ("nfsd: last server has exited, flushing export cache\n" );nfsd_export_flush (net); }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 188/346 ath10k: Release some resources in an error handling path
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 6364e693f4a7a89a2fb3dd2cbd6cc06d5fd6e26d ]
Should an error occur after calling 'ath10k_usb_create()', it should be undone by a corresponding 'ath10k_usb_destroy()' call
--- drivers/net/wireless/ath/ath10k/usb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/usb.c +4 -1
@@ -1032,7 +1032,7 @@ static int ath10k_usb_probe(struct usb_interface *interface, ret =ath10k_core_register (ar, chip_id);if (ret) {ath10k_warn (ar,"failed to register driver core: %d\n" , ret); - goto err; + goto err_usb_destroy; }/* TODO: remove this once USB support is fully implemented */
@@ -1040,6 +1040,9 @@ static int ath10k_usb_probe(struct usb_interface *interface,return 0 ; +err_usb_destroy: +ath10k_usb_destroy (ar); + err:ath10k_core_destroy (ar);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 211/346 seq_buf: Avoid type mismatch for seq_buf_init
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit d9a9280a0d0ae51dc1d4142138b99242b7ec8ac6 ]
Building with W=2 prints a number of warnings for one function that has a pointer type mismatch:
linux/seq_buf.h: In function 'seq_buf_init':linux/seq_buf.h:35:12: warning: pointer targets in assignment from 'unsigned char *' to 'char *' differ in signedness [-Wpointer-sign]
Change the type in the function prototype according to the type in the structure.
--- include/linux/seq_buf.h | 2 +- include/linux/trace_seq.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
include/linux/seq_buf.h +1 -1
@@ -30,7 +30,7 @@ static inline void seq_buf_clear(struct seq_buf *s) }static inline void -seq_buf_init (struct seq_buf *s,unsigned char *buf,unsigned int size) +seq_buf_init (struct seq_buf *s,char *buf,unsigned int size) { s->buffer = buf; s->size = size;
include/linux/trace_seq.h +2 -2
@@ -12,7 +12,7 @@*/ struct trace_seq { -unsigned char buffer[PAGE_SIZE ]; +char buffer[PAGE_SIZE ];struct seq_buf seq;int full; };
@@ -51,7 +51,7 @@ static inline int trace_seq_used(struct trace_seq *s)* that is about to be written to and then return the result * of that write. */ -static inline unsigned char * +static inline char *trace_seq_buffer_ptr (struct trace_seq *s) {return s->buffer +seq_buf_used (&s->seq);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 238/346 net: bcmgenet: Fix a resource leak in an error handling path in the probe functin
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 4375ada01963d1ebf733d60d1bb6e5db401e1ac6 ]
If the 'register_netdev()' call fails, we must undo a previous 'bcmgenet_mii_init()' call.
--- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/genet/bcmgenet.c +3 -1
@@ -3593,8 +3593,10 @@ static int bcmgenet_probe(struct platform_device *pdev)clk_disable_unprepare (priv->clk); err =register_netdev (dev); -if (err) +if (err) { +bcmgenet_mii_exit (dev); goto err; + }return err;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 208/346 cpufreq: scpi: Add missing MODULE_ALIAS
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit c0382d049d2def37b81e907a8b22661a4a4a6eb5 ]
This patch adds missing MODULE_ALIAS for automatic loading of this cpufreq driver when it is compiled as an external module.
--- drivers/cpufreq/scpi-cpufreq.c | 1 + 1 file changed, 1 insertion(+)
drivers/cpufreq/scpi-cpufreq.c +1 -0
@@ -246,6 +246,7 @@ static struct platform_driver scpi_cpufreq_platdrv = { };module_platform_driver (scpi_cpufreq_platdrv); +MODULE_ALIAS ("platform:scpi-cpufreq" );MODULE_AUTHOR ("Sudeep Holla <[email protected]>" );MODULE_DESCRIPTION ("ARM SCPI CPUFreq interface driver" );MODULE_LICENSE ("GPL v2" );
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 209/346 scsi: qedi: Fix missing destroy_workqueue() on error in __qedi_probe
In reply to Greg Kroah-HartmanFrom: Qinglang Miao <[email protected]>
[ Upstream commit 62eebd5247c4e4ce08826ad5995cf4dd7ce919dd ]
Add the missing destroy_workqueue() before return from __qedi_probe in the error handling case when fails to create workqueue qedi->offload_thread.
--- drivers/scsi/qedi/qedi_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/qedi/qedi_main.c +3 -1
@@ -2580,7 +2580,7 @@ static int __qedi_probe(struct pci_dev *pdev, int mode)QEDI_ERR (&qedi->dbg_ctx,"Unable to start offload thread!\n" ); rc = -ENODEV ; - goto free_cid_que; + goto free_tmf_thread; }/* F/w needs 1st task context memory entry for performance */
@@ -2600,6 +2600,8 @@ static int __qedi_probe(struct pci_dev *pdev, int mode)return 0 ; +free_tmf_thread: +destroy_workqueue (qedi->tmf_thread); free_cid_que:qedi_release_cid_que (qedi); free_uio:
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 207/346 cpufreq: loongson1: Add missing MODULE_ALIAS
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit b9acab091842ca8b288882798bb809f7abf5408a ]
This patch adds missing MODULE_ALIAS for automatic loading of this cpufreq driver when it is compiled as an external module.
--- drivers/cpufreq/loongson1-cpufreq.c | 1 + 1 file changed, 1 insertion(+)
drivers/cpufreq/loongson1-cpufreq.c +1 -0
@@ -217,6 +217,7 @@ static struct platform_driver ls1x_cpufreq_platdrv = {module_platform_driver (ls1x_cpufreq_platdrv); +MODULE_ALIAS ("platform:ls1x-cpufreq" );MODULE_AUTHOR ("Kelvin Cheung <[email protected]>" );MODULE_DESCRIPTION ("Loongson1 CPUFreq driver" );MODULE_LICENSE ("GPL" );
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 205/346 cpufreq: mediatek: Add missing MODULE_DEVICE_TABLE
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit af6eca06501118af3e2ad46eee8edab20624b74e ]
This patch adds missing MODULE_DEVICE_TABLE definition which generates correct modalias for automatic loading of this cpufreq driver when it is compiled as an external module.
--- drivers/cpufreq/mediatek-cpufreq.c | 1 + 1 file changed, 1 insertion(+)
drivers/cpufreq/mediatek-cpufreq.c +1 -0
@@ -554,6 +554,7 @@ static const struct of_device_id mtk_cpufreq_machines[] __initconst = { { } }; +MODULE_DEVICE_TABLE (of, mtk_cpufreq_machines);static int __init mtk_cpufreq_driver_init (void ) {
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 206/346 cpufreq: st: Add missing MODULE_DEVICE_TABLE
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit 183747ab52654eb406fc6b5bfb40806b75d31811 ]
This patch adds missing MODULE_DEVICE_TABLE definition which generates correct modalias for automatic loading of this cpufreq driver when it is compiled as an external module.
--- drivers/cpufreq/sti-cpufreq.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/cpufreq/sti-cpufreq.c +7 -0
@@ -295,6 +295,13 @@ register_cpufreq_dt: }module_init (sti_cpufreq_init); +static const struct of_device_id __maybe_unused sti_cpufreq_of_match[] = { + { .compatible ="st,stih407" }, + { .compatible ="st,stih410" }, + { }, +}; +MODULE_DEVICE_TABLE (of, sti_cpufreq_of_match); +MODULE_DESCRIPTION ("STMicroelectronics CPUFreq/OPP driver" );MODULE_AUTHOR ("Ajitpal Singh <[email protected]>" );MODULE_AUTHOR ("Lee Jones <[email protected]>" );
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 213/346 platform/x86: mlx-platform: Fix item counter assignment for MSN2700, MSN24xx systems
In reply to Greg Kroah-HartmanFrom: Vadim Pasternak <[email protected]>
[ Upstream commit ba4939f1dd46dde08c2f9b9d7ac86ed3ea7ead86 ]
Fix array names to match assignments for data items and data items counter in 'mlxplat_mlxcpld_default_items' structure for:
.data = mlxplat_mlxcpld_default_pwr_items_data, .count = ARRAY_SIZE(mlxplat_mlxcpld_pwr),
and
.data = mlxplat_mlxcpld_default_fan_items_data, .count = ARRAY_SIZE(mlxplat_mlxcpld_fan),
Replace:
- 'mlxplat_mlxcpld_pwr' by 'mlxplat_mlxcpld_default_pwr_items_data' for ARRAY_SIZE() calculation.
- 'mlxplat_mlxcpld_fan' by 'mlxplat_mlxcpld_default_fan_items_data' for ARRAY_SIZE() calculation.
--- drivers/platform/x86/mlx-platform.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/mlx-platform.c +2 -2
@@ -333,7 +333,7 @@ static struct mlxreg_core_item mlxplat_mlxcpld_default_items[] = { .aggr_mask = MLXPLAT_CPLD_AGGR_PWR_MASK_DEF, .reg = MLXPLAT_CPLD_LPC_REG_PWR_OFFSET, .mask = MLXPLAT_CPLD_PWR_MASK, - .count = ARRAY_SIZE(mlxplat_mlxcpld_pwr), + .count = ARRAY_SIZE(mlxplat_mlxcpld_default_pwr_items_data), .inversed = 0, .health = false, },
@@ -342,7 +342,7 @@ static struct mlxreg_core_item mlxplat_mlxcpld_default_items[] = { .aggr_mask = MLXPLAT_CPLD_AGGR_FAN_MASK_DEF, .reg = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, .mask = MLXPLAT_CPLD_FAN_MASK, - .count = ARRAY_SIZE(mlxplat_mlxcpld_fan), + .count = ARRAY_SIZE(mlxplat_mlxcpld_default_fan_items_data), .inversed = 1, .health = false, },
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 204/346 cpufreq: highbank: Add missing MODULE_DEVICE_TABLE
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit 9433777a6e0aae27468d3434b75cd51bb88ff711 ]
This patch adds missing MODULE_DEVICE_TABLE definition which generates correct modalias for automatic loading of this cpufreq driver when it is compiled as an external module.
--- drivers/cpufreq/highbank-cpufreq.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/cpufreq/highbank-cpufreq.c +7 -0
@@ -104,6 +104,13 @@ out_put_node: }module_init (hb_cpufreq_driver_init); +static const struct of_device_id __maybe_unused hb_cpufreq_of_match[] = { + { .compatible ="calxeda,highbank" }, + { .compatible ="calxeda,ecx-2000" }, + { }, +}; +MODULE_DEVICE_TABLE (of, hb_cpufreq_of_match); +MODULE_AUTHOR ("Mark Langsdorf <[email protected]>" );MODULE_DESCRIPTION ("Calxeda Highbank cpufreq driver" );MODULE_LICENSE ("GPL" );
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 247/346 perf record: Fix memory leak when using --user-regs=? to list registers
In reply to Greg Kroah-HartmanFrom: Zheng Zengkai <[email protected]>
[ Upstream commit 2eb5dd418034ecea2f7031e3d33f2991a878b148 ]
When using 'perf record's option '-I' or '--user-regs=' along with argument '?' to list available register names, memory of variable 'os' allocated by strdup() needs to be released before __parse_regs() returns, otherwise memory leak will occur.
--- tools/perf/util/parse-regs-options.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/parse-regs-options.c +1 -1
@@ -41,7 +41,7 @@ parse_regs(const struct option *opt, const char *str, int unset) }fputc ('\n' , stderr);/* just printing available regs */ -return -1 ; + goto error; }for (r = sample_reg_masks; r->name; r++) {if (!strcasecmp (s, r->name))
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 203/346 clocksource/drivers/arm_arch_timer: Correct fault programming of CNTKCTL_EL1.EVNTI
In reply to Greg Kroah-HartmanFrom: Keqian Zhu <[email protected]>
[ Upstream commit 8b7770b877d187bfdae1eaf587bd2b792479a31c ]
ARM virtual counter supports event stream, it can only trigger an event when the trigger bit (the value of CNTKCTL_EL1.EVNTI) of CNTVCT_EL0 changes, so the actual period of event stream is 2^(cntkctl_evnti + 1). For example, when the trigger bit is 0, then virtual counter trigger an event for every two cycles.
While we're at it, rework the way we compute the trigger bit position by making it more obvious that when bits [n:n-1] are both set (with n being the most significant bit), we pick bit (n + 1).
--- drivers/clocksource/arm_arch_timer.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)
drivers/clocksource/arm_arch_timer.c +16 -7
@@ -827,15 +827,24 @@ static void arch_timer_evtstrm_enable(int divider)static void arch_timer_configure_evtstream (void ) { -int evt_stream_div, pos; +int evt_stream_div, lsb; + +/* +* As the event stream can at most be generated at half the frequency +* of the counter, use half the frequency when computing the divider. +*/ + evt_stream_div = arch_timer_rate /ARCH_TIMER_EVT_STREAM_FREQ /2 ; + +/* +* Find the closest power of two to the divisor. If the adjacent bit +* of lsb (last set bit, starts from 0) is set, then we use (lsb + 1). +*/ + lsb =fls (evt_stream_div) -1 ; +if (lsb >0 && (evt_stream_div &BIT (lsb -1 ))) + lsb++; -/* Find the closest power of two to the divisor */ - evt_stream_div = arch_timer_rate /ARCH_TIMER_EVT_STREAM_FREQ ; - pos =fls (evt_stream_div); -if (pos >1 && !(evt_stream_div & (1 << (pos -2 )))) - pos--;/* enable event stream */ -arch_timer_evtstrm_enable (min (pos,15 )); +arch_timer_evtstrm_enable (max (0 ,min (lsb,15 ))); }static void arch_counter_set_user_access (void )
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 185/346 platform/x86: dell-smbios-base: Fix error return code in dell_smbios_init
In reply to Greg Kroah-HartmanFrom: Qinglang Miao <[email protected]>
[ Upstream commit 2425ccd30fd78ce35237350fe8baac31dc18bd45 ]
Fix to return the error code -ENODEV when fails to init wmi and smm.
--- drivers/platform/x86/dell-smbios-base.c | 1 + 1 file changed, 1 insertion(+)
drivers/platform/x86/dell-smbios-base.c +1 -0
@@ -597,6 +597,7 @@ static int __init dell_smbios_init(void)if (wmi && smm) {pr_err ("No SMBIOS backends available (wmi: %d, smm: %d)\n" , wmi, smm); + ret = -ENODEV ; goto fail_create_group; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 198/346 arm64: dts: rockchip: Fix UART pull-ups on rk3328
In reply to Greg Kroah-HartmanFrom: Chen-Yu Tsai <[email protected]>
[ Upstream commit 94dad6bed3c86c00050bf7c2b2ad6b630facae31 ]
For UARTs, the local pull-ups should be on the RX pin, not the TX pin. UARTs transmit active-low, so a disconnected RX pin should be pulled high instead of left floating to prevent noise being interpreted as transmissions.
This gets rid of bogus sysrq events when the UART console is not connected.
--- arch/arm64/boot/dts/rockchip/rk3328.dtsi | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
arch/arm64/boot/dts/rockchip/rk3328.dtsi +8 -8
@@ -1085,8 +1085,8 @@ uart0 { uart0_xfer: uart0-xfer { - rockchip,pins = <1 RK_PB1 1 &pcfg_pull_up>, - <1 RK_PB0 1 &pcfg_pull_none>; + rockchip,pins = <1 RK_PB1 1 &pcfg_pull_none>, + <1 RK_PB0 1 &pcfg_pull_up>; }; uart0_cts: uart0-cts {
@@ -1104,8 +1104,8 @@ uart1 { uart1_xfer: uart1-xfer { - rockchip,pins = <3 RK_PA4 4 &pcfg_pull_up>, - <3 RK_PA6 4 &pcfg_pull_none>; + rockchip,pins = <3 RK_PA4 4 &pcfg_pull_none>, + <3 RK_PA6 4 &pcfg_pull_up>; }; uart1_cts: uart1-cts {
@@ -1123,15 +1123,15 @@ uart2-0 { uart2m0_xfer: uart2m0-xfer { - rockchip,pins = <1 RK_PA0 2 &pcfg_pull_up>, - <1 RK_PA1 2 &pcfg_pull_none>; + rockchip,pins = <1 RK_PA0 2 &pcfg_pull_none>, + <1 RK_PA1 2 &pcfg_pull_up>; }; }; uart2-1 { uart2m1_xfer: uart2m1-xfer { - rockchip,pins = <2 RK_PA0 1 &pcfg_pull_up>, - <2 RK_PA1 1 &pcfg_pull_none>; + rockchip,pins = <2 RK_PA0 1 &pcfg_pull_none>, + <2 RK_PA1 1 &pcfg_pull_up>; }; };
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 155/346 spi: fix resource leak for drivers without .remove callback
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit 440408dbadfe47a615afd0a0a4a402e629be658a ]
Consider an spi driver with a .probe but without a .remove callback (e.g. rtc-ds1347). The function spi_drv_probe() is called to bind a device and so dev_pm_domain_attach() is called. As there is no remove callback spi_drv_remove() isn't called at unbind time however and so calling dev_pm_domain_detach() is missed and the pm domain keeps active.
To fix this always use both spi_drv_probe() and spi_drv_remove() and make them handle the respective callback not being set. This has the side effect that for a (hypothetical) driver that has neither .probe nor remove the clk and pm domain setup is done.
--- drivers/spi/spi.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
drivers/spi/spi.c +10 -9
@@ -362,9 +362,11 @@ static int spi_drv_probe(struct device *dev)if (ret)return ret; - ret = sdrv->probe (spi); -if (ret) -dev_pm_domain_detach (dev, true); +if (sdrv->probe) { + ret = sdrv->probe (spi); +if (ret) +dev_pm_domain_detach (dev, true); + }return ret; }
@@ -372,9 +374,10 @@ static int spi_drv_probe(struct device *dev)static int spi_drv_remove (struct device *dev) {const struct spi_driver *sdrv =to_spi_driver (dev->driver); -int ret; +int ret =0 ; - ret = sdrv->remove (to_spi_device (dev)); +if (sdrv->remove) + ret = sdrv->remove (to_spi_device (dev));dev_pm_domain_detach (dev, true);return ret;
@@ -399,10 +402,8 @@ int __spi_register_driver(struct module *owner, struct spi_driver *sdrv) { sdrv->driver.owner = owner; sdrv->driver.bus = &spi_bus_type; -if (sdrv->probe) - sdrv->driver.probe = spi_drv_probe; -if (sdrv->remove) - sdrv->driver.remove = spi_drv_remove; + sdrv->driver.probe = spi_drv_probe; + sdrv->driver.remove = spi_drv_remove;if (sdrv->shutdown) sdrv->driver.shutdown = spi_drv_shutdown;return driver_register (&sdrv->driver);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 179/346 genirq/irqdomain: Dont try to free an interrupt that has no mapping
In reply to Greg Kroah-HartmanFrom: Marc Zyngier <[email protected]>
[ Upstream commit 4615fbc3788ddc8e7c6d697714ad35a53729aa2c ]
When an interrupt allocation fails for N interrupts, it is pretty common for the error handling code to free the same number of interrupts, no matter how many interrupts have actually been allocated.
This may result in the domain freeing code to be unexpectedly called for interrupts that have no mapping in that domain. Things end pretty badly.
Instead, add some checks to irq_domain_free_irqs_hierarchy() to make sure that thiss does not follow the hierarchy if no mapping exists for a given interrupt.
--- kernel/irq/irqdomain.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
kernel/irq/irqdomain.c +9 -2
@@ -1247,8 +1247,15 @@ static void irq_domain_free_irqs_hierarchy(struct irq_domain *domain, unsigned int irq_base, unsigned int nr_irqs) { - if (domain->ops->free) - domain->ops->free(domain, irq_base, nr_irqs); +unsigned int i; + +if (!domain->ops->free) +return ; + +for (i =0 ; i < nr_irqs; i++) { +if (irq_domain_get_irq_data (domain, irq_base + i)) + domain->ops->free (domain, irq_base + i,1 ); + } } int irq_domain_alloc_irqs_hierarchy(struct irq_domain *domain,
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 181/346 PCI: Fix overflow in command-line resource alignment requests
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit cc73eb321d246776e5a9f7723d15708809aa3699 ]
The shift of 1 by align_order is evaluated using 32 bit arithmetic and the result is assigned to a resource_size_t type variable that is a 64 bit unsigned integer on 64 bit platforms. Fix an overflow before widening issue by making the 1 a ULL.
Addresses-Coverity: ("Unintentional integer overflow")
--- drivers/pci/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pci.c +1 -1
@@ -5854,7 +5854,7 @@ static resource_size_t pci_specified_resource_alignment(struct pci_dev *dev, ret =pci_dev_str_match (dev, p, &p);if (ret ==1 ) { *resize = true; - align =1 << align_order; + align =1ULL << align_order;break ; }else if (ret <0 ) { pr_err("PCI: Can't parse resource_alignment parameter: %s\n",
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 164/346 orinoco: Move context allocation after processing the skb
In reply to Greg Kroah-HartmanFrom: Sebastian Andrzej Siewior <[email protected]>
[ Upstream commit a31eb615646a63370aa1da1053c45439c7653d83 ]
ezusb_xmit() allocates a context which is leaked if orinoco_process_xmit_skb() returns an error.
Move ezusb_alloc_ctx() after the invocation of orinoco_process_xmit_skb() because the context is not needed so early. ezusb_access_ltv() will cleanup the context in case of an error.
--- .../net/wireless/intersil/orinoco/orinoco_usb.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/net/wireless/intersil/orinoco/orinoco_usb.c +7 -7
@@ -1237,13 +1237,6 @@ static netdev_tx_t ezusb_xmit(struct sk_buff *skb, struct net_device *dev)if (skb->len <ETH_HLEN ) goto drop; - ctx =ezusb_alloc_ctx (upriv,EZUSB_RID_TX ,0 ); -if (!ctx) - goto busy; - -memset (ctx->buf,0 ,BULK_BUF_SIZE ); - buf = ctx->buf->data; - tx_control =0 ; err = orinoco_process_xmit_skb(skb, dev, priv, &tx_control,
@@ -1251,6 +1244,13 @@ static netdev_tx_t ezusb_xmit(struct sk_buff *skb, struct net_device *dev)if (err) goto drop; + ctx =ezusb_alloc_ctx (upriv,EZUSB_RID_TX ,0 ); +if (!ctx) + goto drop; + +memset (ctx->buf,0 ,BULK_BUF_SIZE ); + buf = ctx->buf->data; + {__le16 *tx_cntl = (__le16 *)buf; *tx_cntl =cpu_to_le16 (tx_control);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 166/346 dmaengine: mv_xor_v2: Fix error return code in mv_xor_v2_probe()
In reply to Greg Kroah-HartmanFrom: Zhihao Cheng <[email protected]>
[ Upstream commit c95e6515a8c065862361f7e0e452978ade7f94ec ]
Return the corresponding error code when first_msi_entry() returns NULL in mv_xor_v2_probe().
--- drivers/dma/mv_xor_v2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/dma/mv_xor_v2.c +3 -1
@@ -777,8 +777,10 @@ static int mv_xor_v2_probe(struct platform_device *pdev) goto disable_clk; msi_desc =first_msi_entry (&pdev->dev); -if (!msi_desc) +if (!msi_desc) { + ret = -ENODEV ; goto free_msi_irqs; + } xor_dev->msi_desc = msi_desc; ret = devm_request_irq(&pdev->dev, msi_desc->irq,
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 168/346 platform/x86: mlx-platform: Remove PSU EEPROM from default platform configuration
In reply to Greg Kroah-HartmanFrom: Vadim Pasternak <[email protected]>
[ Upstream commit 2bf5046bdb649908df8bcc0a012c56eee931a9af ]
Remove PSU EEPROM configuration for systems class equipped with Mellanox chip Spectrum and Celeron CPU - system types MSN2700, MSN2100. Till now all the systems from this class used few types of power units, all equipped with EEPROM device with address space two bytes. Thus, all these devices have been handled by EEPROM driver "24c02".
There is a new requirement is to support power unit replacement by "off the shelf" device, matching electrical required parameters. Such device can be equipped with different EEPROM type, which could be one byte address space addressing or even could be not equipped with EEPROM. In such case "24c02" will not work.
--- drivers/platform/x86/mlx-platform.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/platform/x86/mlx-platform.c +2 -4
@@ -251,15 +251,13 @@ static struct mlxreg_core_data mlxplat_mlxcpld_default_psu_items_data[] = { .label = "psu1", .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET, .mask = BIT(0), - .hpdev.brdinfo = &mlxplat_mlxcpld_psu[0], - .hpdev.nr = MLXPLAT_CPLD_PSU_DEFAULT_NR, + .hpdev.nr = MLXPLAT_CPLD_NR_NONE, }, { .label = "psu2", .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET, .mask = BIT(1), - .hpdev.brdinfo = &mlxplat_mlxcpld_psu[1], - .hpdev.nr = MLXPLAT_CPLD_PSU_DEFAULT_NR, + .hpdev.nr = MLXPLAT_CPLD_NR_NONE, }, };
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 173/346 slimbus: qcom-ngd-ctrl: Avoid sending power requests without QMI
In reply to Greg Kroah-HartmanFrom: Bjorn Andersson <[email protected]>
[ Upstream commit 39014ce6d6028614a46395923a2c92d058b6fa87 ]
Attempting to send a power request during PM operations, when the QMI handle isn't initialized results in a NULL pointer dereference. So check if the QMI handle has been initialized before attempting to post the power requests.
--- drivers/slimbus/qcom-ngd-ctrl.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/slimbus/qcom-ngd-ctrl.c +6 -0
@@ -1200,6 +1200,9 @@ static int qcom_slim_ngd_runtime_resume(struct device *dev)struct qcom_slim_ngd_ctrl *ctrl =dev_get_drvdata (dev);int ret =0 ; +if (!ctrl->qmi.handle) +return 0 ; +if (ctrl->state >=QCOM_SLIM_NGD_CTRL_ASLEEP ) ret =qcom_slim_ngd_power_up (ctrl);if (ret) {
@@ -1493,6 +1496,9 @@ static int __maybe_unused qcom_slim_ngd_runtime_suspend(struct device *dev)struct qcom_slim_ngd_ctrl *ctrl =dev_get_drvdata (dev);int ret =0 ; +if (!ctrl->qmi.handle) +return 0 ; + ret =qcom_slim_qmi_power_request (ctrl, false);if (ret && ret != -EBUSY )dev_info (ctrl->dev,"slim resource not idle:%d\n" , ret);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 94/346 crypto: af_alg - avoid undefined behavior accessing salg_name
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
commit 92eb6c3060ebe3adf381fd9899451c5b047bb14d upstream.
Commit 3f69cc60768b ("crypto: af_alg - Allow arbitrarily long algorithm names") made the kernel start accepting arbitrarily long algorithm names in sockaddr_alg. However, the actual length of the salg_name field stayed at the original 64 bytes.
This is broken because the kernel can access indices >= 64 in salg_name, which is undefined behavior -- even though the memory that is accessed is still located within the sockaddr structure. It would only be defined behavior if the array were properly marked as arbitrary-length (either by making it a flexible array, which is the recommended way these days, or by making it an array of length 0 or 1).
We can't simply change salg_name into a flexible array, since that would break source compatibility with userspace programs that embed sockaddr_alg into another struct, or (more commonly) declare a sockaddr_alg like 'struct sockaddr_alg sa = { .salg_name = "foo" };'.
One solution would be to change salg_name into a flexible array only when '#ifdef __KERNEL__'. However, that would keep userspace without an easy way to actually use the longer algorithm names.
Instead, add a new structure 'sockaddr_alg_new' that has the flexible array field, and expose it to both userspace and the kernel. Make the kernel use it correctly in alg_bind().
This addresses the syzbot report
"UBSAN: array-index-out-of-bounds in alg_bind"
(https://syzkaller.appspot.com/bug?extid=92ead4eb8e26a26d465e).
--- crypto/af_alg.c | 10 +++++++--- include/uapi/linux/if_alg.h | 16 ++++++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-)
crypto/af_alg.c +7 -3
@@ -151,7 +151,7 @@ static int alg_bind(struct socket *sock,const u32 allowed =CRYPTO_ALG_KERN_DRIVER_ONLY ;struct sock *sk = sock->sk;struct alg_sock *ask =alg_sk (sk); -struct sockaddr_alg *sa = (void *)uaddr; +struct sockaddr_alg_new *sa = (void *)uaddr;const struct af_alg_type *type;void *private;int err;
@@ -159,7 +159,11 @@ static int alg_bind(struct socket *sock,if (sock->state ==SS_CONNECTED )return -EINVAL ; -if (addr_len <sizeof (*sa)) +BUILD_BUG_ON (offsetof(struct sockaddr_alg_new , salg_name) != + offsetof(struct sockaddr_alg , salg_name)); +BUILD_BUG_ON (offsetof(struct sockaddr_alg , salg_name) !=sizeof (*sa)); + +if (addr_len <sizeof (*sa) +1 )return -EINVAL ;/* If caller uses non-allowed flag, return error. */
@@ -167,7 +171,7 @@ static int alg_bind(struct socket *sock,return -EINVAL ; sa->salg_type[sizeof (sa->salg_type) -1 ] =0 ; - sa->salg_name[sizeof (sa->salg_name) + addr_len -sizeof (*sa) -1 ] =0 ; + sa->salg_name[addr_len -sizeof (*sa) -1 ] =0 ; type =alg_get_type (sa->salg_type);if (IS_ERR (type) &&PTR_ERR (type) == -ENOENT ) {
include/uapi/linux/if_alg.h +16 -0
@@ -24,6 +24,22 @@ struct sockaddr_alg {__u8 salg_name[64 ]; }; +/* +* Linux v4.12 and later removed the 64-byte limit on salg_name[]; it's now an +* arbitrary-length field. We had to keep the original struct above for source +* compatibility with existing userspace programs, though. Use the new struct +* below if support for very long algorithm names is needed. To do this, +* allocate 'sizeof(struct sockaddr_alg_new) + strlen(algname) + 1' bytes, and +* copy algname (including the null terminator) into salg_name. +*/ +struct sockaddr_alg_new { +__u16 salg_family; +__u8 salg_type[14 ]; +__u32 salg_feat; +__u32 salg_mask; +__u8 salg_name[]; +}; +struct af_alg_iv {__u32 ivlen;__u8 iv[0 ];
Greg Kroah-Hartman
maintainerPATCH 134/346 ASoC: arizona: Fix a wrong free in wm8997_probe
In reply to Greg Kroah-HartmanFrom: Zhang Qilong <[email protected]>
[ Upstream commit 5e7aace13df24ff72511f29c14ebbfe638ef733c ]
In the normal path, we should not free the arizona, we should return immediately. It will be free when call remove operation.
--- sound/soc/codecs/wm8997.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/codecs/wm8997.c +2 -0
@@ -1180,6 +1180,8 @@ static int wm8997_probe(struct platform_device *pdev) goto err_spk_irqs; } +return ret; + err_spk_irqs:arizona_free_spk_irqs (arizona);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 148/346 Input: ads7846 - fix integer overflow on Rt calculation
In reply to Greg Kroah-HartmanFrom: Oleksij Rempel <[email protected]>
[ Upstream commit 820830ec918f6c3dcd77a54a1c6198ab57407916 ]
In some rare cases the 32 bit Rt value will overflow if z2 and x is max, z1 is minimal value and x_plate_ohms is relatively high (for example 800 ohm). This would happen on some screen age with low pressure.
There are two possible fixes:
- make Rt 64bit
- reorder calculation to avoid overflow
The second variant seems to be preferable, since 64 bit calculation on 32 bit system is a bit more expensive.
--- drivers/input/touchscreen/ads7846.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/input/touchscreen/ads7846.c +3 -2
@@ -801,10 +801,11 @@ static void ads7846_report_state(struct ads7846 *ts)/* compute touch pressure resistance using equation #2 */ Rt = z2; Rt -= z1; - Rt *= x; Rt *= ts->x_plate_ohms; + Rt =DIV_ROUND_CLOSEST (Rt,16 ); + Rt *= x; Rt /= z1; - Rt = (Rt +2047 ) >>12 ; + Rt =DIV_ROUND_CLOSEST (Rt,256 ); }else { Rt =0 ; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 149/346 Input: ads7846 - fix unaligned access on 7845
In reply to Greg Kroah-HartmanFrom: Dmitry Torokhov <[email protected]>
[ Upstream commit 03e2c9c782f721b661a0e42b1b58f394b5298544 ]
req->sample[1] is not naturally aligned at word boundary, and therefore we should use get_unaligned_be16() when accessing it.
--- drivers/input/touchscreen/ads7846.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/input/touchscreen/ads7846.c +2 -1
@@ -35,6 +35,7 @@#include <linux/regulator/consumer.h> #include <linux/module.h> #include <asm/irq.h> +#include <asm/unaligned.h> /* * This code has been heavily tested on a Nokia 770, and lightly
@@ -434,7 +435,7 @@ static int ads7845_read12_ser(struct device *dev, unsigned command)if (status ==0 ) {/* BE12 value, then padding */ - status =be16_to_cpu (*((u16 *)&req->sample[1 ])); + status =get_unaligned_be16 (&req->sample[1 ]); status = status >>3 ; status &=0x0fff ; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 141/346 media: mtk-vcodec: add missing put_device() call in mtk_vcodec_release_dec_pm()
In reply to Greg Kroah-HartmanFrom: Yu Kuai <[email protected]>
[ Upstream commit 27c3943683f74e35e1d390ceb2e3639eff616ad6 ]
mtk_vcodec_release_dec_pm() will be called in two places:
a. mtk_vcodec_init_dec_pm() succeed while mtk_vcodec_probe() return error. b. mtk_vcodec_dec_remove().
In both cases put_device() call is needed, since of_find_device_by_node() was called in mtk_vcodec_init_dec_pm() previously.
Thus add put_devices() call in mtk_vcodec_release_dec_pm()
--- drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c +1 -0
@@ -103,6 +103,7 @@ int mtk_vcodec_init_dec_pm(struct mtk_vcodec_dev *mtkdev)void mtk_vcodec_release_dec_pm (struct mtk_vcodec_dev *dev) {pm_runtime_disable (dev->pm.dev); +put_device (dev->pm.larbvdec); }void mtk_vcodec_dec_pw_on (struct mtk_vcodec_pm *pm)
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 162/346 ARM: dts: at91: sama5d4_xplained: add pincontrol for USB Host
In reply to Greg Kroah-HartmanFrom: Cristian Birsan <[email protected]>
[ Upstream commit be4dd2d448816a27c1446f8f37fce375daf64148 ]
The pincontrol node is needed for USB Host since Linux v5.7-rc1. Without it the driver probes but VBus is not powered because of wrong pincontrol configuration.
--- arch/arm/boot/dts/at91-sama5d4_xplained.dts | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/boot/dts/at91-sama5d4_xplained.dts +7 -0
@@ -170,6 +170,11 @@ atmel,pins = <AT91_PIOE 31 AT91_PERIPH_GPIO AT91_PINCTRL_DEGLITCH>; }; + pinctrl_usb_default: usb_default { + atmel,pins = + <AT91_PIOE 11 AT91_PERIPH_GPIO AT91_PINCTRL_NONE + AT91_PIOE 14 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>; + }; pinctrl_key_gpio: key_gpio_0 { atmel,pins = <AT91_PIOE 8 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>;
@@ -195,6 +200,8 @@ &pioE 11 GPIO_ACTIVE_HIGH &pioE 14 GPIO_ACTIVE_HIGH >; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_usb_default>; status = "okay"; };
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 163/346 ARM: dts: at91: sama5d3_xplained: add pincontrol for USB Host
In reply to Greg Kroah-HartmanFrom: Cristian Birsan <[email protected]>
[ Upstream commit e1062fa7292f1e3744db0a487c4ac0109e09b03d ]
The pincontrol node is needed for USB Host since Linux v5.7-rc1. Without it the driver probes but VBus is not powered because of wrong pincontrol configuration.
--- arch/arm/boot/dts/at91-sama5d3_xplained.dts | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/boot/dts/at91-sama5d3_xplained.dts +7 -0
@@ -243,6 +243,11 @@ atmel,pins = <AT91_PIOE 9 AT91_PERIPH_GPIO AT91_PINCTRL_DEGLITCH>; /* PE9, conflicts with A9 */ }; + pinctrl_usb_default: usb_default { + atmel,pins = + <AT91_PIOE 3 AT91_PERIPH_GPIO AT91_PINCTRL_NONE + AT91_PIOE 4 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>; + }; }; }; };
@@ -260,6 +265,8 @@ &pioE 3 GPIO_ACTIVE_LOW &pioE 4 GPIO_ACTIVE_LOW >; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_usb_default>; status = "okay"; };
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 165/346 cw1200: fix missing destroy_workqueue() on error in cw1200_init_common
In reply to Greg Kroah-HartmanFrom: Qinglang Miao <[email protected]>
[ Upstream commit 7ec8a926188eb8e7a3cbaca43ec44f2d7146d71b ]
Add the missing destroy_workqueue() before return from cw1200_init_common in the error handling case.
--- drivers/net/wireless/st/cw1200/main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/st/cw1200/main.c +2 -0
@@ -384,6 +384,7 @@ static struct ieee80211_hw *cw1200_init_common(const u8 *macaddr, CW1200_LINK_ID_MAX, cw1200_skb_dtor, priv)) { +destroy_workqueue (priv->workqueue);ieee80211_free_hw (hw);return NULL ; }
@@ -395,6 +396,7 @@ static struct ieee80211_hw *cw1200_init_common(const u8 *macaddr,for (; i >0 ; i--)cw1200_queue_deinit (&priv->tx_queue[i -1 ]);cw1200_queue_stats_deinit (&priv->tx_queue_stats); +destroy_workqueue (priv->workqueue);ieee80211_free_hw (hw);return NULL ; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 126/346 spi: tegra20-slink: fix reference leak in slink ops of tegra20
In reply to Greg Kroah-HartmanFrom: Zhang Qilong <[email protected]>
[ Upstream commit 763eab7074f6e71babd85d796156f05a675f9510 ]
pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to pm_runtime_put_noidle will result in reference leak in two callers(tegra_slink_setup and tegra_slink_resume), so we should fix it.
--- drivers/spi/spi-tegra20-slink.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/spi/spi-tegra20-slink.c +2 -0
@@ -761,6 +761,7 @@ static int tegra_slink_setup(struct spi_device *spi) ret =pm_runtime_get_sync (tspi->dev);if (ret <0 ) { +pm_runtime_put_noidle (tspi->dev);dev_err (tspi->dev,"pm runtime failed, e = %d\n" , ret);return ret; }
@@ -1197,6 +1198,7 @@ static int tegra_slink_resume(struct device *dev) ret =pm_runtime_get_sync (dev);if (ret <0 ) { +pm_runtime_put_noidle (dev);dev_err (dev,"pm runtime failed, e = %d\n" , ret);return ret; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 146/346 drm/omap: dmm_tiler: fix return error code in omap_dmm_probe()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 723ae803218da993143387bf966042eccefac077 ]
Return -ENOMEM when allocating refill memory failed.
--- drivers/gpu/drm/omapdrm/omap_dmm_tiler.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/omapdrm/omap_dmm_tiler.c +1 -0
@@ -763,6 +763,7 @@ static int omap_dmm_probe(struct platform_device *dev) &omap_dmm->refill_pa, GFP_KERNEL);if (!omap_dmm->refill_va) {dev_err (&dev->dev,"could not allocate refill memory\n" ); + ret = -ENOMEM ; goto fail; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 120/346 selinux: fix inode_doinit_with_dentry() LABEL_INVALID error handling
In reply to Greg Kroah-HartmanFrom: Paul Moore <[email protected]>
[ Upstream commit 200ea5a2292dc444a818b096ae6a32ba3caa51b9 ]
A previous fix, commit 83370b31a915 ("selinux: fix error initialization in inode_doinit_with_dentry()"), changed how failures were handled before a SELinux policy was loaded. Unfortunately that patch was potentially problematic for two reasons: it set the isec->initialized state without holding a lock, and it didn't set the inode's SELinux label to the "default" for the particular filesystem. The later can be a problem if/when a later attempt to revalidate the inode fails and SELinux reverts to the existing inode label.
This patch should restore the default inode labeling that existed before the original fix, without affecting the LABEL_INVALID marking such that revalidation will still be attempted in the future.
--- security/selinux/hooks.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-)
security/selinux/hooks.c +13 -18
@@ -1618,13 +1618,7 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent* inode_doinit with a dentry, before these inodes could * be used again by userspace. */ - isec->initialized =LABEL_INVALID ; -/* -* There is nothing useful to jump to the "out" -* label, except a needless spin lock/unlock -* cycle. -*/ -return 0 ; + goto out_invalid; } len =INITCONTEXTLEN ;
@@ -1739,15 +1733,8 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent* inode_doinit() with a dentry, before these inodes * could be used again by userspace. */ -if (!dentry) { - isec->initialized =LABEL_INVALID ; -/* -* There is nothing useful to jump to the "out" -* label, except a needless spin lock/unlock -* cycle. -*/ -return 0 ; - } +if (!dentry) + goto out_invalid; rc =selinux_genfs_get_sid (dentry, sclass, sbsec->flags, &sid);dput (dentry);
@@ -1760,11 +1747,10 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent out:spin_lock (&isec->lock);if (isec->initialized ==LABEL_PENDING ) { -if (!sid || rc) { +if (rc) { isec->initialized =LABEL_INVALID ; goto out_unlock; } - isec->initialized =LABEL_INITIALIZED ; isec->sid = sid; }
@@ -1772,6 +1758,15 @@ out: out_unlock:spin_unlock (&isec->lock);return rc; + +out_invalid: +spin_lock (&isec->lock); +if (isec->initialized ==LABEL_PENDING ) { + isec->initialized =LABEL_INVALID ; + isec->sid = sid; + } +spin_unlock (&isec->lock); +return 0 ; }/* Convert a Linux signal to an access vector. */
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 133/346 net: evaluate net.ipv4.conf.all.proxy_arp_pvlan
In reply to Greg Kroah-HartmanFrom: Vincent Bernat <[email protected]>
[ Upstream commit 1af5318c00a8acc33a90537af49b3f23f72a2c4b ]
Introduced in 65324144b50b, the "proxy_arp_vlan" sysctl is a per-interface sysctl to tune proxy ARP support for private VLANs. While the "all" variant is exposed, it was a noop and never evaluated. We use the usual "or" logic for this kind of sysctls.
--- include/linux/inetdevice.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/inetdevice.h +1 -1
@@ -105,7 +105,7 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev)#define IN_DEV_LOG_MARTIANS (in_dev) IN_DEV_ORCONF((in_dev), LOG_MARTIANS)#define IN_DEV_PROXY_ARP (in_dev) IN_DEV_ORCONF((in_dev), PROXY_ARP) -#define IN_DEV_PROXY_ARP_PVLAN (in_dev) IN_DEV_CONF_GET(in_dev, PROXY_ARP_PVLAN) +#define IN_DEV_PROXY_ARP_PVLAN (in_dev) IN_DEV_ORCONF((in_dev), PROXY_ARP_PVLAN)#define IN_DEV_SHARED_MEDIA (in_dev) IN_DEV_ORCONF((in_dev), SHARED_MEDIA)#define IN_DEV_TX_REDIRECTS (in_dev) IN_DEV_ORCONF((in_dev), SEND_REDIRECTS)#define IN_DEV_SEC_REDIRECTS (in_dev) IN_DEV_ORCONF((in_dev), \
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 143/346 scsi: core: Fix VPD LUN ID designator priorities
In reply to Greg Kroah-HartmanFrom: Martin Wilck <[email protected]>
[ Upstream commit 2e4209b3806cda9b89c30fd5e7bfecb7044ec78b ]
The current implementation of scsi_vpd_lun_id() uses the designator length as an implicit measure of priority. This works most of the time, but not always. For example, some Hitachi storage arrays return this in VPD 0x83:
VPD INQUIRY: Device Identification page
Designation descriptor number 1, descriptor length: 24
designator_type: T10 vendor identification, code_set: ASCII associated with the Addressed logical unit
vendor id: HITACHI
vendor specific: 5030C3502025
Designation descriptor number 2, descriptor length: 6
designator_type: vendor specific [0x0], code_set: Binary associated with the Target port
vendor specific: 08 03
Designation descriptor number 3, descriptor length: 20
designator_type: NAA, code_set: Binary
associated with the Addressed logical unit
NAA 6, IEEE Company_id: 0x60e8
Vendor Specific Identifier: 0x7c35000
Vendor Specific Identifier Extension: 0x30c35000002025
[0x60060e8007c350000030c35000002025]The current code would use the first descriptor because it's longer than the NAA descriptor. But this is wrong, the kernel is supposed to prefer NAA descriptors over T10 vendor ID. Designator length should only be used to compare designators of the same type.
This patch addresses the issue by separating designator priority and length.
--- drivers/scsi/scsi_lib.c | 126 +++++++++++++++++++++++++++------------- 1 file changed, 86 insertions(+), 40 deletions(-)
drivers/scsi/scsi_lib.c +86 -40
@@ -3446,6 +3446,78 @@ void sdev_enable_disk_events(struct scsi_device *sdev) }EXPORT_SYMBOL (sdev_enable_disk_events); +static unsigned char designator_prio (const unsigned char *d) +{ +if (d[1 ] &0x30 ) +/* not associated with LUN */ +return 0 ; + +if (d[3 ] ==0 ) +/* invalid length */ +return 0 ; + +/* +* Order of preference for lun descriptor: +* - SCSI name string +* - NAA IEEE Registered Extended +* - EUI-64 based 16-byte +* - EUI-64 based 12-byte +* - NAA IEEE Registered +* - NAA IEEE Extended +* - EUI-64 based 8-byte +* - SCSI name string (truncated) +* - T10 Vendor ID +* as longer descriptors reduce the likelyhood +* of identification clashes. +*/ + +switch (d[1 ] &0xf ) { +case 8 : +/* SCSI name string, variable-length UTF-8 */ +return 9 ; +case 3 : +switch (d[4 ] >>4 ) { +case 6 : +/* NAA registered extended */ +return 8 ; +case 5 : +/* NAA registered */ +return 5 ; +case 4 : +/* NAA extended */ +return 4 ; +case 3 : +/* NAA locally assigned */ +return 1 ; +default : +break ; + } +break ; +case 2 : +switch (d[3 ]) { +case 16 : +/* EUI64-based, 16 byte */ +return 7 ; +case 12 : +/* EUI64-based, 12 byte */ +return 6 ; +case 8 : +/* EUI64-based, 8 byte */ +return 3 ; +default : +break ; + } +break ; +case 1 : +/* T10 vendor ID */ +return 1 ; +default : +break ; + } + +return 0 ; +} +/** * scsi_vpd_lun_id - return a unique device identification * @sdev: SCSI device
@@ -3462,7 +3534,7 @@ EXPORT_SYMBOL(sdev_enable_disk_events);*/ int scsi_vpd_lun_id (struct scsi_device *sdev,char *id,size_t id_len) { -u8 cur_id_type =0xff ; +u8 cur_id_prio =0 ;u8 cur_id_size =0 ;const unsigned char *d, *cur_id_str;const struct scsi_vpd *vpd_pg83;
@@ -3475,20 +3547,6 @@ int scsi_vpd_lun_id(struct scsi_device *sdev, char *id, size_t id_len)return -ENXIO ; } -/* -* Look for the correct descriptor. -* Order of preference for lun descriptor: -* - SCSI name string -* - NAA IEEE Registered Extended -* - EUI-64 based 16-byte -* - EUI-64 based 12-byte -* - NAA IEEE Registered -* - NAA IEEE Extended -* - T10 Vendor ID -* as longer descriptors reduce the likelyhood -* of identification clashes. -*/ -/* The id string must be at least 20 bytes + terminating NULL byte */ if (id_len <21 ) {rcu_read_unlock ();
@@ -3498,8 +3556,9 @@ int scsi_vpd_lun_id(struct scsi_device *sdev, char *id, size_t id_len)memset (id,0 , id_len); d = vpd_pg83->data +4 ;while (d < vpd_pg83->data + vpd_pg83->len) { -/* Skip designators not referring to the LUN */ -if ((d[1 ] &0x30 ) !=0x00 ) +u8 prio =designator_prio (d); + +if (prio ==0 || cur_id_prio > prio) goto next_desig;switch (d[1 ] &0xf ) {
@@ -3507,28 +3566,19 @@ int scsi_vpd_lun_id(struct scsi_device *sdev, char *id, size_t id_len)/* T10 Vendor ID */ if (cur_id_size > d[3 ])break ; -/* Prefer anything */ -if (cur_id_type >0x01 && cur_id_type !=0xff ) -break ; + cur_id_prio = prio; cur_id_size = d[3 ];if (cur_id_size +4 > id_len) cur_id_size = id_len -4 ; cur_id_str = d +4 ; - cur_id_type = d[1 ] &0xf ; id_size =snprintf (id, id_len,"t10.%*pE" , cur_id_size, cur_id_str);break ;case 0x2 :/* EUI-64 */ -if (cur_id_size > d[3 ]) -break ; -/* Prefer NAA IEEE Registered Extended */ -if (cur_id_type ==0x3 && - cur_id_size == d[3 ]) -break ; + cur_id_prio = prio; cur_id_size = d[3 ]; cur_id_str = d +4 ; - cur_id_type = d[1 ] &0xf ;switch (cur_id_size) {case 8 : id_size = snprintf(id, id_len,
@@ -3546,17 +3596,14 @@ int scsi_vpd_lun_id(struct scsi_device *sdev, char *id, size_t id_len) cur_id_str);break ;default : - cur_id_size =0 ;break ; }break ;case 0x3 :/* NAA */ -if (cur_id_size > d[3 ]) -break ; + cur_id_prio = prio; cur_id_size = d[3 ]; cur_id_str = d +4 ; - cur_id_type = d[1 ] &0xf ;switch (cur_id_size) {case 8 : id_size = snprintf(id, id_len,
@@ -3569,26 +3616,25 @@ int scsi_vpd_lun_id(struct scsi_device *sdev, char *id, size_t id_len) cur_id_str);break ;default : - cur_id_size =0 ;break ; }break ;case 0x8 :/* SCSI name string */ -if (cur_id_size +4 > d[3 ]) +if (cur_id_size > d[3 ])break ;/* Prefer others for truncated descriptor */ -if (cur_id_size && d[3 ] > id_len) -break ; +if (d[3 ] > id_len) { + prio =2 ; +if (cur_id_prio > prio) +break ; + } + cur_id_prio = prio; cur_id_size = id_size = d[3 ]; cur_id_str = d +4 ; - cur_id_type = d[1 ] &0xf ;if (cur_id_size >= id_len) cur_id_size = id_len -1 ;memcpy (id, cur_id_str, cur_id_size); -/* Decrease priority for truncated descriptor */ -if (cur_id_size != id_size) - cur_id_size =6 ;break ;default :break ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 147/346 Input: ads7846 - fix race that causes missing releases
In reply to Greg Kroah-HartmanFrom: David Jander <[email protected]>
[ Upstream commit e52cd628a03f72a547dbf90ccb703ee64800504a ]
If touchscreen is released while busy reading HWMON device, the release can be missed. The IRQ thread is not started because no touch is active and BTN_TOUCH release event is never sent.
--- drivers/input/touchscreen/ads7846.c | 44 +++++++++++++++++------------ 1 file changed, 26 insertions(+), 18 deletions(-)
drivers/input/touchscreen/ads7846.c +26 -18
@@ -199,6 +199,26 @@ struct ads7846 {#define REF_ON (READ_12BIT_DFR(x, 1, 1))#define REF_OFF (READ_12BIT_DFR(y, 0, 0)) +static int get_pendown_state (struct ads7846 *ts) +{ +if (ts->get_pendown_state) +return ts->get_pendown_state (); + +return !gpio_get_value (ts->gpio_pendown); +} + +static void ads7846_report_pen_up (struct ads7846 *ts) +{ +struct input_dev *input = ts->input; + +input_report_key (input,BTN_TOUCH ,0 ); +input_report_abs (input,ABS_PRESSURE ,0 ); +input_sync (input); + + ts->pendown = false; +dev_vdbg (&ts->spi->dev,"UP\n" ); +} +/* Must be called with ts->lock held */ static void ads7846_stop (struct ads7846 *ts) {
@@ -215,6 +235,10 @@ static void ads7846_stop(struct ads7846 *ts)static void ads7846_restart (struct ads7846 *ts) {if (!ts->disabled && !ts->suspended) { +/* Check if pen was released since last stop */ +if (ts->pendown && !get_pendown_state (ts)) +ads7846_report_pen_up (ts); +/* Tell IRQ thread that it may poll the device. */ ts->stopped = false;mb ();
@@ -605,14 +629,6 @@ static const struct attribute_group ads784x_attr_group = {/*--------------------------------------------------------------------------*/ -static int get_pendown_state (struct ads7846 *ts) -{ -if (ts->get_pendown_state) -return ts->get_pendown_state (); - -return !gpio_get_value (ts->gpio_pendown); -} -static void null_wait_for_sync (void ) { }
@@ -871,16 +887,8 @@ static irqreturn_t ads7846_irq(int irq, void *handle) msecs_to_jiffies(TS_POLL_PERIOD)); } -if (ts->pendown && !ts->stopped) { -struct input_dev *input = ts->input; - -input_report_key (input,BTN_TOUCH ,0 ); -input_report_abs (input,ABS_PRESSURE ,0 ); -input_sync (input); - - ts->pendown = false; -dev_vdbg (&ts->spi->dev,"UP\n" ); - } +if (ts->pendown && !ts->stopped) +ads7846_report_pen_up (ts);return IRQ_HANDLED ; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 121/346 arm64: dts: exynos: Include common syscon restart/poweroff for Exynos7
In reply to Greg Kroah-HartmanFrom: Paweł Chmiel <[email protected]>
[ Upstream commit 73bc7510ea0dafb4ff1ae6808759627a8ec51f5a ]
Exynos7 uses the same syscon reboot and poweroff nodes as other Exynos SoCs, so instead of duplicating code we can just include common dtsi file, which already contains definitions of them. After this change, poweroff node will be also available, previously this dts file did contain only reboot node.
--- arch/arm64/boot/dts/exynos/exynos7.dtsi | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
arch/arm64/boot/dts/exynos/exynos7.dtsi +1 -7
@@ -494,13 +494,6 @@ pmu_system_controller: system-controller@105c0000 { compatible = "samsung,exynos7-pmu", "syscon"; reg = <0x105c0000 0x5000>; - - reboot: syscon-reboot { - compatible = "syscon-reboot"; - regmap = <&pmu_system_controller>; - offset = <0x0400>; - mask = <0x1>; - }; }; rtc: rtc@10590000 {
@@ -638,3 +631,4 @@ }; #include "exynos7-pinctrl.dtsi" +#include "arm/exynos-syscon-restart.dtsi"
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 144/346 media: solo6x10: fix missing snd_card_free in error handling case
In reply to Greg Kroah-HartmanFrom: Qinglang Miao <[email protected]>
[ Upstream commit dcdff74fa6bc00c32079d0bebd620764c26f2d89 ]
Fix to goto snd_error in error handling case when fails to do snd_ctl_add, as done elsewhere in this function.
--- drivers/media/pci/solo6x10/solo6x10-g723.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/pci/solo6x10/solo6x10-g723.c +1 -1
@@ -410,7 +410,7 @@ int solo_g723_init(struct solo_dev *solo_dev) ret =snd_ctl_add (card,snd_ctl_new1 (&kctl, solo_dev));if (ret <0 ) -return ret; + goto snd_error; ret =solo_snd_pcm_init (solo_dev);if (ret <0 )
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 91/346 Bluetooth: Fix slab-out-of-bounds read in hci_le_direct_adv_report_evt()
In reply to Greg Kroah-HartmanFrom: Peilin Ye <[email protected]>
commit f7e0e8b2f1b0a09b527885babda3e912ba820798 upstream.
num_reports is not being properly checked. A malformed event packet with a large num_reports number makes hci_le_direct_adv_report_evt() read out of bounds. Fix it.
--- net/bluetooth/hci_event.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
net/bluetooth/hci_event.c +5 -7
@@ -5596,21 +5596,19 @@ static void hci_le_direct_adv_report_evt struct sk_buff *skb) {u8 num_reports = skb->data[0 ]; -void *ptr = &skb->data[1 ]; +struct hci_ev_le_direct_adv_info *ev = (void *)&skb->data[1 ]; -hci_dev_lock (hdev); +if (!num_reports || skb->len < num_reports *sizeof (*ev) +1 ) +return ; -while (num_reports--) { -struct hci_ev_le_direct_adv_info *ev = ptr; +hci_dev_lock (hdev); +for (; num_reports; num_reports--, ev++)process_adv_report (hdev, ev->evt_type, &ev->bdaddr, ev->bdaddr_type, &ev->direct_addr, ev->direct_addr_type, ev->rssi,NULL ,0 , false); - ptr +=sizeof (*ev); - } -hci_dev_unlock (hdev); }
Greg Kroah-Hartman
maintainerPATCH 122/346 arm64: dts: exynos: Correct psci compatible used on Exynos7
In reply to Greg Kroah-HartmanFrom: Paweł Chmiel <[email protected]>
[ Upstream commit e1e47fbca668507a81bb388fcae044b89d112ecc ]
It's not possible to reboot or poweroff Exynos7420 using PSCI. Instead we need to use syscon reboot/poweroff drivers, like it's done for other Exynos SoCs. This was confirmed by checking vendor source and testing it on Samsung Galaxy S6 device based on this SoC.
To be able to use custom restart/poweroff handlers instead of PSCI functions, we need to correct psci compatible. This also requires us to provide function ids for CPU_ON and CPU_OFF.
--- arch/arm64/boot/dts/exynos/exynos7.dtsi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/exynos/exynos7.dtsi +3 -1
@@ -62,8 +62,10 @@ }; psci { - compatible = "arm,psci-0.2"; + compatible = "arm,psci"; method = "smc"; + cpu_off = <0x84000002>; + cpu_on = <0xC4000003>; }; soc: soc {
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 90/346 serial_core: Check for port state when tty is in error state
In reply to Greg Kroah-HartmanFrom: Alexey Kardashevskiy <[email protected]>
commit 2f70e49ed860020f5abae4f7015018ebc10e1f0e upstream.
At the moment opening a serial device node (such as /dev/ttyS3) succeeds even if there is no actual serial device behind it. Reading/writing/ioctls fail as expected because the uart port is not initialized (the type is PORT_UNKNOWN) and the TTY_IO_ERROR error state bit is set fot the tty.
However setting line discipline does not have these checks 8250_port.c (8250 is the default choice made by univ8250_console_init()). As the result of PORT_UNKNOWN, uart_port::iobase is NULL which a platform translates onto some address accessing which produces a crash like below.
This adds tty_port_initialized() to uart_set_ldisc() to prevent the crash.
Found by syzkaller.
--- drivers/tty/serial/serial_core.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/tty/serial/serial_core.c +4 -0
@@ -1421,6 +1421,10 @@ static void uart_set_ldisc(struct tty_st {struct uart_state *state = tty->driver_data;struct uart_port *uport; +struct tty_port *port = &state->port; + +if (!tty_port_initialized (port)) +return ;mutex_lock (&state->port.mutex); uport =uart_port_check (state);
Greg Kroah-Hartman
maintainerPATCH 129/346 spi: bcm63xx-hsspi: fix missing clk_disable_unprepare() on error in bcm63xx_hsspi_resume
In reply to Greg Kroah-HartmanFrom: Qinglang Miao <[email protected]>
[ Upstream commit 9bb9ef2b3e5d9d012876e7e2d7757eb30e865bee ]
Fix the missing clk_disable_unprepare() before return from bcm63xx_hsspi_resume in the error handling case when fails to prepare and enable bs->pll_clk.
--- drivers/spi/spi-bcm63xx-hsspi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/spi/spi-bcm63xx-hsspi.c +3 -1
@@ -487,8 +487,10 @@ static int bcm63xx_hsspi_resume(struct device *dev)if (bs->pll_clk) { ret =clk_prepare_enable (bs->pll_clk); -if (ret) +if (ret) { +clk_disable_unprepare (bs->clk);return ret; + } }spi_master_resume (master);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 130/346 mwifiex: fix mwifiex_shutdown_sw() causing sw reset failure
In reply to Greg Kroah-HartmanFrom: Tsuchiya Yuto <[email protected]>
[ Upstream commit fa74cb1dc0f4da46c441b735ca865ac52de42c0e ]
When a PCIe function level reset (FLR) is performed but without fw reset for some reasons (e.g., on Microsoft Surface devices, fw reset requires other quirks), it fails to reset wifi properly. You can trigger the issue on such devices via debugfs entry for reset:
$ echo 1 | sudo tee /sys/kernel/debug/mwifiex/mlan0/reset
and the resulting dmesg log:
[ 45.740508] mwifiex_pcie 0000:03:00.0: Resetting per request
[ 45.742937] mwifiex_pcie 0000:03:00.0: info: successfully disconnected from [BSSID]: reason code 3
[ 45.744666] mwifiex_pcie 0000:03:00.0: info: shutdown mwifiex...
[ 45.751530] mwifiex_pcie 0000:03:00.0: PREP_CMD: card is removed
[ 45.751539] mwifiex_pcie 0000:03:00.0: PREP_CMD: card is removed
[ 45.771691] mwifiex_pcie 0000:03:00.0: PREP_CMD: card is removed
[ 45.771695] mwifiex_pcie 0000:03:00.0: deleting the crypto keys
[ 45.771697] mwifiex_pcie 0000:03:00.0: PREP_CMD: card is removed
[ 45.771698] mwifiex_pcie 0000:03:00.0: deleting the crypto keys
[ 45.771699] mwifiex_pcie 0000:03:00.0: PREP_CMD: card is removed
[ 45.771701] mwifiex_pcie 0000:03:00.0: deleting the crypto keys
[ 45.771702] mwifiex_pcie 0000:03:00.0: PREP_CMD: card is removed
[ 45.771703] mwifiex_pcie 0000:03:00.0: deleting the crypto keys
[ 45.771704] mwifiex_pcie 0000:03:00.0: PREP_CMD: card is removed
[ 45.771705] mwifiex_pcie 0000:03:00.0: deleting the crypto keys
[ 45.771707] mwifiex_pcie 0000:03:00.0: PREP_CMD: card is removed
[ 45.771708] mwifiex_pcie 0000:03:00.0: deleting the crypto keys
[ 53.099343] mwifiex_pcie 0000:03:00.0: info: trying to associate to '[SSID]' bssid [BSSID]
[ 53.241870] mwifiex_pcie 0000:03:00.0: info: associated to bssid [BSSID] successfully
[ 75.377942] mwifiex_pcie 0000:03:00.0: cmd_wait_q terminated: -110
[ 85.385491] mwifiex_pcie 0000:03:00.0: info: successfully disconnected from [BSSID]: reason code 15
[ 87.539408] mwifiex_pcie 0000:03:00.0: cmd_wait_q terminated: -110
[ 87.539412] mwifiex_pcie 0000:03:00.0: deleting the crypto keys
[ 99.699917] mwifiex_pcie 0000:03:00.0: cmd_wait_q terminated: -110
[ 99.699925] mwifiex_pcie 0000:03:00.0: deleting the crypto keys
[ 111.859802] mwifiex_pcie 0000:03:00.0: cmd_wait_q terminated: -110
[ 111.859808] mwifiex_pcie 0000:03:00.0: deleting the crypto keys
[...]When comparing mwifiex_shutdown_sw() with mwifiex_pcie_remove(), it lacks mwifiex_init_shutdown_fw().
This commit fixes mwifiex_shutdown_sw() by adding the missing mwifiex_init_shutdown_fw().
--- drivers/net/wireless/marvell/mwifiex/main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/marvell/mwifiex/main.c +2 -0
@@ -1474,6 +1474,8 @@ int mwifiex_shutdown_sw(struct mwifiex_adapter *adapter) priv =mwifiex_get_priv (adapter,MWIFIEX_BSS_ROLE_ANY );mwifiex_deauthenticate (priv,NULL ); +mwifiex_init_shutdown_fw (priv,MWIFIEX_FUNC_SHUTDOWN ); +mwifiex_uninit_sw (adapter);if (adapter->if_ops.down_dev)
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 89/346 HID: i2c-hid: add Vero K147 to descriptor override
In reply to Greg Kroah-HartmanFrom: Julian Sax <[email protected]>
commit c870d50ce387d84b6438211a7044c60afbd5d60a upstream.
This device uses the SIPODEV SP1064 touchpad, which does not supply descriptors, so it has to be added to the override list.
--- drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c +8 -0
@@ -397,6 +397,14 @@ static const struct dmi_system_id i2c_hi }, .driver_data = (void *)&sipodev_desc }, + { + .ident = "Vero K147", + .matches = { + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "VERO"), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "K147"), + }, + .driver_data = (void *)&sipodev_desc + }, { } /* Terminate list */ };
Greg Kroah-Hartman
maintainerPATCH 109/346 x86/apic: Fix x2apic enablement without interrupt remapping
In reply to Greg Kroah-HartmanFrom: David Woodhouse <[email protected]>
[ Upstream commit 26573a97746c7a99f394f9d398ce91a8853b3b89 ]
Currently, Linux as a hypervisor guest will enable x2apic only if there are no CPUs present at boot time with an APIC ID above 255.
Hotplugging a CPU later with a higher APIC ID would result in a CPU which cannot be targeted by external interrupts.
Add a filter in x2apic_apic_id_valid() which can be used to prevent such CPUs from coming online, and allow x2apic to be enabled even if they are present at boot time.
--- arch/x86/include/asm/apic.h | 1 + arch/x86/kernel/apic/apic.c | 14 ++++++++------ arch/x86/kernel/apic/x2apic_phys.c | 9 +++++++++ 3 files changed, 18 insertions(+), 6 deletions(-)
arch/x86/include/asm/apic.h +1 -0
@@ -252,6 +252,7 @@ static inline u64 native_x2apic_icr_read(void)extern int x2apic_mode;extern int x2apic_phys; +extern void __init x2apic_set_max_apicid (u32 apicid);extern void __init check_x2apic (void );extern void x2apic_setup (void );static inline int x2apic_enabled (void )
arch/x86/kernel/apic/apic.c +8 -6
@@ -1813,20 +1813,22 @@ static __init void try_to_enable_x2apic(int remap_mode)return ;if (remap_mode !=IRQ_REMAP_X2APIC_MODE ) { -/* IR is required if there is APIC ID > 255 even when running -* under KVM +/* +* Using X2APIC without IR is not architecturally supported +* on bare metal but may be supported in guests. */ -if (max_physical_apicid >255 || - !x86_init.hyper.x2apic_available ()) { +if (!x86_init.hyper.x2apic_available ()) {pr_info ("x2apic: IRQ remapping doesn't support X2APIC mode\n" );x2apic_disable ();return ; }/* -* without IR all CPUs can be addressed by IOAPIC/MSI -* only in physical mode +* Without IR, all CPUs can be addressed by IOAPIC/MSI only +* in physical mode, and CPUs with an APIC ID that cannnot +* be addressed must not be brought online. */ +x2apic_set_max_apicid (255 ); x2apic_phys =1 ; }x2apic_enable ();
arch/x86/kernel/apic/x2apic_phys.c +9 -0
@@ -13,6 +13,12 @@int x2apic_phys;static struct apic apic_x2apic_phys; +static u32 x2apic_max_apicid__ro_after_init ; + +void __init x2apic_set_max_apicid (u32 apicid) +{ + x2apic_max_apicid = apicid; +}static int __init set_x2apic_phys_mode (char *arg) {
@@ -103,6 +109,9 @@ static int x2apic_phys_probe(void)/* Common x2apic functions, also used by x2apic_cluster */ int x2apic_apic_id_valid (u32 apicid) { +if (x2apic_max_apicid && apicid > x2apic_max_apicid) +return 0 ; +return 1 ; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 110/346 sched/deadline: Fix sched_dl_global_validate()
In reply to Greg Kroah-HartmanFrom: Peng Liu <[email protected]>
[ Upstream commit a57415f5d1e43c3a5c5d412cd85e2792d7ed9b11 ]
When change sched_rt_{runtime, period}_us, we validate that the new settings should at least accommodate the currently allocated -dl bandwidth:
sched_rt_handler()
--> sched_dl_bandwidth_validate()
{
new_bw = global_rt_runtime()/global_rt_period();
for_each_possible_cpu(cpu) {
dl_b = dl_bw_of(cpu);
if (new_bw < dl_b->total_bw) <-------
ret = -EBUSY;
}
}But under CONFIG_SMP, dl_bw is per root domain , but not per CPU, dl_b->total_bw is the allocated bandwidth of the whole root domain. Instead, we should compare dl_b->total_bw against "cpus*new_bw", where 'cpus' is the number of CPUs of the root domain.
Also, below annotation(in kernel/sched/sched.h) implied implementation only appeared in SCHED_DEADLINE v2[1], then deadline scheduler kept evolving till got merged(v9), but the annotation remains unchanged, meaningless and misleading, update it.
* With respect to SMP, the bandwidth is given on a per-CPU basis,
* meaning that:
* - dl_bw (< 100%) is the bandwidth of the system (group) on each CPU;
* - dl_total_bw array contains, in the i-eth element, the currently
* allocated bandwidth on the i-eth CPU.
[1]: https://lore.kernel.org/lkml/1267385230.13676.101.camel@Palantir/
--- kernel/sched/deadline.c | 5 +++-- kernel/sched/sched.h | 42 ++++++++++++++++++----------------------- 2 files changed, 21 insertions(+), 26 deletions(-)
kernel/sched/deadline.c +3 -2
@@ -2464,7 +2464,7 @@ int sched_dl_global_validate(void)u64 period =global_rt_period ();u64 new_bw =to_ratio (period, runtime);struct dl_bw *dl_b; -int cpu, ret =0 ; +int cpu, cpus, ret =0 ;unsigned long flags;/*
@@ -2479,9 +2479,10 @@ int sched_dl_global_validate(void)for_each_possible_cpu (cpu) {rcu_read_lock_sched (); dl_b =dl_bw_of (cpu); + cpus =dl_bw_cpus (cpu);raw_spin_lock_irqsave (&dl_b->lock, flags); -if (new_bw < dl_b->total_bw) +if (new_bw * cpus < dl_b->total_bw) ret = -EBUSY ;raw_spin_unlock_irqrestore (&dl_b->lock, flags);
kernel/sched/sched.h +18 -24
54 lines not on this page · raw message
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 105/346 ARM: dts: aspeed: s2600wf: Fix VGA memory region location
In reply to Greg Kroah-HartmanFrom: Joel Stanley <[email protected]>
[ Upstream commit 9e1cc9679776f5b9e42481d392b1550753ebd084 ]
The VGA memory region is always from the top of RAM. On this board, that is 0x80000000 + 0x20000000 - 0x01000000 = 0x9f000000.
This was not an issue in practice as the region is "reserved" by the vendor's u-boot reducing the amount of available RAM, and the only user is the host VGA device poking at RAM over PCIe. That is, nothing from the ARM touches it.
It is worth fixing as developers copy existing device trees when building their machines, and the XDMA driver does use the memory region from the ARM side.
--- arch/arm/boot/dts/aspeed-bmc-intel-s2600wf.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/aspeed-bmc-intel-s2600wf.dts +2 -2
@@ -22,9 +22,9 @@ #size-cells = <1>; ranges; - vga_memory: framebuffer@7f000000 { + vga_memory: framebuffer@9f000000 { no-map; - reg = <0x7f000000 0x01000000>; + reg = <0x9f000000 0x01000000>; /* 16M */ }; };
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 98/346 drm/gma500: fix double free of gma_connector
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
[ Upstream commit 4e19d51ca5b28a1d435a844c7b2a8e1b1b6fa237 ]
clang static analysis reports this problem:
cdv_intel_dp.c:2101:2: warning: Attempt to free released memory
kfree(gma_connector);
^~~~~~~~~~~~~~~~~~~~In cdv_intel_dp_init() when the call to cdv_intel_edp_panel_vdd_off() fails, the handler calls cdv_intel_dp_destroy(connector) which does the first free of gma_connector. So adjust the goto label and skip the second free.
--- drivers/gpu/drm/gma500/cdv_intel_dp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/gma500/cdv_intel_dp.c +1 -1
@@ -2124,7 +2124,7 @@ cdv_intel_dp_init(struct drm_device *dev, struct psb_intel_mode_device *mode_devDRM_INFO ("failed to retrieve link info, disabling eDP\n" );cdv_intel_dp_encoder_destroy (encoder);cdv_intel_dp_destroy (connector); - goto err_priv; + goto err_connector; }else { DRM_DEBUG_KMS("DPCD: Rev=%x LN_Rate=%x LN_CNT=%x LN_DOWNSP=%x\n", intel_dp->dpcd[0], intel_dp->dpcd[1],
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 100/346 soc: renesas: rmobile-sysc: Fix some leaks in rmobile_init_pm_domains()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit cf25d802e029c31efac8bdc979236927f37183bd ]
This code needs to call iounmap() on one error path.
--- arch/arm/mach-shmobile/pm-rmobile.c | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-shmobile/pm-rmobile.c +1 -0
@@ -330,6 +330,7 @@ static int __init rmobile_init_pm_domains(void) pmd =of_get_child_by_name (np,"pm-domains" );if (!pmd) { +iounmap (base);pr_warn ("%pOF lacks pm-domains node\n" , np);continue ; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 95/346 md: fix a warning caused by a race between concurrent md_ioctl()s
In reply to Greg Kroah-HartmanFrom: Dae R. Jeong <[email protected]>
commit c731b84b51bf7fe83448bea8f56a6d55006b0615 upstream.
Syzkaller reports a warning as belows.
WARNING: CPU: 0 PID: 9647 at drivers/md/md.c:7169 ... Call Trace: ... RIP: 0010:md_ioctl+0x4017/0x5980 drivers/md/md.c:7169 RSP: 0018:ffff888096027950 EFLAGS: 00010293 RAX: ffff88809322c380 RBX: 0000000000000932 RCX: ffffffff84e266f2 RDX: 0000000000000000 RSI: ffffffff84e299f7 RDI: 0000000000000007 RBP: ffff888096027bc0 R08: ffff88809322c380 R09: ffffed101341a482 R10: ffff888096027940 R11: ffff88809a0d240f R12: 0000000000000932 R13: ffff8880a2c14100 R14: ffff88809a0d2268 R15: ffff88809a0d2408 __blkdev_driver_ioctl block/ioctl.c:304 [inline] blkdev_ioctl+0xece/0x1c10 block/ioctl.c:606 block_ioctl+0xee/0x130 fs/block_dev.c:1930 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:509 [inline] do_vfs_ioctl+0xd5f/0x1380 fs/ioctl.c:696 ksys_ioctl+0xab/0xd0 fs/ioctl.c:713 __do_sys_ioctl fs/ioctl.c:720 [inline] __se_sys_ioctl fs/ioctl.c:718 [inline] __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:718 do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301 entry_SYSCALL_64_after_hwframe+0x49/0xbe
This is caused by a race between two concurrenct md_ioctl()s closing the array.
CPU1 (md_ioctl()) CPU2 (md_ioctl())
------ ------set_bit(MD_CLOSING, &mddev->flags);
did_set_md_closing = true;
WARN_ON_ONCE(test_bit(MD_CLOSING,
&mddev->flags));
if(did_set_md_closing)
clear_bit(MD_CLOSING, &mddev->flags);Fix the warning by returning immediately if the MD_CLOSING bit is set in &mddev->flags which indicates that the array is being closed.
--- drivers/md/md.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/md/md.c +5 -2
@@ -7214,8 +7214,11 @@ static int md_ioctl(struct block_device err = -EBUSY ; goto out; } -WARN_ON_ONCE (test_bit (MD_CLOSING , &mddev->flags)); -set_bit (MD_CLOSING , &mddev->flags); +if (test_and_set_bit (MD_CLOSING , &mddev->flags)) { +mutex_unlock (&mddev->open_mutex); + err = -EBUSY ; + goto out; + } did_set_md_closing = true;mutex_unlock (&mddev->open_mutex);sync_blockdev (bdev);
Greg Kroah-Hartman
maintainerPATCH 82/346 USB: gadget: f_rndis: fix bitrate for SuperSpeed and above
In reply to Greg Kroah-HartmanFrom: Will McVicker <[email protected]>
commit b00f444f9add39b64d1943fa75538a1ebd54a290 upstream.
Align the SuperSpeed Plus bitrate for f_rndis to match f_ncm's ncm_bitrate defined by commit 1650113888fe ("usb: gadget: f_ncm: add SuperSpeed descriptors for CDC NCM").
--- drivers/usb/gadget/function/f_rndis.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/gadget/function/f_rndis.c +3 -1
@@ -87,8 +87,10 @@ static inline struct f_rndis *func_to_rn/* peak (theoretical) bulk transfer rate in bits-per-second */ static unsigned int bitrate (struct usb_gadget *g) { +if (gadget_is_superspeed (g) && g->speed >=USB_SPEED_SUPER_PLUS ) +return 4250000000U ;if (gadget_is_superspeed (g) && g->speed ==USB_SPEED_SUPER ) -return 13 *1024 *8 *1000 *8 ; +return 3750000000U ;else if (gadget_is_dualspeed (g) && g->speed ==USB_SPEED_HIGH )return 13 *512 *8 *1000 *8 ;else
Greg Kroah-Hartman
maintainerPATCH 58/346 gpio: mvebu: fix potential user-after-free on probe
In reply to Greg Kroah-HartmanFrom: Baruch Siach <[email protected]>
[ Upstream commit 7ee1a01e47403f72b9f38839a737692f6991263e ]
When mvebu_pwm_probe() fails IRQ domain is not released. Move pwm probe before IRQ domain allocation. Add pwm cleanup code to the failure path.
--- drivers/gpio/gpio-mvebu.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/gpio/gpio-mvebu.c +11 -5
@@ -1191,6 +1191,13 @@ static int mvebu_gpio_probe(struct platform_device *pdev)devm_gpiochip_add_data (&pdev->dev, &mvchip->chip, mvchip); +/* Some MVEBU SoCs have simple PWM support for GPIO lines */ +if (IS_ENABLED (CONFIG_PWM )) { + err =mvebu_pwm_probe (pdev, mvchip, id); +if (err) +return err; + } +/* Some gpio controllers do not provide irq support */ if (!have_irqs)return 0 ;
@@ -1200,7 +1207,8 @@ static int mvebu_gpio_probe(struct platform_device *pdev)if (!mvchip->domain) {dev_err (&pdev->dev,"couldn't allocate irq domain %s (DT).\n" , mvchip->chip.label); -return -ENODEV ; + err = -ENODEV ; + goto err_pwm; } err = irq_alloc_domain_generic_chips(
@@ -1248,14 +1256,12 @@ static int mvebu_gpio_probe(struct platform_device *pdev) mvchip); } -/* Some MVEBU SoCs have simple PWM support for GPIO lines */ -if (IS_ENABLED (CONFIG_PWM )) -return mvebu_pwm_probe (pdev, mvchip, id); -return 0 ; err_domain:irq_domain_remove (mvchip->domain); +err_pwm: +pwmchip_remove (&mvchip->mvpwm->chip);return err; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 75/346 scsi: mpt3sas: Increase IOCInit request timeout to 30s
In reply to Greg Kroah-HartmanFrom: Sreekanth Reddy <[email protected]>
[ Upstream commit 85dad327d9b58b4c9ce08189a2707167de392d23 ]
Currently the IOCInit request message timeout is set to 10s. This is not sufficient in some scenarios such as during HBA FW downgrade operations.
Increase the IOCInit request timeout to 30s.
--- drivers/scsi/mpt3sas/mpt3sas_base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/mpt3sas/mpt3sas_base.c +1 -1
@@ -5771,7 +5771,7 @@ _base_send_ioc_init(struct MPT3SAS_ADAPTER *ioc) r =_base_handshake_req_reply_wait (ioc,sizeof (Mpi2IOCInitRequest_t), (u32 *)&mpi_request, -sizeof (Mpi2IOCInitReply_t), (u16 *)&mpi_reply,10 ); +sizeof (Mpi2IOCInitReply_t), (u16 *)&mpi_reply,30 );if (r !=0 ) { pr_err(MPT3SAS_FMT "%s: handshake failed (r=%d)\n",
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 76/346 dm table: Remove BUG_ON(in_interrupt())
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
[ Upstream commit e7b624183d921b49ef0a96329f21647d38865ee9 ]
The BUG_ON(in_interrupt()) in dm_table_event() is a historic leftover from a rework of the dm table code which changed the calling context.
Issuing a BUG for a wrong calling context is frowned upon and in_interrupt() is deprecated and only covering parts of the wrong contexts. The sanity check for the context is covered by CONFIG_DEBUG_ATOMIC_SLEEP and other debug facilities already.
--- drivers/md/dm-table.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/md/dm-table.c +0 -6
@@ -1336,12 +1336,6 @@ void dm_table_event_callback(struct dm_table *t,void dm_table_event (struct dm_table *t) { -/* -* You can no longer call dm_table_event() from interrupt -* context, use a bottom half instead. -*/ -BUG_ON (in_interrupt ()); -mutex_lock (&_event_lock);if (t->event_fn) t->event_fn (t->event_context);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 36/346 net: stmmac: dwmac-meson8b: fix mask definition of the m250_sel mux
In reply to Greg Kroah-HartmanFrom: Martin Blumenstingl <[email protected]>
[ Upstream commit 82ca4c922b8992013a238d65cf4e60cc33e12f36 ]
The m250_sel mux clock uses bit 4 in the PRG_ETH0 register. Fix this by shifting the PRG_ETH0_CLK_M250_SEL_MASK accordingly as the "mask" in struct clk_mux expects the mask relative to the "shift" field in the same struct.
While here, get rid of the PRG_ETH0_CLK_M250_SEL_SHIFT macro and use __ffs() to determine it from the existing PRG_ETH0_CLK_M250_SEL_MASK macro.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +3 -3
@@ -35,7 +35,6 @@#define PRG_ETH0_EXT_RMII_MODE 4/* mux to choose between fclk_div2 (bit unset) and mpll2 (bit set) */ -#define PRG_ETH0_CLK_M250_SEL_SHIFT 4#define PRG_ETH0_CLK_M250_SEL_MASK GENMASK(4, 4)#define PRG_ETH0_TXDLY_SHIFT 5
@@ -149,8 +148,9 @@ static int meson8b_init_rgmii_tx_clk(str } clk_configs->m250_mux.reg = dwmac->regs +PRG_ETH0 ; - clk_configs->m250_mux.shift =PRG_ETH0_CLK_M250_SEL_SHIFT ; - clk_configs->m250_mux.mask =PRG_ETH0_CLK_M250_SEL_MASK ; + clk_configs->m250_mux.shift =__ffs (PRG_ETH0_CLK_M250_SEL_MASK ); + clk_configs->m250_mux.mask =PRG_ETH0_CLK_M250_SEL_MASK >> + clk_configs->m250_mux.shift; clk =meson8b_dwmac_register_clk (dwmac,"m250_sel" , mux_parent_names,MUX_CLK_NUM_PARENTS , &clk_mux_ops, &clk_configs->m250_mux.hw);
Greg Kroah-Hartman
maintainerPATCH 73/346 vxlan: Add needed_headroom for lower device
In reply to Greg Kroah-HartmanFrom: Sven Eckelmann <[email protected]>
[ Upstream commit 0a35dc41fea67ac4495ce7584406bf9557a6e7d0 ]
It was observed that sending data via batadv over vxlan (on top of wireguard) reduced the performance massively compared to raw ethernet or batadv on raw ethernet. A check of perf data showed that the vxlan_build_skb was calling all the time pskb_expand_head to allocate enough headroom for:
min_headroom = LL_RESERVED_SPACE(dst->dev) + dst->header_len
+ VXLAN_HLEN + iphdr_len;
But the vxlan_config_apply only requested needed headroom for:
lowerdev->hard_header_len + VXLAN6_HEADROOM or VXLAN_HEADROOM
So it completely ignored the needed_headroom of the lower device. The first caller of net_dev_xmit could therefore never make sure that enough headroom was allocated for the rest of the transmit path.
--- drivers/net/vxlan.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/vxlan.c +1 -0
@@ -3180,6 +3180,7 @@ static void vxlan_config_apply(struct net_device *dev, dev->gso_max_segs = lowerdev->gso_max_segs; needed_headroom = lowerdev->hard_header_len; + needed_headroom += lowerdev->needed_headroom; max_mtu = lowerdev->mtu - (use_ipv6 ?VXLAN6_HEADROOM :VXLAN_HEADROOM );
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 23/346 x86/mm/mem_encrypt: Fix definition of PMD_FLAGS_DEC_WP
In reply to Greg Kroah-HartmanFrom: Arvind Sankar <[email protected]>
commit 29ac40cbed2bc06fa218ca25d7f5e280d3d08a25 upstream.
The PAT bit is in different locations for 4k and 2M/1G page table entries.
Add a definition for _PAGE_LARGE_CACHE_MASK to represent the three caching bits (PWT, PCD, PAT), similar to _PAGE_CACHE_MASK for 4k pages, and use it in the definition of PMD_FLAGS_DEC_WP to get the correct PAT index for write-protected pages.
--- arch/x86/include/asm/pgtable_types.h | 1 + arch/x86/mm/mem_encrypt_identity.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-)
arch/x86/include/asm/pgtable_types.h +1 -0
@@ -148,6 +148,7 @@ enum page_cache_mode {#endif #define _PAGE_CACHE_MASK (_PAGE_PAT | _PAGE_PCD | _PAGE_PWT) +#define _PAGE_LARGE_CACHE_MASK (_PAGE_PWT | _PAGE_PCD | _PAGE_PAT_LARGE)#define _PAGE_NOCACHE (cachemode2protval(_PAGE_CACHE_MODE_UC))#define _PAGE_CACHE_WP (cachemode2protval(_PAGE_CACHE_MODE_WP))
arch/x86/mm/mem_encrypt_identity.c +2 -2
@@ -47,8 +47,8 @@#define PMD_FLAGS_LARGE (__PAGE_KERNEL_LARGE_EXEC & ~_PAGE_GLOBAL)#define PMD_FLAGS_DEC PMD_FLAGS_LARGE -#define PMD_FLAGS_DEC_WP ((PMD_FLAGS_DEC & ~_PAGE_CACHE_MASK) | \ - (_PAGE_PAT | _PAGE_PWT)) +#define PMD_FLAGS_DEC_WP ((PMD_FLAGS_DEC & ~_PAGE_LARGE_CACHE_MASK) | \ + (_PAGE_PAT_LARGE | _PAGE_PWT))#define PMD_FLAGS_ENC (PMD_FLAGS_LARGE | _PAGE_ENC)
Greg Kroah-Hartman
maintainerPATCH 54/346 x86/resctrl: Fix incorrect local bandwidth when mba_sc is enabled
In reply to Greg Kroah-HartmanFrom: Xiaochen Shen <[email protected]>
commit 06c5fe9b12dde1b62821f302f177c972bb1c81f9 upstream
The MBA software controller (mba_sc) is a feedback loop which periodically reads MBM counters and tries to restrict the bandwidth below a user-specified value. It tags along the MBM counter overflow handler to do the updates with 1s interval in mbm_update() and update_mba_bw().
The purpose of mbm_update() is to periodically read the MBM counters to make sure that the hardware counter doesn't wrap around more than once between user samplings. mbm_update() calls __mon_event_count() for local bandwidth updating when mba_sc is not enabled, but calls mbm_bw_count() instead when mba_sc is enabled. __mon_event_count() will not be called for local bandwidth updating in MBM counter overflow handler, but it is still called when reading MBM local bandwidth counter file 'mbm_local_bytes', the call path is as below:
rdtgroup_mondata_show()
mon_event_read()
mon_event_count()
__mon_event_count()In __mon_event_count(), m->chunks is updated by delta chunks which is calculated from previous MSR value (m->prev_msr) and current MSR value. When mba_sc is enabled, m->chunks is also updated in mbm_update() by mistake by the delta chunks which is calculated from m->prev_bw_msr instead of m->prev_msr. But m->chunks is not used in update_mba_bw() in the mba_sc feedback loop.
When reading MBM local bandwidth counter file, m->chunks was changed unexpectedly by mbm_bw_count(). As a result, the incorrect local bandwidth counter which calculated from incorrect m->chunks is shown to the user.
Fix this by removing incorrect m->chunks updating in mbm_bw_count() in MBM counter overflow handler, and always calling __mon_event_count() in mbm_update() to make sure that the hardware local bandwidth counter doesn't wrap around.
Test steps:
# Run workload with aggressive memory bandwidth (e.g., 10 GB/s) git clone https://github.com/intel/intel-cmt-cat && cd intel-cmt-cat && make
./tools/membw/membw -c 0 -b 10000 --read
# Enable MBA software controller
mount -t resctrl resctrl -o mba_MBps /sys/fs/resctrl
# Create control group c1
mkdir /sys/fs/resctrl/c1
# Set MB throttle to 6 GB/s
echo "MB:0=6000;1=6000" > /sys/fs/resctrl/c1/schemata
# Write PID of the workload to tasks file
echo pidof membw > /sys/fs/resctrl/c1/tasks
# Read local bytes counters twice with 1s interval, the calculated
# local bandwidth is not as expected (approaching to 6 GB/s): local_1=`cat /sys/fs/resctrl/c1/mon_data/mon_L3_00/mbm_local_bytes` sleep 1 local_2=`cat /sys/fs/resctrl/c1/mon_data/mon_L3_00/mbm_local_bytes` echo "local b/w (bytes/s):" `expr $local_2 - $local_1`
Before fix:
local b/w (bytes/s): 11076796416
After fix:
local b/w (bytes/s): 5465014272
--- arch/x86/kernel/cpu/intel_rdt_monitor.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
arch/x86/kernel/cpu/intel_rdt_monitor.c +2 -4
@@ -290,7 +290,6 @@ static void mbm_bw_count(u32 rmid, strucreturn ; chunks =mbm_overflow_count (m->prev_bw_msr, tval); - m->chunks += chunks; cur_bw = (chunks * r->mon_scale) >>20 ;if (m->delta_comp)
@@ -460,15 +459,14 @@ static void mbm_update(struct rdt_domain }if (is_mbm_local_enabled ()) { rr.evtid =QOS_L3_MBM_LOCAL_EVENT_ID ; +__mon_event_count (rmid, &rr);/* * Call the MBA software controller only for the * control groups and when user has enabled * the software controller explicitly. */ -if (!is_mba_sc (NULL )) -__mon_event_count (rmid, &rr); -else +if (is_mba_sc (NULL ))mbm_bw_count (rmid, &rr); } }
Greg Kroah-Hartman
maintainerPATCH 64/346 netfilter: x_tables: Switch synchronization to RCU
In reply to Greg Kroah-HartmanFrom: Subash Abhinov Kasiviswanathan <[email protected]>
[ Upstream commit cc00bcaa589914096edef7fb87ca5cee4a166b5c ]
When running concurrent iptables rules replacement with data, the per CPU sequence count is checked after the assignment of the new information. The sequence count is used to synchronize with the packet path without the use of any explicit locking. If there are any packets in the packet path using the table information, the sequence count is incremented to an odd value and is incremented to an even after the packet process completion.
The new table value assignment is followed by a write memory barrier so every CPU should see the latest value. If the packet path has started with the old table information, the sequence counter will be odd and the iptables replacement will wait till the sequence count is even prior to freeing the old table info.
However, this assumes that the new table information assignment and the memory barrier is actually executed prior to the counter check in the replacement thread. If CPU decides to execute the assignment later as there is no user of the table information prior to the sequence check, the packet path in another CPU may use the old table information. The replacement thread would then free the table information under it leading to a use after free in the packet processing context-
Unable to handle kernel NULL pointer dereference at virtual address 000000000000008e pc : ip6t_do_table+0x5d0/0x89c lr : ip6t_do_table+0x5b8/0x89c ip6t_do_table+0x5d0/0x89c ip6table_filter_hook+0x24/0x30 nf_hook_slow+0x84/0x120 ip6_input+0x74/0xe0 ip6_rcv_finish+0x7c/0x128 ipv6_rcv+0xac/0xe4 __netif_receive_skb+0x84/0x17c process_backlog+0x15c/0x1b8 napi_poll+0x88/0x284 net_rx_action+0xbc/0x23c __do_softirq+0x20c/0x48c
This could be fixed by forcing instruction order after the new table information assignment or by switching to RCU for the synchronization.
--- include/linux/netfilter/x_tables.h | 5 ++- net/ipv4/netfilter/arp_tables.c | 14 ++++----- net/ipv4/netfilter/ip_tables.c | 14 ++++----- net/ipv6/netfilter/ip6_tables.c | 14 ++++----- net/netfilter/x_tables.c | 49 +++++++++--------------------- 5 files changed, 40 insertions(+), 56 deletions(-)
include/linux/netfilter/x_tables.h +4 -1
@@ -227,7 +227,7 @@ struct xt_table {unsigned int valid_hooks;/* Man behind the curtain... */ -struct xt_table_info *private; +struct xt_table_info __rcu *private;/* Set this to THIS_MODULE if you are a module, otherwise NULL */ struct module *me;
@@ -449,6 +449,9 @@ xt_get_per_cpu_counter(struct xt_counters *cnt, unsigned int cpu)struct nf_hook_ops *xt_hook_ops_alloc (const struct xt_table *,nf_hookfn *); +struct xt_table_info +*xt_table_get_private_protected (const struct xt_table *table); +#ifdef CONFIG_COMPAT #include <net/compat.h>
net/ipv4/netfilter/arp_tables.c +7 -7
@@ -202,7 +202,7 @@ unsigned int arpt_do_table(struct sk_buff *skb,local_bh_disable (); addend =xt_write_recseq_begin (); - private =READ_ONCE (table->private);/* Address dependency. */ + private =rcu_access_pointer (table->private); cpu =smp_processor_id (); table_base = private->entries; jumpstack = (struct arpt_entry **)private->jumpstack[cpu];
@@ -648,7 +648,7 @@ static struct xt_counters *alloc_counters(const struct xt_table *table) {unsigned int countersize;struct xt_counters *counters; -const struct xt_table_info *private = table->private; +const struct xt_table_info *private =xt_table_get_private_protected (table);/* We need atomic snapshot of counters: rest doesn't change * (other than comefrom, which userspace doesn't care
@@ -672,7 +672,7 @@ static int copy_entries_to_user(unsigned int total_size,unsigned int off, num;const struct arpt_entry *e;struct xt_counters *counters; -struct xt_table_info *private = table->private; +struct xt_table_info *private =xt_table_get_private_protected (table);int ret =0 ;void *loc_cpu_entry;
@@ -807,7 +807,7 @@ static int get_info(struct net *net, void __user *user, t =xt_request_find_table_lock (net,NFPROTO_ARP , name);if (!IS_ERR (t)) {struct arpt_getinfo info; -const struct xt_table_info *private = t->private; +const struct xt_table_info *private =xt_table_get_private_protected (t);#ifdef CONFIG_COMPAT struct xt_table_info tmp;
@@ -860,7 +860,7 @@ static int get_entries(struct net *net, struct arpt_get_entries __user *uptr, t =xt_find_table_lock (net,NFPROTO_ARP , get.name);if (!IS_ERR (t)) { -const struct xt_table_info *private = t->private; +const struct xt_table_info *private =xt_table_get_private_protected (t);if (get.size == private->size) ret = copy_entries_to_user(private->size,
@@ -1019,7 +1019,7 @@ static int do_add_counters(struct net *net, const void __user *user, }local_bh_disable (); - private = t->private; + private =xt_table_get_private_protected (t);if (private->number != tmp.num_counters) { ret = -EINVAL ; goto unlock_up_free;
@@ -1356,7 +1356,7 @@ static int compat_copy_entries_to_user(unsigned int total_size, void __user *userptr) {struct xt_counters *counters; -const struct xt_table_info *private = table->private; +const struct xt_table_info *private =xt_table_get_private_protected (table);void __user *pos;unsigned int size;int ret =0 ;
net/ipv4/netfilter/ip_tables.c +7 -7
@@ -261,7 +261,7 @@ ipt_do_table(struct sk_buff *skb,WARN_ON (!(table->valid_hooks & (1 << hook)));local_bh_disable (); addend =xt_write_recseq_begin (); - private =READ_ONCE (table->private);/* Address dependency. */ + private =rcu_access_pointer (table->private); cpu =smp_processor_id (); table_base = private->entries; jumpstack = (struct ipt_entry **)private->jumpstack[cpu];
@@ -794,7 +794,7 @@ static struct xt_counters *alloc_counters(const struct xt_table *table) {unsigned int countersize;struct xt_counters *counters; -const struct xt_table_info *private = table->private; +const struct xt_table_info *private =xt_table_get_private_protected (table);/* We need atomic snapshot of counters: rest doesn't change (other than comefrom, which userspace doesn't care
@@ -818,7 +818,7 @@ copy_entries_to_user(unsigned int total_size,unsigned int off, num;const struct ipt_entry *e;struct xt_counters *counters; -const struct xt_table_info *private = table->private; +const struct xt_table_info *private =xt_table_get_private_protected (table);int ret =0 ;const void *loc_cpu_entry;
@@ -968,7 +968,7 @@ static int get_info(struct net *net, void __user *user, t =xt_request_find_table_lock (net,AF_INET , name);if (!IS_ERR (t)) {struct ipt_getinfo info; -const struct xt_table_info *private = t->private; +const struct xt_table_info *private =xt_table_get_private_protected (t);#ifdef CONFIG_COMPAT struct xt_table_info tmp;
@@ -1022,7 +1022,7 @@ get_entries(struct net *net, struct ipt_get_entries __user *uptr, t =xt_find_table_lock (net,AF_INET , get.name);if (!IS_ERR (t)) { -const struct xt_table_info *private = t->private; +const struct xt_table_info *private =xt_table_get_private_protected (t);if (get.size == private->size) ret =copy_entries_to_user (private->size, t, uptr->entrytable);
@@ -1178,7 +1178,7 @@ do_add_counters(struct net *net, const void __user *user, }local_bh_disable (); - private = t->private; + private =xt_table_get_private_protected (t);if (private->number != tmp.num_counters) { ret = -EINVAL ; goto unlock_up_free;
@@ -1573,7 +1573,7 @@ compat_copy_entries_to_user(unsigned int total_size, struct xt_table *table, void __user *userptr) {struct xt_counters *counters; -const struct xt_table_info *private = table->private; +const struct xt_table_info *private =xt_table_get_private_protected (table);void __user *pos;unsigned int size;int ret =0 ;
net/ipv6/netfilter/ip6_tables.c +7 -7
@@ -283,7 +283,7 @@ ip6t_do_table(struct sk_buff *skb,local_bh_disable (); addend =xt_write_recseq_begin (); - private =READ_ONCE (table->private);/* Address dependency. */ + private =rcu_access_pointer (table->private); cpu =smp_processor_id (); table_base = private->entries; jumpstack = (struct ip6t_entry **)private->jumpstack[cpu];
@@ -810,7 +810,7 @@ static struct xt_counters *alloc_counters(const struct xt_table *table) {unsigned int countersize;struct xt_counters *counters; -const struct xt_table_info *private = table->private; +const struct xt_table_info *private =xt_table_get_private_protected (table);/* We need atomic snapshot of counters: rest doesn't change (other than comefrom, which userspace doesn't care
@@ -834,7 +834,7 @@ copy_entries_to_user(unsigned int total_size,unsigned int off, num;const struct ip6t_entry *e;struct xt_counters *counters; -const struct xt_table_info *private = table->private; +const struct xt_table_info *private =xt_table_get_private_protected (table);int ret =0 ;const void *loc_cpu_entry;
@@ -984,7 +984,7 @@ static int get_info(struct net *net, void __user *user, t =xt_request_find_table_lock (net,AF_INET6 , name);if (!IS_ERR (t)) {struct ip6t_getinfo info; -const struct xt_table_info *private = t->private; +const struct xt_table_info *private =xt_table_get_private_protected (t);#ifdef CONFIG_COMPAT struct xt_table_info tmp;
@@ -1039,7 +1039,7 @@ get_entries(struct net *net, struct ip6t_get_entries __user *uptr, t =xt_find_table_lock (net,AF_INET6 , get.name);if (!IS_ERR (t)) { -struct xt_table_info *private = t->private; +struct xt_table_info *private =xt_table_get_private_protected (t);if (get.size == private->size) ret =copy_entries_to_user (private->size, t, uptr->entrytable);
@@ -1194,7 +1194,7 @@ do_add_counters(struct net *net, const void __user *user, unsigned int len, }local_bh_disable (); - private = t->private; + private =xt_table_get_private_protected (t);if (private->number != tmp.num_counters) { ret = -EINVAL ; goto unlock_up_free;
@@ -1582,7 +1582,7 @@ compat_copy_entries_to_user(unsigned int total_size, struct xt_table *table, void __user *userptr) {struct xt_counters *counters; -const struct xt_table_info *private = table->private; +const struct xt_table_info *private =xt_table_get_private_protected (table);void __user *pos;unsigned int size;int ret =0 ;
net/netfilter/x_tables.c +15 -34
94 lines not on this page · raw message
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 65/346 gpio: eic-sprd: break loop when getting NULL device resource
In reply to Greg Kroah-HartmanFrom: Chunyan Zhang <[email protected]>
[ Upstream commit 263ade7166a2e589c5b605272690c155c0637dcb ]
EIC controller have unfixed numbers of banks on different Spreadtrum SoCs, and each bank has its own base address, the loop of getting there base address in driver should break if the resource gotten via platform_get_resource() is NULL already. The later ones would be all NULL even if the loop continues.
--- drivers/gpio/gpio-eic-sprd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-eic-sprd.c +1 -1
@@ -599,7 +599,7 @@ static int sprd_eic_probe(struct platform_device *pdev)*/ res =platform_get_resource (pdev,IORESOURCE_MEM , i);if (!res) -continue ; +break ; sprd_eic->base[i] =devm_ioremap_resource (&pdev->dev, res);if (IS_ERR (sprd_eic->base[i]))
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 67/346 RDMA/cm: Fix an attempt to use non-valid pointer when cleaning timewait
In reply to Greg Kroah-HartmanFrom: Leon Romanovsky <[email protected]>
[ Upstream commit 340b940ea0ed12d9adbb8f72dea17d516b2019e8 ]
If cm_create_timewait_info() fails, the timewait_info pointer will contain an error value and will be used in cm_remove_remote() later.
general protection fault, probably for non-canonical address 0xdffffc0000000024: 0000 [#1] SMP KASAN PTI KASAN: null-ptr-deref in range [0×0000000000000120-0×0000000000000127] CPU: 2 PID: 12446 Comm: syz-executor.3 Not tainted 5.10.0-rc5-5d4c0742a60e #27 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014 RIP: 0010:cm_remove_remote.isra.0+0x24/0×170 drivers/infiniband/core/cm.c:978 Code: 84 00 00 00 00 00 41 54 55 53 48 89 fb 48 8d ab 2d 01 00 00 e8 7d bf 4b fe 48 89 ea 48 b8 00 00 00 00 00 fc ff df 48 c1 ea 03 <0f> b6 04 02 48 89 ea 83 e2 07 38 d0 7f 08 84 c0 0f 85 fc 00 00 00 RSP: 0018:ffff888013127918 EFLAGS: 00010006 RAX: dffffc0000000000 RBX: fffffffffffffff4 RCX: ffffc9000a18b000 RDX: 0000000000000024 RSI: ffffffff82edc573 RDI: fffffffffffffff4 RBP: 0000000000000121 R08: 0000000000000001 R09: ffffed1002624f1d R10: 0000000000000003 R11: ffffed1002624f1c R12: ffff888107760c70 R13: ffff888107760c40 R14: fffffffffffffff4 R15: ffff888107760c9c FS: 00007fe1ffcc1700(0000) GS:ffff88811a600000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000001b2ff21000 CR3: 000000010f504001 CR4: 0000000000370ee0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: cm_destroy_id+0x189/0×15b0 drivers/infiniband/core/cm.c:1155 cma_connect_ib drivers/infiniband/core/cma.c:4029 [inline] rdma_connect_locked+0x1100/0×17c0 drivers/infiniband/core/cma.c:4107 rdma_connect+0x2a/0×40 drivers/infiniband/core/cma.c:4140 ucma_connect+0x277/0×340 drivers/infiniband/core/ucma.c:1069 ucma_write+0x236/0×2f0 drivers/infiniband/core/ucma.c:1724 vfs_write+0x220/0×830 fs/read_write.c:603 ksys_write+0x1df/0×240 fs/read_write.c:658 do_syscall_64+0x33/0×40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9
--- drivers/infiniband/core/cm.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/core/cm.c +2 -0
@@ -1443,6 +1443,7 @@ int ib_send_cm_req(struct ib_cm_id *cm_id, id.local_id);if (IS_ERR (cm_id_priv->timewait_info)) { ret =PTR_ERR (cm_id_priv->timewait_info); + cm_id_priv->timewait_info =NULL ; goto out; }
@@ -1969,6 +1970,7 @@ static int cm_req_handler(struct cm_work *work) id.local_id);if (IS_ERR (cm_id_priv->timewait_info)) { ret =PTR_ERR (cm_id_priv->timewait_info); + cm_id_priv->timewait_info =NULL ; goto destroy; } cm_id_priv->timewait_info->work.remote_id = req_msg->local_comm_id;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 70/346 kernel/cpu: add arch override for clear_tasks_mm_cpumask() mm handling
In reply to Greg Kroah-HartmanFrom: Nicholas Piggin <[email protected]>
[ Upstream commit 8ff00399b153440c1c83e20c43020385b416415b ]
powerpc/64s keeps a counter in the mm which counts bits set in mm_cpumask as well as other things. This means it can't use generic code to clear bits out of the mask and doesn't adjust the arch specific counter.
Add an arch override that allows powerpc/64s to use clear_tasks_mm_cpumask().
--- kernel/cpu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
kernel/cpu.c +5 -1
@@ -776,6 +776,10 @@ void __init cpuhp_threads_init(void) }#ifdef CONFIG_HOTPLUG_CPU +#ifndef arch_clear_mm_cpumask_cpu +#define arch_clear_mm_cpumask_cpu (cpu, mm) cpumask_clear_cpu(cpu, mm_cpumask(mm)) +#endif +/** * clear_tasks_mm_cpumask - Safely clear tasks' mm_cpumask for a CPU * @cpu: a CPU id
@@ -811,7 +815,7 @@ void clear_tasks_mm_cpumask(int cpu) t =find_lock_task_mm (p);if (!t)continue ; -cpumask_clear_cpu (cpu,mm_cpumask (t->mm)); +arch_clear_mm_cpumask_cpu (cpu, t->mm);task_unlock (t); }rcu_read_unlock ();
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 53/346 x86/resctrl: Remove unused struct mbm_state::chunks_bw
In reply to Greg Kroah-HartmanFrom: James Morse <[email protected]>
commit abe8f12b44250d02937665033a8b750c1bfeb26e upstream
Nothing reads struct mbm_states's chunks_bw value, its a copy of chunks. Remove it.
--- arch/x86/kernel/cpu/intel_rdt.h | 2 -- arch/x86/kernel/cpu/intel_rdt_monitor.c | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-)
arch/x86/kernel/cpu/intel_rdt.h +0 -2
@@ -251,7 +251,6 @@ struct rftype {* struct mbm_state - status for each MBM counter in each domain * @chunks: Total data moved (multiply by rdt_group.mon_scale to get bytes) * @prev_msr Value of IA32_QM_CTR for this RMID last time we read it -* @chunks_bw Total local data moved. Used for bandwidth calculation * @prev_bw_msr:Value of previous IA32_QM_CTR for bandwidth counting * @prev_bw The most recent bandwidth in MBps * @delta_bw Difference between the current and previous bandwidth
@@ -260,7 +259,6 @@ struct rftype {struct mbm_state {u64 chunks;u64 prev_msr; -u64 chunks_bw;u64 prev_bw_msr;u32 prev_bw;u32 delta_bw;
arch/x86/kernel/cpu/intel_rdt_monitor.c +1 -2
@@ -290,8 +290,7 @@ static void mbm_bw_count(u32 rmid, strucreturn ; chunks =mbm_overflow_count (m->prev_bw_msr, tval); - m->chunks_bw += chunks; - m->chunks = m->chunks_bw; + m->chunks += chunks; cur_bw = (chunks * r->mon_scale) >>20 ;if (m->delta_comp)
Greg Kroah-Hartman
maintainerPATCH 40/346 USB: add RESET_RESUME quirk for Snapscan 1212
In reply to Greg Kroah-HartmanFrom: Oliver Neukum <[email protected]>
commit 08a02f954b0def3ada8ed6d4b2c7bcb67e885e9c upstream.
I got reports that some models of this old scanner need this when using runtime PM.
--- drivers/usb/core/quirks.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/core/quirks.c +3 -0
@@ -342,6 +342,9 @@ static const struct usb_device_id usb_qu { USB_DEVICE(0x06a3, 0x0006), .driver_info = USB_QUIRK_CONFIG_INTF_STRINGS }, + /* Agfa SNAPSCAN 1212U */ + { USB_DEVICE(0x06bd, 0x0001), .driver_info = USB_QUIRK_RESET_RESUME }, + /* Guillemot Webcam Hercules Dualpix Exchange (2nd ID) */ { USB_DEVICE(0x06f8, 0x0804), .driver_info = USB_QUIRK_RESET_RESUME },
Greg Kroah-Hartman
maintainerPATCH 39/346 USB: dummy-hcd: Fix uninitialized array use in init()
In reply to Greg Kroah-HartmanFrom: Bui Quang Minh <[email protected]>
commit e90cfa813da7a527785033a0b247594c2de93dd8 upstream.
This error path
err_add_pdata: for (i = 0; i < mod_data.num; i++) kfree(dum[i]);
can be triggered when not all dum's elements are initialized.
Fix this by initializing all dum's elements to NULL.
--- drivers/usb/gadget/udc/dummy_hcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/udc/dummy_hcd.c +1 -1
@@ -2747,7 +2747,7 @@ static int __init init(void) {int retval = -ENOMEM ;int i; -struct dummy *dum[MAX_NUM_UDC ]; +struct dummy *dum[MAX_NUM_UDC ] = {};if (usb_disabled ())return -ENODEV ;
Greg Kroah-Hartman
maintainerPATCH 48/346 drm/xen-front: Fix misused IS_ERR_OR_NULL checks
In reply to Greg Kroah-HartmanFrom: Oleksandr Andrushchenko <[email protected]>
commit 14dee058610446aa464254fc5c8e88c7535195e0 upstream
The patch c575b7eeb89f: "drm/xen-front: Add support for Xen PV display frontend" from Apr 3, 2018, leads to the following static checker warning:
drivers/gpu/drm/xen/xen_drm_front_gem.c:140 xen_drm_front_gem_create() warn: passing zero to 'ERR_CAST'
drivers/gpu/drm/xen/xen_drm_front_gem.c
133 struct drm_gem_object *xen_drm_front_gem_create(struct drm_device *dev,
134 size_t size)
135 {
136 struct xen_gem_object *xen_obj;
137
138 xen_obj = gem_create(dev, size);
139 if (IS_ERR_OR_NULL(xen_obj))
140 return ERR_CAST(xen_obj);
Fix this and the rest of misused places with IS_ERR_OR_NULL in the driver.
--- drivers/gpu/drm/xen/xen_drm_front.c | 2 +- drivers/gpu/drm/xen/xen_drm_front_gem.c | 8 ++++---- drivers/gpu/drm/xen/xen_drm_front_kms.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/xen/xen_drm_front.c +1 -1
@@ -410,7 +410,7 @@ static int xen_drm_drv_dumb_create(struc args->size = args->pitch * args->height; obj =xen_drm_front_gem_create (dev, args->size); -if (IS_ERR_OR_NULL (obj)) { +if (IS_ERR (obj)) { ret =PTR_ERR (obj); goto fail; }
drivers/gpu/drm/xen/xen_drm_front_gem.c +4 -4
@@ -85,7 +85,7 @@ static struct xen_gem_object *gem_create size =round_up (size,PAGE_SIZE ); xen_obj =gem_create_obj (dev, size); -if (IS_ERR_OR_NULL (xen_obj)) +if (IS_ERR (xen_obj))return xen_obj;if (drm_info->front_info->cfg.be_alloc) {
@@ -119,7 +119,7 @@ static struct xen_gem_object *gem_create*/ xen_obj->num_pages =DIV_ROUND_UP (size,PAGE_SIZE ); xen_obj->pages =drm_gem_get_pages (&xen_obj->base); -if (IS_ERR_OR_NULL (xen_obj->pages)) { +if (IS_ERR (xen_obj->pages)) { ret =PTR_ERR (xen_obj->pages); xen_obj->pages =NULL ; goto fail;
@@ -138,7 +138,7 @@ struct drm_gem_object *xen_drm_front_gemstruct xen_gem_object *xen_obj; xen_obj =gem_create (dev, size); -if (IS_ERR_OR_NULL (xen_obj)) +if (IS_ERR (xen_obj))return ERR_CAST (xen_obj);return &xen_obj->base;
@@ -196,7 +196,7 @@ xen_drm_front_gem_import_sg_table(struct size = attach->dmabuf->size; xen_obj =gem_create_obj (dev, size); -if (IS_ERR_OR_NULL (xen_obj)) +if (IS_ERR (xen_obj))return ERR_CAST (xen_obj); ret =gem_alloc_pages_array (xen_obj, size);
drivers/gpu/drm/xen/xen_drm_front_kms.c +1 -1
@@ -59,7 +59,7 @@ fb_create(struct drm_device *dev, structint ret; fb =drm_gem_fb_create_with_funcs (dev, filp, mode_cmd, &fb_funcs); -if (IS_ERR_OR_NULL (fb)) +if (IS_ERR (fb))return fb; gem_obj =drm_gem_object_lookup (filp, mode_cmd->handles[0 ]);
Greg Kroah-Hartman
maintainerPATCH 3/346 spi: bcm2835aux: Fix use-after-free on unbind
In reply to Greg Kroah-HartmanFrom: Lukas Wunner <[email protected]>
[ Upstream commit e13ee6cc4781edaf8c7321bee19217e3702ed481 ]
bcm2835aux_spi_remove() accesses the driver's private data after calling spi_unregister_master() even though that function releases the last reference on the spi_master and thereby frees the private data.
Fix by switching over to the new devm_spi_alloc_master() helper which keeps the private data accessible until the driver has unbound.
--- drivers/spi/spi-bcm2835aux.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-)
drivers/spi/spi-bcm2835aux.c +6 -12
@@ -407,7 +407,7 @@ static int bcm2835aux_spi_probe(struct punsigned long clk_hz;int err; - master =spi_alloc_master (&pdev->dev,sizeof (*bs)); + master =devm_spi_alloc_master (&pdev->dev,sizeof (*bs));if (!master) {dev_err (&pdev->dev,"spi_alloc_master() failed\n" );return -ENOMEM ;
@@ -439,30 +439,26 @@ static int bcm2835aux_spi_probe(struct p/* the main area */ res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); bs->regs =devm_ioremap_resource (&pdev->dev, res); -if (IS_ERR (bs->regs)) { - err =PTR_ERR (bs->regs); - goto out_master_put; - } +if (IS_ERR (bs->regs)) +return PTR_ERR (bs->regs); bs->clk =devm_clk_get (&pdev->dev,NULL );if ((!bs->clk) || (IS_ERR (bs->clk))) { - err =PTR_ERR (bs->clk);dev_err (&pdev->dev,"could not get clk: %d\n" , err); - goto out_master_put; +return PTR_ERR (bs->clk); } bs->irq =platform_get_irq (pdev,0 );if (bs->irq <=0 ) {dev_err (&pdev->dev,"could not get IRQ: %d\n" , bs->irq); - err = bs->irq ? bs->irq : -ENODEV ; - goto out_master_put; +return bs->irq ? bs->irq : -ENODEV ; }/* this also enables the HW block */ err =clk_prepare_enable (bs->clk);if (err) {dev_err (&pdev->dev,"could not prepare clock: %d\n" , err); - goto out_master_put; +return err; }/* just checking if the clock returns a sane value */
@@ -495,8 +491,6 @@ static int bcm2835aux_spi_probe(struct p out_clk_disable:clk_disable_unprepare (bs->clk); -out_master_put: -spi_master_put (master);return err; }
Greg Kroah-Hartman
maintainerPATCH 21/346 kbuild: avoid static_assert for genksyms
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
commit 14dc3983b5dff513a90bd5a8cc90acaf7867c3d0 upstream.
genksyms does not know or care about the _Static_assert() built-in, and sometimes falls back to ignoring the later symbols, which causes undefined behavior such as
WARNING: modpost: EXPORT symbol "ethtool_set_ethtool_phy_ops" [vmlinux] version generation failed, symbol will not be versioned.
ld: net/ethtool/common.o: relocation R_AARCH64_ABS32 against `__crc_ethtool_set_ethtool_phy_ops' can not be used when making a shared object net/ethtool/common.o:(_ftrace_annotated_branch+0x0): dangerous relocation: unsupported relocation
Redefine static_assert for genksyms to avoid that.
--- include/linux/build_bug.h | 5 +++++ 1 file changed, 5 insertions(+)
include/linux/build_bug.h +5 -0
@@ -80,4 +80,9 @@#endif /* __CHECKER__ */ +#ifdef __GENKSYMS__ +/* genksyms gets confused by _Static_assert */ +#define _Static_assert (expr, ...) +#endif +#endif /* _LINUX_BUILD_BUG_H */
Greg Kroah-Hartman
maintainerPATCH 47/346 serial: 8250_omap: Avoid FIFO corruption caused by MDR1 access
In reply to Greg Kroah-HartmanFrom: Alexander Sverdlin <[email protected]>
commit d96f04d347e4011977abdbb4da5d8f303ebd26f8 upstream.
It has been observed that once per 300-1300 port openings the first transmitted byte is being corrupted on AM3352 ("v" written to FIFO appeared as "e" on the wire). It only happened if single byte has been transmitted right after port open, which means, DMA is not used for this transfer and the corruption never happened afterwards.
Therefore I've carefully re-read the MDR1 errata (link below), which says "when accessing the MDR1 registers that causes a dummy under-run condition that will freeze the UART in IrDA transmission. In UART mode, this may corrupt the transferred data". Strictly speaking, omap_8250_mdr1_errataset() performs a read access and if the value is the same as should be written, exits without errata-recommended FIFO reset.
A brief check of the serial_omap_mdr1_errataset() from the competing omap-serial driver showed it has no read access of MDR1. After removing the read access from omap_8250_mdr1_errataset() the data corruption never happened any more.
--- drivers/tty/serial/8250/8250_omap.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/tty/serial/8250/8250_omap.c +0 -5
@@ -163,11 +163,6 @@ static void omap_8250_mdr1_errataset(str struct omap8250_priv *priv) {u8 timeout =255 ; -u8 old_mdr1; - - old_mdr1 =serial_in (up,UART_OMAP_MDR1 ); -if (old_mdr1 == priv->mdr1) -return ;serial_out (up,UART_OMAP_MDR1 , priv->mdr1);udelay (2 );
Greg Kroah-Hartman
maintainerPATCH 19/346 pinctrl: amd: remove debounce filter setting in IRQ type setting
In reply to Greg Kroah-HartmanFrom: Coiby Xu <[email protected]>
commit 47a0001436352c9853d72bf2071e85b316d688a2 upstream.
Debounce filter setting should be independent from IRQ type setting because according to the ACPI specs, there are separate arguments for specifying debounce timeout and IRQ type in GpioIo() and GpioInt().
Together with commit 06abe8291bc31839950f7d0362d9979edc88a666 ("pinctrl: amd: fix incorrect way to disable debounce filter") and Andy's patch "gpiolib: acpi: Take into account debounce settings" [1], this will fix broken touchpads for laptops whose BIOS set the debounce timeout to a relatively large value. For example, the BIOS of Lenovo AMD gaming laptops including Legion-5 15ARH05 (R7000), Legion-5P (R7000P) and IdeaPad Gaming 3 15ARH05, set the debounce timeout to 124.8ms. This led to the kernel receiving only ~7 HID reports per second from the Synaptics touchpad
(MSFT0001:00 06CB:7F28).
Existing touchpads like [2][3] are not troubled by this bug because the debounce timeout has been set to 0 by the BIOS before enabling the debounce filter in setting IRQ type.
[1] https://lore.kernel.org/linux-gpio/[email protected]/
8dcb7a15a585 ("gpiolib: acpi: Take into account debounce settings")
[2] https://github.com/Syniurge/i2c-amd-mp2/issues/11#issuecomment-721331582
[3] https://forum.manjaro.org/t/random-short-touchpad-freezes/30832/28
--- drivers/pinctrl/pinctrl-amd.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/pinctrl/pinctrl-amd.c +0 -7
@@ -439,7 +439,6 @@ static int amd_gpio_irq_set_type(struct pin_reg &= ~BIT (LEVEL_TRIG_OFF ); pin_reg &= ~(ACTIVE_LEVEL_MASK <<ACTIVE_LEVEL_OFF ); pin_reg |=ACTIVE_HIGH <<ACTIVE_LEVEL_OFF ; - pin_reg |=DB_TYPE_REMOVE_GLITCH <<DB_CNTRL_OFF ;irq_set_handler_locked (d, handle_edge_irq);break ;
@@ -447,7 +446,6 @@ static int amd_gpio_irq_set_type(struct pin_reg &= ~BIT (LEVEL_TRIG_OFF ); pin_reg &= ~(ACTIVE_LEVEL_MASK <<ACTIVE_LEVEL_OFF ); pin_reg |=ACTIVE_LOW <<ACTIVE_LEVEL_OFF ; - pin_reg |=DB_TYPE_REMOVE_GLITCH <<DB_CNTRL_OFF ;irq_set_handler_locked (d, handle_edge_irq);break ;
@@ -455,7 +453,6 @@ static int amd_gpio_irq_set_type(struct pin_reg &= ~BIT (LEVEL_TRIG_OFF ); pin_reg &= ~(ACTIVE_LEVEL_MASK <<ACTIVE_LEVEL_OFF ); pin_reg |=BOTH_EADGE <<ACTIVE_LEVEL_OFF ; - pin_reg |=DB_TYPE_REMOVE_GLITCH <<DB_CNTRL_OFF ;irq_set_handler_locked (d, handle_edge_irq);break ;
@@ -463,8 +460,6 @@ static int amd_gpio_irq_set_type(struct pin_reg |=LEVEL_TRIGGER <<LEVEL_TRIG_OFF ; pin_reg &= ~(ACTIVE_LEVEL_MASK <<ACTIVE_LEVEL_OFF ); pin_reg |=ACTIVE_HIGH <<ACTIVE_LEVEL_OFF ; - pin_reg &= ~(DB_CNTRl_MASK <<DB_CNTRL_OFF ); - pin_reg |=DB_TYPE_PRESERVE_LOW_GLITCH <<DB_CNTRL_OFF ;irq_set_handler_locked (d, handle_level_irq);break ;
@@ -472,8 +467,6 @@ static int amd_gpio_irq_set_type(struct pin_reg |=LEVEL_TRIGGER <<LEVEL_TRIG_OFF ; pin_reg &= ~(ACTIVE_LEVEL_MASK <<ACTIVE_LEVEL_OFF ); pin_reg |=ACTIVE_LOW <<ACTIVE_LEVEL_OFF ; - pin_reg &= ~(DB_CNTRl_MASK <<DB_CNTRL_OFF ); - pin_reg |=DB_TYPE_PRESERVE_HIGH_GLITCH <<DB_CNTRL_OFF ;irq_set_handler_locked (d, handle_level_irq);break ;
Greg Kroah-Hartman
maintainerPATCH 28/346 mac80211: mesh: fix mesh_pathtbl_init() error path
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 905b2032fa424f253d9126271439cc1db2b01130 ]
If tbl_mpp can not be allocated, we call mesh_table_free(tbl_path) while tbl_path rhashtable has not yet been initialized, which causes panics.
Simply factorize the rhashtable_init() call into mesh_table_alloc()
WARNING: CPU: 1 PID: 8474 at kernel/workqueue.c:3040 __flush_work kernel/workqueue.c:3040 [inline] WARNING: CPU: 1 PID: 8474 at kernel/workqueue.c:3040 __cancel_work_timer+0x514/0x540 kernel/workqueue.c:3136 Modules linked in: CPU: 1 PID: 8474 Comm: syz-executor663 Not tainted 5.10.0-rc6-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:__flush_work kernel/workqueue.c:3040 [inline] RIP: 0010:__cancel_work_timer+0x514/0x540 kernel/workqueue.c:3136 Code: 5d c3 e8 bf ae 29 00 0f 0b e9 f0 fd ff ff e8 b3 ae 29 00 0f 0b 43 80 3c 3e 00 0f 85 31 ff ff ff e9 34 ff ff ff e8 9c ae 29 00 <0f> 0b e9 dc fe ff ff 89 e9 80 e1 07 80 c1 03 38 c1 0f 8c 7d fd ff RSP: 0018:ffffc9000165f5a0 EFLAGS: 00010293 RAX: ffffffff814b7064 RBX: 0000000000000001 RCX: ffff888021c80000 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: ffff888024039ca0 R08: dffffc0000000000 R09: fffffbfff1dd3e64 R10: fffffbfff1dd3e64 R11: 0000000000000000 R12: 1ffff920002cbebd R13: ffff888024039c88 R14: 1ffff11004807391 R15: dffffc0000000000 FS: 0000000001347880(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000020000140 CR3: 000000002cc0a000 CR4: 00000000001506e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: rhashtable_free_and_destroy+0x25/0x9c0 lib/rhashtable.c:1137 mesh_table_free net/mac80211/mesh_pathtbl.c:69 [inline] mesh_pathtbl_init+0x287/0x2e0 net/mac80211/mesh_pathtbl.c:785 ieee80211_mesh_init_sdata+0x2ee/0x530 net/mac80211/mesh.c:1591 ieee80211_setup_sdata+0x733/0xc40 net/mac80211/iface.c:1569 ieee80211_if_add+0xd5c/0x1cd0 net/mac80211/iface.c:1987 ieee80211_add_iface+0x59/0x130 net/mac80211/cfg.c:125 rdev_add_virtual_intf net/wireless/rdev-ops.h:45 [inline] nl80211_new_interface+0x563/0xb40 net/wireless/nl80211.c:3855 genl_family_rcv_msg_doit net/netlink/genetlink.c:739 [inline] genl_family_rcv_msg net/netlink/genetlink.c:783 [inline] genl_rcv_msg+0xe4e/0x1280 net/netlink/genetlink.c:800 netlink_rcv_skb+0x190/0x3a0 net/netlink/af_netlink.c:2494 genl_rcv+0x24/0x40 net/netlink/genetlink.c:811 netlink_unicast_kernel net/netlink/af_netlink.c:1304 [inline] netlink_unicast+0x780/0x930 net/netlink/af_netlink.c:1330 netlink_sendmsg+0x9a8/0xd40 net/netlink/af_netlink.c:1919 sock_sendmsg_nosec net/socket.c:651 [inline] sock_sendmsg net/socket.c:671 [inline] ____sys_sendmsg+0x519/0x800 net/socket.c:2353 ___sys_sendmsg net/socket.c:2407 [inline] __sys_sendmsg+0x2b1/0x360 net/socket.c:2440 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9
--- net/mac80211/mesh_pathtbl.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
net/mac80211/mesh_pathtbl.c +1 -3
@@ -63,6 +63,7 @@ static struct mesh_table *mesh_table_allatomic_set (&newtbl->entries,0 );spin_lock_init (&newtbl->gates_lock);spin_lock_init (&newtbl->walk_lock); +rhashtable_init (&newtbl->rhead, &mesh_rht_params);return newtbl; }
@@ -786,9 +787,6 @@ int mesh_pathtbl_init(struct ieee80211_s goto free_path; } -rhashtable_init (&tbl_path->rhead, &mesh_rht_params); -rhashtable_init (&tbl_mpp->rhead, &mesh_rht_params); - sdata->u.mesh.mesh_paths = tbl_path; sdata->u.mesh.mpp_paths = tbl_mpp;
Greg Kroah-Hartman
maintainerPATCH 9/346 ARC: stack unwinding: dont assume non-current task is sleeping
In reply to Greg Kroah-HartmanFrom: Vineet Gupta <[email protected]>
[ Upstream commit e42404fa10fd11fe72d0a0e149a321d10e577715 ]
To start stack unwinding (SP, PC and BLINK) are needed. When the explicit execution context (pt_regs etc) is not available, unwinder assumes the task is sleeping (in __switch_to()) and fetches SP and BLINK from kernel mode stack.
But this assumption is not true, specially in a SMP system, when top runs on 1 core, there may be active running processes on all cores.
So when unwinding non courrent tasks, ensure they are NOT running.
And while at it, handle the self unwinding case explicitly.
This came out of investigation of a customer reported hang with rcutorture+top
--- arch/arc/kernel/stacktrace.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-)
arch/arc/kernel/stacktrace.c +15 -8
@@ -41,15 +41,15 @@#ifdef CONFIG_ARC_DW2_UNWIND -static void seed_unwind_frame_info (struct task_struct *tsk, -struct pt_regs *regs, -struct unwind_frame_info *frame_info) +static int +seed_unwind_frame_info (struct task_struct *tsk,struct pt_regs *regs, +struct unwind_frame_info *frame_info) {/* * synchronous unwinding (e.g. dump_stack) * - uses current values of SP and friends */ -if (tsk ==NULL && regs ==NULL ) { +if (regs ==NULL && (tsk ==NULL || tsk == current)) {unsigned long fp, sp, blink, ret; frame_info->task = current;
@@ -68,11 +68,15 @@ static void seed_unwind_frame_info(struct task_struct *tsk, frame_info->call_frame =0 ; }else if (regs ==NULL ) {/* -* Asynchronous unwinding of sleeping task -* - Gets SP etc from task's pt_regs (saved bottom of kernel -* mode stack of task) +* Asynchronous unwinding of a likely sleeping task +* - first ensure it is actually sleeping +* - if so, it will be in __switch_to, kernel mode SP of task +* is safe-kept and BLINK at a well known location in there */ +if (tsk->state ==TASK_RUNNING ) +return -1 ; + frame_info->task = tsk; frame_info->regs.r27 =TSK_K_FP (tsk);
@@ -106,6 +110,8 @@ static void seed_unwind_frame_info(struct task_struct *tsk, frame_info->regs.r63 = regs->ret; frame_info->call_frame = 0; } + +return 0 ; }#endif
@@ -119,7 +125,8 @@ arc_unwind_core(struct task_struct *tsk, struct pt_regs *regs,unsigned int address;struct unwind_frame_info frame_info; -seed_unwind_frame_info (tsk, regs, &frame_info); +if (seed_unwind_frame_info (tsk, regs, &frame_info)) +return 0 ;while (1 ) { address =UNW_PC (&frame_info);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 20/346 mmc: block: Fixup condition for CMD13 polling for RPMB requests
In reply to Greg Kroah-HartmanFrom: Bean Huo <[email protected]>
commit 6246d7c9d15aaff0bc3863f67900c6a6e6be921b upstream.
The CMD13 polling is needed for commands with R1B responses. In commit a0d4c7eb71dd ("mmc: block: Add CMD13 polling for MMC IOCTLS with R1B response"), the intent was to introduce this for requests targeted to the RPMB partition. However, the condition to trigger the polling loop became wrong, leading to unnecessary polling. Let's fix the condition to avoid this.
--- drivers/mmc/core/block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/core/block.c +1 -1
@@ -631,7 +631,7 @@ static int __mmc_blk_ioctl_cmd(struct mmmemcpy (&(idata->ic.response), cmd.resp,sizeof (cmd.resp)); -if (idata->rpmb || (cmd.flags &MMC_RSP_R1B )) { +if (idata->rpmb || (cmd.flags &MMC_RSP_R1B ) ==MMC_RSP_R1B ) {/* * Ensure RPMB/R1B command has completed by polling CMD13 * "Send Status".
Greg Kroah-Hartman
maintainerPATCH 11/346 irqchip/gic-v3-its: Unconditionally save/restore the ITS state on suspend
In reply to Greg Kroah-HartmanFrom: Xu Qiang <[email protected]>
[ Upstream commit 74cde1a53368aed4f2b4b54bf7030437f64a534b ]
On systems without HW-based collections (i.e. anything except GIC-500), we rely on firmware to perform the ITS save/restore. This doesn't really work, as although FW can properly save everything, it cannot fully restore the state of the command queue (the read-side is reset to the head of the queue). This results in the ITS consuming previously processed commands, potentially corrupting the state.
Instead, let's always save the ITS state on suspend, disabling it in the process, and restore the full state on resume. This saves us from broken FW as long as it doesn't enable the ITS by itself (for which we can't do anything).
This amounts to simply dropping the ITS_FLAGS_SAVE_SUSPEND_STATE.
--- drivers/irqchip/irq-gic-v3-its.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-)
drivers/irqchip/irq-gic-v3-its.c +3 -13
@@ -49,7 +49,6 @@#define ITS_FLAGS_CMDQ_NEEDS_FLUSHING (1ULL << 0)#define ITS_FLAGS_WORKAROUND_CAVIUM_22375 (1ULL << 1)#define ITS_FLAGS_WORKAROUND_CAVIUM_23144 (1ULL << 2) -#define ITS_FLAGS_SAVE_SUSPEND_STATE (1ULL << 3)#define RDIST_FLAGS_PROPBASE_NEEDS_FLUSHING (1 << 0)
@@ -3240,9 +3239,6 @@ static int its_save_disable(void)list_for_each_entry (its, &its_nodes, entry) {void __iomem *base; -if (!(its->flags &ITS_FLAGS_SAVE_SUSPEND_STATE )) -continue ; - base = its->base; its->ctlr_save =readl_relaxed (base +GITS_CTLR ); err =its_force_quiescent (base);
@@ -3261,9 +3257,6 @@ err:list_for_each_entry_continue_reverse (its, &its_nodes, entry) {void __iomem *base; -if (!(its->flags &ITS_FLAGS_SAVE_SUSPEND_STATE )) -continue ; - base = its->base;writel_relaxed (its->ctlr_save, base +GITS_CTLR ); }
@@ -3283,9 +3276,6 @@ static void its_restore_enable(void)void __iomem *base;int i; -if (!(its->flags &ITS_FLAGS_SAVE_SUSPEND_STATE )) -continue ; - base = its->base;/*
@@ -3293,7 +3283,10 @@ static void its_restore_enable(void)* don't restore it since writing to CBASER or BASER<n> * registers is undefined according to the GIC v3 ITS * Specification. +* +* Firmware resuming with the ITS enabled is terminally broken. */ +WARN_ON (readl_relaxed (base +GITS_CTLR ) &GITS_CTLR_ENABLE ); ret =its_force_quiescent (base);if (ret) { pr_err("ITS@%pa: failed to quiesce on resume: %d\n",
@@ -3558,9 +3551,6 @@ static int __init its_probe_one(struct resource *res, ctlr |= GITS_CTLR_ImDe;writel_relaxed (ctlr, its->base +GITS_CTLR ); -if (GITS_TYPER_HCC (typer)) - its->flags |=ITS_FLAGS_SAVE_SUSPEND_STATE ; - err =its_init_domain (handle, its);if (err) goto out_free_tables;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 14/346 platform/x86: thinkpad_acpi: Add BAT1 is primary battery quirk for Thinkpad Yoga 11e 4th gen
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit c986a7024916c92a775fc8d853fba3cae1d5fde4 ]
The Thinkpad Yoga 11e 4th gen with the N3450 / Celeron CPU only has one battery which is named BAT1 instead of the expected BAT0, add a quirk for this. This fixes not being able to set the charging tresholds on this model; and this alsoe fixes the following errors in dmesg:
ACPI: \_SB_.PCI0.LPCB.EC__.HKEY: BCTG evaluated but flagged as errorthinkpad_acpi: Error probing battery 2
battery: extension failed to load: ThinkPad Battery Extension
battery: extension unregistered: ThinkPad Battery Extension
Note that the added quirk is for the "R0K" BIOS versions which are used on the Thinkpad Yoga 11e 4th gen's with a Celeron CPU, there is a separate "R0L" BIOS for the i3/i5 based versions. This may also need the same quirk, but if that really is necessary is unknown.
--- drivers/platform/x86/thinkpad_acpi.c | 1 + 1 file changed, 1 insertion(+)
drivers/platform/x86/thinkpad_acpi.c +1 -0
@@ -9697,6 +9697,7 @@ static const struct tpacpi_quirk battery_quirk_table[] __initconst = {TPACPI_Q_LNV3 ('R' ,'0' ,'B' , true),/* Thinkpad 11e gen 3 */ TPACPI_Q_LNV3 ('R' ,'0' ,'C' , true),/* Thinkpad 13 */ TPACPI_Q_LNV3 ('R' ,'0' ,'J' , true),/* Thinkpad 13 gen 2 */ + TPACPI_Q_LNV3('R', '0', 'K', true), /* Thinkpad 11e gen 4 celeron BIOS */ };static int __init tpacpi_battery_init (struct ibm_init_struct *ibm)
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 10/346 scsi: ufs: Make sure clk scaling happens only when HBA is runtime ACTIVE
In reply to Greg Kroah-HartmanFrom: Can Guo <[email protected]>
[ Upstream commit 73cc291c270248567245f084dcdf5078069af6b5 ]
If someone plays with the UFS clk scaling devfreq governor through sysfs, ufshcd_devfreq_scale may be called even when HBA is not runtime ACTIVE. This can lead to unexpected error. We cannot just protect it by calling pm_runtime_get_sync() because that may cause a race condition since HBA runtime suspend ops need to suspend clk scaling. To fix this call pm_runtime_get_noresume() and check HBA's runtime status. Only proceed if HBA is runtime ACTIVE, otherwise just bail.
governor_store
devfreq_performance_handler
update_devfreq
devfreq_set_target
ufshcd_devfreq_target
ufshcd_devfreq_scale
--- drivers/scsi/ufs/ufshcd.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/scsi/ufs/ufshcd.c +7 -0
@@ -1281,8 +1281,15 @@ static int ufshcd_devfreq_target(struct device *dev, }spin_unlock_irqrestore (hba->host->host_lock, irq_flags); +pm_runtime_get_noresume (hba->dev); +if (!pm_runtime_active (hba->dev)) { +pm_runtime_put_noidle (hba->dev); + ret = -EAGAIN ; + goto out; + } start =ktime_get (); ret =ufshcd_devfreq_scale (hba, scale_up); +pm_runtime_put (hba->dev); trace_ufshcd_profile_clk_scaling(dev_name(hba->dev), (scale_up ? "up" : "down"),
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 16/346 platform/x86: intel-vbtn: Support for tablet mode on HP Pavilion 13 x360 PC
In reply to Greg Kroah-HartmanFrom: Max Verevkin <[email protected]>
[ Upstream commit 8b205d3e1bf52ab31cdd5c55f87c87a227793d84 ]
The Pavilion 13 x360 PC has a chassis-type which does not indicate it is a convertible, while it is actually a convertible. Add it to the dmi_switches_allow_list.
--- drivers/platform/x86/intel-vbtn.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/platform/x86/intel-vbtn.c +6 -0
@@ -197,6 +197,12 @@ static const struct dmi_system_id dmi_switches_allow_list[] = { DMI_MATCH(DMI_PRODUCT_NAME, "HP Stream x360 Convertible PC 11"), }, }, + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), + DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion 13 x360 PC"), + }, + }, {}/* Array terminator */ };
Signature · 1 line
2.27.0
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.164 release. There are 346 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 Wed, 30 Dec 2020 12:48:23 +0000. Anything received after that time might be too late.
Build results:
total: 155 pass: 155 fail: 0 Qemu test results: total: 418 pass: 418 fail: 0
Guenter
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.164 release. There are 346 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 Wed, 30 Dec 2020 12:48:23 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.164-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v4.19:
12 builds: 12 pass, 0 fail
22 boots: 22 pass, 0 fail
38 tests: 38 pass, 0 failLinux version: 4.19.164-rc1-gc1838bdb8a07
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra20-ventana,
tegra210-p2371-2180, tegra30-cardhu-a04Jon
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.164 release. There are 346 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 Wed, 30 Dec 2020 12:48:23 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.164-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
Summary
------------------------------------------------------------------------
kernel: 4.19.164-rc1
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.19.y
git commit: c1838bdb8a07c9ea1120eb17b9b879246466e691
git describe: v4.19.163-347-gc1838bdb8a07
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-4.19.y/build/v4.19.163-347-gc1838bdb8a07
No regressions (compared to build v4.19.163)
No fixes (compared to build v4.19.163)
Ran 45371 total tests in the following environments and test suites.
Environments
--------------
- arm
- arm64
- dragonboard-410c - arm64
- hi6220-hikey - arm64
- i386
- juno-r2 - arm64
- juno-r2-compat
- juno-r2-kasan
- mips
- qemu-arm64-clang
- qemu-arm64-kasan
- qemu-x86_64-clang
- qemu-x86_64-kasan
- qemu_arm
- qemu_arm64
- qemu_arm64-compat
- qemu_i386
- qemu_x86_64
- qemu_x86_64-compat
- s390
- sparc
- x15 - arm
- x86_64
- x86-kasan
Test Suites
-----------
* build
* linux-log-parser
* install-android-platform-tools-r2600
* kselftest
* kvm-unit-tests
* ltp-cap_bounds-tests
* ltp-commands-tests
* ltp-containers-tests
* ltp-cpuhotplug-tests
* ltp-crypto-tests
* ltp-cve-tests
* ltp-math-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* perf
* fwts
* libhugetlbfs
* ltp-controllers-tests
* ltp-hugetlb-tests
* ltp-ipc-tests
* ltp-mm-tests
* ltp-tracing-tests
* network-basic-tests
* v4l2-compliance
* ltp-dio-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-io-tests
* ltp-open-posix-tests
* rcutorture
* kselftest-vsyscall-mode-native
* kselftest-vsyscall-mode-none
Signature · 2 lines
Linaro LKFT https://lkft.linaro.org
Hi!
Quoted 5 lines
This is the start of the stable review cycle for the 4.19.164 release. There are 346 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 8 lines
Responses should be made by Wed, 30 Dec 2020 12:48:23 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.164-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.
CIP testing did not find any problems here:
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-4.19.y
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Greg Kroah-Hartman
maintainerQuoted 16 lines · Pavel Machek
Hi!
Quoted 5 lines
This is the start of the stable review cycle for the 4.19.164 release. There are 346 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 8 lines
Responses should be made by Wed, 30 Dec 2020 12:48:23 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.164-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.
Quoted 5 lines
CIP testing did not find any problems here:
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-4.19.y
Tested-by Pavel Machek (CIP) <[email protected]>
Thanks for testing 2 of these and letting me know.
greg k-h