4.19.99-stable review
Subsystems (10)
Greg Kroah-Hartman
maintainerPATCH 316/639 usb: typec: tcpm: Notify the tcpc to start connection-detection for SRPs
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 7893f9e1c26d1f9ea02622902ee671de45ad377b ]
Some tcpc device-drivers need to explicitly be told to watch for connection events, otherwise the tcpc will not generate any TCPM_CC_EVENTs and devices being plugged into the Type-C port will not be noticed.
For dual-role ports tcpm_start_drp_toggling() is used to tell the tcpc to watch for connection events. Sofar we lack a similar callback to the tcpc for single-role ports. With some tcpc-s such as the fusb302 this means no TCPM_CC_EVENTs will be generated when the port is configured as a single-role port.
This commit renames start_drp_toggling to start_toggling and since the device-properties are parsed by the tcpm-core, adds a port_type parameter to the start_toggling callback so that the tcpc_dev driver knows the port-type and can act accordingly when it starts toggling.
The new start_toggling callback now always gets called if defined, instead of only being called for DRP ports.
To avoid this causing undesirable functional changes all existing start_drp_toggling implementations are not only renamed to start_toggling, but also get a port_type check added and return -EOPNOTSUPP when port_type is not DRP.
--- drivers/usb/typec/fusb302/fusb302.c | 10 ++++++--- drivers/usb/typec/tcpci.c | 10 ++++++--- drivers/usb/typec/tcpm.c | 32 +++++++++++++---------------- drivers/usb/typec/typec_wcove.c | 10 ++++++--- include/linux/usb/tcpm.h | 13 ++++++------ 5 files changed, 42 insertions(+), 33 deletions(-)
drivers/usb/typec/fusb302/fusb302.c +7 -3
@@ -990,13 +990,17 @@ done:return ret; } -static int tcpm_start_drp_toggling (struct tcpc_dev *dev, -enum typec_cc_status cc) +static int tcpm_start_toggling (struct tcpc_dev *dev, +enum typec_port_type port_type, +enum typec_cc_status cc) { struct fusb302_chip *chip = container_of(dev, struct fusb302_chip, tcpc_dev);int ret =0 ; +if (port_type !=TYPEC_PORT_DRP ) +return -EOPNOTSUPP ; +mutex_lock (&chip->lock); ret =fusb302_set_src_current (chip, cc_src_current[cc]);if (ret <0 ) {
@@ -1206,7 +1210,7 @@ static void init_tcpc_dev(struct tcpc_dev *fusb302_tcpc_dev) fusb302_tcpc_dev->set_vbus = tcpm_set_vbus; fusb302_tcpc_dev->set_pd_rx = tcpm_set_pd_rx; fusb302_tcpc_dev->set_roles = tcpm_set_roles; - fusb302_tcpc_dev->start_drp_toggling = tcpm_start_drp_toggling; + fusb302_tcpc_dev->start_toggling = tcpm_start_toggling; fusb302_tcpc_dev->pd_transmit = tcpm_pd_transmit; }
drivers/usb/typec/tcpci.c +7 -3
@@ -100,13 +100,17 @@ static int tcpci_set_cc(struct tcpc_dev *tcpc, enum typec_cc_status cc)return 0 ; } -static int tcpci_start_drp_toggling (struct tcpc_dev *tcpc, -enum typec_cc_status cc) +static int tcpci_start_toggling (struct tcpc_dev *tcpc, +enum typec_port_type port_type, +enum typec_cc_status cc) {int ret;struct tcpci *tcpci =tcpc_to_tcpci (tcpc);unsigned int reg =TCPC_ROLE_CTRL_DRP ; +if (port_type !=TYPEC_PORT_DRP ) +return -EOPNOTSUPP ; +/* Handle vendor drp toggling */ if (tcpci->data->start_drp_toggling) { ret = tcpci->data->start_drp_toggling (tcpci, tcpci->data, cc);
@@ -511,7 +515,7 @@ struct tcpci *tcpci_register_port(struct device *dev, struct tcpci_data *data) tcpci->tcpc.get_cc = tcpci_get_cc; tcpci->tcpc.set_polarity = tcpci_set_polarity; tcpci->tcpc.set_vconn = tcpci_set_vconn; - tcpci->tcpc.start_drp_toggling = tcpci_start_drp_toggling; + tcpci->tcpc.start_toggling = tcpci_start_toggling; tcpci->tcpc.set_pd_rx = tcpci_set_pd_rx; tcpci->tcpc.set_roles = tcpci_set_roles;
drivers/usb/typec/tcpm.c +14 -18
@@ -31,7 +31,7 @@#define FOREACH_STATE (S ) \ S(INVALID_STATE), \ - S(DRP_TOGGLING), \ + S(TOGGLING), \ S(SRC_UNATTACHED), \ S(SRC_ATTACH_WAIT), \ S(SRC_ATTACHED), \
@@ -473,7 +473,7 @@ static void tcpm_log(struct tcpm_port *port, const char *fmt, ...)/* Do not log while disconnected and unattached */ if (tcpm_port_is_disconnected (port) && (port->state ==SRC_UNATTACHED || port->state ==SNK_UNATTACHED || - port->state ==DRP_TOGGLING )) + port->state ==TOGGLING ))return ;va_start (args, fmt);
@@ -2561,20 +2561,16 @@ static int tcpm_set_charge(struct tcpm_port *port, bool charge)return 0 ; } -static bool tcpm_start_drp_toggling (struct tcpm_port *port, -enum typec_cc_status cc) +static bool tcpm_start_toggling (struct tcpm_port *port,enum typec_cc_status cc) {int ret; -if (port->tcpc->start_drp_toggling && - port->port_type ==TYPEC_PORT_DRP ) { -tcpm_log_force (port,"Start DRP toggling" ); - ret = port->tcpc->start_drp_toggling (port->tcpc, cc); -if (!ret) -return true; - } +if (!port->tcpc->start_toggling) +return false; -return false; +tcpm_log_force (port,"Start toggling" ); + ret = port->tcpc->start_toggling (port->tcpc, port->port_type, cc); +return ret ==0 ; }static void tcpm_set_cc (struct tcpm_port *port,enum typec_cc_status cc)
@@ -2868,15 +2864,15 @@ static void run_state_machine(struct tcpm_port *port) port->enter_state = port->state;switch (port->state) { -case DRP_TOGGLING : +case TOGGLING :break ;/* SRC states */ case SRC_UNATTACHED :if (!port->non_pd_role_swap)tcpm_swap_complete (port, -ENOTCONN );tcpm_src_detach (port); -if (tcpm_start_drp_toggling (port,tcpm_rp_cc (port))) { -tcpm_set_state (port,DRP_TOGGLING ,0 ); +if (tcpm_start_toggling (port,tcpm_rp_cc (port))) { +tcpm_set_state (port,TOGGLING ,0 );break ; }tcpm_set_cc (port,tcpm_rp_cc (port));
@@ -3074,8 +3070,8 @@ static void run_state_machine(struct tcpm_port *port)tcpm_swap_complete (port, -ENOTCONN );tcpm_pps_complete (port, -ENOTCONN );tcpm_snk_detach (port); -if (tcpm_start_drp_toggling (port,TYPEC_CC_RD )) { -tcpm_set_state (port,DRP_TOGGLING ,0 ); +if (tcpm_start_toggling (port,TYPEC_CC_RD )) { +tcpm_set_state (port,TOGGLING ,0 );break ; }tcpm_set_cc (port,TYPEC_CC_RD );
@@ -3642,7 +3638,7 @@ static void _tcpm_cc_change(struct tcpm_port *port, enum typec_cc_status cc1, : "connected");switch (port->state) { -case DRP_TOGGLING : +case TOGGLING :if (tcpm_port_is_debug (port) ||tcpm_port_is_audio (port) ||tcpm_port_is_source (port))tcpm_set_state (port,SRC_ATTACH_WAIT ,0 );
drivers/usb/typec/typec_wcove.c +7 -3
@@ -416,12 +416,16 @@ static int wcove_pd_transmit(struct tcpc_dev *tcpc,return regmap_write (wcove->regmap,USBC_TXCMD , cmd |USBC_TXCMD_START ); } -static int wcove_start_drp_toggling (struct tcpc_dev *tcpc, -enum typec_cc_status cc) +static int wcove_start_toggling (struct tcpc_dev *tcpc, +enum typec_port_type port_type, +enum typec_cc_status cc) {struct wcove_typec *wcove =tcpc_to_wcove (tcpc);unsigned int usbc_ctrl; +if (port_type !=TYPEC_PORT_DRP ) +return -EOPNOTSUPP ; + usbc_ctrl =USBC_CONTROL1_MODE_DRP |USBC_CONTROL1_DRPTOGGLE_RANDOM ;switch (cc) {
@@ -642,7 +646,7 @@ static int wcove_typec_probe(struct platform_device *pdev) wcove->tcpc.set_polarity = wcove_set_polarity; wcove->tcpc.set_vconn = wcove_set_vconn; wcove->tcpc.set_current_limit = wcove_set_current_limit; - wcove->tcpc.start_drp_toggling = wcove_start_drp_toggling; + wcove->tcpc.start_toggling = wcove_start_toggling; wcove->tcpc.set_pd_rx = wcove_set_pd_rx; wcove->tcpc.set_roles = wcove_set_roles;
include/linux/usb/tcpm.h +7 -6
@@ -121,10 +121,10 @@ struct tcpc_config {* with partner. * @set_pd_rx: Called to enable or disable reception of PD messages * @set_roles: Called to set power and data roles -* @start_drp_toggling: -* Optional; if supported by hardware, called to start DRP -* toggling. DRP toggling is stopped automatically if -* a connection is established. +* @start_toggling: +* Optional; if supported by hardware, called to start dual-role +* toggling or single-role connection detection. Toggling stops +* automatically if a connection is established. * @try_role: Optional; called to set a preferred role * @pd_transmit:Called to transmit PD message * @mux: Pointer to multiplexer data
@@ -147,8 +147,9 @@ struct tcpc_dev {int (*set_pd_rx)(struct tcpc_dev *dev,bool on);int (*set_roles)(struct tcpc_dev *dev,bool attached,enum typec_role role,enum typec_data_role data); -int (*start_drp_toggling)(struct tcpc_dev *dev, -enum typec_cc_status cc); +int (*start_toggling)(struct tcpc_dev *dev, +enum typec_port_type port_type, +enum typec_cc_status cc);int (*try_role)(struct tcpc_dev *dev,int role);int (*pd_transmit)(struct tcpc_dev *dev,enum tcpm_transmit_type type,const struct pd_message *msg);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 317/639 selftests/ipc: Fix msgque compiler warnings
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit a147faa96f832f76e772b1e448e94ea84c774081 ]
This fixes the various compiler warnings when building the msgque selftest. The primary change is using sys/msg.h instead of linux/msg.h directly to gain the API declarations.
--- tools/testing/selftests/ipc/msgque.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
tools/testing/selftests/ipc/msgque.c +6 -5
@@ -1,9 +1,10 @@// SPDX-License-Identifier: GPL-2.0 +#define _GNU_SOURCE#include <stdlib.h> #include <stdio.h> #include <string.h> #include <errno.h> -#include <linux/msg.h> +#include <sys/msg.h> #include <fcntl.h> #include "../kselftest.h"
@@ -73,7 +74,7 @@ int restore_queue(struct msgque_data *msgque)return 0 ; destroy: -if (msgctl (id,IPC_RMID ,0 )) +if (msgctl (id,IPC_RMID ,NULL ))printf ("Failed to destroy queue: %d\n" , -errno);return ret; }
@@ -120,7 +121,7 @@ int check_and_destroy_queue(struct msgque_data *msgque) ret =0 ; err: -if (msgctl (msgque->msq_id,IPC_RMID ,0 )) { +if (msgctl (msgque->msq_id,IPC_RMID ,NULL )) {printf ("Failed to destroy queue: %d\n" , -errno);return -errno; }
@@ -129,7 +130,7 @@ err:int dump_queue (struct msgque_data *msgque) { -struct msqid64_ds ds; +struct msqid_ds ds;int kern_id;int i, ret;
@@ -245,7 +246,7 @@ int main(int argc, char **argv)return ksft_exit_pass (); err_destroy: -if (msgctl (msgque.msq_id,IPC_RMID ,0 )) { +if (msgctl (msgque.msq_id,IPC_RMID ,NULL )) {printf ("Failed to destroy queue: %d\n" , -errno);return ksft_exit_fail (); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 318/639 net: hns3: fix loop condition of hns3_get_tx_timeo_queue_info()
In reply to Greg Kroah-HartmanFrom: Jian Shen <[email protected]>
[ Upstream commit fa6c4084b98b82c98cada0f0d5c9f8577579f962 ]
In function hns3_get_tx_timeo_queue_info(), it should use netdev->num_tx_queues, instead of netdve->real_num_tx_queues as the loop limitation.
--- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +1 -1
@@ -1464,7 +1464,7 @@ static bool hns3_get_tx_timeo_queue_info(struct net_device *ndev)int i;/* Find the stopped queue the same way the stack does */ -for (i =0 ; i < ndev->real_num_tx_queues; i++) { +for (i =0 ; i < ndev->num_tx_queues; i++) {struct netdev_queue *q;unsigned long trans_start;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 319/639 powerpc: vdso: Make vdso32 installation conditional in vdso_install
In reply to Greg Kroah-HartmanFrom: Ben Hutchings <[email protected]>
[ Upstream commit ff6d27823f619892ab96f7461764840e0d786b15 ]
The 32-bit vDSO is not needed and not normally built for 64-bit little-endian configurations. However, the vdso_install target still builds and installs it. Add the same config condition as is normally used for the build.
--- arch/powerpc/Makefile | 2 ++ 1 file changed, 2 insertions(+)
arch/powerpc/Makefile +2 -0
@@ -412,7 +412,9 @@ vdso_install: ifdef CONFIG_PPC64 $(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso64 $@ endif +ifdef CONFIG_VDSO32 $(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso32 $@ +endif archclean: $(Q)$(MAKE) $(clean)=$(boot)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 320/639 ARM: dts: ls1021: Fix SGMII PCS link remaining down after PHY disconnect
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit c7861adbe37f576931650ad8ef805e0c47564b9a ]
Each eTSEC MAC has its own TBI (SGMII) PCS and private MDIO bus. But due to a DTS oversight, both SGMII-compatible MACs of the LS1021 SoC are pointing towards the same internal PCS. Therefore nobody is controlling the internal PCS of eTSEC0.
Upon initial ndo_open, the SGMII link is ok by virtue of U-boot initialization. But upon an ifdown/ifup sequence, the code path from ndo_open -> init_phy -> gfar_configure_serdes does not get executed for the PCS of eTSEC0 (and is executed twice for MAC eTSEC1). So the SGMII link remains down for eTSEC0. On the LS1021A-TWR board, to signal this failure condition, the PHY driver keeps printing '803x_aneg_done: SGMII link is not ok'.
Also, it changes compatible of mdio0 to "fsl,etsec2-mdio" to match mdio1 device.
--- arch/arm/boot/dts/ls1021a-twr.dts | 9 ++++++++- arch/arm/boot/dts/ls1021a.dtsi | 11 ++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-)
arch/arm/boot/dts/ls1021a-twr.dts +8 -1
@@ -143,7 +143,7 @@ }; &enet0 { - tbi-handle = <&tbi1>; + tbi-handle = <&tbi0>; phy-handle = <&sgmii_phy2>; phy-connection-type = "sgmii"; status = "okay";
@@ -222,6 +222,13 @@ sgmii_phy2: ethernet-phy@2 { reg = <0x2>; }; + tbi0: tbi-phy@1f { + reg = <0x1f>; + device_type = "tbi-phy"; + }; +}; + +&mdio1 { tbi1: tbi-phy@1f { reg = <0x1f>; device_type = "tbi-phy";
arch/arm/boot/dts/ls1021a.dtsi +10 -1
@@ -584,7 +584,7 @@ }; mdio0: mdio@2d24000 { - compatible = "gianfar"; + compatible = "fsl,etsec2-mdio"; device_type = "mdio"; #address-cells = <1>; #size-cells = <0>;
@@ -592,6 +592,15 @@ <0x0 0x2d10030 0x0 0x4>; }; + mdio1: mdio@2d64000 { + compatible = "fsl,etsec2-mdio"; + device_type = "mdio"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x0 0x2d64000 0x0 0x4000>, + <0x0 0x2d50030 0x0 0x4>; + }; + ptp_clock@2d10e00 { compatible = "fsl,etsec-ptp"; reg = <0x0 0x2d10e00 0x0 0xb0>;
Signature · 1 line
2.20.1
Re: [PATCH 4.19 320/639] ARM: dts: ls1021: Fix SGMII PCS link remaining down after PHY disconnect
Hi!
Quoted 15 lines
[ Upstream commit
c7861adbe37f576931650ad8ef805e0c47564b9a]Each eTSEC MAC has its own TBI (SGMII) PCS and private MDIO bus. But due to a DTS oversight, both SGMII-compatible MACs of the LS1021 SoC are pointing towards the same internal PCS. Therefore nobody is controlling the internal PCS of eTSEC0.
Upon initial
ndo_open, the SGMII link is ok by virtue of U-boot initialization. But upon an ifdown/ifup sequence, the code path fromndo_open->init_phy->gfar_configure_serdesdoes not get executed for the PCS of eTSEC0 (and is executed twice for MAC eTSEC1). So the SGMII link remains down for eTSEC0. On the LS1021A-TWR board, to signal this failure condition, the PHY driver keeps printing '803x_aneg_done: SGMII link is not ok'.
Quoted 2 lines
Also, it changes compatible of mdio0 to "fsl,etsec2-mdio" to match mdio1 device.
It actually changes compatible of both devices.
Quoted 11 lines
+++
b/arch/arm/boot/dts/ls1021a.dtsiarch/arm/boot/dts/ls1021a.dtsi +1
-1@@ -584,7 +584,7 @@ }; mdio0: mdio@2d24000 { - compatible = "gianfar"; + compatible = "fsl,etsec2-mdio"; device_type = "mdio"; #address-cells = <1>; #size-cells = <0>;
arch/arm/boot/dts/ls1021a.dtsi line 596
Quoted 5 lines
arch/arm/boot/dts/ls1021a.dtsi +2
-0@@ -592,6 +592,15 @@ <0x0 0x2d10030 0x0 0x4>; }; + mdio1: mdio@2d64000 { + compatible = "fsl,etsec2-mdio";
And they trigger different code in the driver:
.type = "mdio",
.compatible = "gianfar",
.data = &(struct fsl_pq_mdio_data) {
...
.get_tbipa = get_gfar_tbipa_from_mdio,
},
.compatible = "fsl,etsec2-mdio",
.data = &(struct fsl_pq_mdio_data) {
...
.get_tbipa = get_etsec_tbipa,
},Are you sure that is good idea for both mainline and stable?
Best regards,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: [PATCH 4.19 320/639] ARM: dts: ls1021: Fix SGMII PCS link remaining down after PHY disconnect
Hi Pavel,
Quoted 56 lines · Pavel Machek
Hi!
Quoted 15 lines
[ Upstream commit
c7861adbe37f576931650ad8ef805e0c47564b9a]Each eTSEC MAC has its own TBI (SGMII) PCS and private MDIO bus. But due to a DTS oversight, both SGMII-compatible MACs of the LS1021 SoC are pointing towards the same internal PCS. Therefore nobody is controlling the internal PCS of eTSEC0.
Upon initial
ndo_open, the SGMII link is ok by virtue of U-boot initialization. But upon an ifdown/ifup sequence, the code path fromndo_open->init_phy->gfar_configure_serdesdoes not get executed for the PCS of eTSEC0 (and is executed twice for MAC eTSEC1). So the SGMII link remains down for eTSEC0. On the LS1021A-TWR board, to signal this failure condition, the PHY driver keeps printing '803x_aneg_done: SGMII link is not ok'.Quoted 2 lines
Also, it changes compatible of mdio0 to "fsl,etsec2-mdio" to match mdio1 device.
It actually changes compatible of both devices.
Quoted 11 lines
+++
b/arch/arm/boot/dts/ls1021a.dtsiarch/arm/boot/dts/ls1021a.dtsi +1
-1@@ -584,7 +584,7 @@ }; mdio0: mdio@2d24000 { - compatible = "gianfar"; + compatible = "fsl,etsec2-mdio"; device_type = "mdio"; #address-cells = <1>; #size-cells = <0>;arch/arm/boot/dts/ls1021a.dtsi line 596
Quoted 5 lines
arch/arm/boot/dts/ls1021a.dtsi +2
-0@@ -592,6 +592,15 @@ <0x0 0x2d10030 0x0 0x4>; }; + mdio1: mdio@2d64000 { + compatible = "fsl,etsec2-mdio";And they trigger different code in the driver:
.type = "mdio", .compatible = "gianfar", .data = &(struct fsl_pq_mdio_data) { ... .get_tbipa = get_gfar_tbipa_from_mdio, }, .compatible = "fsl,etsec2-mdio", .data = &(struct fsl_pq_mdio_data) { ... .get_tbipa = get_etsec_tbipa, },
Quoted 2 lines
Are you sure that is good idea for both mainline and stable?
Thanks for spotting this.
What has happened is that [ Leo ] Li Yang suggested me to change the compatible in v1 of this patch here:
https://patchwork.ozlabs.org/patch/1064015/
Not having any argument to oppose (and not much experience, to be frank) I complied and sent out a 2-patch v2 series:
https://patchwork.ozlabs.org/patch/1084366/
https://patchwork.ozlabs.org/patch/1084365/
And Shawn squashed them when merging them, "to get it land as fix a bit easier".
Judging the code in more detail, you are indeed correct that the "gianfar" compatible was the right one for this hardware. The difference being the "get_tbipa" function which calculates the address of the TBIPA register automatically, if not explicitly specified. However, for ls1021a.dtsi, the TBIPA register _is_ explicitly specified via the second "reg" (<0x0 0x2d10030 0x0 0x4>), so the "get_tbipa" function is dead code for LS1021A. Therefore, luckily no harm was done.
I would suggest that this patch continues to be applied as-is to the stable kernels, just for the sake of not having divergent patches across branches, and I'll send a new one that turns the compatible back into "gianfar".
Quoted 5 lines
Best regards,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Thanks,
-Vladimir
Greg Kroah-Hartman
maintainerPATCH 321/639 media: ov2659: fix unbalanced mutex_lock/unlock
In reply to Greg Kroah-HartmanFrom: Akinobu Mita <[email protected]>
[ Upstream commit 384538bda10913e5c94ec5b5d34bd3075931bcf4 ]
Avoid returning with mutex locked.
--- drivers/media/i2c/ov2659.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/ov2659.c +1 -1
@@ -1136,7 +1136,7 @@ static int ov2659_set_fmt(struct v4l2_subdev *sd, mf =v4l2_subdev_get_try_format (sd, cfg, fmt->pad); *mf = fmt->format;#else -return -ENOTTY ; + ret = -ENOTTY ;#endif }else {s64 val;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 322/639 6lowpan: Off by one handling ->nexthdr
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit f57c4bbf34439531adccd7d3a4ecc14f409c1399 ]
NEXTHDR_MAX is 255. What happens here is that we take a u8 value "hdr->nexthdr" from the network and then look it up in lowpan_nexthdr_nhcs[]. The problem is that if hdr->nexthdr is 0xff then we read one element beyond the end of the array so the array needs to be one element larger.
--- net/6lowpan/nhc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/6lowpan/nhc.c +1 -1
@@ -18,7 +18,7 @@#include "nhc.h" static struct rb_root rb_root =RB_ROOT ; -static struct lowpan_nhc *lowpan_nexthdr_nhcs[NEXTHDR_MAX ]; +static struct lowpan_nhc *lowpan_nexthdr_nhcs[NEXTHDR_MAX +1 ];static DEFINE_SPINLOCK (lowpan_nhc_lock);static int lowpan_nhc_insert (struct lowpan_nhc *nhc)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 323/639 dmaengine: axi-dmac: Dont check the number of frames for alignment
In reply to Greg Kroah-HartmanFrom: Alexandru Ardelean <[email protected]>
[ Upstream commit 648865a79d8ee3d1aa64aab5eb2a9d12eeed14f9 ]
In 2D transfers (for the AXI DMAC), the number of frames (numf) represents Y_LENGTH, and the length of a frame is X_LENGTH. 2D transfers are useful for video transfers where screen resolutions ( X * Y ) are typically aligned for X, but not for Y.
There is no requirement for Y_LENGTH to be aligned to the bus-width (or anything), and this is also true for AXI DMAC.
Checking the Y_LENGTH for alignment causes false errors when initiating DMA transfers. This change fixes this by checking only that the Y_LENGTH is non-zero.
--- drivers/dma/dma-axi-dmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/dma-axi-dmac.c +1 -1
@@ -486,7 +486,7 @@ static struct dma_async_tx_descriptor *axi_dmac_prep_interleaved(if (chan->hw_2d) {if (!axi_dmac_check_len (chan, xt->sgl[0 ].size) || - !axi_dmac_check_len (chan, xt->numf)) + xt->numf ==0 )return NULL ;if (xt->sgl[0 ].size + dst_icg > chan->max_length || xt->sgl[0 ].size + src_icg > chan->max_length)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 324/639 ALSA: usb-audio: Handle the error from snd_usb_mixer_apply_create_quirk()
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 328e9f6973be2ee67862cb17bf6c0c5c5918cd72 ]
The error from snd_usb_mixer_apply_create_quirk() is ignored in the current usb-audio driver code, which will continue the probing even after the error. Let's take it more serious.
--- sound/usb/mixer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/usb/mixer.c +3 -1
@@ -3480,7 +3480,9 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif,if (err <0 ) goto _error; -snd_usb_mixer_apply_create_quirk (mixer); + err =snd_usb_mixer_apply_create_quirk (mixer); +if (err <0 ) + goto _error; err =snd_device_new (chip->card,SNDRV_DEV_CODEC , mixer, &dev_ops);if (err <0 )
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 325/639 afs: Fix AFS file locking to allow fine grained locks
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit 68ce801ffd82e72d5005ab5458e8b9e59f24d9cc ]
Fix AFS file locking to allow fine grained locks as some applications, such as firefox, won't work if they can't take such locks on certain state files
- thereby preventing the use of kAFS to distribute a home directory.
Note that this cannot be made completely functional as the protocol only has provision for whole-file locks, so there exists the possibility of a process deadlocking itself by getting a partial read-lock on a file first and then trying to get a non-overlapping write-lock - but we got the server's read lock with the first lock, so we're now stuck.
OpenAFS solves this by just granting any partial-range lock directly without consulting the server - and hoping there's no remote collision. I want to implement that in a separate patch and it requires a bit more thought.
--- fs/afs/flock.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-)
fs/afs/flock.c +9 -14
@@ -432,10 +432,6 @@ static int afs_do_setlk(struct file *file, struct file_lock *fl)_enter ("{%x:%u},%u" , vnode->fid.vid, vnode->fid.vnode, fl->fl_type); -/* only whole-file locks are supported */ -if (fl->fl_start !=0 || fl->fl_end !=OFFSET_MAX ) -return -EINVAL ; - fl->fl_ops = &afs_lock_ops;INIT_LIST_HEAD (&fl->fl_u.afs.link); fl->fl_u.afs.state =AFS_LOCK_PENDING ;
@@ -587,10 +583,6 @@ static int afs_do_unlk(struct file *file, struct file_lock *fl)/* Flush all pending writes before doing anything with locks. */ vfs_fsync (file,0 ); -/* only whole-file unlocks are supported */ -if (fl->fl_start !=0 || fl->fl_end !=OFFSET_MAX ) -return -EINVAL ; - ret =posix_lock_file (file, fl,NULL );_leave (" = %d [%u]" , ret, vnode->lock_state);return ret;
@@ -618,12 +610,15 @@ static int afs_do_getlk(struct file *file, struct file_lock *fl) goto error; lock_count =READ_ONCE (vnode->status.lock_count); -if (lock_count >0 ) - fl->fl_type =F_RDLCK ; -else - fl->fl_type =F_WRLCK ; - fl->fl_start =0 ; - fl->fl_end =OFFSET_MAX ; +if (lock_count !=0 ) { +if (lock_count >0 ) + fl->fl_type =F_RDLCK ; +else + fl->fl_type =F_WRLCK ; + fl->fl_start =0 ; + fl->fl_end =OFFSET_MAX ; + fl->fl_pid =0 ; + } } ret =0 ;
Signature · 1 line
2.20.1
Re: [PATCH 4.19 325/639] afs: Fix AFS file locking to allow fine grained locks
Quoted 10 lines · Greg Kroah-Hartman
From: David Howells <[email protected]>
[ Upstream commit
68ce801ffd82e72d5005ab5458e8b9e59f24d9cc]Fix AFS file locking to allow fine grained locks as some applications, such as firefox, won't work if they can't take such locks on certain state files
- thereby preventing the use of kAFS to distribute a home directory.Note that this cannot be made completely functional as the protocol only has provision for whole-file locks, so there exists the possibility
Is this suitable for -stable?
"AFS does not support fine-grained locks" is fine and easy to understand. "AFS pretends it supports locks and hopes for the best for benefit of firefox"... may be good idea for mainline, but I don't think it matches -stable criteria.
Best regards,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Greg Kroah-Hartman
maintainerRe: [PATCH 4.19 325/639] afs: Fix AFS file locking to allow fine grained locks
Quoted 5 lines · Pavel Machek
Quoted 4 lines · Greg Kroah-Hartman
From: David Howells <[email protected]>
[ Upstream commit
68ce801ffd82e72d5005ab5458e8b9e59f24d9cc]
Quoted 8 lines
Quoted 6 lines
Fix AFS file locking to allow fine grained locks as some applications, such as firefox, won't work if they can't take such locks on certain state files
- thereby preventing the use of kAFS to distribute a home directory.Note that this cannot be made completely functional as the protocol only has provision for whole-file locks, so there exists the possibility
Is this suitable for -stable?
Yes, it fixes a bug.
Greg Kroah-Hartman
maintainerPATCH 326/639 afs: Further fix file locking
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit 4be5975aea154e164696128d049dec9ed341585c ]
Further fix the file locking in the afs filesystem client in a number of ways, including:
(1) Don't submit the operation to obtain a lock from the server in a work queue context, but rather do it in the process context of whoever issued the requesting system call.
(2) The owner of the file_lock struct at the front of the pending_locks queue now owns right to talk to the server.
(3) Write locks can be instantly granted if they don't overlap with any other locks *and* we have a write lock on the server.
(4) In the event of an authentication/permission error, all other matching pending locks requests are also immediately aborted.
(5) Properly use VFS core locks_lock_file_wait() to distribute the server lock amongst local client locks, including waiting for the lock to become available.
Test with:
sqlite3 /afs/.../scratch/billings.sqlite <<EOF CREATE TABLE hosts ( hostname varchar(80), shorthost varchar(80), room varchar(30), building varchar(30), PRIMARY KEY(shorthost) ); EOF
With the version of sqlite3 that I have, this should fail consistently with EAGAIN, whether or not the program is straced (which introduces some delays between lock syscalls).
--- fs/afs/flock.c | 392 ++++++++++++++++++++++++------------------------- 1 file changed, 196 insertions(+), 196 deletions(-)
fs/afs/flock.c +196 -196
@@ -13,9 +13,11 @@#define AFS_LOCK_GRANTED 0#define AFS_LOCK_PENDING 1 +#define AFS_LOCK_YOUR_TRY 2struct workqueue_struct *afs_lock_manager; +static void afs_next_locker (struct afs_vnode *vnode,int error);static void afs_fl_copy_lock (struct file_lock *new,struct file_lock *fl);static void afs_fl_release_private (struct file_lock *fl);
@@ -24,6 +26,12 @@ static const struct file_lock_operations afs_lock_ops = { .fl_release_private = afs_fl_release_private, }; +static inline void afs_set_lock_state (struct afs_vnode *vnode,enum afs_lock_state state) +{ +_debug ("STATE %u -> %u" , vnode->lock_state, state); + vnode->lock_state = state; +} +/* * if the callback is broken on this vnode, then the lock may now be available */
@@ -31,14 +39,20 @@ void afs_lock_may_be_available(struct afs_vnode *vnode) {_enter ("{%x:%u}" , vnode->fid.vid, vnode->fid.vnode); -queue_delayed_work (afs_lock_manager, &vnode->lock_work,0 ); +if (vnode->lock_state !=AFS_VNODE_LOCK_WAITING_FOR_CB ) +return ; + +spin_lock (&vnode->lock); +if (vnode->lock_state ==AFS_VNODE_LOCK_WAITING_FOR_CB ) +afs_next_locker (vnode,0 ); +spin_unlock (&vnode->lock); }/* * the lock will time out in 5 minutes unless we extend it, so schedule * extension in a bit less than that time */ -static void afs_schedule_lock_extension (struct afs_vnode *vnode) +static void __maybe_unused afs_schedule_lock_extension (struct afs_vnode *vnode) {queue_delayed_work (afs_lock_manager, &vnode->lock_work,AFS_LOCKWAIT *HZ /2 );
@@ -49,22 +63,65 @@ static void afs_schedule_lock_extension(struct afs_vnode *vnode)* first lock in the queue is itself a readlock) * - the caller must hold the vnode lock */ -static void afs_grant_locks (struct afs_vnode *vnode,struct file_lock *fl) +static void afs_grant_locks (struct afs_vnode *vnode) {struct file_lock *p, *_p; +bool exclusive = (vnode->lock_type ==AFS_LOCK_WRITE ); -list_move_tail (&fl->fl_u.afs.link, &vnode->granted_locks); -if (fl->fl_type ==F_RDLCK ) { -list_for_each_entry_safe (p, _p, &vnode->pending_locks, - fl_u.afs.link) { -if (p->fl_type ==F_RDLCK ) { - p->fl_u.afs.state =AFS_LOCK_GRANTED ; -list_move_tail (&p->fl_u.afs.link, - &vnode->granted_locks); -wake_up (&p->fl_wait); - } +list_for_each_entry_safe (p, _p, &vnode->pending_locks, fl_u.afs.link) { +if (!exclusive && p->fl_type ==F_WRLCK ) +continue ; + +list_move_tail (&p->fl_u.afs.link, &vnode->granted_locks); + p->fl_u.afs.state =AFS_LOCK_GRANTED ; +wake_up (&p->fl_wait); + } +} + +/* +* If an error is specified, reject every pending lock that matches the +* authentication and type of the lock we failed to get. If there are any +* remaining lockers, try to wake up one of them to have a go. +*/ +static void afs_next_locker (struct afs_vnode *vnode,int error) +{ +struct file_lock *p, *_p, *next =NULL ; +struct key *key = vnode->lock_key; +unsigned int fl_type =F_RDLCK ; + +_enter ("" ); + +if (vnode->lock_type ==AFS_LOCK_WRITE ) + fl_type =F_WRLCK ; + +list_for_each_entry_safe (p, _p, &vnode->pending_locks, fl_u.afs.link) { +if (error && + p->fl_type == fl_type && +afs_file_key (p->fl_file) == key) { +list_del_init (&p->fl_u.afs.link); + p->fl_u.afs.state = error; +wake_up (&p->fl_wait); } + +/* Select the next locker to hand off to. */ +if (next && + (next->fl_type ==F_WRLCK || p->fl_type ==F_RDLCK )) +continue ; + next = p; } + + vnode->lock_key =NULL ; +key_put (key); + +if (next) { +afs_set_lock_state (vnode,AFS_VNODE_LOCK_SETTING ); + next->fl_u.afs.state =AFS_LOCK_YOUR_TRY ; +wake_up (&next->fl_wait); + }else { +afs_set_lock_state (vnode,AFS_VNODE_LOCK_NONE ); + } + +_leave ("" ); }/*
@@ -170,8 +227,6 @@ void afs_lock_work(struct work_struct *work) {struct afs_vnode *vnode = container_of(work, struct afs_vnode, lock_work.work); -struct file_lock *fl, *next; -afs_lock_type_t type;struct key *key;int ret;
@@ -184,7 +239,7 @@ again:switch (vnode->lock_state) {case AFS_VNODE_LOCK_NEED_UNLOCK :_debug ("unlock" ); - vnode->lock_state =AFS_VNODE_LOCK_UNLOCKING ; +afs_set_lock_state (vnode,AFS_VNODE_LOCK_UNLOCKING );spin_unlock (&vnode->lock);/* attempt to release the server lock; if it fails, we just
@@ -196,22 +251,9 @@ again: vnode->fid.vid, vnode->fid.vnode, ret);spin_lock (&vnode->lock); -key_put (vnode->lock_key); - vnode->lock_key =NULL ; - vnode->lock_state =AFS_VNODE_LOCK_NONE ; - -if (list_empty (&vnode->pending_locks)) { -spin_unlock (&vnode->lock); -return ; - } - -/* The new front of the queue now owns the state variables. */ - next =list_entry (vnode->pending_locks.next, - struct file_lock, fl_u.afs.link); - vnode->lock_key =key_get (afs_file_key (next->fl_file)); - vnode->lock_type = (next->fl_type ==F_RDLCK ) ?AFS_LOCK_READ :AFS_LOCK_WRITE ; - vnode->lock_state =AFS_VNODE_LOCK_WAITING_FOR_CB ; - goto again; +afs_next_locker (vnode,0 ); +spin_unlock (&vnode->lock); +return ;/* If we've already got a lock, then it must be time to extend that * lock as AFS locks time out after 5 minutes.
@@ -222,7 +264,7 @@ again:ASSERT (!list_empty (&vnode->granted_locks)); key =key_get (vnode->lock_key); - vnode->lock_state =AFS_VNODE_LOCK_EXTENDING ; +afs_set_lock_state (vnode,AFS_VNODE_LOCK_EXTENDING );spin_unlock (&vnode->lock); ret =afs_extend_lock (vnode, key);/* RPC */
@@ -236,72 +278,26 @@ again:if (vnode->lock_state !=AFS_VNODE_LOCK_EXTENDING ) goto again; - vnode->lock_state =AFS_VNODE_LOCK_GRANTED ; +afs_set_lock_state (vnode,AFS_VNODE_LOCK_GRANTED ); -if (ret ==0 ) -afs_schedule_lock_extension (vnode); -else +if (ret !=0 )queue_delayed_work (afs_lock_manager, &vnode->lock_work,HZ *10 );spin_unlock (&vnode->lock);_leave (" [ext]" );return ; -/* If we don't have a granted lock, then we must've been called -* back by the server, and so if might be possible to get a -* lock we're currently waiting for. -*/ +/* If we're waiting for a callback to indicate lock release, we can't +* actually rely on this, so need to recheck at regular intervals. The +* problem is that the server might not notify us if the lock just +* expires (say because a client died) rather than being explicitly +* released. +*/ case AFS_VNODE_LOCK_WAITING_FOR_CB : -_debug ("get" ); - - key =key_get (vnode->lock_key); - type = vnode->lock_type; - vnode->lock_state =AFS_VNODE_LOCK_SETTING ; +_debug ("retry" ); +afs_next_locker (vnode,0 );spin_unlock (&vnode->lock); - - ret =afs_set_lock (vnode, key, type);/* RPC */ -key_put (key); - -spin_lock (&vnode->lock); -switch (ret) { -case -EWOULDBLOCK : -_debug ("blocked" ); -break ; -case 0 : -_debug ("acquired" ); - vnode->lock_state =AFS_VNODE_LOCK_GRANTED ; -/* Fall through */ -default : -/* Pass the lock or the error onto the first locker in -* the list - if they're looking for this type of lock. -* If they're not, we assume that whoever asked for it -* took a signal. -*/ -if (list_empty (&vnode->pending_locks)) { -_debug ("withdrawn" ); - vnode->lock_state =AFS_VNODE_LOCK_NEED_UNLOCK ; - goto again; - } - - fl =list_entry (vnode->pending_locks.next, - struct file_lock, fl_u.afs.link); - type = (fl->fl_type ==F_RDLCK ) ?AFS_LOCK_READ :AFS_LOCK_WRITE ; -if (vnode->lock_type != type) { -_debug ("changed" ); - vnode->lock_state =AFS_VNODE_LOCK_NEED_UNLOCK ; - goto again; - } - - fl->fl_u.afs.state = ret; -if (ret ==0 ) -afs_grant_locks (vnode, fl); -else -list_del_init (&fl->fl_u.afs.link); -wake_up (&fl->fl_wait); -spin_unlock (&vnode->lock); -_leave (" [granted]" ); -return ; - } +return ;default :/* Looks like a lock request was withdrawn. */
@@ -319,14 +315,15 @@ again:*/ static void afs_defer_unlock (struct afs_vnode *vnode) { -_enter ("" ); +_enter ("%u" , vnode->lock_state); -if (vnode->lock_state ==AFS_VNODE_LOCK_GRANTED || - vnode->lock_state ==AFS_VNODE_LOCK_EXTENDING ) { +if (list_empty (&vnode->granted_locks) && + (vnode->lock_state ==AFS_VNODE_LOCK_GRANTED || + vnode->lock_state ==AFS_VNODE_LOCK_EXTENDING )) {cancel_delayed_work (&vnode->lock_work); - vnode->lock_state =AFS_VNODE_LOCK_NEED_UNLOCK ; -afs_lock_may_be_available (vnode); +afs_set_lock_state (vnode,AFS_VNODE_LOCK_NEED_UNLOCK ); +queue_delayed_work (afs_lock_manager, &vnode->lock_work,0 ); } }
@@ -375,50 +372,6 @@ static int afs_do_setlk_check(struct afs_vnode *vnode, struct key *key,return 0 ; } -/* -* Remove the front runner from the pending queue. -* - The caller must hold vnode->lock. -*/ -static void afs_dequeue_lock (struct afs_vnode *vnode,struct file_lock *fl) -{ -struct file_lock *next; - -_enter ("" ); - -/* ->lock_type, ->lock_key and ->lock_state only belong to this -* file_lock if we're at the front of the pending queue or if we have -* the lock granted or if the lock_state is NEED_UNLOCK or UNLOCKING. -*/ -if (vnode->granted_locks.next == &fl->fl_u.afs.link && - vnode->granted_locks.prev == &fl->fl_u.afs.link) { -list_del_init (&fl->fl_u.afs.link); -afs_defer_unlock (vnode); -return ; - } - -if (!list_empty (&vnode->granted_locks) || - vnode->pending_locks.next != &fl->fl_u.afs.link) { -list_del_init (&fl->fl_u.afs.link); -return ; - } - -list_del_init (&fl->fl_u.afs.link); -key_put (vnode->lock_key); - vnode->lock_key =NULL ; - vnode->lock_state =AFS_VNODE_LOCK_NONE ; - -if (list_empty (&vnode->pending_locks)) -return ; - -/* The new front of the queue now owns the state variables. */ - next =list_entry (vnode->pending_locks.next, - struct file_lock, fl_u.afs.link); - vnode->lock_key =key_get (afs_file_key (next->fl_file)); - vnode->lock_type = (next->fl_type ==F_RDLCK ) ?AFS_LOCK_READ :AFS_LOCK_WRITE ; - vnode->lock_state =AFS_VNODE_LOCK_WAITING_FOR_CB ; -afs_lock_may_be_available (vnode); -} -/* * request a lock on a file on the server */
@@ -443,44 +396,66 @@ static int afs_do_setlk(struct file *file, struct file_lock *fl)return ret;spin_lock (&vnode->lock); +list_add_tail (&fl->fl_u.afs.link, &vnode->pending_locks); -/* If we've already got a readlock on the server then we instantly -* grant another readlock, irrespective of whether there are any -* pending writelocks. +/* If we've already got a lock on the server then try to move to having +* the VFS grant the requested lock. Note that this means that other +* clients may get starved out. */ -if (type ==AFS_LOCK_READ && - vnode->lock_state ==AFS_VNODE_LOCK_GRANTED && - vnode->lock_type ==AFS_LOCK_READ ) { -_debug ("instant readlock" ); -ASSERT (!list_empty (&vnode->granted_locks)); - goto share_existing_lock; - } +_debug ("try %u" , vnode->lock_state); +if (vnode->lock_state ==AFS_VNODE_LOCK_GRANTED ) { +if (type ==AFS_LOCK_READ ) { +_debug ("instant readlock" ); +list_move_tail (&fl->fl_u.afs.link, &vnode->granted_locks); + fl->fl_u.afs.state =AFS_LOCK_GRANTED ; + goto vnode_is_locked_u; + } -list_add_tail (&fl->fl_u.afs.link, &vnode->pending_locks); +if (vnode->lock_type ==AFS_LOCK_WRITE ) { +_debug ("instant writelock" ); +list_move_tail (&fl->fl_u.afs.link, &vnode->granted_locks); + fl->fl_u.afs.state =AFS_LOCK_GRANTED ; + goto vnode_is_locked_u; + } + }if (vnode->lock_state !=AFS_VNODE_LOCK_NONE ) goto need_to_wait; +try_to_lock:/* We don't have a lock on this vnode and we aren't currently waiting * for one either, so ask the server for a lock. * * Note that we need to be careful if we get interrupted by a signal * after dispatching the request as we may still get the lock, even * though we don't wait for the reply (it's not too bad a problem - the -* lock will expire in 10 mins anyway). +* lock will expire in 5 mins anyway). */ _debug ("not locked" ); vnode->lock_key =key_get (key); vnode->lock_type = type; - vnode->lock_state =AFS_VNODE_LOCK_SETTING ; +afs_set_lock_state (vnode,AFS_VNODE_LOCK_SETTING );spin_unlock (&vnode->lock); ret =afs_set_lock (vnode, key, type);/* RPC */ spin_lock (&vnode->lock);switch (ret) { +case -EKEYREJECTED : +case -EKEYEXPIRED : +case -EKEYREVOKED : +case -EPERM : +case -EACCES : + fl->fl_u.afs.state = ret; +list_del_init (&fl->fl_u.afs.link); +afs_next_locker (vnode, ret); + goto error_unlock; +default : - goto abort_attempt; + fl->fl_u.afs.state = ret; +list_del_init (&fl->fl_u.afs.link); +afs_next_locker (vnode,0 ); + goto error_unlock;case -EWOULDBLOCK :/* The server doesn't have a lock-waiting queue, so the client
@@ -490,29 +465,23 @@ static int afs_do_setlk(struct file *file, struct file_lock *fl)_debug ("would block" );ASSERT (list_empty (&vnode->granted_locks)); ASSERTCMP(vnode->pending_locks.next, ==, &fl->fl_u.afs.link); - vnode->lock_state =AFS_VNODE_LOCK_WAITING_FOR_CB ; - goto need_to_wait; + goto lock_is_contended;case 0 :_debug ("acquired" ); -break ; +afs_set_lock_state (vnode,AFS_VNODE_LOCK_GRANTED ); +afs_grant_locks (vnode); + goto vnode_is_locked_u; } -/* we've acquired a server lock, but it needs to be renewed after 5 -* mins */ - vnode->lock_state =AFS_VNODE_LOCK_GRANTED ; -afs_schedule_lock_extension (vnode); - -share_existing_lock: -/* the lock has been granted as far as we're concerned... */ - fl->fl_u.afs.state =AFS_LOCK_GRANTED ; -list_move_tail (&fl->fl_u.afs.link, &vnode->granted_locks); - -given_lock: -/* ... but we do still need to get the VFS's blessing */ +vnode_is_locked_u:spin_unlock (&vnode->lock); +vnode_is_locked: +/* the lock has been granted by the server... */ + ASSERTCMP(fl->fl_u.afs.state, ==, AFS_LOCK_GRANTED); - ret =posix_lock_file (file, fl,NULL ); +/* ... but the VFS still needs to distribute access on this client. */ + ret =locks_lock_file_wait (file, fl);if (ret <0 ) goto vfs_rejected_lock;
@@ -524,38 +493,61 @@ given_lock:_leave (" = 0" );return 0 ; +lock_is_contended: +if (!(fl->fl_flags &FL_SLEEP )) { +list_del_init (&fl->fl_u.afs.link); +afs_next_locker (vnode,0 ); + ret = -EAGAIN ; + goto error_unlock; + } + +afs_set_lock_state (vnode,AFS_VNODE_LOCK_WAITING_FOR_CB ); +queue_delayed_work (afs_lock_manager, &vnode->lock_work,HZ *5 ); + need_to_wait:/* We're going to have to wait. Either this client doesn't have a lock * on the server yet and we need to wait for a callback to occur, or -* the client does have a lock on the server, but it belongs to some -* other process(es) and is incompatible with the lock we want. +* the client does have a lock on the server, but it's shared and we +* need an exclusive lock. */ - ret = -EAGAIN ; -if (fl->fl_flags &FL_SLEEP ) { -spin_unlock (&vnode->lock); +spin_unlock (&vnode->lock); -_debug ("sleep" ); - ret =wait_event_interruptible (fl->fl_wait, - fl->fl_u.afs.state !=AFS_LOCK_PENDING ); +_debug ("sleep" ); + ret =wait_event_interruptible (fl->fl_wait, + fl->fl_u.afs.state !=AFS_LOCK_PENDING ); +_debug ("wait = %d" , ret); +if (fl->fl_u.afs.state >=0 && fl->fl_u.afs.state !=AFS_LOCK_GRANTED ) {spin_lock (&vnode->lock); - } -if (fl->fl_u.afs.state ==AFS_LOCK_GRANTED ) - goto given_lock; -if (fl->fl_u.afs.state <0 ) - ret = fl->fl_u.afs.state; +switch (fl->fl_u.afs.state) { +case AFS_LOCK_YOUR_TRY : + fl->fl_u.afs.state =AFS_LOCK_PENDING ; + goto try_to_lock; +case AFS_LOCK_PENDING : +if (ret >0 ) { +/* We need to retry the lock. We may not be +* notified by the server if it just expired +* rather than being released. +*/ + ASSERTCMP(vnode->lock_state, ==, AFS_VNODE_LOCK_WAITING_FOR_CB); +afs_set_lock_state (vnode,AFS_VNODE_LOCK_SETTING ); + fl->fl_u.afs.state =AFS_LOCK_PENDING ; + goto try_to_lock; + } + goto error_unlock; +case AFS_LOCK_GRANTED : +default : +break ; + } -abort_attempt: -/* we aren't going to get the lock, either because we're unwilling to -* wait, or because some signal happened */ -_debug ("abort" ); -afs_dequeue_lock (vnode, fl); +spin_unlock (&vnode->lock); + } -error_unlock: -spin_unlock (&vnode->lock); -_leave (" = %d" , ret); -return ret; +if (fl->fl_u.afs.state ==AFS_LOCK_GRANTED ) + goto vnode_is_locked; + ret = fl->fl_u.afs.state; + goto error; vfs_rejected_lock:/* The VFS rejected the lock we just obtained, so we have to discard
@@ -565,9 +557,13 @@ vfs_rejected_lock:_debug ("vfs refused %d" , ret);spin_lock (&vnode->lock);list_del_init (&fl->fl_u.afs.link); -if (list_empty (&vnode->granted_locks)) -afs_defer_unlock (vnode); - goto error_unlock; +afs_defer_unlock (vnode); + +error_unlock: +spin_unlock (&vnode->lock); +error: +_leave (" = %d" , ret); +return ret; }/*
@@ -583,7 +579,7 @@ static int afs_do_unlk(struct file *file, struct file_lock *fl)/* Flush all pending writes before doing anything with locks. */ vfs_fsync (file,0 ); - ret =posix_lock_file (file, fl,NULL ); + ret =locks_lock_file_wait (file, fl);_leave (" = %d [%u]" , ret, vnode->lock_state);return ret; }
@@ -705,7 +701,11 @@ static void afs_fl_release_private(struct file_lock *fl)_enter ("" );spin_lock (&vnode->lock); -afs_dequeue_lock (vnode, fl); + +list_del_init (&fl->fl_u.afs.link); +if (list_empty (&vnode->granted_locks)) +afs_defer_unlock (vnode); +_debug ("state %u for %p" , vnode->lock_state, vnode);spin_unlock (&vnode->lock); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 327/639 NFS: Dont interrupt file writeout due to fatal errors
In reply to Greg Kroah-HartmanFrom: Trond Myklebust <[email protected]>
[ Upstream commit 14bebe3c90b326d2a0df78aed5e9de090c71d878 ]
When flushing out dirty pages, the fact that we may hit fatal errors is not a reason to stop writeback. Those errors are reported through fsync(), not through the flush mechanism.
--- fs/nfs/write.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/write.c +1 -1
@@ -646,7 +646,7 @@ out:return ret; out_launder:nfs_write_error_remove_page (req); -return ret; +return 0 ; } static int nfs_do_writepage(struct page *page, struct writeback_control *wbc,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 328/639 coresight: catu: fix clang build warning
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 59d63de076607a9334b11628b5c3ddda1d8f56cd ]
Clang points out a syntax error, as the etr_catu_buf_ops structure is declared 'static' before the type is known:
In file included from drivers/hwtracing/coresight/coresight-tmc-etr.c:12:drivers/hwtracing/coresight/coresight-catu.h:116:40: warning: tentative definition of variable with internal linkage has incomplete non-array type 'const struct etr_buf_operations' [-Wtentative-definition-incomplete-type]
static const struct etr_buf_operations etr_catu_buf_ops;
^drivers/hwtracing/coresight/coresight-catu.h:116:21: note: forward declaration of 'struct etr_buf_operations' static const struct etr_buf_operations etr_catu_buf_ops;
This seems worth fixing in the code, so replace pointer to the empty constant structure with a NULL pointer. We need an extra NULL pointer check here, but the result should be better object code otherwise, avoiding the silly empty structure.
--- drivers/hwtracing/coresight/coresight-catu.h | 5 ----- drivers/hwtracing/coresight/coresight-tmc-etr.c | 5 +++-- 2 files changed, 3 insertions(+), 7 deletions(-)
drivers/hwtracing/coresight/coresight-catu.h +0 -5
@@ -109,11 +109,6 @@ static inline bool coresight_is_catu_device(struct coresight_device *csdev) return true; } -#ifdef CONFIG_CORESIGHT_CATU extern const struct etr_buf_operations etr_catu_buf_ops; -#else -/* Dummy declaration for the CATU ops */ -static const struct etr_buf_operations etr_catu_buf_ops; -#endif #endif
drivers/hwtracing/coresight/coresight-tmc-etr.c +3 -2
@@ -747,7 +747,8 @@ static inline void tmc_etr_disable_catu(struct tmc_drvdata *drvdata)static const struct etr_buf_operations *etr_buf_ops[] = { [ETR_MODE_FLAT ] = &etr_flat_buf_ops, [ETR_MODE_ETR_SG ] = &etr_sg_buf_ops, - [ETR_MODE_CATU ] = &etr_catu_buf_ops, + [ETR_MODE_CATU ] =IS_ENABLED (CONFIG_CORESIGHT_CATU ) + ? &etr_catu_buf_ops :NULL , }; static inline int tmc_etr_mode_alloc_buf(int mode,
@@ -761,7 +762,7 @@ static inline int tmc_etr_mode_alloc_buf(int mode,case ETR_MODE_FLAT :case ETR_MODE_ETR_SG :case ETR_MODE_CATU : -if (etr_buf_ops[mode]->alloc) +if (etr_buf_ops[mode] && etr_buf_ops[mode]->alloc) rc = etr_buf_ops[mode]->alloc (drvdata, etr_buf, node, pages);if (!rc)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 329/639 s390/kexec_file: Fix potential segment overlap in ELF loader
In reply to Greg Kroah-HartmanFrom: Philipp Rudo <[email protected]>
[ Upstream commit 6339a3889ad4d0dd930ed7a1e873fb81d3e690f7 ]
When loading an ELF image via kexec_file the segment alignment is ignored in the calculation for the load address of the next segment. When there are multiple segments this can lead to segment overlap and thus load failure.
--- arch/s390/kernel/kexec_elf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/kernel/kexec_elf.c +1 -1
@@ -58,7 +58,7 @@ static int kexec_file_add_elf_kernel(struct kimage *image,if (ret)return ret; - data->memsz += buf.memsz; + data->memsz =ALIGN (data->memsz, phdr->p_align) + buf.memsz; }return 0 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 330/639 irqchip/gic-v3-its: fix some definitions of inner cacheability attributes
In reply to Greg Kroah-HartmanFrom: Hongbo Yao <[email protected]>
[ Upstream commit 0f29456d08042134aff6e562d07a6365c841c4ad ]
Some definitions of Inner Cacheability attibutes need to be corrected.
--- include/linux/irqchip/arm-gic-v3.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
include/linux/irqchip/arm-gic-v3.h +6 -6
@@ -165,7 +165,7 @@#define GICR_PROPBASER_nCnB GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, nCnB)#define GICR_PROPBASER_nC GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, nC)#define GICR_PROPBASER_RaWt GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, RaWt) -#define GICR_PROPBASER_RaWb GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, RaWt) +#define GICR_PROPBASER_RaWb GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, RaWb)#define GICR_PROPBASER_WaWt GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, WaWt)#define GICR_PROPBASER_WaWb GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, WaWb)#define GICR_PROPBASER_RaWaWt GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, RaWaWt)
@@ -192,7 +192,7 @@#define GICR_PENDBASER_nCnB GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, nCnB)#define GICR_PENDBASER_nC GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, nC)#define GICR_PENDBASER_RaWt GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, RaWt) -#define GICR_PENDBASER_RaWb GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, RaWt) +#define GICR_PENDBASER_RaWb GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, RaWb)#define GICR_PENDBASER_WaWt GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, WaWt)#define GICR_PENDBASER_WaWb GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, WaWb)#define GICR_PENDBASER_RaWaWt GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, RaWaWt)
@@ -251,7 +251,7 @@#define GICR_VPROPBASER_nCnB GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, nCnB)#define GICR_VPROPBASER_nC GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, nC)#define GICR_VPROPBASER_RaWt GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, RaWt) -#define GICR_VPROPBASER_RaWb GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, RaWt) +#define GICR_VPROPBASER_RaWb GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, RaWb)#define GICR_VPROPBASER_WaWt GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, WaWt)#define GICR_VPROPBASER_WaWb GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, WaWb)#define GICR_VPROPBASER_RaWaWt GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, RaWaWt)
@@ -277,7 +277,7 @@#define GICR_VPENDBASER_nCnB GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, nCnB)#define GICR_VPENDBASER_nC GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, nC)#define GICR_VPENDBASER_RaWt GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, RaWt) -#define GICR_VPENDBASER_RaWb GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, RaWt) +#define GICR_VPENDBASER_RaWb GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, RaWb)#define GICR_VPENDBASER_WaWt GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, WaWt)#define GICR_VPENDBASER_WaWb GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, WaWb)#define GICR_VPENDBASER_RaWaWt GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, RaWaWt)
@@ -351,7 +351,7 @@#define GITS_CBASER_nCnB GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, nCnB)#define GITS_CBASER_nC GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, nC)#define GITS_CBASER_RaWt GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, RaWt) -#define GITS_CBASER_RaWb GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, RaWt) +#define GITS_CBASER_RaWb GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, RaWb)#define GITS_CBASER_WaWt GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, WaWt)#define GITS_CBASER_WaWb GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, WaWb)#define GITS_CBASER_RaWaWt GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, RaWaWt)
@@ -375,7 +375,7 @@#define GITS_BASER_nCnB GIC_BASER_CACHEABILITY(GITS_BASER, INNER, nCnB)#define GITS_BASER_nC GIC_BASER_CACHEABILITY(GITS_BASER, INNER, nC)#define GITS_BASER_RaWt GIC_BASER_CACHEABILITY(GITS_BASER, INNER, RaWt) -#define GITS_BASER_RaWb GIC_BASER_CACHEABILITY(GITS_BASER, INNER, RaWt) +#define GITS_BASER_RaWb GIC_BASER_CACHEABILITY(GITS_BASER, INNER, RaWb)#define GITS_BASER_WaWt GIC_BASER_CACHEABILITY(GITS_BASER, INNER, WaWt)#define GITS_BASER_WaWb GIC_BASER_CACHEABILITY(GITS_BASER, INNER, WaWb)#define GITS_BASER_RaWaWt GIC_BASER_CACHEABILITY(GITS_BASER, INNER, RaWaWt)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 331/639 scsi: qla2xxx: Fix a format specifier
In reply to Greg Kroah-HartmanFrom: Bart Van Assche <[email protected]>
[ Upstream commit 19ce192cd718e02f880197c0983404ca48236807 ]
Since mcmd->sess->port_name is eight bytes long, use %8phC to format that port name instead of %phC.
--- drivers/scsi/qla2xxx/qla_target.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_target.c +1 -1
@@ -2290,7 +2290,7 @@ void qlt_xmit_tm_rsp(struct qla_tgt_mgmt_cmd *mcmd) mcmd->orig_iocb.imm_ntfy.u.isp24.status_subcode == ELS_TPRLO) {ql_dbg (ql_dbg_disc, vha,0x2106 , -"TM response logo %phC status %#x state %#x" , +"TM response logo %8phC status %#x state %#x" , mcmd->sess->port_name, mcmd->fc_tm_rsp, mcmd->flags);qlt_schedule_sess_for_deletion (mcmd->sess);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 332/639 scsi: qla2xxx: Fix error handling in qlt_alloc_qfull_cmd()
In reply to Greg Kroah-HartmanFrom: Bart Van Assche <[email protected]>
[ Upstream commit c04466c17142d5eb566984372b9a5003d1900fe3 ]
The test "if (!cmd)" is not useful because it is guaranteed that cmd != NULL. Instead of testing the cmd pointer, rely on the tag to decide whether or not command allocation failed.
--- drivers/scsi/qla2xxx/qla_target.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/scsi/qla2xxx/qla_target.c +2 -5
@@ -5334,11 +5334,7 @@ qlt_alloc_qfull_cmd(struct scsi_qla_host *vha, se_sess = sess->se_sess; tag =sbitmap_queue_get (&se_sess->sess_tag_pool, &cpu); -if (tag <0 ) -return ; - - cmd = &((struct qla_tgt_cmd *)se_sess->sess_cmd_map)[tag]; -if (!cmd) { +if (tag <0 ) {ql_dbg (ql_dbg_io, vha,0x3009 ,"qla_target(%d): %s: Allocation of cmd failed\n" , vha->vp_idx, __func__);
@@ -5353,6 +5349,7 @@ qlt_alloc_qfull_cmd(struct scsi_qla_host *vha,return ; } + cmd = &((struct qla_tgt_cmd *)se_sess->sess_cmd_map)[tag];memset (cmd,0 ,sizeof (struct qla_tgt_cmd ));qlt_incr_num_pend_cmds (vha);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 333/639 scsi: qla2xxx: Avoid that qlt_send_resp_ctio() corrupts memory
In reply to Greg Kroah-HartmanFrom: Bart Van Assche <[email protected]>
[ Upstream commit a861b49273578e255426a499842cf7f465456351 ]
The "(&ctio->u.status1.sense_data)[i]" where i >= 0 expressions in qlt_send_resp_ctio() are probably typos and should have been "(&ctio->u.status1.sense_data[4 * i])" instead. Instead of only fixing these typos, modify the code for storing sense data such that it becomes easy to read. This patch fixes a Coverity complaint about accessing an array outside its bounds.
--- drivers/scsi/qla2xxx/qla_target.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/scsi/qla2xxx/qla_target.c +6 -6
@@ -2233,14 +2233,14 @@ void qlt_send_resp_ctio(struct qla_qpair *qpair, struct qla_tgt_cmd *cmd, ctio->u.status1.scsi_status |=cpu_to_le16 (SS_RESIDUAL_UNDER ); -/* Response code and sense key */ -put_unaligned_le32 (((0x70 <<24 ) | (sense_key <<8 )), - (&ctio->u.status1.sense_data)[0 ]); +/* Fixed format sense data. */ + ctio->u.status1.sense_data[0 ] =0x70 ; + ctio->u.status1.sense_data[2 ] = sense_key;/* Additional sense length */ -put_unaligned_le32 (0x0a , (&ctio->u.status1.sense_data)[1 ]); + ctio->u.status1.sense_data[7 ] =0xa ;/* ASC and ASCQ */ -put_unaligned_le32 (((asc <<24 ) | (ascq <<16 )), - (&ctio->u.status1.sense_data)[3 ]); + ctio->u.status1.sense_data[12 ] = asc; + ctio->u.status1.sense_data[13 ] = ascq;/* Memory Barrier */ wmb ();
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 334/639 KVM: PPC: Book3S HV: Fix lockdep warning when entering the guest
In reply to Greg Kroah-HartmanFrom: Alexey Kardashevskiy <[email protected]>
[ Upstream commit 3309bec85e60d60d6394802cb8e183a4f4a72def ]
The trace_hardirqs_on() sets current->hardirqs_enabled and from here the lockdep assumes interrupts are enabled although they are remain disabled until the context switches to the guest. Consequent srcu_read_lock() checks the flags in rcu_lock_acquire(), observes disabled interrupts and prints a warning (see below).
This moves trace_hardirqs_on/off closer to __kvmppc_vcore_entry to prevent lockdep from being confused.
DEBUG_LOCKS_WARN_ON(current->hardirqs_enabled)
WARNING: CPU: 16 PID: 8038 at kernel/locking/lockdep.c:4128 check_flags.part.25+0x224/0x280 [...] NIP [c000000000185b84] check_flags.part.25+0x224/0x280 LR [c000000000185b80] check_flags.part.25+0x220/0x280 Call Trace: [c000003fec253710] [c000000000185b80] check_flags.part.25+0x220/0x280 (unreliable) [c000003fec253780] [c000000000187ea4] lock_acquire+0x94/0x260 [c000003fec253840] [c00800001a1e9768] kvmppc_run_core+0xa60/0x1ab0 [kvm_hv] [c000003fec253a10] [c00800001a1ed944] kvmppc_vcpu_run_hv+0x73c/0xec0 [kvm_hv] [c000003fec253ae0] [c00800001a1095dc] kvmppc_vcpu_run+0x34/0x48 [kvm] [c000003fec253b00] [c00800001a1056bc] kvm_arch_vcpu_ioctl_run+0x2f4/0x400 [kvm] [c000003fec253b90] [c00800001a0f3618] kvm_vcpu_ioctl+0x460/0x850 [kvm] [c000003fec253d00] [c00000000041c4f4] do_vfs_ioctl+0xe4/0x930 [c000003fec253db0] [c00000000041ce04] ksys_ioctl+0xc4/0x110 [c000003fec253e00] [c00000000041ce78] sys_ioctl+0x28/0x80 [c000003fec253e20] [c00000000000b5a4] system_call+0x5c/0x70 Instruction dump: 419e0034 3d220004 39291730 81290000 2f890000 409e0020 3c82ffc6 3c62ffc5 3884be70 386329c0 4bf6ea71 60000000 <0fe00000> 3c62ffc6 3863be90 4801273d irq event stamp: 1025 hardirqs last enabled at (1025): [<c00800001a1e9728>] kvmppc_run_core+0xa20/0x1ab0 [kvm_hv] hardirqs last disabled at (1024): [<c00800001a1e9358>] kvmppc_run_core+0x650/0x1ab0 [kvm_hv] softirqs last enabled at (0): [<c0000000000f1210>] copy_process.isra.4.part.5+0x5f0/0x1d00 softirqs last disabled at (0): [<0000000000000000>] (null) ---[ end trace 31180adcc848993e ]--- possible reason: unannotated irqs-off. irq event stamp: 1025 hardirqs last enabled at (1025): [<c00800001a1e9728>] kvmppc_run_core+0xa20/0x1ab0 [kvm_hv] hardirqs last disabled at (1024): [<c00800001a1e9358>] kvmppc_run_core+0x650/0x1ab0 [kvm_hv] softirqs last enabled at (0): [<c0000000000f1210>] copy_process.isra.4.part.5+0x5f0/0x1d00 softirqs last disabled at (0): [<0000000000000000>] (null)
--- arch/powerpc/kvm/book3s_hv.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
arch/powerpc/kvm/book3s_hv.c +8 -7
@@ -2993,25 +2993,26 @@ static noinline void kvmppc_run_core(struct kvmppc_vcore *vc) } } -/* -* Interrupts will be enabled once we get into the guest, -* so tell lockdep that we're about to enable interrupts. -*/ -trace_hardirqs_on (); -guest_enter_irqoff (); srcu_idx =srcu_read_lock (&vc->kvm->srcu);this_cpu_disable_ftrace (); +/* +* Interrupts will be enabled once we get into the guest, +* so tell lockdep that we're about to enable interrupts. +*/ +trace_hardirqs_on (); + trap =__kvmppc_vcore_entry (); +trace_hardirqs_off (); +this_cpu_enable_ftrace ();srcu_read_unlock (&vc->kvm->srcu, srcu_idx); -trace_hardirqs_off ();set_irq_happened (trap);spin_lock (&vc->lock);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 335/639 netfilter: nft_flow_offload: add entry to flowtable after confirmation
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 270a8a297f42ecff82060aaa53118361f09c1f7d ]
This is fixing flow offload for UDP traffic where packets only follow one single direction.
The flow_offload_fixup_tcp() mechanism works fine in case that the offloaded entry remains in SYN_RECV state, given sequence tracking is reset and that conntrack handles syn+ack packets as a retransmission, ie.
sES + synack => sIG
for reply traffic.
--- net/netfilter/nft_flow_offload.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/netfilter/nft_flow_offload.c +1 -2
@@ -103,8 +103,7 @@ static void nft_flow_offload_eval(const struct nft_expr *expr, ct->status & IPS_SEQ_ADJUST) goto out; -if (ctinfo ==IP_CT_NEW || - ctinfo ==IP_CT_RELATED ) +if (!nf_ct_is_confirmed (ct)) goto out;if (test_and_set_bit (IPS_OFFLOAD_BIT , &ct->status))
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 336/639 PCI: iproc: Enable iProc config read for PAXBv2
In reply to Greg Kroah-HartmanFrom: Srinath Mannam <[email protected]>
[ Upstream commit 8cff995405eb0b563e7a0d2c49838611ea3f2692 ]
iProc config read flag has to be enabled for PAXBv2 instead of PAXB.
--- drivers/pci/controller/pcie-iproc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/pcie-iproc.c +1 -1
@@ -1347,7 +1347,6 @@ static int iproc_pcie_rev_init(struct iproc_pcie *pcie)break ;case IPROC_PCIE_PAXB : regs = iproc_pcie_reg_paxb; - pcie->iproc_cfg_read = true; pcie->has_apb_err_disable = true;if (pcie->need_ob_cfg) { pcie->ob_map = paxb_ob_map;
@@ -1356,6 +1355,7 @@ static int iproc_pcie_rev_init(struct iproc_pcie *pcie)break ;case IPROC_PCIE_PAXB_V2 : regs = iproc_pcie_reg_paxb_v2; + pcie->iproc_cfg_read = true; pcie->has_apb_err_disable = true;if (pcie->need_ob_cfg) { pcie->ob_map = paxb_v2_ob_map;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 337/639 ARM: dts: logicpd-som-lv: Fix MMC1 card detect
In reply to Greg Kroah-HartmanFrom: Adam Ford <[email protected]>
[ Upstream commit 6a38df676a0a06bfc7ff8607ac62ccd6d95969ad ]
The card detect pin was incorrectly using IRQ_TYPE_LEVEL_LOW instead of GPIO_ACTIVE_LOW when reading the state of the CD pin.
This was previosly fixed on Torpedo, but missed on the SOM-LV
--- arch/arm/boot/dts/logicpd-som-lv-baseboard.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/logicpd-som-lv-baseboard.dtsi +1 -1
@@ -153,7 +153,7 @@ pinctrl-names = "default"; pinctrl-0 = <&mmc1_pins>; wp-gpios = <&gpio4 30 GPIO_ACTIVE_HIGH>; /* gpio_126 */ - cd-gpios = <&gpio4 14 IRQ_TYPE_LEVEL_LOW>; /* gpio_110 */ + cd-gpios = <&gpio4 14 GPIO_ACTIVE_LOW>; /* gpio_110 */ vmmc-supply = <&vmmc1>; bus-width = <4>; cap-power-off-card;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 338/639 packet: in recvmsg msg_name return at least sizeof sockaddr_ll
In reply to Greg Kroah-HartmanFrom: Willem de Bruijn <[email protected]>
[ Upstream commit b2cf86e1563e33a14a1c69b3e508d15dc12f804c ]
Packet send checks that msg_name is at least sizeof sockaddr_ll. Packet recv must return at least this length, so that its output can be passed unmodified to packet send.
This ceased to be true since adding support for lladdr longer than sll_addr. Since, the return value uses true address length.
Always return at least sizeof sockaddr_ll, even if address length is shorter. Zero the padding bytes.
Change v1->v2: do not overwrite zeroed padding again. use copy_len.
--- net/packet/af_packet.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
net/packet/af_packet.c +11 -2
@@ -3371,20 +3371,29 @@ static int packet_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,sock_recv_ts_and_drops (msg, sk, skb);if (msg->msg_name) { +int copy_len; +/* If the address length field is there to be filled * in, we fill it in now. */ if (sock->type ==SOCK_PACKET ) {__sockaddr_check_size (sizeof (struct sockaddr_pkt )); msg->msg_namelen =sizeof (struct sockaddr_pkt ); + copy_len = msg->msg_namelen; }else {struct sockaddr_ll *sll = &PACKET_SKB_CB (skb)->sa.ll; msg->msg_namelen = sll->sll_halen + offsetof(struct sockaddr_ll , sll_addr); + copy_len = msg->msg_namelen; +if (msg->msg_namelen <sizeof (struct sockaddr_ll )) { +memset (msg->msg_name + + offsetof(struct sockaddr_ll , sll_addr), +0 ,sizeof (sll->sll_addr)); + msg->msg_namelen =sizeof (struct sockaddr_ll ); + } } -memcpy (msg->msg_name, &PACKET_SKB_CB (skb)->sa, - msg->msg_namelen); +memcpy (msg->msg_name, &PACKET_SKB_CB (skb)->sa, copy_len); }if (pkt_sk (sk)->auxdata) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 339/639 ASoC: fix valid stream condition
In reply to Greg Kroah-HartmanFrom: Jerome Brunet <[email protected]>
[ Upstream commit 6a7c59c6d9f3b280e81d7a04bbe4e55e90152dce ]
A stream may specify a rate range using 'rate_min' and 'rate_max', so a stream may be valid and not specify any rates. However, as stream cannot be valid and not have any channel. Let's use this condition instead to determine if a stream is valid or not.
--- sound/soc/soc-pcm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/soc-pcm.c +2 -2
@@ -42,8 +42,8 @@ static bool snd_soc_dai_stream_valid(struct snd_soc_dai *dai, int stream)else codec_stream = &dai->driver->capture; -/* If the codec specifies any rate at all, it supports the stream. */ -return codec_stream->rates; +/* If the codec specifies any channels at all, it supports the stream */ +return codec_stream->channels_min; }/**
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 340/639 usb: gadget: fsl: fix link error against usb-gadget module
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 2100e3ca3676e894fa48b8f6f01d01733387fe81 ]
The dependency to ensure this driver links correctly fails since it can not be a loadable module:
drivers/usb/phy/phy-fsl-usb.o: In function `fsl_otg_set_peripheral':
phy-fsl-usb.c:(.text+0x2224): undefined reference to `usb_gadget_vbus_disconnect'
Make the option 'tristate' so it can work correctly.
--- drivers/usb/phy/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/phy/Kconfig +1 -1
@@ -20,7 +20,7 @@ config AB8500_USB in host mode, low speed. config FSL_USB2_OTG - bool "Freescale USB OTG Transceiver Driver" + tristate "Freescale USB OTG Transceiver Driver" depends on USB_EHCI_FSL && USB_FSL_USB2 && USB_OTG_FSM=y && PM depends on USB_GADGET || !USB_GADGET # if USB_GADGET=m, this can't be 'y' select USB_PHY
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 341/639 dwc2: gadget: Fix completed transfer size calculation in DDMA
In reply to Greg Kroah-HartmanFrom: Minas Harutyunyan <[email protected]>
[ Upstream commit 5acb4b970184d189d901192d075997c933b82260 ]
Fix calculation of transfer size on completion in function dwc2_gadget_get_xfersize_ddma().
Added increment of descriptor pointer to move to next descriptor in the loop.
--- drivers/usb/dwc2/gadget.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/dwc2/gadget.c +1 -0
@@ -2230,6 +2230,7 @@ static unsigned int dwc2_gadget_get_xfersize_ddma(struct dwc2_hsotg_ep *hs_ep)if (status &DEV_DMA_STS_MASK )dev_err (hsotg->dev,"descriptor %d closed with %x\n" , i, status &DEV_DMA_STS_MASK ); + desc++; }return bytes_rem;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 342/639 IB/mlx5: Add missing XRC options to QP optional params mask
In reply to Greg Kroah-HartmanFrom: Jack Morgenstein <[email protected]>
[ Upstream commit 8f4426aa19fcdb9326ac44154a117b1a3a5ae126 ]
The QP transition optional parameters for the various transition for XRC QPs are identical to those for RC QPs.
Many of the XRC QP transition optional parameter bits are missing from the QP optional mask table. These omissions caused failures when doing XRC QP state transitions.
For example, when trying to change the response timer of an XRC receive QP via the RTS2RTS transition, the new timer value was ignored because MLX5_QP_OPTPAR_RNR_TIMEOUT bit was missing from the optional params mask for XRC qps for the RTS2RTS transition.
Fix this by adding the missing XRC optional parameters for all QP transitions to the opt_mask table.
--- drivers/infiniband/hw/mlx5/qp.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
drivers/infiniband/hw/mlx5/qp.c +21 -0
@@ -2598,6 +2598,11 @@ static enum mlx5_qp_optpar opt_mask[MLX5_QP_NUM_STATE][MLX5_QP_NUM_STATE][MLX5_Q [MLX5_QP_ST_UD ] =MLX5_QP_OPTPAR_PKEY_INDEX |MLX5_QP_OPTPAR_Q_KEY | MLX5_QP_OPTPAR_PRI_PORT, + [MLX5_QP_ST_XRC ] =MLX5_QP_OPTPAR_RRE | +MLX5_QP_OPTPAR_RAE | +MLX5_QP_OPTPAR_RWE | +MLX5_QP_OPTPAR_PKEY_INDEX | +MLX5_QP_OPTPAR_PRI_PORT , }, [MLX5_QP_STATE_RTR] = { [MLX5_QP_ST_RC] = MLX5_QP_OPTPAR_ALT_ADDR_PATH |
@@ -2631,6 +2636,12 @@ static enum mlx5_qp_optpar opt_mask[MLX5_QP_NUM_STATE][MLX5_QP_NUM_STATE][MLX5_QMLX5_QP_OPTPAR_RWE | MLX5_QP_OPTPAR_PM_STATE, [MLX5_QP_ST_UD] = MLX5_QP_OPTPAR_Q_KEY, + [MLX5_QP_ST_XRC ] =MLX5_QP_OPTPAR_ALT_ADDR_PATH | +MLX5_QP_OPTPAR_RRE | +MLX5_QP_OPTPAR_RAE | +MLX5_QP_OPTPAR_RWE | +MLX5_QP_OPTPAR_PM_STATE | + MLX5_QP_OPTPAR_RNR_TIMEOUT, }, }, [MLX5_QP_STATE_RTS] = {
@@ -2647,6 +2658,12 @@ static enum mlx5_qp_optpar opt_mask[MLX5_QP_NUM_STATE][MLX5_QP_NUM_STATE][MLX5_Q [MLX5_QP_ST_UD ] =MLX5_QP_OPTPAR_Q_KEY |MLX5_QP_OPTPAR_SRQN | MLX5_QP_OPTPAR_CQN_RCV, + [MLX5_QP_ST_XRC ] =MLX5_QP_OPTPAR_RRE | +MLX5_QP_OPTPAR_RAE | +MLX5_QP_OPTPAR_RWE | +MLX5_QP_OPTPAR_RNR_TIMEOUT | +MLX5_QP_OPTPAR_PM_STATE | + MLX5_QP_OPTPAR_ALT_ADDR_PATH, }, }, [MLX5_QP_STATE_SQER] = {
@@ -2658,6 +2675,10 @@ static enum mlx5_qp_optpar opt_mask[MLX5_QP_NUM_STATE][MLX5_QP_NUM_STATE][MLX5_QMLX5_QP_OPTPAR_RWE |MLX5_QP_OPTPAR_RAE | MLX5_QP_OPTPAR_RRE, + [MLX5_QP_ST_XRC ] =MLX5_QP_OPTPAR_RNR_TIMEOUT | +MLX5_QP_OPTPAR_RWE | +MLX5_QP_OPTPAR_RAE | + MLX5_QP_OPTPAR_RRE, }, }, };
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 343/639 RDMA/rxe: Consider skb reserve space based on netdev of GID
In reply to Greg Kroah-HartmanFrom: Parav Pandit <[email protected]>
[ Upstream commit 3bf3e2b881c1412d0329ce9376dfe1518489b8fc ]
Always consider the skb reserve space based on netdevice of the GID attribute, regardless of vlan or non vlan netdevice.
--- drivers/infiniband/sw/rxe/rxe_net.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/sw/rxe/rxe_net.c +2 -1
@@ -533,8 +533,9 @@ struct sk_buff *rxe_init_packet(struct rxe_dev *rxe, struct rxe_av *av,if (unlikely (!skb)) goto out; -skb_reserve (skb, hdr_len +LL_RESERVED_SPACE (rxe->ndev)); +skb_reserve (skb, hdr_len +LL_RESERVED_SPACE (ndev)); +/* FIXME: hold reference to this netdev until life of this skb. */ skb->dev = ndev;if (av->network_type ==RDMA_NETWORK_IPV4 ) skb->protocol =htons (ETH_P_IP );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 344/639 iommu/vt-d: Make kernel parameter igfx_off work with vIOMMU
In reply to Greg Kroah-HartmanFrom: Lu Baolu <[email protected]>
[ Upstream commit 5daab58043ee2bca861068e2595564828f3bc663 ]
The kernel parameter igfx_off is used by users to disable DMA remapping for the Intel integrated graphic device. It was designed for bare metal cases where a dedicated IOMMU is used for graphic. This doesn't apply to virtual IOMMU case where an include-all IOMMU is used. This makes the kernel parameter work with virtual IOMMU as well.
--- drivers/iommu/intel-iommu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/iommu/intel-iommu.c +4 -1
@@ -3387,9 +3387,12 @@ static int __init init_dmars(void) iommu_identity_mapping |=IDENTMAP_ALL ;#ifdef CONFIG_INTEL_IOMMU_BROKEN_GFX_WA - iommu_identity_mapping |=IDENTMAP_GFX ; + dmar_map_gfx =0 ;#endif +if (!dmar_map_gfx) + iommu_identity_mapping |=IDENTMAP_GFX ; +check_tylersburg_isoch ();if (iommu_identity_mapping) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 345/639 net: ena: fix swapped parameters when calling ena_com_indirect_table_fill_entry
In reply to Greg Kroah-HartmanFrom: Sameeh Jubran <[email protected]>
[ Upstream commit 3c6eeff295f01bdf1c6c3addcb0a04c0c6c029e9 ]
second parameter should be the index of the table rather than the value.
--- drivers/net/ethernet/amazon/ena/ena_ethtool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/amazon/ena/ena_ethtool.c +2 -2
@@ -695,8 +695,8 @@ static int ena_set_rxfh(struct net_device *netdev, const u32 *indir,if (indir) {for (i =0 ; i <ENA_RX_RSS_TABLE_SIZE ; i++) { rc =ena_com_indirect_table_fill_entry (ena_dev, -ENA_IO_RXQ_IDX (indir[i]), - i); + i, +ENA_IO_RXQ_IDX (indir[i]));if (unlikely (rc)) {netif_err (adapter, drv, netdev,"Cannot fill indirect table (index is too large)\n" );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 346/639 net: ena: fix: Free napi resources when ena_up() fails
In reply to Greg Kroah-HartmanFrom: Sameeh Jubran <[email protected]>
[ Upstream commit b287cdbd1cedfc9606682c6e02b58d00ff3a33ae ]
ena_up() calls ena_init_napi() but does not call ena_del_napi() in case of failure. This causes a segmentation fault upon rmmod when netif_napi_del() is called. Fix this bug by calling ena_del_napi() before returning error from ena_up().
--- drivers/net/ethernet/amazon/ena/ena_netdev.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/amazon/ena/ena_netdev.c +1 -0
@@ -1800,6 +1800,7 @@ err_setup_rx: err_setup_tx:ena_free_io_irq (adapter); err_req_irq: +ena_del_napi (adapter);return rc; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 347/639 net: ena: fix incorrect test of supported hash function
In reply to Greg Kroah-HartmanFrom: Sameeh Jubran <[email protected]>
[ Upstream commit d3cfe7ddbc3dfbb9b201615b7fef8fd66d1b5fe8 ]
ena_com_set_hash_function() tests if a hash function is supported by the device before setting it.
The test returns the opposite result than needed. Reverse the condition to return the correct value.
Also use the BIT macro instead of inline shift.
--- drivers/net/ethernet/amazon/ena/ena_com.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/amazon/ena/ena_com.c +1 -1
@@ -2008,7 +2008,7 @@ int ena_com_set_hash_function(struct ena_com_dev *ena_dev)if (unlikely (ret))return ret; -if (get_resp.u.flow_hash_func.supported_func & (1 << rss->hash_func)) { +if (!(get_resp.u.flow_hash_func.supported_func &BIT (rss->hash_func))) {pr_err ("Func hash %d isn't supported by device, abort\n" , rss->hash_func);return -EOPNOTSUPP ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 348/639 net: ena: fix ena_com_fill_hash_function() implementation
In reply to Greg Kroah-HartmanFrom: Sameeh Jubran <[email protected]>
[ Upstream commit 11bd7a00c0d8ffe33d1e926f8e789b4aea787186 ]
ena_com_fill_hash_function() didn't configure the rss->hash_func.
--- drivers/net/ethernet/amazon/ena/ena_com.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/amazon/ena/ena_com.c +1 -0
@@ -2093,6 +2093,7 @@ int ena_com_fill_hash_function(struct ena_com_dev *ena_dev,return -EINVAL ; } + rss->hash_func = func; rc =ena_com_set_hash_function (ena_dev);/* Restore the old function */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 349/639 dmaengine: tegra210-adma: restore channel status
In reply to Greg Kroah-HartmanFrom: Sameer Pujar <[email protected]>
[ Upstream commit f33e7bb3eb922618612a90f0a828c790e8880773 ]
Status of ADMA channel registers is not saved and restored during system suspend. During active playback if system enters suspend, this results in wrong state of channel registers during system resume and playback fails to resume properly. Fix this by saving following channel registers in runtime suspend and restore during runtime resume.
* ADMA_CH_LOWER_SRC_ADDR
* ADMA_CH_LOWER_TRG_ADDR
* ADMA_CH_FIFO_CTRL
* ADMA_CH_CONFIG
* ADMA_CH_CTRL
* ADMA_CH_CMD
* ADMA_CH_TC
Runtime PM calls will be inovked during system resume path if a playback or capture needs to be resumed. Hence above changes work fine for system suspend case.
--- drivers/dma/tegra210-adma.c | 46 ++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-)
drivers/dma/tegra210-adma.c +45 -1
@@ -98,6 +98,7 @@ struct tegra_adma_chan_regs {unsigned int src_addr;unsigned int trg_addr;unsigned int fifo_ctrl; +unsigned int cmd;unsigned int tc; };
@@ -127,6 +128,7 @@ struct tegra_adma_chan {enum dma_transfer_direction sreq_dir;unsigned int sreq_index;bool sreq_reserved; +struct tegra_adma_chan_regs ch_regs;/* Transfer count and position info */ unsigned int tx_buf_count;
@@ -635,8 +637,30 @@ static struct dma_chan *tegra_dma_of_xlate(struct of_phandle_args *dma_spec,static int tegra_adma_runtime_suspend (struct device *dev) {struct tegra_adma *tdma =dev_get_drvdata (dev); +struct tegra_adma_chan_regs *ch_reg; +struct tegra_adma_chan *tdc; +int i; tdma->global_cmd =tdma_read (tdma,ADMA_GLOBAL_CMD ); +if (!tdma->global_cmd) + goto clk_disable; + +for (i =0 ; i < tdma->nr_channels; i++) { + tdc = &tdma->channels[i]; + ch_reg = &tdc->ch_regs; + ch_reg->cmd =tdma_ch_read (tdc,ADMA_CH_CMD ); +/* skip if channel is not active */ +if (!ch_reg->cmd) +continue ; + ch_reg->tc =tdma_ch_read (tdc,ADMA_CH_TC ); + ch_reg->src_addr =tdma_ch_read (tdc,ADMA_CH_LOWER_SRC_ADDR ); + ch_reg->trg_addr =tdma_ch_read (tdc,ADMA_CH_LOWER_TRG_ADDR ); + ch_reg->ctrl =tdma_ch_read (tdc,ADMA_CH_CTRL ); + ch_reg->fifo_ctrl =tdma_ch_read (tdc,ADMA_CH_FIFO_CTRL ); + ch_reg->config =tdma_ch_read (tdc,ADMA_CH_CONFIG ); + } + +clk_disable:clk_disable_unprepare (tdma->ahub_clk);return 0 ;
@@ -645,7 +669,9 @@ static int tegra_adma_runtime_suspend(struct device *dev)static int tegra_adma_runtime_resume (struct device *dev) {struct tegra_adma *tdma =dev_get_drvdata (dev); -int ret; +struct tegra_adma_chan_regs *ch_reg; +struct tegra_adma_chan *tdc; +int ret, i; ret =clk_prepare_enable (tdma->ahub_clk);if (ret) {
@@ -654,6 +680,24 @@ static int tegra_adma_runtime_resume(struct device *dev) }tdma_write (tdma,ADMA_GLOBAL_CMD , tdma->global_cmd); +if (!tdma->global_cmd) +return 0 ; + +for (i =0 ; i < tdma->nr_channels; i++) { + tdc = &tdma->channels[i]; + ch_reg = &tdc->ch_regs; +/* skip if channel was not active earlier */ +if (!ch_reg->cmd) +continue ; +tdma_ch_write (tdc,ADMA_CH_TC , ch_reg->tc); +tdma_ch_write (tdc,ADMA_CH_LOWER_SRC_ADDR , ch_reg->src_addr); +tdma_ch_write (tdc,ADMA_CH_LOWER_TRG_ADDR , ch_reg->trg_addr); +tdma_ch_write (tdc,ADMA_CH_CTRL , ch_reg->ctrl); +tdma_ch_write (tdc,ADMA_CH_FIFO_CTRL , ch_reg->fifo_ctrl); +tdma_ch_write (tdc,ADMA_CH_CONFIG , ch_reg->config); +tdma_ch_write (tdc,ADMA_CH_CMD , ch_reg->cmd); + } +return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 350/639 watchdog: rtd119x_wdt: Fix remove function
In reply to Greg Kroah-HartmanFrom: Guenter Roeck <[email protected]>
[ Upstream commit 8dd29f19512cc75ee470d7bb8ec86af199de23a8 ]
The driver registers the watchdog with devm_watchdog_register_device() but still calls watchdog_unregister_device() on remove. Since clocks have to be stopped when removing the driver, after the watchdog device has been unregistered, we can not drop the call to watchdog_unregister_device(). Use watchdog_register_device() to register the watchdog.
--- drivers/watchdog/rtd119x_wdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/rtd119x_wdt.c +1 -1
@@ -135,7 +135,7 @@ static int rtd119x_wdt_probe(struct platform_device *pdev)rtd119x_wdt_set_timeout (&data->wdt_dev, data->wdt_dev.timeout);rtd119x_wdt_stop (&data->wdt_dev); - ret =devm_watchdog_register_device (&pdev->dev, &data->wdt_dev); + ret =watchdog_register_device (&data->wdt_dev);if (ret) {clk_disable_unprepare (data->clk);clk_put (data->clk);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 351/639 mmc: core: fix possible use after free of host
In reply to Greg Kroah-HartmanFrom: Pan Bian <[email protected]>
[ Upstream commit 8e1943af2986db42bee2b8dddf49a36cdb2e9219 ]
In the function mmc_alloc_host, the function put_device is called to release allocated resources when mmc_gpio_alloc fails. Finally, the function pointed by host->class_dev.class->dev_release (i.e., mmc_host_classdev_release) is used to release resources including the host structure. However, after put_device, host is used and released again. Resulting in a use-after-free bug.
--- drivers/mmc/core/host.c | 2 -- 1 file changed, 2 deletions(-)
drivers/mmc/core/host.c +0 -2
@@ -385,8 +385,6 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev)if (mmc_gpio_alloc (host)) {put_device (&host->class_dev); -ida_simple_remove (&mmc_host_ida, host->index); -kfree (host);return NULL ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 352/639 lightnvm: pblk: fix lock order in pblk_rb_tear_down_check
In reply to Greg Kroah-HartmanFrom: Igor Konopko <[email protected]>
[ Upstream commit 486b5aac85f6ec0b2df3e82a6a629d5eb7804db5 ]
In pblk_rb_tear_down_check() the spinlock functions are not called in proper order.
--- drivers/lightnvm/pblk-rb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/lightnvm/pblk-rb.c +1 -1
@@ -784,8 +784,8 @@ int pblk_rb_tear_down_check(struct pblk_rb *rb) } out: -spin_unlock (&rb->w_lock);spin_unlock_irq (&rb->s_lock); +spin_unlock (&rb->w_lock);return ret; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 353/639 ath10k: Fix encoding for protected management frames
In reply to Greg Kroah-HartmanFrom: Rakesh Pillai <[email protected]>
[ Upstream commit 42f1bc43e6a97b9ddbe976eba9bd05306c990c75 ]
Currently the protected management frames are
not appended with the MIC_LEN which results in
the protected management frames being encoded
incorrectly.
Add the extra space at the end of the protected
management frames to fix this encoding error for
the protected management frames.
Tested HW: WCN3990
Tested FW: WLAN.HL.3.1-00784-QCAHLSWMTPLZ-1
--- drivers/net/wireless/ath/ath10k/wmi-tlv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/wmi-tlv.c +3 -1
@@ -2692,8 +2692,10 @@ ath10k_wmi_tlv_op_gen_mgmt_tx_send(struct ath10k *ar, struct sk_buff *msdu,if ((ieee80211_is_action (hdr->frame_control) ||ieee80211_is_deauth (hdr->frame_control) ||ieee80211_is_disassoc (hdr->frame_control)) && -ieee80211_has_protected (hdr->frame_control)) +ieee80211_has_protected (hdr->frame_control)) { +skb_put (msdu,IEEE80211_CCMP_MIC_LEN ); buf_len +=IEEE80211_CCMP_MIC_LEN ; + } buf_len =min_t (u32, buf_len,WMI_TLV_MGMT_TX_FRAME_MAX_LEN ); buf_len =round_up (buf_len,4 );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 354/639 afs: Fix the afs.cell and afs.volume xattr handlers
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit c73aa4102f5b9f261a907c3b3df94cd2c478504d ]
Fix the ->get handlers for the afs.cell and afs.volume xattrs to pass the source data size to memcpy() rather than target buffer size.
Overcopying the source data occasionally causes the kernel to oops.
--- fs/afs/xattr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/afs/xattr.c +2 -2
@@ -50,7 +50,7 @@ static int afs_xattr_get_cell(const struct xattr_handler *handler,return namelen;if (namelen > size)return -ERANGE ; -memcpy (buffer, cell->name, size); +memcpy (buffer, cell->name, namelen);return namelen; }
@@ -104,7 +104,7 @@ static int afs_xattr_get_volume(const struct xattr_handler *handler,return namelen;if (namelen > size)return -ERANGE ; -memcpy (buffer, volname, size); +memcpy (buffer, volname, namelen);return namelen; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 355/639 vfio/mdev: Avoid release parent reference during error path
In reply to Greg Kroah-HartmanFrom: Parav Pandit <[email protected]>
[ Upstream commit 60e7f2c3fe9919cee9534b422865eed49f4efb15 ]
During mdev parent registration in mdev_register_device(), if parent device is duplicate, it releases the reference of existing parent device.
This is incorrect. Existing parent device should not be touched.
--- drivers/vfio/mdev/mdev_core.c | 1 + 1 file changed, 1 insertion(+)
drivers/vfio/mdev/mdev_core.c +1 -0
@@ -182,6 +182,7 @@ int mdev_register_device(struct device *dev, const struct mdev_parent_ops *ops)/* Check for duplicate */ parent =__find_parent_device (dev);if (parent) { + parent =NULL ; ret = -EEXIST ; goto add_dev_err; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 356/639 vfio/mdev: Follow correct remove sequence
In reply to Greg Kroah-HartmanFrom: Parav Pandit <[email protected]>
[ Upstream commit a6d6f4f160f76d840e59affe664b8d3159e23056 ]
mdev_remove_sysfs_files() should follow exact mirror sequence of a create, similar to what is followed in error unwinding path of mdev_create_sysfs_files().
--- drivers/vfio/mdev/mdev_sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vfio/mdev/mdev_sysfs.c +1 -1
@@ -280,7 +280,7 @@ type_link_failed:void mdev_remove_sysfs_files (struct device *dev,struct mdev_type *type) { +sysfs_remove_files (&dev->kobj, mdev_device_attrs);sysfs_remove_link (&dev->kobj,"mdev_type" );sysfs_remove_link (type->devices_kobj,dev_name (dev)); -sysfs_remove_files (&dev->kobj, mdev_device_attrs); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 357/639 vfio/mdev: Fix aborting mdev child device removal if one fails
In reply to Greg Kroah-HartmanFrom: Parav Pandit <[email protected]>
[ Upstream commit 6093e348a5e2475c5bb2e571346460f939998670 ]
device_for_each_child() stops executing callback function for remaining child devices, if callback hits an error.
Each child mdev device is independent of each other.
While unregistering parent device, mdev core must remove all child mdev devices.
Therefore, mdev_device_remove_cb() always returns success so that device_for_each_child doesn't abort if one child removal hits error.
While at it, improve remove and unregister functions for below simplicity.
There isn't need to pass forced flag pointer during mdev parent removal which invokes mdev_device_remove(). So simplify the flow.
mdev_device_remove() is called from two paths.
1. mdev_unregister_driver()
mdev_device_remove_cb()
mdev_device_remove()
2. remove_store()
mdev_device_remove()
--- drivers/vfio/mdev/mdev_core.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/vfio/mdev/mdev_core.c +4 -6
@@ -150,10 +150,10 @@ static int mdev_device_remove_ops(struct mdev_device *mdev, bool force_remove)static int mdev_device_remove_cb (struct device *dev,void *data) { -if (!dev_is_mdev (dev)) -return 0 ; +if (dev_is_mdev (dev)) +mdev_device_remove (dev, true); -return mdev_device_remove (dev, data ? *(bool *)data : true); +return 0 ; }/*
@@ -241,7 +241,6 @@ EXPORT_SYMBOL(mdev_register_device);void mdev_unregister_device (struct device *dev) {struct mdev_parent *parent; -bool force_remove = true;mutex_lock (&parent_list_lock); parent =__find_parent_device (dev);
@@ -255,8 +254,7 @@ void mdev_unregister_device(struct device *dev)list_del (&parent->next);class_compat_remove_link (mdev_bus_compat_class, dev,NULL ); -device_for_each_child (dev, (void *)&force_remove, - mdev_device_remove_cb); +device_for_each_child (dev,NULL , mdev_device_remove_cb);parent_remove_sysfs_files (parent);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 358/639 l2tp: Fix possible NULL pointer dereference
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit 638a3a1e349ddf5b82f222ff5cb3b4f266e7c278 ]
BUG: unable to handle kernel NULL pointer dereference at 0000000000000128 PGD 0 P4D 0 Oops: 0000 [#1 CPU: 0 PID: 5697 Comm: modprobe Tainted: G W 5.1.0-rc7+ #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.9.3-0-ge2fc41e-prebuilt.qemu-project.org 04/01/2014 RIP: 0010:__lock_acquire+0x53/0x10b0 Code: 8b 1c 25 40 5e 01 00 4c 8b 6d 10 45 85 e4 0f 84 bd 06 00 00 44 8b 1d 7c d2 09 02 49 89 fe 41 89 d2 45 85 db 0f 84 47 02 00 00 <48> 81 3f a0 05 70 83 b8 00 00 00 00 44 0f 44 c0 83 fe 01 0f 86 3a RSP: 0018:ffffc90001c07a28 EFLAGS: 00010002 RAX: 0000000000000000 RBX: ffff88822f038440 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000128 RBP: ffffc90001c07a88 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000001 R13: 0000000000000000 R14: 0000000000000128 R15: 0000000000000000 FS: 00007fead0811540(0000) GS:ffff888237a00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000128 CR3: 00000002310da000 CR4: 00000000000006f0 Call Trace: ? __lock_acquire+0x24e/0x10b0 lock_acquire+0xdf/0x230 ? flush_workqueue+0x71/0x530 flush_workqueue+0x97/0x530 ? flush_workqueue+0x71/0x530 l2tp_exit_net+0x170/0x2b0 [l2tp_core ? l2tp_exit_net+0x93/0x2b0 [l2tp_core ops_exit_list.isra.6+0x36/0x60 unregister_pernet_operations+0xb8/0x110 unregister_pernet_device+0x25/0x40 l2tp_init+0x55/0x1000 [l2tp_core ? 0xffffffffa018d000 do_one_initcall+0x6c/0x3cc ? do_init_module+0x22/0x1f1 ? rcu_read_lock_sched_held+0x97/0xb0 ? kmem_cache_alloc_trace+0x325/0x3b0 do_init_module+0x5b/0x1f1 load_module+0x1db1/0x2690 ? m_show+0x1d0/0x1d0 __do_sys_finit_module+0xc5/0xd0 __x64_sys_finit_module+0x15/0x20 do_syscall_64+0x6b/0x1d0 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x7fead031a839 Code: 00 f3 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 1f f6 2c 00 f7 d8 64 89 01 48 RSP: 002b:00007ffe8d9acca8 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 RAX: ffffffffffffffda RBX: 0000560078398b80 RCX: 00007fead031a839 RDX: 0000000000000000 RSI: 000056007659dc2e RDI: 0000000000000003 RBP: 000056007659dc2e R08: 0000000000000000 R09: 0000560078398b80 R10: 0000000000000003 R11: 0000000000000246 R12: 0000000000000000 R13: 00005600783a04a0 R14: 0000000000040000 R15: 0000560078398b80 Modules linked in: l2tp_core(+) e1000 ip_tables ipv6 [last unloaded: l2tp_core CR2: 0000000000000128 ---[ end trace 8322b2b8bf83f8e1
If alloc_workqueue fails in l2tp_init, l2tp_net_ops is unregistered on failure path. Then l2tp_exit_net is called which will flush NULL workqueue, this patch add a NULL check to fix it.
--- net/l2tp/l2tp_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/l2tp/l2tp_core.c +2 -1
@@ -1735,7 +1735,8 @@ static __net_exit void l2tp_exit_net(struct net *net) }rcu_read_unlock_bh (); -flush_workqueue (l2tp_wq); +if (l2tp_wq) +flush_workqueue (l2tp_wq);rcu_barrier ();for (hash =0 ; hash <L2TP_HASH_SIZE_2 ; hash++)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 359/639 ALSA: aica: Fix a long-time build breakage
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 534420c6ff87d3052540f1fd346e0adcff440819 ]
The build of aica sound driver has been broken since the timer API conversion and some code rewrite. This patch fixes the breakage by using the common substream field, as well as a bit cleaning up wrt the timer handling in the code.
--- sound/sh/aica.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
sound/sh/aica.c +4 -10
@@ -303,7 +303,7 @@ static void aica_period_elapsed(struct timer_list *t) {struct snd_card_aica *dreamcastcard =from_timer (dreamcastcard, t, timer); -struct snd_pcm_substream *substream = dreamcastcard->timer_substream; +struct snd_pcm_substream *substream = dreamcastcard->substream;/*timer function - so cannot sleep */ int play_period;struct snd_pcm_runtime *runtime;
@@ -335,13 +335,6 @@ static void spu_begin_dma(struct snd_pcm_substream *substream) dreamcastcard = substream->pcm->private_data;/*get the queue to do the work */ schedule_work (&(dreamcastcard->spu_dma_work)); -/* Timer may already be running */ -if (unlikely (dreamcastcard->timer_substream)) { -mod_timer (&dreamcastcard->timer, jiffies +4 ); -return ; - } -timer_setup (&dreamcastcard->timer, aica_period_elapsed,0 ); - dreamcastcard->timer_substream = substream;mod_timer (&dreamcastcard->timer, jiffies +4 ); }
@@ -379,8 +372,8 @@ static int snd_aicapcm_pcm_close(struct snd_pcm_substream {struct snd_card_aica *dreamcastcard = substream->pcm->private_data;flush_work (&(dreamcastcard->spu_dma_work)); -if (dreamcastcard->timer_substream) -del_timer (&dreamcastcard->timer); +del_timer (&dreamcastcard->timer); + dreamcastcard->substream =NULL ;kfree (dreamcastcard->channel);spu_disable ();return 0 ;
@@ -615,6 +608,7 @@ static int snd_aica_probe(struct platform_device *devptr) "Yamaha AICA Super Intelligent Sound Processor for SEGA Dreamcast");/* Prepare to use the queue */ INIT_WORK (&(dreamcastcard->spu_dma_work), run_spu_dma); +timer_setup (&dreamcastcard->timer, aica_period_elapsed,0 );/* Load the PCM 'chip' */ err =snd_aicapcmchip (dreamcastcard,0 );if (unlikely (err <0 ))
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 360/639 media: omap_vout: potential buffer overflow in vidioc_dqbuf()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit dd6e2a981bfe83aa4a493143fd8cf1edcda6c091 ]
The "b->index" is a u32 the comes from the user in the ioctl. It hasn't been checked. We aren't supposed to use it but we're instead supposed to use the value that gets written to it when we call videobuf_dqbuf().
The videobuf_dqbuf() first memsets it to zero and then re-initializes it inside the videobuf_status() function. It's this final value which we want.
Hans Verkuil pointed out that we need to check the return from videobuf_dqbuf(). I ended up doing a little cleanup related to that as well.
--- drivers/media/platform/omap/omap_vout.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/media/platform/omap/omap_vout.c +6 -9
@@ -1527,23 +1527,20 @@ static int vidioc_dqbuf(struct file *file, void *fh, struct v4l2_buffer *b)unsigned long size;struct videobuf_buffer *vb; - vb = q->bufs[b->index]; -if (!vout->streaming)return -EINVAL ; -if (file->f_flags &O_NONBLOCK ) -/* Call videobuf_dqbuf for non blocking mode */ - ret =videobuf_dqbuf (q, (struct v4l2_buffer *)b,1 ); -else -/* Call videobuf_dqbuf for blocking mode */ - ret =videobuf_dqbuf (q, (struct v4l2_buffer *)b,0 ); + ret =videobuf_dqbuf (q, b, !!(file->f_flags &O_NONBLOCK )); +if (ret) +return ret; + + vb = q->bufs[b->index]; addr = (unsigned long ) vout->buf_phy_addr[vb->i]; size = (unsigned long ) vb->size;dma_unmap_single (vout->vid_dev->v4l2_dev.dev, addr, size,DMA_TO_DEVICE ); -return ret; +return 0 ; }static int vidioc_streamon (struct file *file,void *fh,enum v4l2_buf_type i)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 361/639 media: davinci/vpbe: array underflow in vpbe_enum_outputs()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit b72845ee5577b227131b1fef23f9d9a296621d7b ]
In vpbe_enum_outputs() we check if (temp_index >= cfg->num_outputs) but the problem is that "temp_index" can be negative. This patch changes the types to unsigned to address this array underflow bug.
--- drivers/media/platform/davinci/vpbe.c | 2 +- include/media/davinci/vpbe.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/media/platform/davinci/vpbe.c +1 -1
@@ -126,7 +126,7 @@ static int vpbe_enum_outputs(struct vpbe_device *vpbe_dev, struct v4l2_output *output) {struct vpbe_config *cfg = vpbe_dev->cfg; -int temp_index = output->index; +unsigned int temp_index = output->index;if (temp_index >= cfg->num_outputs)return -EINVAL ;
include/media/davinci/vpbe.h +1 -1
@@ -92,7 +92,7 @@ struct vpbe_config {struct encoder_config_info *ext_encoders;/* amplifier information goes here */ struct amp_config_info *amp; -int num_outputs; +unsigned int num_outputs;/* Order is venc outputs followed by LCD and then external encoders */ struct vpbe_output *outputs; };
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 362/639 platform/x86: alienware-wmi: printing the wrong error code
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 6d1f8b3d75419a8659ac916a1e9543bb3513a882 ]
The "out_data" variable is uninitialized at the point. Originally, this used to print "status" instead and that seems like the correct thing to print.
--- drivers/platform/x86/alienware-wmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/alienware-wmi.c +1 -1
@@ -587,7 +587,7 @@ static ssize_t show_hdmi_source(struct device *dev,return scnprintf (buf,PAGE_SIZE ,"input [gpu] unknown\n" ); } -pr_err ("alienware-wmi: unknown HDMI source status: %d\n" , out_data); +pr_err ("alienware-wmi: unknown HDMI source status: %u\n" , status);return scnprintf (buf,PAGE_SIZE ,"input gpu [unknown]\n" ); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 363/639 crypto: caam - fix caam_dump_sg that iterates through scatterlist
In reply to Greg Kroah-HartmanFrom: Iuliana Prodan <[email protected]>
[ Upstream commit 8c65d35435e8cbfdf953cafe5ebe3648ee9276a2 ]
Fix caam_dump_sg by correctly determining the next scatterlist entry in the list.
--- drivers/crypto/caam/error.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/caam/error.c +1 -1
@@ -22,7 +22,7 @@ void caam_dump_sg(const char *level, const char *prefix_str, int prefix_type,size_t len;void *buf; -for (it = sg; it && tlen >0 ; it =sg_next (sg)) { +for (it = sg; it && tlen >0 ; it =sg_next (it)) {/* * make sure the scatterlist's page * has a valid virtual memory mapping
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 364/639 netfilter: ebtables: CONFIG_COMPAT: reject trailing data after last rule
In reply to Greg Kroah-HartmanFrom: Florian Westphal <[email protected]>
[ Upstream commit 680f6af5337c98d116e4f127cea7845339dba8da ]
If userspace provides a rule blob with trailing data after last target, we trigger a splat, then convert ruleset to 64bit format (with trailing data), then pass that to do_replace_finish() which then returns -EINVAL.
Erroring out right away avoids the splat plus unneeded translation and error unwind.
--- net/bridge/netfilter/ebtables.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/bridge/netfilter/ebtables.c +3 -1
@@ -2165,7 +2165,9 @@ static int compat_copy_entries(unsigned char *data, unsigned int size_user,if (ret <0 )return ret; -WARN_ON (size_remaining); +if (size_remaining) +return -EINVAL ; +return state->buf_kern_offset; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 365/639 pwm: meson: Consider 128 a valid pre-divider
In reply to Greg Kroah-HartmanFrom: Martin Blumenstingl <[email protected]>
[ Upstream commit 51496e4446875726d50a5617a6e0e0dabbc2e6da ]
The pre-divider allows configuring longer PWM periods compared to using the input clock directly. The pre-divider is 7 bit wide, meaning it's maximum value is 128 (the register value is off-by-one: 0x7f or 127).
Change the loop to also allow for the maximum possible value to be considered valid.
--- drivers/pwm/pwm-meson.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pwm/pwm-meson.c +2 -2
@@ -188,7 +188,7 @@ static int meson_pwm_calc(struct meson_pwm *meson,do_div (fin_ps, fin_freq);/* Calc pre_div with the period */ -for (pre_div =0 ; pre_div <MISC_CLK_DIV_MASK ; pre_div++) { +for (pre_div =0 ; pre_div <=MISC_CLK_DIV_MASK ; pre_div++) { cnt =DIV_ROUND_CLOSEST_ULL ((u64 )period *1000 , fin_ps * (pre_div +1 )); dev_dbg(meson->chip.dev, "fin_ps=%llu pre_div=%u cnt=%u\n",
@@ -197,7 +197,7 @@ static int meson_pwm_calc(struct meson_pwm *meson,break ; } -if (pre_div ==MISC_CLK_DIV_MASK ) { +if (pre_div >MISC_CLK_DIV_MASK ) {dev_err (meson->chip.dev,"unable to get period pre_div\n" );return -EINVAL ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 366/639 pwm: meson: Dont disable PWM when setting duty repeatedly
In reply to Greg Kroah-HartmanFrom: Bichao Zheng <[email protected]>
[ Upstream commit a279345807e1e0ae79567a52cfdd9d30c9174a3c ]
There is an abnormally low about 20ms,when setting duty repeatedly. Because setting the duty will disable PWM and then enable. Delete this operation now.
--- drivers/pwm/pwm-meson.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/pwm/pwm-meson.c +0 -5
@@ -325,11 +325,6 @@ static int meson_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,if (state->period != channel->state.period || state->duty_cycle != channel->state.duty_cycle || state->polarity != channel->state.polarity) { -if (channel->state.enabled) { -meson_pwm_disable (meson, pwm->hwpwm); - channel->state.enabled = false; - } -if (state->polarity != channel->state.polarity) {if (state->polarity ==PWM_POLARITY_NORMAL ) meson->inverter_mask |=BIT (pwm->hwpwm);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 367/639 ARM: riscpc: fix lack of keyboard interrupts after irq conversion
In reply to Greg Kroah-HartmanFrom: Russell King <[email protected]>
[ Upstream commit 63a0666bca9311f35017be454587f3ba903644b8 ]
Fix lack of keyboard interrupts for RiscPC due to incorrect conversion.
--- arch/arm/mach-rpc/irq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/mach-rpc/irq.c +2 -1
@@ -118,7 +118,7 @@ extern unsigned char rpc_default_fiq_start, rpc_default_fiq_end;void __init rpc_init_irq (void ) { -unsigned int irq, clr, set =0 ; +unsigned int irq, clr, set;iomd_writeb (0 ,IOMD_IRQMASKA );iomd_writeb (0 ,IOMD_IRQMASKB );
@@ -130,6 +130,7 @@ void __init rpc_init_irq(void)for (irq =0 ; irq <NR_IRQS ; irq++) { clr =IRQ_NOREQUEST ; + set =0 ;if (irq <=6 || (irq >=9 && irq <=15 )) clr |=IRQ_NOPROBE ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 368/639 nfp: bpf: fix static check error through tightening shift amount adjustment
In reply to Greg Kroah-HartmanFrom: Jiong Wang <[email protected]>
[ Upstream commit 69e168ebdcfcb87ce7252d4857d570f99996fa27 ]
NFP shift instruction has something special. If shift direction is left then shift amount of 1 to 31 is specified as 32 minus the amount to shift.
But no need to do this for indirect shift which has shift amount be 0. Even after we do this subtraction, shift amount 0 will be turned into 32 which will eventually be encoded the same as 0 because only low 5 bits are encoded, but shift amount be 32 will fail the FIELD_PREP check done later on shift mask (0x1f), due to 32 is out of mask range. Such error has been observed when compiling nfp/bpf/jit.c using gcc 8.3 + O3.
This issue has started when indirect shift support added after which the incoming shift amount to __emit_shf could be 0, therefore it is at that time shift amount adjustment inside __emit_shf should have been tightened.
--- drivers/net/ethernet/netronome/nfp/bpf/jit.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/net/ethernet/netronome/nfp/bpf/jit.c +12 -1
@@ -326,7 +326,18 @@ __emit_shf(struct nfp_prog *nfp_prog, u16 dst, enum alu_dst_ab dst_ab,return ; } -if (sc ==SHF_SC_L_SHF ) +/* NFP shift instruction has something special. If shift direction is +* left then shift amount of 1 to 31 is specified as 32 minus the amount +* to shift. +* +* But no need to do this for indirect shift which has shift amount be +* 0. Even after we do this subtraction, shift amount 0 will be turned +* into 32 which will eventually be encoded the same as 0 because only +* low 5 bits are encoded, but shift amount be 32 will fail the +* FIELD_PREP check done later on shift mask (0x1f), due to 32 is out of +* mask range. +*/ +if (sc ==SHF_SC_L_SHF && shift) shift =32 - shift; insn = OP_SHF_BASE |
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 369/639 kdb: do a sanity check on the cpu in kdb_per_cpu()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit b586627e10f57ee3aa8f0cfab0d6f7dc4ae63760 ]
The "whichcpu" comes from argv[3]. The cpu_online() macro looks up the cpu in a bitmap of online cpus, but if the value is too high then it could read beyond the end of the bitmap and possibly Oops.
--- kernel/debug/kdb/kdb_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/debug/kdb/kdb_main.c +1 -1
@@ -2604,7 +2604,7 @@ static int kdb_per_cpu(int argc, const char **argv) diag =kdbgetularg (argv[3 ], &whichcpu);if (diag)return diag; -if (!cpu_online (whichcpu)) { +if (whichcpu >= nr_cpu_ids || !cpu_online (whichcpu)) {kdb_printf ("cpu %ld is not online\n" , whichcpu);return KDB_BADCPUNUM ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 370/639 netfilter: nf_tables: correct NFT_LOGLEVEL_MAX value
In reply to Greg Kroah-HartmanFrom: Florian Westphal <[email protected]>
[ Upstream commit 92285a079eedfe104a773a7c4293f77a01f456fb ]
should be same as NFT_LOGLEVEL_AUDIT, so use -, not +.
--- include/uapi/linux/netfilter/nf_tables.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/netfilter/nf_tables.h +1 -1
@@ -1128,7 +1128,7 @@ enum nft_log_level {NFT_LOGLEVEL_AUDIT , __NFT_LOGLEVEL_MAX }; -#define NFT_LOGLEVEL_MAX (__NFT_LOGLEVEL_MAX + 1) +#define NFT_LOGLEVEL_MAX (__NFT_LOGLEVEL_MAX - 1)/** * enum nft_queue_attributes - nf_tables queue expression netlink attributes
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 371/639 backlight: lm3630a: Return 0 on success in update_status functions
In reply to Greg Kroah-HartmanFrom: Brian Masney <[email protected]>
[ Upstream commit d3f48ec0954c6aac736ab21c34a35d7554409112 ]
lm3630a_bank_a_update_status() and lm3630a_bank_b_update_status() both return the brightness value if the brightness was successfully updated. Writing to these attributes via sysfs would cause a 'Bad address' error to be returned. These functions should return 0 on success, so let's change it to correct that error.
--- drivers/video/backlight/lm3630a_bl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/video/backlight/lm3630a_bl.c +2 -2
@@ -201,7 +201,7 @@ static int lm3630a_bank_a_update_status(struct backlight_device *bl) LM3630A_LEDA_ENABLE, LM3630A_LEDA_ENABLE);if (ret <0 ) goto out_i2c_err; -return bl->props.brightness; +return 0 ; out_i2c_err:dev_err (pchip->dev,"i2c failed to access\n" );
@@ -278,7 +278,7 @@ static int lm3630a_bank_b_update_status(struct backlight_device *bl) LM3630A_LEDB_ENABLE, LM3630A_LEDB_ENABLE);if (ret <0 ) goto out_i2c_err; -return bl->props.brightness; +return 0 ; out_i2c_err:dev_err (pchip->dev,"i2c failed to access REG_CTRL\n" );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 372/639 thermal: rcar_gen3_thermal: fix interrupt type
In reply to Greg Kroah-HartmanFrom: Jiada Wang <[email protected]>
[ Upstream commit 2c0928c9e004589dc9e7672c40a38d6c4ca12701 ]
Currently IRQF_SHARED type interrupt line is allocated, but it is not appropriate, as the interrupt line isn't shared between different devices, instead IRQF_ONESHOT is the proper type.
By changing interrupt type to IRQF_ONESHOT, now irq handler is no longer needed, as clear of interrupt status can be done in threaded interrupt context.
Because IRQF_ONESHOT type interrupt line is kept disabled until the threaded handler has been run, so there is no need to protect read/write of REG_GEN3_IRQSTR with lock.
--- drivers/thermal/rcar_gen3_thermal.c | 38 +++++------------------------ 1 file changed, 6 insertions(+), 32 deletions(-)
drivers/thermal/rcar_gen3_thermal.c +6 -32
@@ -14,7 +14,6 @@#include <linux/of_device.h> #include <linux/platform_device.h> #include <linux/pm_runtime.h> -#include <linux/spinlock.h> #include <linux/sys_soc.h> #include <linux/thermal.h>
@@ -81,7 +80,6 @@ struct rcar_gen3_thermal_tsc {struct rcar_gen3_thermal_priv {struct rcar_gen3_thermal_tsc *tscs[TSC_MAX_NUM ];unsigned int num_tscs; -spinlock_t lock;/* Protect interrupts on and off */ void (*thermal_init)(struct rcar_gen3_thermal_tsc *tsc); };
@@ -231,38 +229,16 @@ static irqreturn_t rcar_gen3_thermal_irq(int irq, void *data) {struct rcar_gen3_thermal_priv *priv = data;u32 status; -int i, ret =IRQ_HANDLED ; +int i; -spin_lock (&priv->lock);for (i =0 ; i < priv->num_tscs; i++) { status =rcar_gen3_thermal_read (priv->tscs[i],REG_GEN3_IRQSTR );rcar_gen3_thermal_write (priv->tscs[i],REG_GEN3_IRQSTR ,0 );if (status) - ret =IRQ_WAKE_THREAD ; +thermal_zone_device_update (priv->tscs[i]->zone, +THERMAL_EVENT_UNSPECIFIED ); } -if (ret ==IRQ_WAKE_THREAD ) -rcar_thermal_irq_set (priv, false); - -spin_unlock (&priv->lock); - -return ret; -} - -static irqreturn_t rcar_gen3_thermal_irq_thread (int irq,void *data) -{ -struct rcar_gen3_thermal_priv *priv = data; -unsigned long flags; -int i; - -for (i =0 ; i < priv->num_tscs; i++) -thermal_zone_device_update (priv->tscs[i]->zone, -THERMAL_EVENT_UNSPECIFIED ); - -spin_lock_irqsave (&priv->lock, flags); -rcar_thermal_irq_set (priv, true); -spin_unlock_irqrestore (&priv->lock, flags); -return IRQ_HANDLED ; }
@@ -364,8 +340,6 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)if (soc_device_match (r8a7795es1)) priv->thermal_init = rcar_gen3_thermal_init_r8a7795es1; -spin_lock_init (&priv->lock); -platform_set_drvdata (pdev, priv);/*
@@ -383,9 +357,9 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)if (!irqname)return -ENOMEM ; - ret =devm_request_threaded_irq (dev, irq, rcar_gen3_thermal_irq, - rcar_gen3_thermal_irq_thread, -IRQF_SHARED , irqname, priv); + ret =devm_request_threaded_irq (dev, irq,NULL , + rcar_gen3_thermal_irq, +IRQF_ONESHOT , irqname, priv);if (ret)return ret; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 373/639 thermal: cpu_cooling: Actually trace CPU load in thermal_power_cpu_get_power
In reply to Greg Kroah-HartmanFrom: Matthias Kaehlcke <[email protected]>
[ Upstream commit bf45ac18b78038e43af3c1a273cae4ab5704d2ce ]
The CPU load values passed to the thermal_power_cpu_get_power tracepoint are zero for all CPUs, unless, unless the thermal_power_cpu_limit tracepoint is enabled too:
irq/41-rockchip-98 [000] .... 290.972410: thermal_power_cpu_get_power:
cpus=0000000f freq=1800000 load={{0x0,0x0,0x0,0x0}} dynamic_power=4815
vs
irq/41-rockchip-96 [000] .... 95.773585: thermal_power_cpu_get_power:
cpus=0000000f freq=1800000 load={{0x56,0x64,0x64,0x5e}} dynamic_power=4959
irq/41-rockchip-96 [000] .... 95.773596: thermal_power_cpu_limit:
cpus=0000000f freq=408000 cdev_state=10 power=416
There seems to be no good reason for omitting the CPU load information depending on another tracepoint. My guess is that the intention was to check whether thermal_power_cpu_get_power is (still) enabled, however 'load_cpu != NULL' already indicates that it was at least enabled when cpufreq_get_requested_power() was entered, there seems little gain from omitting the assignment if the tracepoint was just disabled, so just remove the check.
--- drivers/thermal/cpu_cooling.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/cpu_cooling.c +1 -1
@@ -458,7 +458,7 @@ static int cpufreq_get_requested_power(struct thermal_cooling_device *cdev, load =0 ; total_load += load; -if (trace_thermal_power_cpu_limit_enabled () && load_cpu) +if (load_cpu) load_cpu[i] = load; i++;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 374/639 EDAC/mc: Fix edac_mc_find() in case no device is found
In reply to Greg Kroah-HartmanFrom: Robert Richter <[email protected]>
[ Upstream commit 29a0c843973bc385918158c6976e4dbe891df969 ]
The function should return NULL in case no device is found, but it always returns the last checked mc device from the list even if the index did not match. Fix that.
I did some analysis why this did not raise any issues for about 3 years and the reason is that edac_mc_find() is mostly used to search for existing devices. Thus, the bug is not triggered.
[ bp: Drop the if (mci->mc_idx > idx) test in favor of readability. ]
--- drivers/edac/edac_mc.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/edac/edac_mc.c +4 -8
@@ -681,22 +681,18 @@ static int del_mc_from_global_list(struct mem_ctl_info *mci)struct mem_ctl_info *edac_mc_find (int idx) { -struct mem_ctl_info *mci =NULL ; +struct mem_ctl_info *mci;struct list_head *item;mutex_lock (&mem_ctls_mutex);list_for_each (item, &mc_devices) { mci = list_entry(item, struct mem_ctl_info, link); - -if (mci->mc_idx >= idx) { -if (mci->mc_idx == idx) { - goto unlock; - } -break ; - } +if (mci->mc_idx == idx) + goto unlock; } + mci =NULL ; unlock:mutex_unlock (&mem_ctls_mutex);return mci;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 375/639 afs: Fix key leak in afs_release() and afs_evict_inode()
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit a1b879eefc2b34cd3f17187ef6fc1cf3960e9518 ]
Fix afs_release() to go through the cleanup part of the function if FMODE_WRITE is set rather than exiting through vfs_fsync() (which skips the cleanup). The cleanup involves discarding the refs on the key used for file ops and the writeback key record.
Also fix afs_evict_inode() to clean up any left over wb keys attached to the inode/vnode when it is removed.
--- fs/afs/file.c | 7 ++++--- fs/afs/inode.c | 1 + 2 files changed, 5 insertions(+), 3 deletions(-)
fs/afs/file.c +4 -3
@@ -169,11 +169,12 @@ int afs_release(struct inode *inode, struct file *file) {struct afs_vnode *vnode =AFS_FS_I (inode);struct afs_file *af = file->private_data; +int ret =0 ;_enter ("{%x:%u}," , vnode->fid.vid, vnode->fid.vnode);if ((file->f_mode &FMODE_WRITE )) -return vfs_fsync (file,0 ); + ret =vfs_fsync (file,0 ); file->private_data =NULL ;if (af->wb)
@@ -181,8 +182,8 @@ int afs_release(struct inode *inode, struct file *file)key_put (af->key);kfree (af);afs_prune_wb_keys (vnode); -_leave (" = 0" ); -return 0 ; +_leave (" = %d" , ret); +return ret; }/*
fs/afs/inode.c +1 -0
@@ -541,6 +541,7 @@ void afs_evict_inode(struct inode *inode) }#endif +afs_prune_wb_keys (vnode);afs_put_permits (rcu_access_pointer (vnode->permit_cache));key_put (vnode->lock_key); vnode->lock_key =NULL ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 376/639 afs: Dont invalidate callback if AFS_VNODE_DIR_VALID not set
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit d9052dda8a39069312218f913d22d99c48d90004 ]
Don't invalidate the callback promise on a directory if the AFS_VNODE_DIR_VALID flag is not set (which indicates that the directory contents are invalid, due to edit failure, callback break, page reclaim).
The directory will be reloaded next time the directory is accessed, so clearing the callback flag at this point may race with a reload of the directory and cancel it's recorded callback promise.
--- fs/afs/inode.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
fs/afs/inode.c +2 -5
@@ -398,12 +398,9 @@ int afs_validate(struct afs_vnode *vnode, struct key *key) vnode->cb_s_break = vnode->cb_interest->server->cb_s_break; vnode->cb_v_break = vnode->volume->cb_v_break; valid = false; - }else if (vnode->status.type ==AFS_FTYPE_DIR && - (!test_bit (AFS_VNODE_DIR_VALID , &vnode->flags) || - vnode->cb_expires_at -10 <= now)) { + }else if (test_bit (AFS_VNODE_ZAP_DATA , &vnode->flags)) { valid = false; - }else if (test_bit (AFS_VNODE_ZAP_DATA , &vnode->flags) || - vnode->cb_expires_at -10 <= now) { + }else if (vnode->cb_expires_at -10 <= now) { valid = false; }else { valid = true;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 377/639 afs: Fix lock-wait/callback-break double locking
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit c7226e407b6065d3bda8bd9dc627663d2c505ea3 ]
__afs_break_callback() holds vnode->lock around its call of afs_lock_may_be_available() - which also takes that lock.
Fix this by not taking the lock in __afs_break_callback().
Also, there's no point checking the granted_locks and pending_locks queues; it's sufficient to check lock_state, so move that check out of afs_lock_may_be_available() into __afs_break_callback() to replace the queue checks.
--- fs/afs/callback.c | 8 +------- fs/afs/flock.c | 3 --- 2 files changed, 1 insertion(+), 10 deletions(-)
fs/afs/callback.c +1 -7
@@ -221,14 +221,8 @@ void afs_break_callback(struct afs_vnode *vnode) vnode->cb_break++;afs_clear_permits (vnode); -spin_lock (&vnode->lock); - -_debug ("break callback" ); - -if (list_empty (&vnode->granted_locks) && - !list_empty (&vnode->pending_locks)) +if (vnode->lock_state ==AFS_VNODE_LOCK_WAITING_FOR_CB )afs_lock_may_be_available (vnode); -spin_unlock (&vnode->lock); }write_sequnlock (&vnode->cb_lock);
fs/afs/flock.c +0 -3
@@ -39,9 +39,6 @@ void afs_lock_may_be_available(struct afs_vnode *vnode) {_enter ("{%x:%u}" , vnode->fid.vid, vnode->fid.vnode); -if (vnode->lock_state !=AFS_VNODE_LOCK_WAITING_FOR_CB ) -return ; -spin_lock (&vnode->lock);if (vnode->lock_state ==AFS_VNODE_LOCK_WAITING_FOR_CB )afs_next_locker (vnode,0 );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 378/639 afs: Fix double inc of vnode->cb_break
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit fd711586bb7d63f257da5eff234e68c446ac35ea ]
When __afs_break_callback() clears the CB_PROMISED flag, it increments vnode->cb_break to trigger a future refetch of the status and callback - however it also calls afs_clear_permits(), which also increments vnode->cb_break.
Fix this by removing the increment from afs_clear_permits().
Whilst we're at it, fix the conditional call to afs_put_permits() as the function checks to see if the argument is NULL, so the check is redundant.
--- fs/afs/security.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
fs/afs/security.c +1 -3
@@ -87,11 +87,9 @@ void afs_clear_permits(struct afs_vnode *vnode) permits =rcu_dereference_protected (vnode->permit_cache,lockdep_is_held (&vnode->lock));RCU_INIT_POINTER (vnode->permit_cache,NULL ); - vnode->cb_break++;spin_unlock (&vnode->lock); -if (permits) -afs_put_permits (permits); +afs_put_permits (permits); }/*
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 379/639 ARM: dts: sun8i-h3: Fix wifi in Beelink X2 DT
In reply to Greg Kroah-HartmanFrom: Jernej Skrabec <[email protected]>
[ Upstream commit ca0961011db57e39880df0b5708df8aa3339dc6f ]
mmc1 node where wifi module is connected doesn't have properly defined power supplies so wifi module is never powered up. Fix that by specifying additional power supplies.
Additionally, this STB may have either Realtek or Broadcom based wifi module. One based on Broadcom module also needs external clock to work properly. Fix that by adding clock property to wifi_pwrseq node.
--- arch/arm/boot/dts/sun8i-h3-beelink-x2.dts | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/boot/dts/sun8i-h3-beelink-x2.dts +4 -0
@@ -90,6 +90,8 @@ wifi_pwrseq: wifi_pwrseq { compatible = "mmc-pwrseq-simple"; reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>; /* PL7 */ + clocks = <&rtc 1>; + clock-names = "ext_clock"; }; sound_spdif {
@@ -155,6 +157,8 @@ &mmc1 { vmmc-supply = <®_vcc3v3>; + vqmmc-supply = <®_vcc3v3>; + mmc-pwrseq = <&wifi_pwrseq>; bus-width = <4>; non-removable; status = "okay";
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 380/639 clk: meson: gxbb: no spread spectrum on mpll0
In reply to Greg Kroah-HartmanFrom: Jerome Brunet <[email protected]>
[ Upstream commit 8925dbd03bb29b1b0de30ac4e02c18faf8ddc9db ]
The documentation says there is an SSEN bit on mpll0 but, after testing it, no spread spectrum function appears to be enabled by this bit on any of the MPLLs.
Let's remove it until we know more
--- drivers/clk/meson/gxbb.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/clk/meson/gxbb.c +0 -5
@@ -650,11 +650,6 @@ static struct clk_regmap gxbb_mpll0_div = { .shift = 16, .width = 9, }, - .ssen = { - .reg_off = HHI_MPLL_CNTL, - .shift = 25, - .width = 1, - }, .lock = &meson_clk_lock, }, .hw.init = &(struct clk_init_data ){
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 381/639 clk: meson: axg: spread spectrum is on mpll2
In reply to Greg Kroah-HartmanFrom: Jerome Brunet <[email protected]>
[ Upstream commit dc4e62d373f881cbf51513296a6db7806516a01a ]
After testing, it appears that the SSEN bit controls the spread spectrum function on MPLL2, not MPLL0.
--- drivers/clk/meson/axg.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/clk/meson/axg.c +5 -5
@@ -461,11 +461,6 @@ static struct clk_regmap axg_mpll0_div = { .shift = 16, .width = 9, }, - .ssen = { - .reg_off = HHI_MPLL_CNTL, - .shift = 25, - .width = 1, - }, .misc = { .reg_off = HHI_PLL_TOP_MISC, .shift = 0,
@@ -560,6 +555,11 @@ static struct clk_regmap axg_mpll2_div = { .shift = 16, .width = 9, }, + .ssen = { + .reg_off = HHI_MPLL_CNTL, + .shift = 25, + .width = 1, + }, .misc = { .reg_off = HHI_PLL_TOP_MISC, .shift = 2,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 382/639 dmaengine: tegra210-adma: Fix crash during probe
In reply to Greg Kroah-HartmanFrom: Jon Hunter <[email protected]>
[ Upstream commit b53611fb1ce9b1786bd18205473e0c1d6bfa8934 ]
Commit f33e7bb3eb92 ("dmaengine: tegra210-adma: restore channel status") added support to save and restore the DMA channel registers when runtime suspending the ADMA. This change is causing the kernel to crash when probing the ADMA, if the device is probed deferred when looking up the channel interrupts. The crash occurs because not all of the channel base addresses have been setup at this point and in the clean-up path of the probe, pm_runtime_suspend() is called invoking its callback which expects all the channel base addresses to be initialised.
Although this could be fixed by simply checking for a NULL address, on further review of the driver it seems more appropriate that we only call pm_runtime_get_sync() after all the channel interrupts and base addresses have been configured. Therefore, fix this crash by moving the calls to pm_runtime_enable(), pm_runtime_get_sync() and tegra_adma_init() after the DMA channels have been initialised.
--- drivers/dma/tegra210-adma.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
drivers/dma/tegra210-adma.c +13 -13
@@ -744,16 +744,6 @@ static int tegra_adma_probe(struct platform_device *pdev)return PTR_ERR (tdma->ahub_clk); } -pm_runtime_enable (&pdev->dev); - - ret =pm_runtime_get_sync (&pdev->dev); -if (ret <0 ) - goto rpm_disable; - - ret =tegra_adma_init (tdma); -if (ret) - goto rpm_put; -INIT_LIST_HEAD (&tdma->dma_dev.channels);for (i =0 ; i < tdma->nr_channels; i++) {struct tegra_adma_chan *tdc = &tdma->channels[i];
@@ -771,6 +761,16 @@ static int tegra_adma_probe(struct platform_device *pdev) tdc->tdma = tdma; } +pm_runtime_enable (&pdev->dev); + + ret =pm_runtime_get_sync (&pdev->dev); +if (ret <0 ) + goto rpm_disable; + + ret =tegra_adma_init (tdma); +if (ret) + goto rpm_put; +dma_cap_set (DMA_SLAVE , tdma->dma_dev.cap_mask);dma_cap_set (DMA_PRIVATE , tdma->dma_dev.cap_mask);dma_cap_set (DMA_CYCLIC , tdma->dma_dev.cap_mask);
@@ -812,13 +812,13 @@ static int tegra_adma_probe(struct platform_device *pdev) dma_remove:dma_async_device_unregister (&tdma->dma_dev); -irq_dispose: -while (--i >=0 ) -irq_dispose_mapping (tdma->channels[i].irq); rpm_put:pm_runtime_put_sync (&pdev->dev); rpm_disable:pm_runtime_disable (&pdev->dev); +irq_dispose: +while (--i >=0 ) +irq_dispose_mapping (tdma->channels[i].irq);return ret; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 383/639 arm64: dts: meson: libretech-cc: set eMMC as removable
In reply to Greg Kroah-HartmanFrom: Jerome Brunet <[email protected]>
[ Upstream commit 9f72e321d5506fe3e162a6308a4a295d7f10bb5d ]
The eMMC on this board is add-on module which is not mandatory. Removing 'non-removable' property should prevent some errors when booting a board w/o an eMMC module present.
--- arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts | 1 - 1 file changed, 1 deletion(-)
arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts +0 -1
@@ -256,7 +256,6 @@ cap-mmc-highspeed; mmc-ddr-3_3v; max-frequency = <50000000>; - non-removable; disable-wp; mmc-pwrseq = <&emmc_pwrseq>;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 384/639 RDMA/qedr: Fix incorrect device rate.
In reply to Greg Kroah-HartmanFrom: Sagiv Ozeri <[email protected]>
[ Upstream commit 69054666df0a9b4e8331319f98b6b9a88bc3fcc4 ]
Use the correct enum value introduced in commit 12113a35ada6 ("IB/core:
Add HDR speed enum") Prior to this change a 50Gbps port would show 40Gbps.
This patch also cleaned up the redundant redefiniton of ib speeds for qedr.
--- drivers/infiniband/hw/qedr/verbs.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-)
drivers/infiniband/hw/qedr/verbs.c +9 -16
@@ -158,54 +158,47 @@ int qedr_query_device(struct ib_device *ibdev,return 0 ; } -#define QEDR_SPEED_SDR (1) -#define QEDR_SPEED_DDR (2) -#define QEDR_SPEED_QDR (4) -#define QEDR_SPEED_FDR10 (8) -#define QEDR_SPEED_FDR (16) -#define QEDR_SPEED_EDR (32) -static inline void get_link_speed_and_width (int speed,u8 *ib_speed,u8 *ib_width) {switch (speed) {case 1000 : - *ib_speed =QEDR_SPEED_SDR ; + *ib_speed =IB_SPEED_SDR ; *ib_width =IB_WIDTH_1X ;break ;case 10000 : - *ib_speed =QEDR_SPEED_QDR ; + *ib_speed =IB_SPEED_QDR ; *ib_width =IB_WIDTH_1X ;break ;case 20000 : - *ib_speed =QEDR_SPEED_DDR ; + *ib_speed =IB_SPEED_DDR ; *ib_width =IB_WIDTH_4X ;break ;case 25000 : - *ib_speed =QEDR_SPEED_EDR ; + *ib_speed =IB_SPEED_EDR ; *ib_width =IB_WIDTH_1X ;break ;case 40000 : - *ib_speed =QEDR_SPEED_QDR ; + *ib_speed =IB_SPEED_QDR ; *ib_width =IB_WIDTH_4X ;break ;case 50000 : - *ib_speed =QEDR_SPEED_QDR ; - *ib_width =IB_WIDTH_4X ; + *ib_speed =IB_SPEED_HDR ; + *ib_width =IB_WIDTH_1X ;break ;case 100000 : - *ib_speed =QEDR_SPEED_EDR ; + *ib_speed =IB_SPEED_EDR ; *ib_width =IB_WIDTH_4X ;break ;default :/* Unsupported */ - *ib_speed =QEDR_SPEED_SDR ; + *ib_speed =IB_SPEED_SDR ; *ib_width =IB_WIDTH_1X ; } }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 385/639 spi: spi-fsl-spi: call spi_finalize_current_message() at the end
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
[ Upstream commit 44a042182cb1e9f7916e015c836967bf638b33c4 ]
spi_finalize_current_message() shall be called once all actions are finished, otherwise the last actions might step over a newly started transfer.
--- drivers/spi/spi-fsl-spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-fsl-spi.c +1 -1
@@ -407,7 +407,6 @@ static int fsl_spi_do_one_msg(struct spi_master *master, } m->status = status; -spi_finalize_current_message (master);if (status || !cs_change) {ndelay (nsecs);
@@ -415,6 +414,7 @@ static int fsl_spi_do_one_msg(struct spi_master *master, }fsl_spi_setup_transfer (spi,NULL ); +spi_finalize_current_message (master);return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 386/639 crypto: ccp - fix AES CFB error exposed by new test vectors
In reply to Greg Kroah-HartmanFrom: Hook, Gary <[email protected]>
[ Upstream commit c3b359d6567c0b8f413e924feb37cf025067d55a ]
Updated testmgr will exhibit this error message when loading the ccp-crypto module:
alg: skcipher: cfb-aes-ccp encryption failed with err -22 on test vector 3, cfg="in-place"
Update the CCP crypto driver to correctly treat CFB as a streaming mode cipher (instead of block mode). Update the configuration for CFB to specify the block size as a single byte;
--- drivers/crypto/ccp/ccp-crypto-aes.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/crypto/ccp/ccp-crypto-aes.c +4 -4
@@ -1,7 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * AMD Cryptographic Coprocessor (CCP) AES crypto API support * -* Copyright (C) 2013,2016 Advanced Micro Devices, Inc. +* Copyright (C) 2013-2019 Advanced Micro Devices, Inc. * * Author: Tom Lendacky <[email protected]> *
@@ -79,8 +80,7 @@ static int ccp_aes_crypt(struct ablkcipher_request *req, bool encrypt)return -EINVAL ;if (((ctx->u.aes.mode ==CCP_AES_MODE_ECB ) || - (ctx->u.aes.mode ==CCP_AES_MODE_CBC ) || - (ctx->u.aes.mode ==CCP_AES_MODE_CFB )) && + (ctx->u.aes.mode ==CCP_AES_MODE_CBC )) && (req->nbytes & (AES_BLOCK_SIZE -1 )))return -EINVAL ;
@@ -291,7 +291,7 @@ static struct ccp_aes_def aes_algs[] = { .version = CCP_VERSION(3, 0), .name = "cfb(aes)", .driver_name = "cfb-aes-ccp", - .blocksize = AES_BLOCK_SIZE, + .blocksize = 1, .ivsize = AES_BLOCK_SIZE, .alg_defaults = &ccp_aes_defaults, },
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 387/639 crypto: ccp - Fix 3DES complaint from ccp-crypto module
In reply to Greg Kroah-HartmanFrom: Hook, Gary <[email protected]>
[ Upstream commit 89646fdda4cae203185444ac7988835f36a21ee1 ]
Crypto self-tests reveal an error:
alg: skcipher: cbc-des3-ccp encryption test failed (wrong output IV) on test vector 0, cfg="in-place"
The offset value should not be recomputed when retrieving the context. Also, a code path exists which makes decisions based on older (version 3) hardware; a v3 device deosn't support 3DES so remove this check.
--- drivers/crypto/ccp/ccp-ops.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)
drivers/crypto/ccp/ccp-ops.c +4 -11
@@ -1293,6 +1293,9 @@ static int ccp_run_des3_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd)int ret;/* Error checks */ +if (cmd_q->ccp->vdata->version <CCP_VERSION (5 ,0 )) +return -EINVAL ; +if (!cmd_q->ccp->vdata->perform->des3)return -EINVAL ;
@@ -1375,8 +1378,6 @@ static int ccp_run_des3_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd)* passthru option to convert from big endian to little endian. */ if (des3->mode !=CCP_DES3_MODE_ECB ) { -u32 load_mode; - op.sb_ctx = cmd_q->sb_ctx; ret = ccp_init_dm_workarea(&ctx, cmd_q,
@@ -1392,12 +1393,8 @@ static int ccp_run_des3_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd)if (ret) goto e_ctx; -if (cmd_q->ccp->vdata->version ==CCP_VERSION (3 ,0 )) - load_mode =CCP_PASSTHRU_BYTESWAP_NOOP ; -else - load_mode =CCP_PASSTHRU_BYTESWAP_256BIT ; ret =ccp_copy_to_sb (cmd_q, &ctx, op.jobid, op.sb_ctx, - load_mode); +CCP_PASSTHRU_BYTESWAP_256BIT );if (ret) { cmd->engine_error = cmd_q->cmd_error; goto e_ctx;
@@ -1459,10 +1456,6 @@ static int ccp_run_des3_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) }/* ...but we only need the last DES3_EDE_BLOCK_SIZE bytes */ -if (cmd_q->ccp->vdata->version ==CCP_VERSION (3 ,0 )) - dm_offset =CCP_SB_BYTES - des3->iv_len; -else - dm_offset =0 ;ccp_get_dm_area (&ctx, dm_offset, des3->iv,0 ,DES3_EDE_BLOCK_SIZE ); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 388/639 serial: stm32: fix word length configuration
In reply to Greg Kroah-HartmanFrom: Erwan Le Ray <[email protected]>
[ Upstream commit c8a9d043947b4acb19a65f7fac2bd0893e581cd5 ]
STM32 supports either:
- 8 and 9 bits word length (including parity bit) for stm32f4 compatible devices
- 7, 8 and 9 bits word length (including parity bit) for stm32f7 and stm32h7 compatible devices.
As a consequence STM32 supports the following termios configurations:
- CS7 with parity bit, and CS8 (with or without parity bit) for stm32f4 compatible devices.
- CS6 with parity bit, CS7 and CS8 (with or without parity bit) for stm32f7 and stm32h7 compatible devices.
This patch is fixing word length by configuring correctly the SoC with supported configurations.
--- drivers/tty/serial/stm32-usart.c | 56 ++++++++++++++++++++++++++++---- drivers/tty/serial/stm32-usart.h | 3 +- 2 files changed, 50 insertions(+), 9 deletions(-)
drivers/tty/serial/stm32-usart.c +49 -7
@@ -599,6 +599,36 @@ static void stm32_shutdown(struct uart_port *port)free_irq (port->irq, port); } +unsigned int stm32_get_databits (struct ktermios *termios) +{ +unsigned int bits; + +tcflag_t cflag = termios->c_cflag; + +switch (cflag &CSIZE ) { +/* +* CSIZE settings are not necessarily supported in hardware. +* CSIZE unsupported configurations are handled here to set word length +* to 8 bits word as default configuration and to print debug message. +*/ +case CS5 : + bits =5 ; +break ; +case CS6 : + bits =6 ; +break ; +case CS7 : + bits =7 ; +break ; +/* default including CS8 */ +default : + bits =8 ; +break ; + } + +return bits; +} +static void stm32_set_termios (struct uart_port *port,struct ktermios *termios,struct ktermios *old) {
@@ -606,7 +636,7 @@ static void stm32_set_termios(struct uart_port *port, struct ktermios *termios,struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;struct stm32_usart_config *cfg = &stm32_port->info->cfg;struct serial_rs485 *rs485conf = &port->rs485; -unsigned int baud; +unsigned int baud, bits;u32 usartdiv, mantissa, fraction, oversampling;tcflag_t cflag = termios->c_cflag;u32 cr1, cr2, cr3;
@@ -632,16 +662,28 @@ static void stm32_set_termios(struct uart_port *port, struct ktermios *termios,if (cflag &CSTOPB ) cr2 |=USART_CR2_STOP_2B ; + bits =stm32_get_databits (termios); +if (cflag &PARENB ) { + bits++; cr1 |=USART_CR1_PCE ; -if ((cflag &CSIZE ) ==CS8 ) { -if (cfg->has_7bits_data) - cr1 |=USART_CR1_M0 ; -else - cr1 |=USART_CR1_M ; - } } +/* +* Word length configuration: +* CS8 + parity, 9 bits word aka [M1:M0] = 0b01 +* CS7 or (CS6 + parity), 7 bits word aka [M1:M0] = 0b10 +* CS8 or (CS7 + parity), 8 bits word aka [M1:M0] = 0b00 +* M0 and M1 already cleared by cr1 initialization. +*/ +if (bits ==9 ) + cr1 |=USART_CR1_M0 ; +else if ((bits ==7 ) && cfg->has_7bits_data) + cr1 |=USART_CR1_M1 ; +else if (bits !=8 ) +dev_dbg (port->dev,"Unsupported data bits config: %u bits\n" + , bits); +if (cflag &PARODD ) cr1 |=USART_CR1_PS ;
drivers/tty/serial/stm32-usart.h +1 -2
@@ -151,8 +151,7 @@ struct stm32_usart_info stm32h7_info = {#define USART_CR1_PS BIT(9)#define USART_CR1_PCE BIT(10)#define USART_CR1_WAKE BIT(11) -#define USART_CR1_M BIT(12) -#define USART_CR1_M0 BIT(12)/* F7 */ +#define USART_CR1_M0 BIT(12)/* F7 (CR1_M for F4) */ #define USART_CR1_MME BIT(13)/* F7 */ #define USART_CR1_CMIE BIT(14)/* F7 */ #define USART_CR1_OVER8 BIT(15)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 389/639 serial: stm32: fix rx error handling
In reply to Greg Kroah-HartmanFrom: Erwan Le Ray <[email protected]>
[ Upstream commit 4f01d833fdcdd6f9b85d9e5d5d7568eb683626a7 ]
- Fixes parity and framing error bit by clearing parity and framing error flag. The current implementation doesn't clear the error bits when an error is detected.
- Fixes the incorrect name of framing error clearing flag in header file.
- Fixes misalignement between data frame and errors status. The status read for "n" frame was the status of "n+1" frame".
- Fixes break detection was not triggered by the expected register.
--- drivers/tty/serial/stm32-usart.c | 54 +++++++++++++++++++++----------- drivers/tty/serial/stm32-usart.h | 10 ++---- 2 files changed, 37 insertions(+), 27 deletions(-)
drivers/tty/serial/stm32-usart.c +35 -19
@@ -225,35 +225,51 @@ static void stm32_receive_chars(struct uart_port *port, bool threaded)while (stm32_pending_rx (port, &sr, &stm32_port->last_res, threaded)) { sr |=USART_SR_DUMMY_RX ; - c =stm32_get_char (port, &sr, &stm32_port->last_res); flag =TTY_NORMAL ; - port->icount.rx++; +/* +* Status bits has to be cleared before reading the RDR: +* In FIFO mode, reading the RDR will pop the next data +* (if any) along with its status bits into the SR. +* Not doing so leads to misalignement between RDR and SR, +* and clear status bits of the next rx data. +* +* Clear errors flags for stm32f7 and stm32h7 compatible +* devices. On stm32f4 compatible devices, the error bit is +* cleared by the sequence [read SR - read DR]. +*/ +if ((sr &USART_SR_ERR_MASK ) && ofs->icr !=UNDEF_REG ) +stm32_clr_bits (port, ofs->icr,USART_ICR_ORECF | +USART_ICR_PECF |USART_ICR_FECF ); + + c =stm32_get_char (port, &sr, &stm32_port->last_res); + port->icount.rx++;if (sr &USART_SR_ERR_MASK ) { -if (sr &USART_SR_LBD ) { - port->icount.brk++; -if (uart_handle_break (port)) -continue ; - }else if (sr &USART_SR_ORE ) { -if (ofs->icr !=UNDEF_REG ) -writel_relaxed (USART_ICR_ORECF , - port->membase + - ofs->icr); +if (sr &USART_SR_ORE ) { port->icount.overrun++; }else if (sr &USART_SR_PE ) { port->icount.parity++; }else if (sr &USART_SR_FE ) { - port->icount.frame++; +/* Break detection if character is null */ +if (!c) { + port->icount.brk++; +if (uart_handle_break (port)) +continue ; + }else { + port->icount.frame++; + } } sr &= port->read_status_mask; -if (sr &USART_SR_LBD ) - flag =TTY_BREAK ; -else if (sr &USART_SR_PE ) +if (sr &USART_SR_PE ) { flag =TTY_PARITY ; -else if (sr &USART_SR_FE ) - flag =TTY_FRAME ; + }else if (sr &USART_SR_FE ) { +if (!c) + flag =TTY_BREAK ; +else + flag =TTY_FRAME ; + } }if (uart_handle_sysrq_char (port, c))
@@ -721,14 +737,14 @@ static void stm32_set_termios(struct uart_port *port, struct ktermios *termios,if (termios->c_iflag &INPCK ) port->read_status_mask |=USART_SR_PE |USART_SR_FE ;if (termios->c_iflag & (IGNBRK |BRKINT |PARMRK )) - port->read_status_mask |=USART_SR_LBD ; + port->read_status_mask |=USART_SR_FE ;/* Characters to ignore */ port->ignore_status_mask =0 ;if (termios->c_iflag &IGNPAR ) port->ignore_status_mask =USART_SR_PE |USART_SR_FE ;if (termios->c_iflag &IGNBRK ) { - port->ignore_status_mask |=USART_SR_LBD ; + port->ignore_status_mask |=USART_SR_FE ;/* * If we're ignoring parity and break indicators, * ignore overruns too (for real raw support).
drivers/tty/serial/stm32-usart.h +2 -8
@@ -108,7 +108,6 @@ struct stm32_usart_info stm32h7_info = {#define USART_SR_RXNE BIT(5)#define USART_SR_TC BIT(6)#define USART_SR_TXE BIT(7) -#define USART_SR_LBD BIT(8)#define USART_SR_CTSIF BIT(9)#define USART_SR_CTS BIT(10)/* F7 */ #define USART_SR_RTOF BIT(11)/* F7 */
@@ -120,8 +119,7 @@ struct stm32_usart_info stm32h7_info = {#define USART_SR_SBKF BIT(18)/* F7 */ #define USART_SR_WUF BIT(20)/* H7 */ #define USART_SR_TEACK BIT(21)/* F7 */ -#define USART_SR_ERR_MASK (USART_SR_LBD | USART_SR_ORE | \ - USART_SR_FE | USART_SR_PE) +#define USART_SR_ERR_MASK (USART_SR_ORE | USART_SR_FE | USART_SR_PE)/* Dummy bits */ #define USART_SR_DUMMY_RX BIT(16)
@@ -168,8 +166,6 @@ struct stm32_usart_info stm32h7_info = {/* USART_CR2 */ #define USART_CR2_ADD_MASK GENMASK(3, 0)/* F4 */ #define USART_CR2_ADDM7 BIT(4)/* F7 */ -#define USART_CR2_LBDL BIT(5) -#define USART_CR2_LBDIE BIT(6)#define USART_CR2_LBCL BIT(8)#define USART_CR2_CPHA BIT(9)#define USART_CR2_CPOL BIT(10)
@@ -226,12 +222,10 @@ struct stm32_usart_info stm32h7_info = {/* USART_ICR */ #define USART_ICR_PECF BIT(0)/* F7 */ -#define USART_ICR_FFECF BIT(1)/* F7 */ -#define USART_ICR_NCF BIT(2)/* F7 */ +#define USART_ICR_FECF BIT(1)/* F7 */ #define USART_ICR_ORECF BIT(3)/* F7 */ #define USART_ICR_IDLECF BIT(4)/* F7 */ #define USART_ICR_TCCF BIT(6)/* F7 */ -#define USART_ICR_LBDCF BIT(8)/* F7 */ #define USART_ICR_CTSCF BIT(9)/* F7 */ #define USART_ICR_RTOCF BIT(11)/* F7 */ #define USART_ICR_EOBCF BIT(12)/* F7 */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 390/639 serial: stm32: fix rx data length when parity enabled
In reply to Greg Kroah-HartmanFrom: Erwan Le Ray <[email protected]>
[ Upstream commit 6c5962f30bce147b1c83869085f3ddde3b34c9e3 ]
- Fixes a rx data error when data length < 8 bits and parity is enabled. RDR register MSB is used for parity bit reception.
- Adds a mask to ignore MSB when data is get from RDR.
--- drivers/tty/serial/stm32-usart.c | 12 ++++++++---- drivers/tty/serial/stm32-usart.h | 1 + 2 files changed, 9 insertions(+), 4 deletions(-)
drivers/tty/serial/stm32-usart.c +8 -4
@@ -194,8 +194,8 @@ static int stm32_pending_rx(struct uart_port *port, u32 *sr, int *last_res,return 0 ; } -static unsigned long -stm32_get_char (struct uart_port *port,u32 *sr,int *last_res) +static unsigned long stm32_get_char (struct uart_port *port,u32 *sr, +int *last_res) {struct stm32_port *stm32_port =to_stm32_port (port);struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
@@ -205,10 +205,13 @@ stm32_get_char(struct uart_port *port, u32 *sr, int *last_res) c = stm32_port->rx_buf[RX_BUF_L - (*last_res)--];if ((*last_res) ==0 ) *last_res =RX_BUF_L ; -return c; }else { -return readl_relaxed (port->membase + ofs->rdr); + c =readl_relaxed (port->membase + ofs->rdr); +/* apply RDR data mask */ + c &= stm32_port->rdr_mask; } + +return c; }static void stm32_receive_chars (struct uart_port *port,bool threaded)
@@ -679,6 +682,7 @@ static void stm32_set_termios(struct uart_port *port, struct ktermios *termios, cr2 |=USART_CR2_STOP_2B ; bits =stm32_get_databits (termios); + stm32_port->rdr_mask = (BIT (bits) -1 );if (cflag &PARENB ) { bits++;
drivers/tty/serial/stm32-usart.h +1 -0
@@ -254,6 +254,7 @@ struct stm32_port {bool hw_flow_control;bool fifoen;int wakeirq; +int rdr_mask;/* receive data register mask */ };static struct stm32_port stm32_ports[STM32_MAX_PORTS ];
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 391/639 serial: stm32: fix transmit_chars when tx is stopped
In reply to Greg Kroah-HartmanFrom: Erwan Le Ray <[email protected]>
[ Upstream commit b83b957c91f68e53f0dc596e129e8305761f2a32 ]
Disables the tx irq when the transmission is ended and updates stop_tx conditions for code cleanup.
--- drivers/tty/serial/stm32-usart.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/tty/serial/stm32-usart.c +3 -8
@@ -420,13 +420,8 @@ static void stm32_transmit_chars(struct uart_port *port)return ; } -if (uart_tx_stopped (port)) { -stm32_stop_tx (port); -return ; - } - -if (uart_circ_empty (xmit)) { -stm32_stop_tx (port); +if (uart_circ_empty (xmit) ||uart_tx_stopped (port)) { +stm32_clr_bits (port, ofs->cr1,USART_CR1_TXEIE );return ; }
@@ -439,7 +434,7 @@ static void stm32_transmit_chars(struct uart_port *port)uart_write_wakeup (port);if (uart_circ_empty (xmit)) -stm32_stop_tx (port); +stm32_clr_bits (port, ofs->cr1,USART_CR1_TXEIE ); }static irqreturn_t stm32_interrupt (int irq,void *ptr)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 392/639 serial: stm32: Add support of TC bit status check
In reply to Greg Kroah-HartmanFrom: Erwan Le Ray <[email protected]>
[ Upstream commit 64c32eab660386f9904bb295a104c9c425e9f8b2 ]
Adds a check on the Transmission Complete bit status before closing the com port. Prevents the port closure before the end of the transmission. TC poll loop is moved from stm32_tx_dma_complete to stm32_shutdown routine, in order to check TC before shutdown in both dma and PIO tx modes.
TC clear is added in stm32_transmit_char routine, in order to be cleared before transmitting in both dma and PIO tx modes.
--- drivers/tty/serial/stm32-usart.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-)
drivers/tty/serial/stm32-usart.c +15 -17
@@ -290,21 +290,6 @@ static void stm32_tx_dma_complete(void *arg)struct uart_port *port = arg;struct stm32_port *stm32port =to_stm32_port (port);struct stm32_usart_offsets *ofs = &stm32port->info->ofs; -unsigned int isr; -int ret; - - ret =readl_relaxed_poll_timeout_atomic (port->membase + ofs->isr, - isr, - (isr &USART_SR_TC ), -10 ,100000 ); - -if (ret) -dev_err (port->dev,"terminal count not set\n" ); - -if (ofs->icr ==UNDEF_REG ) -stm32_clr_bits (port, ofs->isr,USART_SR_TC ); -else -stm32_set_bits (port, ofs->icr,USART_CR_TC );stm32_clr_bits (port, ofs->cr3,USART_CR3_DMAT ); stm32port->tx_dma_busy = false;
@@ -396,7 +381,6 @@ static void stm32_transmit_chars_dma(struct uart_port *port)/* Issue pending DMA TX requests */ dma_async_issue_pending (stm32port->tx_ch); -stm32_clr_bits (port, ofs->isr,USART_SR_TC );stm32_set_bits (port, ofs->cr3,USART_CR3_DMAT ); xmit->tail = (xmit->tail + count) & (UART_XMIT_SIZE -1 );
@@ -425,6 +409,11 @@ static void stm32_transmit_chars(struct uart_port *port)return ; } +if (ofs->icr ==UNDEF_REG ) +stm32_clr_bits (port, ofs->isr,USART_SR_TC ); +else +stm32_set_bits (port, ofs->icr,USART_ICR_TCCF ); +if (stm32_port->tx_ch)stm32_transmit_chars_dma (port);else
@@ -601,12 +590,21 @@ static void stm32_shutdown(struct uart_port *port)struct stm32_port *stm32_port =to_stm32_port (port);struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;struct stm32_usart_config *cfg = &stm32_port->info->cfg; -u32 val; +u32 val, isr; +int ret; val =USART_CR1_TXEIE |USART_CR1_RXNEIE |USART_CR1_TE |USART_CR1_RE ; val |=BIT (cfg->uart_enable_bit);if (stm32_port->fifoen) val |=USART_CR1_FIFOEN ; + + ret =readl_relaxed_poll_timeout (port->membase + ofs->isr, + isr, (isr &USART_SR_TC ), +10 ,100000 ); + +if (ret) +dev_err (port->dev,"transmission complete not set\n" ); +stm32_clr_bits (port, ofs->cr1, val);dev_pm_clear_wake_irq (port->dev);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 393/639 serial: stm32: fix wakeup source initialization
In reply to Greg Kroah-HartmanFrom: Erwan Le Ray <[email protected]>
[ Upstream commit 5297f274e8b61ceb9676cba6649d3de9d03387ad ]
Fixes dedicated_irq_wakeup issue and deactivated uart as wakeup source by default.
--- drivers/tty/serial/stm32-usart.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-)
drivers/tty/serial/stm32-usart.c +15 -13
@@ -557,7 +557,6 @@ static int stm32_startup(struct uart_port *port) {struct stm32_port *stm32_port =to_stm32_port (port);struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; -struct stm32_usart_config *cfg = &stm32_port->info->cfg;const char *name =to_platform_device (port->dev)->name;u32 val;int ret;
@@ -568,15 +567,6 @@ static int stm32_startup(struct uart_port *port)if (ret)return ret; -if (cfg->has_wakeup && stm32_port->wakeirq >=0 ) { - ret =dev_pm_set_dedicated_wake_irq (port->dev, - stm32_port->wakeirq); -if (ret) { -free_irq (port->irq, port); -return ret; - } - } - val =USART_CR1_RXNEIE |USART_CR1_TE |USART_CR1_RE ;if (stm32_port->fifoen) val |=USART_CR1_FIFOEN ;
@@ -607,7 +597,6 @@ static void stm32_shutdown(struct uart_port *port)stm32_clr_bits (port, ofs->cr1, val); -dev_pm_clear_wake_irq (port->dev);free_irq (port->irq, port); }
@@ -1079,11 +1068,18 @@ static int stm32_serial_probe(struct platform_device *pdev) ret =device_init_wakeup (&pdev->dev, true);if (ret) goto err_uninit; + + ret =dev_pm_set_dedicated_wake_irq (&pdev->dev, + stm32port->wakeirq); +if (ret) + goto err_nowup; + +device_set_wakeup_enable (&pdev->dev, false); } ret =uart_add_one_port (&stm32_usart_driver, &stm32port->port);if (ret) - goto err_nowup; + goto err_wirq; ret =stm32_of_dma_rx_probe (stm32port, pdev);if (ret)
@@ -1097,6 +1093,10 @@ static int stm32_serial_probe(struct platform_device *pdev)return 0 ; +err_wirq: +if (stm32port->info->cfg.has_wakeup && stm32port->wakeirq >=0 ) +dev_pm_clear_wake_irq (&pdev->dev); + err_nowup:if (stm32port->info->cfg.has_wakeup && stm32port->wakeirq >=0 )device_init_wakeup (&pdev->dev, false);
@@ -1134,8 +1134,10 @@ static int stm32_serial_remove(struct platform_device *pdev)TX_BUF_L , stm32_port->tx_buf, stm32_port->tx_dma_buf); -if (cfg->has_wakeup && stm32_port->wakeirq >=0 ) +if (cfg->has_wakeup && stm32_port->wakeirq >=0 ) { +dev_pm_clear_wake_irq (&pdev->dev);device_init_wakeup (&pdev->dev, false); + }clk_disable_unprepare (stm32_port->clk);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 394/639 misc: sgi-xp: Properly initialize buf in xpc_get_rsvd_page_pa
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit b0576f9ecb5c51e9932531d23c447b2739261841 ]
Clang warns:
drivers/misc/sgi-xp/xpc_partition.c:73:14: warning: variable 'buf' is uninitialized when used within its own initialization [-Wuninitialized]
void *buf = buf;
~~~ ^~~1 warning generated.
Arnd's explanation during review:
/*
* Returns the physical address of the partition's reserved page through
* an iterative number of calls.
*
* On first call, 'cookie' and 'len' should be set to 0, and 'addr'
* set to the nasid of the partition whose reserved page's address is
* being sought.
* On subsequent calls, pass the values, that were passed back on the
* previous call.
*
* While the return status equals SALRET_MORE_PASSES, keep calling
* this function after first copying 'len' bytes starting at 'addr'
* into 'buf'. Once the return status equals SALRET_OK, 'addr' will
* be the physical address of the partition's reserved page. If the
* return status equals neither of these, an error as occurred. */
static inline s64
sn_partition_reserved_page_pa(u64 buf, u64 *cookie, u64 *addr, u64 *len)
so *len is set to zero on the first call and tells the bios how many bytes are accessible at 'buf', and it does get updated by the BIOS to tell us how many bytes it needs, and then we allocate that and try again.
--- drivers/misc/sgi-xp/xpc_partition.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/sgi-xp/xpc_partition.c +1 -1
@@ -70,7 +70,7 @@ xpc_get_rsvd_page_pa(int nasid)unsigned long rp_pa = nasid;/* seed with nasid */ size_t len =0 ;size_t buf_len =0 ; -void *buf = buf; +void *buf =NULL ;void *buf_base =NULL ;enum xp_retval (*get_partition_rsvd_page_pa) (void *, u64 *, unsigned long *, size_t *) =
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 395/639 PCI: PM: Avoid possible suspend-to-idle issue
In reply to Greg Kroah-HartmanFrom: Rafael J. Wysocki <[email protected]>
[ Upstream commit d491f2b75237ef37d8867830ab7fad8d9659e853 ]
If a PCI driver leaves the device handled by it in D0 and calls pci_save_state() on the device in its ->suspend() or ->suspend_late() callback, it can expect the device to stay in D0 over the whole s2idle cycle. However, that may not be the case if there is a spurious wakeup while the system is suspended, because in that case pci_pm_suspend_noirq() will run again after pci_pm_resume_noirq() which calls pci_restore_state(), via pci_pm_default_resume_early(), so state_saved is cleared and the second iteration of pci_pm_suspend_noirq() will invoke pci_prepare_to_sleep() which may change the power state of the device.
To avoid that, add a new internal flag, skip_bus_pm, that will be set by pci_pm_suspend_noirq() when it runs for the first time during the given system suspend-resume cycle if the state of the device has been saved already and the device is still in D0. Setting that flag will cause the next iterations of pci_pm_suspend_noirq() to set state_saved for pci_pm_resume_noirq(), so that it always restores the device state from the originally saved data, and avoid calling pci_prepare_to_sleep() for the device.
--- drivers/pci/pci-driver.c | 17 ++++++++++++++++- include/linux/pci.h | 1 + 2 files changed, 17 insertions(+), 1 deletion(-)
drivers/pci/pci-driver.c +16 -1
@@ -736,6 +736,8 @@ static int pci_pm_suspend(struct device *dev)struct pci_dev *pci_dev =to_pci_dev (dev);const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm :NULL ; + pci_dev->skip_bus_pm = false; +if (pci_has_legacy_pm_support (pci_dev))return pci_legacy_suspend (dev,PMSG_SUSPEND );
@@ -829,7 +831,20 @@ static int pci_pm_suspend_noirq(struct device *dev) } } -if (!pci_dev->state_saved) { +if (pci_dev->skip_bus_pm) { +/* +* The function is running for the second time in a row without +* going through full resume, which is possible only during +* suspend-to-idle in a spurious wakeup case. Moreover, the +* device was originally left in D0, so its power state should +* not be changed here and the device register values saved +* originally should be restored on resume again. +*/ + pci_dev->state_saved = true; + }else if (pci_dev->state_saved) { +if (pci_dev->current_state ==PCI_D0 ) + pci_dev->skip_bus_pm = true; + }else {pci_save_state (pci_dev);if (pci_power_manageable (pci_dev))pci_prepare_to_sleep (pci_dev);
include/linux/pci.h +1 -0
@@ -342,6 +342,7 @@ struct pci_dev {D3cold, not set for devices powered on/off by the corresponding bridge */ + unsigned int skip_bus_pm:1; /* Internal: Skip bus-level PM */ unsigned int ignore_hotplug:1; /* Ignore hotplug events */ unsigned int hotplug_user_indicators:1; /* SlotCtl indicatorscontrolled exclusively by
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 396/639 iommu: Add missing new line for dma type
In reply to Greg Kroah-HartmanFrom: Lu Baolu <[email protected]>
[ Upstream commit 24f307d8abf79486dd3c1b645037df7d91602aaa ]
So that all types are printed in the same format.
--- drivers/iommu/iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/iommu.c +1 -1
@@ -317,7 +317,7 @@ static ssize_t iommu_group_show_type(struct iommu_group *group, type ="unmanaged\n" ;break ;case IOMMU_DOMAIN_DMA : - type ="DMA" ; + type ="DMA\n" ;break ; } }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 397/639 iommu: Use right function to get group for device
In reply to Greg Kroah-HartmanFrom: Lu Baolu <[email protected]>
[ Upstream commit 57274ea25736496ee019a5c40479855b21888839 ]
The iommu_group_get_for_dev() will allocate a group for a device if it isn't in any group. This isn't the use case in iommu_request_dm_for_dev(). Let's use iommu_group_get() instead.
--- drivers/iommu/iommu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iommu/iommu.c +3 -3
@@ -1900,9 +1900,9 @@ int iommu_request_dm_for_dev(struct device *dev)int ret;/* Device must already be in a group before calling this function */ - group =iommu_group_get_for_dev (dev); -if (IS_ERR (group)) -return PTR_ERR (group); + group =iommu_group_get (dev); +if (!group) +return -EINVAL ;mutex_lock (&group->mutex);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 398/639 signal/bpfilter: Fix bpfilter_kernl to use send_sig not force_sig
In reply to Greg Kroah-HartmanFrom: Eric W. Biederman <[email protected]>
[ Upstream commit 1dfd1711de2952fd1bfeea7152bd1687a4eea771 ]
The locking in force_sig_info is not prepared to deal with a task that exits or execs (as sighand may change). As force_sig is only built to handle synchronous exceptions.
Further the function force_sig_info changes the signal state if the signal is ignored, or blocked or if SIGNAL_UNKILLABLE will prevent the delivery of the signal. The signal SIGKILL can not be ignored and can not be blocked and SIGNAL_UNKILLABLE won't prevent it from being delivered.
So using force_sig rather than send_sig for SIGKILL is pointless.
Because it won't impact the sending of the signal and and because using force_sig is wrong, replace force_sig with send_sig.
--- net/bpfilter/bpfilter_kern.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bpfilter/bpfilter_kern.c +1 -1
@@ -25,7 +25,7 @@ static void shutdown_umh(struct umh_info *info)return ; tsk =get_pid_task (find_vpid (info->pid),PIDTYPE_PID );if (tsk) { -force_sig (SIGKILL , tsk); +send_sig (SIGKILL , tsk,1 );put_task_struct (tsk); }fput (info->pipe_to_umh);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 399/639 signal/cifs: Fix cifs_put_tcp_session to call send_sig instead of force_sig
In reply to Greg Kroah-HartmanFrom: Eric W. Biederman <[email protected]>
[ Upstream commit 72abe3bcf0911d69b46c1e8bdb5612675e0ac42c ]
The locking in force_sig_info is not prepared to deal with a task that exits or execs (as sighand may change). The is not a locking problem in force_sig as force_sig is only built to handle synchronous exceptions.
Further the function force_sig_info changes the signal state if the signal is ignored, or blocked or if SIGNAL_UNKILLABLE will prevent the delivery of the signal. The signal SIGKILL can not be ignored and can not be blocked and SIGNAL_UNKILLABLE won't prevent it from being delivered.
So using force_sig rather than send_sig for SIGKILL is confusing and pointless.
Because it won't impact the sending of the signal and and because using force_sig is wrong, replace force_sig with send_sig.
--- fs/cifs/connect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/connect.c +1 -1
@@ -2454,7 +2454,7 @@ cifs_put_tcp_session(struct TCP_Server_Info *server, int from_reconnect) task =xchg (&server->tsk,NULL );if (task) -force_sig (SIGKILL , task); +send_sig (SIGKILL , task,1 ); } static struct TCP_Server_Info *
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 400/639 inet: frags: call inet_frags_fini() after unregister_pernet_subsys()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit ae7352d384a552d8c799c242e74a934809990a71 ]
Both IPv6 and 6lowpan are calling inet_frags_fini() too soon.
inet_frags_fini() is dismantling a kmem_cache, that might be needed later when unregister_pernet_subsys() eventually has to remove frags queues from hash tables and free them.
This fixes potential use-after-free, and is a prereq for the following patch.
--- net/ieee802154/6lowpan/reassembly.c | 2 +- net/ipv6/reassembly.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/ieee802154/6lowpan/reassembly.c +1 -1
@@ -629,7 +629,7 @@ err_sysctl:void lowpan_net_frag_exit (void ) { -inet_frags_fini (&lowpan_frags);lowpan_frags_sysctl_unregister ();unregister_pernet_subsys (&lowpan_frags_ops); +inet_frags_fini (&lowpan_frags); }
net/ipv6/reassembly.c +1 -1
@@ -593,8 +593,8 @@ err_protocol:void ipv6_frag_exit (void ) { -inet_frags_fini (&ip6_frags);ip6_frags_sysctl_unregister ();unregister_pernet_subsys (&ip6_frags_ops);inet6_del_protocol (&frag_protocol,IPPROTO_FRAGMENT ); +inet_frags_fini (&ip6_frags); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 401/639 net: hns3: fix a memory leak issue for hclge_map_unmap_ring_to_vf_vector
In reply to Greg Kroah-HartmanFrom: Huazhong Tan <[email protected]>
[ Upstream commit 49f971bd308571fe466687227130a7082b662d0e ]
When hclge_bind_ring_with_vector() fails, hclge_map_unmap_ring_to_vf_vector() returns the error directly, so nobody will free the memory allocated by hclge_get_ring_chain_from_mbx().
So hclge_free_vector_ring_chain() should be called no matter hclge_bind_ring_with_vector() fails or not.
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c +1 -3
@@ -181,12 +181,10 @@ static int hclge_map_unmap_ring_to_vf_vector(struct hclge_vport *vport, bool en,return ret; ret =hclge_bind_ring_with_vector (vport, vector_id, en, &ring_chain); -if (ret) -return ret;hclge_free_vector_ring_chain (&ring_chain); -return 0 ; +return ret; } static int hclge_set_vf_promisc_mode(struct hclge_vport *vport,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 402/639 media: Staging: media: Release the correct resource in an error handling path
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 3b6471c7becd06325eb5e701cc2602b2edbbc7b6 ]
'res' is reassigned several times in the function and if we 'goto error_unmap', its value is not the returned value of 'request_mem_region()' anymore.
Introduce a new 'struct resource *' variable (i.e. res2) to keep a pointer to the right resource, if needed in the error handling path.
--- drivers/staging/media/davinci_vpfe/dm365_ipipe.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/media/davinci_vpfe/dm365_ipipe.c +5 -5
@@ -1777,7 +1777,7 @@ vpfe_ipipe_init(struct vpfe_ipipe_device *ipipe, struct platform_device *pdev)struct media_pad *pads = &ipipe->pads[0 ];struct v4l2_subdev *sd = &ipipe->subdev;struct media_entity *me = &sd->entity; -struct resource *res, *memres; +struct resource *res, *res2, *memres; res =platform_get_resource (pdev,IORESOURCE_MEM ,4 );if (!res)
@@ -1791,11 +1791,11 @@ vpfe_ipipe_init(struct vpfe_ipipe_device *ipipe, struct platform_device *pdev)if (!ipipe->base_addr) goto error_release; - res =platform_get_resource (pdev,IORESOURCE_MEM ,6 ); -if (!res) + res2 =platform_get_resource (pdev,IORESOURCE_MEM ,6 ); +if (!res2) goto error_unmap; - ipipe->isp5_base_addr =ioremap_nocache (res->start, -resource_size (res)); + ipipe->isp5_base_addr =ioremap_nocache (res2->start, +resource_size (res2));if (!ipipe->isp5_base_addr) goto error_unmap;
Signature · 1 line
2.20.1
A message that is not in the archive (sent off-list or not yet received): 1578497930.3188.1579867610896.JavaMail.www@wwinf1n19
Greg Kroah-Hartman
maintainerRe: [PATCH 4.19 402/639] media: Staging: media: Release the correct resource in an error handling path
Quoted 9 lines · Marion et Christophe JAILLET
Hi,
Apparently is patch is no more needed in 4.19.98+.
'res' is not used anymore in the error handling path (or its use depends on another patch which has not been backported). 'res' can safely be overriden.
There is no need to add extra variable
Ok, now dropped, thanks.
greg k-h
Greg Kroah-Hartman
maintainerPATCH 403/639 crypto: talitos - fix AEAD processing.
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
[ Upstream commit e345177ded17611e36c067751d63d64bf106cb54 ]
This driver is working well in 'simple cases', but as soon as more exotic SG lists are provided (dst different from src, auth part not in a single SG fragment, ...) there are wrong results, overruns, etc ...
This patch cleans up the AEAD processing by:
- Simplifying the location of 'out of line' ICV
- Never using 'out of line' ICV on encryp
- Always using 'out of line' ICV on decrypt
- Forcing the generation of a SG table on decrypt
--- drivers/crypto/talitos.c | 158 +++++++++++++-------------------------- drivers/crypto/talitos.h | 2 +- 2 files changed, 55 insertions(+), 105 deletions(-)
drivers/crypto/talitos.c +54 -104
@@ -974,8 +974,8 @@ static void ipsec_esp_unmap(struct device *dev, DMA_FROM_DEVICE);unmap_single_talitos_ptr (dev, civ_ptr,DMA_TO_DEVICE ); -talitos_sg_unmap (dev, edesc, areq->src, areq->dst, cryptlen, - areq->assoclen); +talitos_sg_unmap (dev, edesc, areq->src, areq->dst, + cryptlen + authsize, areq->assoclen);if (edesc->dma_len) dma_unmap_single(dev, edesc->dma_link_tbl, edesc->dma_len,
@@ -996,30 +996,15 @@ static void ipsec_esp_encrypt_done(struct device *dev, struct talitos_desc *desc, void *context, int err) { - struct talitos_private *priv = dev_get_drvdata(dev); -bool is_sec1 =has_ftr_sec1 (priv); struct aead_request *areq = context;struct crypto_aead *authenc =crypto_aead_reqtfm (areq); -unsigned int authsize =crypto_aead_authsize (authenc);unsigned int ivsize =crypto_aead_ivsize (authenc);struct talitos_edesc *edesc; -void *icvdata; edesc = container_of(desc, struct talitos_edesc, desc);ipsec_esp_unmap (dev, edesc, areq, true); -/* copy the generated ICV to dst */ -if (edesc->icv_ool) { -if (is_sec1) - icvdata = edesc->buf + areq->assoclen + areq->cryptlen; -else - icvdata = &edesc->link_tbl[edesc->src_nents + - edesc->dst_nents +2 ]; -sg_pcopy_from_buffer (areq->dst, edesc->dst_nents ? :1 , icvdata, - authsize, areq->assoclen + areq->cryptlen); - } -dma_unmap_single (dev, edesc->iv_dma, ivsize,DMA_TO_DEVICE );kfree (edesc);
@@ -1036,39 +1021,15 @@ static void ipsec_esp_decrypt_swauth_done(struct device *dev,unsigned int authsize =crypto_aead_authsize (authenc);struct talitos_edesc *edesc;char *oicv, *icv; -struct talitos_private *priv =dev_get_drvdata (dev); -bool is_sec1 =has_ftr_sec1 (priv); edesc = container_of(desc, struct talitos_edesc, desc);ipsec_esp_unmap (dev, edesc, req, false);if (!err) { -char icvdata[SHA512_DIGEST_SIZE ]; -int nents = edesc->dst_nents ? :1 ; -unsigned int len = req->assoclen + req->cryptlen; -/* auth check */ -if (nents >1 ) { -sg_pcopy_to_buffer (req->dst, nents, icvdata, authsize, - len - authsize); - icv = icvdata; - }else { - icv = (char *)sg_virt (req->dst) + len - authsize; - } - -if (edesc->dma_len) { -if (is_sec1) - oicv = (char *)&edesc->dma_link_tbl + - req->assoclen + req->cryptlen; -else - oicv = (char *) - &edesc->link_tbl[edesc->src_nents + - edesc->dst_nents +2 ]; -if (edesc->icv_ool) - icv = oicv + authsize; - }else - oicv = (char *)&edesc->link_tbl[0 ]; + oicv = edesc->buf + edesc->dma_len; + icv = oicv - authsize; err =crypto_memneq (oicv, icv, authsize) ? -EBADMSG :0 ; }
@@ -1104,11 +1065,12 @@ static void ipsec_esp_decrypt_hwauth_done(struct device *dev,* stop at cryptlen bytes */ static int sg_to_link_tbl_offset (struct scatterlist *sg,int sg_count, -unsigned int offset,int cryptlen, +unsigned int offset,int datalen,int elen,struct talitos_ptr *link_tbl_ptr) { -int n_sg = sg_count; +int n_sg = elen ? sg_count +1 : sg_count;int count =0 ; +int cryptlen = datalen + elen;while (cryptlen && sg && n_sg--) {unsigned int len =sg_dma_len (sg);
@@ -1123,11 +1085,20 @@ static int sg_to_link_tbl_offset(struct scatterlist *sg, int sg_count,if (len > cryptlen) len = cryptlen; +if (datalen >0 && len > datalen) { +to_talitos_ptr (link_tbl_ptr + count, +sg_dma_address (sg) + offset, datalen,0 ); +to_talitos_ptr_ext_set (link_tbl_ptr + count,0 ,0 ); + count++; + len -= datalen; + offset += datalen; + }to_talitos_ptr (link_tbl_ptr + count,sg_dma_address (sg) + offset, len,0 );to_talitos_ptr_ext_set (link_tbl_ptr + count,0 ,0 ); count++; cryptlen -= len; + datalen -= len; offset =0 ; next:
@@ -1137,7 +1108,7 @@ next:/* tag end of link table */ if (count >0 )to_talitos_ptr_ext_set (link_tbl_ptr + count -1 , -DESC_PTR_LNKTBL_RETURN ,0 ); +DESC_PTR_LNKTBL_RET ,0 );return count; }
@@ -1145,7 +1116,8 @@ next:static int talitos_sg_map_ext (struct device *dev,struct scatterlist *src,unsigned int len,struct talitos_edesc *edesc,struct talitos_ptr *ptr,int sg_count, -unsigned int offset,int tbl_off,int elen) +unsigned int offset,int tbl_off,int elen, +bool force) {struct talitos_private *priv =dev_get_drvdata (dev);bool is_sec1 =has_ftr_sec1 (priv);
@@ -1155,7 +1127,7 @@ static int talitos_sg_map_ext(struct device *dev, struct scatterlist *src,return 1 ; }to_talitos_ptr_ext_set (ptr, elen, is_sec1); -if (sg_count ==1 ) { +if (sg_count ==1 && !force) {to_talitos_ptr (ptr,sg_dma_address (src) + offset, len, is_sec1);return sg_count; }
@@ -1163,9 +1135,9 @@ static int talitos_sg_map_ext(struct device *dev, struct scatterlist *src,to_talitos_ptr (ptr, edesc->dma_link_tbl + offset, len, is_sec1);return sg_count; } - sg_count =sg_to_link_tbl_offset (src, sg_count, offset, len + elen, + sg_count =sg_to_link_tbl_offset (src, sg_count, offset, len, elen, &edesc->link_tbl[tbl_off]); -if (sg_count ==1 ) { +if (sg_count ==1 && !force) {/* Only one segment now, so no link tbl needed*/ copy_talitos_ptr (ptr, &edesc->link_tbl[tbl_off], is_sec1);return sg_count;
@@ -1183,7 +1155,7 @@ static int talitos_sg_map(struct device *dev, struct scatterlist *src, unsigned int offset, int tbl_off) {return talitos_sg_map_ext (dev, src, len, edesc, ptr, sg_count, offset, - tbl_off,0 ); + tbl_off,0 , false); }/*
@@ -1211,6 +1183,7 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq,bool is_ipsec_esp = desc->hdr &DESC_HDR_TYPE_IPSEC_ESP ;struct talitos_ptr *civ_ptr = &desc->ptr[is_ipsec_esp ?2 :3 ];struct talitos_ptr *ckey_ptr = &desc->ptr[is_ipsec_esp ?3 :2 ]; +dma_addr_t dma_icv = edesc->dma_link_tbl + edesc->dma_len - authsize;/* hmac key */ to_talitos_ptr (&desc->ptr[0 ], ctx->dma_key, ctx->authkeylen, is_sec1);
@@ -1250,7 +1223,8 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, elen = authsize; ret =talitos_sg_map_ext (dev, areq->src, cryptlen, edesc, &desc->ptr[4 ], - sg_count, areq->assoclen, tbl_off, elen); + sg_count, areq->assoclen, tbl_off, elen, + false);if (ret >1 ) { tbl_off += ret;
@@ -1264,55 +1238,35 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq,dma_map_sg (dev, areq->dst, sg_count,DMA_FROM_DEVICE ); } - ret =talitos_sg_map (dev, areq->dst, cryptlen, edesc, &desc->ptr[5 ], - sg_count, areq->assoclen, tbl_off); - -if (is_ipsec_esp) -to_talitos_ptr_ext_or (&desc->ptr[5 ], authsize, is_sec1); +if (is_ipsec_esp && encrypt) + elen = authsize; +else + elen =0 ; + ret =talitos_sg_map_ext (dev, areq->dst, cryptlen, edesc, &desc->ptr[5 ], + sg_count, areq->assoclen, tbl_off, elen, + is_ipsec_esp && !encrypt); + tbl_off += ret;/* ICV data */ -if (ret >1 ) { - tbl_off += ret; - edesc->icv_ool = true; - sync_needed = true; + edesc->icv_ool = !encrypt; -if (is_ipsec_esp) { -struct talitos_ptr *tbl_ptr = &edesc->link_tbl[tbl_off]; -int offset = (edesc->src_nents + edesc->dst_nents +2 ) * -sizeof (struct talitos_ptr ) + authsize; +if (!encrypt && is_ipsec_esp) { +struct talitos_ptr *tbl_ptr = &edesc->link_tbl[tbl_off]; -/* Add an entry to the link table for ICV data */ -to_talitos_ptr_ext_set (tbl_ptr -1 ,0 , is_sec1); -to_talitos_ptr_ext_set (tbl_ptr,DESC_PTR_LNKTBL_RETURN , - is_sec1); +/* Add an entry to the link table for ICV data */ +to_talitos_ptr_ext_set (tbl_ptr -1 ,0 , is_sec1); +to_talitos_ptr_ext_set (tbl_ptr,DESC_PTR_LNKTBL_RET , is_sec1); -/* icv data follows link tables */ -to_talitos_ptr (tbl_ptr, edesc->dma_link_tbl + offset, - authsize, is_sec1); - }else { -dma_addr_t addr = edesc->dma_link_tbl; - -if (is_sec1) - addr += areq->assoclen + cryptlen; -else - addr +=sizeof (struct talitos_ptr ) * tbl_off; - -to_talitos_ptr (&desc->ptr[6 ], addr, authsize, is_sec1); - } +/* icv data follows link tables */ +to_talitos_ptr (tbl_ptr, dma_icv, authsize, is_sec1); +to_talitos_ptr_ext_or (&desc->ptr[5 ], authsize, is_sec1); + sync_needed = true; + }else if (!encrypt) { +to_talitos_ptr (&desc->ptr[6 ], dma_icv, authsize, is_sec1); + sync_needed = true; }else if (!is_ipsec_esp) { - ret =talitos_sg_map (dev, areq->dst, authsize, edesc, - &desc->ptr[6 ], sg_count, areq->assoclen + - cryptlen, - tbl_off); -if (ret >1 ) { - tbl_off += ret; - edesc->icv_ool = true; - sync_needed = true; - }else { - edesc->icv_ool = false; - } - }else { - edesc->icv_ool = false; +talitos_sg_map (dev, areq->dst, authsize, edesc, &desc->ptr[6 ], + sg_count, areq->assoclen + cryptlen, tbl_off); }/* iv out */
@@ -1395,18 +1349,18 @@ static struct talitos_edesc *talitos_edesc_alloc(struct device *dev,* and space for two sets of ICVs (stashed and generated) */ alloc_len =sizeof (struct talitos_edesc ); -if (src_nents || dst_nents) { +if (src_nents || dst_nents || !encrypt) {if (is_sec1) dma_len = (src_nents ? src_len :0 ) + - (dst_nents ? dst_len :0 ); + (dst_nents ? dst_len :0 ) + authsize;else dma_len = (src_nents + dst_nents +2 ) * -sizeof (struct talitos_ptr ) + authsize *2 ; +sizeof (struct talitos_ptr ) + authsize; alloc_len += dma_len; }else { dma_len =0 ; - alloc_len += icv_stashing ? authsize :0 ; } + alloc_len += icv_stashing ? authsize :0 ;/* if its a ahash, add space for a second desc next to the first one */ if (is_sec1 && !dst)
@@ -1500,11 +1454,7 @@ static int aead_decrypt(struct aead_request *req) edesc->desc.hdr = ctx->desc_hdr_template |DESC_HDR_DIR_INBOUND ;/* stash incoming ICV for later cmp with ICV generated by the h/w */ -if (edesc->dma_len) - icvdata = (char *)&edesc->link_tbl[edesc->src_nents + - edesc->dst_nents +2 ]; -else - icvdata = &edesc->link_tbl[0 ]; + icvdata = edesc->buf + edesc->dma_len;sg_pcopy_to_buffer (req->src, edesc->src_nents ? :1 , icvdata, authsize, req->assoclen + req->cryptlen - authsize);
drivers/crypto/talitos.h +1 -1
@@ -442,5 +442,5 @@ static inline bool has_ftr_sec1(struct talitos_private *priv)/* link table extent field bits */ #define DESC_PTR_LNKTBL_JUMP 0x80 -#define DESC_PTR_LNKTBL_RETURN 0x02 +#define DESC_PTR_LNKTBL_RET 0x02#define DESC_PTR_LNKTBL_NEXT 0x01
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 404/639 netvsc: unshare skb in VF rx handler
In reply to Greg Kroah-HartmanFrom: Stephen Hemminger <[email protected]>
[ Upstream commit 996ed04741467f6d1552440c92988b132a9487ec ]
The netvsc VF skb handler should make sure that skb is not shared. Similar logic already exists in bonding and team device drivers.
This is not an issue in practice because the VF devicex does not send up shared skb's. But the netvsc driver should do the right thing if it did.
--- drivers/net/hyperv/netvsc_drv.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/hyperv/netvsc_drv.c +6 -0
@@ -2004,6 +2004,12 @@ static rx_handler_result_t netvsc_vf_handle_frame(struct sk_buff **pskb)struct netvsc_vf_pcpu_stats *pcpu_stats =this_cpu_ptr (ndev_ctx->vf_stats); + skb =skb_share_check (skb,GFP_ATOMIC ); +if (unlikely (!skb)) +return RX_HANDLER_CONSUMED ; + + *pskb = skb; + skb->dev = ndev;u64_stats_update_begin (&pcpu_stats->syncp);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 405/639 net: core: support XDP generic on stacked devices.
In reply to Greg Kroah-HartmanFrom: Stephen Hemminger <[email protected]>
[ Upstream commit 458bf2f224f04a513b0be972f8708e78ee2c986e ]
When a device is stacked like (team, bonding, failsafe or netvsc) the XDP generic program for the parent device was not called.
Move the call to XDP generic inside __netif_receive_skb_core where it can be done multiple times for stacked case.
--- net/core/dev.c | 58 +++++++++++--------------------------------------- 1 file changed, 12 insertions(+), 46 deletions(-)
net/core/dev.c +12 -46
@@ -4465,23 +4465,6 @@ static int netif_rx_internal(struct sk_buff *skb)trace_netif_rx (skb); -if (static_branch_unlikely (&generic_xdp_needed_key)) { -int ret; - -preempt_disable (); -rcu_read_lock (); - ret =do_xdp_generic (rcu_dereference (skb->dev->xdp_prog), skb); -rcu_read_unlock (); -preempt_enable (); - -/* Consider XDP consuming the packet a success from -* the netdev point of view we do not want to count -* this as an error. -*/ -if (ret !=XDP_PASS ) -return NET_RX_SUCCESS ; - } -#ifdef CONFIG_RPS if (static_key_false (&rps_needed)) {struct rps_dev_flow voidflow, *rflow = &voidflow;
@@ -4815,6 +4798,18 @@ another_round:__this_cpu_inc (softnet_data.processed); +if (static_branch_unlikely (&generic_xdp_needed_key)) { +int ret2; + +preempt_disable (); + ret2 =do_xdp_generic (rcu_dereference (skb->dev->xdp_prog), skb); +preempt_enable (); + +if (ret2 !=XDP_PASS ) +return NET_RX_DROP ; +skb_reset_mac_len (skb); + } +if (skb->protocol ==cpu_to_be16 (ETH_P_8021Q ) || skb->protocol ==cpu_to_be16 (ETH_P_8021AD )) { skb =skb_vlan_untag (skb);
@@ -5133,19 +5128,6 @@ static int netif_receive_skb_internal(struct sk_buff *skb)if (skb_defer_rx_timestamp (skb))return NET_RX_SUCCESS ; -if (static_branch_unlikely (&generic_xdp_needed_key)) { -int ret; - -preempt_disable (); -rcu_read_lock (); - ret =do_xdp_generic (rcu_dereference (skb->dev->xdp_prog), skb); -rcu_read_unlock (); -preempt_enable (); - -if (ret !=XDP_PASS ) -return NET_RX_DROP ; - } -rcu_read_lock ();#ifdef CONFIG_RPS if (static_key_false (&rps_needed)) {
@@ -5166,7 +5148,6 @@ static int netif_receive_skb_internal(struct sk_buff *skb)static void netif_receive_skb_list_internal (struct list_head *head) { -struct bpf_prog *xdp_prog =NULL ;struct sk_buff *skb, *next;struct list_head sublist;
@@ -5179,21 +5160,6 @@ static void netif_receive_skb_list_internal(struct list_head *head) }list_splice_init (&sublist, head); -if (static_branch_unlikely (&generic_xdp_needed_key)) { -preempt_disable (); -rcu_read_lock (); -list_for_each_entry_safe (skb, next, head, list) { - xdp_prog =rcu_dereference (skb->dev->xdp_prog); -skb_list_del_init (skb); -if (do_xdp_generic (xdp_prog, skb) ==XDP_PASS ) -list_add_tail (&skb->list, &sublist); - } -rcu_read_unlock (); -preempt_enable (); -/* Put passed packets back on main list */ -list_splice_init (&sublist, head); - } -rcu_read_lock ();#ifdef CONFIG_RPS if (static_key_false (&rps_needed)) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 406/639 RDMA/uverbs: check for allocation failure in uapi_add_elm()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit cac2a301c02a9b178842e22df34217da7854e588 ]
If the kzalloc() fails then we should return ERR_PTR(-ENOMEM). In the current code it's possible that the kzalloc() fails and the radix_tree_insert() inserts the NULL pointer successfully and we return the NULL "elm" pointer to the caller. That results in a NULL pointer dereference.
--- drivers/infiniband/core/uverbs_uapi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/core/uverbs_uapi.c +2 -0
@@ -17,6 +17,8 @@ static void *uapi_add_elm(struct uverbs_api *uapi, u32 key, size_t alloc_size)return ERR_PTR (-EOVERFLOW ); elm =kzalloc (alloc_size,GFP_KERNEL ); +if (!elm) +return ERR_PTR (-ENOMEM ); rc =radix_tree_insert (&uapi->radix, key, elm);if (rc) {kfree (elm);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 407/639 net: dont clear sock->sk early to avoid trouble in strparser
In reply to Greg Kroah-HartmanFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 2b81f8161dfeda4017cef4f2498ccb64b13f0d61 ]
af_inet sets sock->sk to NULL which trips strparser over:
BUG: kernel NULL pointer dereference, address: 0000000000000012 PGD 0 P4D 0 Oops: 0000 [#1] SMP PTI CPU: 7 PID: 0 Comm: swapper/7 Not tainted 5.2.0-rc1-00139-g14629453a6d3 #21 RIP: 0010:tcp_peek_len+0x10/0x60 RSP: 0018:ffffc02e41c54b98 EFLAGS: 00010246 RAX: 0000000000000000 RBX: ffff9cf924c4e030 RCX: 0000000000000051 RDX: 0000000000000000 RSI: 000000000000000c RDI: ffff9cf97128f480 RBP: ffff9cf9365e0300 R08: ffff9cf94fe7d2c0 R09: 0000000000000000 R10: 000000000000036b R11: ffff9cf939735e00 R12: ffff9cf91ad9ae40 R13: ffff9cf924c4e000 R14: ffff9cf9a8fcbaae R15: 0000000000000020 FS: 0000000000000000(0000) GS:ffff9cf9af7c0000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000012 CR3: 000000013920a003 CR4: 00000000003606e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <IRQ> strp_data_ready+0x48/0x90 tls_data_ready+0x22/0xd0 [tls] tcp_rcv_established+0x569/0x620 tcp_v4_do_rcv+0x127/0x1e0 tcp_v4_rcv+0xad7/0xbf0 ip_protocol_deliver_rcu+0x2c/0x1c0 ip_local_deliver_finish+0x41/0x50 ip_local_deliver+0x6b/0xe0 ? ip_protocol_deliver_rcu+0x1c0/0x1c0 ip_rcv+0x52/0xd0 ? ip_rcv_finish_core.isra.20+0x380/0x380 __netif_receive_skb_one_core+0x7e/0x90 netif_receive_skb_internal+0x42/0xf0 napi_gro_receive+0xed/0x150 nfp_net_poll+0x7a2/0xd30 [nfp] ? kmem_cache_free_bulk+0x286/0x310 net_rx_action+0x149/0x3b0 __do_softirq+0xe3/0x30a ? handle_irq_event_percpu+0x6a/0x80 irq_exit+0xe8/0xf0 do_IRQ+0x85/0xd0 common_interrupt+0xf/0xf </IRQ> RIP: 0010:cpuidle_enter_state+0xbc/0x450
To avoid this issue set sock->sk after sk_prot->close. My grepping and testing did not discover any code which would depend on the current behaviour.
--- net/ipv4/af_inet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/af_inet.c +1 -1
@@ -424,8 +424,8 @@ int inet_release(struct socket *sock)if (sock_flag (sk,SOCK_LINGER ) && !(current->flags &PF_EXITING )) timeout = sk->sk_lingertime; - sock->sk =NULL ; sk->sk_prot->close (sk, timeout); + sock->sk =NULL ; }return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 408/639 phy: qcom-qusb2: fix missing assignment of ret when calling clk_prepare_enable
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit d98010817a26eba8d4d1e8a639e0b7d7f042308a ]
The error return from the call to clk_prepare_enable is not being assigned to variable ret even though ret is being used to check if the call failed. Fix this by adding in the missing assignment.
Addresses-Coverity: ("Logically dead code")
--- drivers/phy/qualcomm/phy-qcom-qusb2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/phy/qualcomm/phy-qcom-qusb2.c +1 -1
@@ -526,7 +526,7 @@ static int __maybe_unused qusb2_phy_runtime_resume(struct device *dev) }if (!qphy->has_se_clk_scheme) { -clk_prepare_enable (qphy->ref_clk); + ret =clk_prepare_enable (qphy->ref_clk);if (ret) {dev_err (dev,"failed to enable ref clk, %d\n" , ret); goto disable_ahb_clk;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 409/639 cpufreq: brcmstb-avs-cpufreq: Fix initial command check
In reply to Greg Kroah-HartmanFrom: Florian Fainelli <[email protected]>
[ Upstream commit 22a26cc6a51ef73dcfeb64c50513903f6b2d53d8 ]
There is a logical error in brcm_avs_is_firmware_loaded() whereby if the firmware returns -EINVAL, we will be reporting this as an error. The comment is correct, the code was not.
--- drivers/cpufreq/brcmstb-avs-cpufreq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/cpufreq/brcmstb-avs-cpufreq.c +2 -2
@@ -446,8 +446,8 @@ static bool brcm_avs_is_firmware_loaded(struct private_data *priv) rc =brcm_avs_get_pmap (priv,NULL ); magic =readl (priv->base +AVS_MBOX_MAGIC ); -return (magic ==AVS_FIRMWARE_MAGIC ) && (rc != -ENOTSUPP ) && - (rc != -EINVAL ); +return (magic ==AVS_FIRMWARE_MAGIC ) && ((rc != -ENOTSUPP ) || + (rc != -EINVAL )); }static unsigned int brcm_avs_cpufreq_get (unsigned int cpu)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 410/639 cpufreq: brcmstb-avs-cpufreq: Fix types for voltage/frequency
In reply to Greg Kroah-HartmanFrom: Florian Fainelli <[email protected]>
[ Upstream commit 4c5681fcc684c762b09435de3e82ffeee7769d21 ]
What we read back from the register is going to be capped at 32-bits, and cpufreq_freq_table.frequency is an unsigned int. Avoid any possible value truncation by using the appropriate return value.
--- drivers/cpufreq/brcmstb-avs-cpufreq.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/cpufreq/brcmstb-avs-cpufreq.c +4 -4
@@ -384,12 +384,12 @@ static int brcm_avs_set_pstate(struct private_data *priv, unsigned int pstate)return __issue_avs_command (priv,AVS_CMD_SET_PSTATE , true, args); } -static unsigned long brcm_avs_get_voltage (void __iomem *base) +static u32 brcm_avs_get_voltage (void __iomem *base) {return readl (base +AVS_MBOX_VOLTAGE1 ); } -static unsigned long brcm_avs_get_frequency (void __iomem *base) +static u32 brcm_avs_get_frequency (void __iomem *base) {return readl (base +AVS_MBOX_FREQUENCY ) *1000 ;/* in kHz */ }
@@ -653,14 +653,14 @@ static ssize_t show_brcm_avs_voltage(struct cpufreq_policy *policy, char *buf) {struct private_data *priv = policy->driver_data; -return sprintf (buf,"0x%08lx\n" ,brcm_avs_get_voltage (priv->base)); +return sprintf (buf,"0x%08x\n" ,brcm_avs_get_voltage (priv->base)); }static ssize_t show_brcm_avs_frequency (struct cpufreq_policy *policy,char *buf) {struct private_data *priv = policy->driver_data; -return sprintf (buf,"0x%08lx\n" ,brcm_avs_get_frequency (priv->base)); +return sprintf (buf,"0x%08x\n" ,brcm_avs_get_frequency (priv->base)); }cpufreq_freq_attr_ro (brcm_avs_pstate);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 411/639 clk: sunxi-ng: sun50i-h6-r: Fix incorrect W1 clock gate register
In reply to Greg Kroah-HartmanFrom: Ondrej Jirman <[email protected]>
[ Upstream commit f167675486c37b88620d344fbb12d06e34f11d47 ]
The current code defines W1 clock gate to be at 0x1cc, overlaying it with the IR gate.
Clock gate for r-apb1-w1 is at 0x1ec. This fixes issues with IR receiver causing interrupt floods on H6 (because interrupt flags can't be cleared, due to IR module's bus being disabled).
--- drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c +1 -1
@@ -104,7 +104,7 @@ static SUNXI_CCU_GATE(r_apb2_i2c_clk, "r-apb2-i2c", "r-apb2", static SUNXI_CCU_GATE(r_apb1_ir_clk, "r-apb1-ir", "r-apb1", 0x1cc, BIT(0), 0); static SUNXI_CCU_GATE(r_apb1_w1_clk, "r-apb1-w1", "r-apb1", - 0x1cc, BIT(0), 0); + 0x1ec, BIT(0), 0);/* Information of IR(RX) mod clock is gathered from BSP source code */ static const char *const r_mod0_default_parents[] = {"osc32k" ,"osc24M" };
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 412/639 media: vivid: fix incorrect assignment operation when setting video mode
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit d4ec9550e4b2d2e357a46fdc65d8ef3d4d15984c ]
The assigment of FB_VMODE_NONINTERLACE to var->vmode should be a bit-wise or of FB_VMODE_NONINTERLACE instead of an assignment, otherwise the previous clearing of the FB_VMODE_MASK bits of var->vmode makes no sense and is redundant.
Addresses-Coverity: ("Unused value")
--- drivers/media/platform/vivid/vivid-osd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/vivid/vivid-osd.c +1 -1
@@ -155,7 +155,7 @@ static int _vivid_fb_check_var(struct fb_var_screeninfo *var, struct vivid_dev * var->nonstd =0 ; var->vmode &= ~FB_VMODE_MASK ; - var->vmode =FB_VMODE_NONINTERLACED ; + var->vmode |=FB_VMODE_NONINTERLACED ;/* Dummy values */ var->hsync_len =24 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 413/639 crypto: inside-secure - fix zeroing of the request in ahash_exit_inv
In reply to Greg Kroah-HartmanFrom: Antoine Tenart <[email protected]>
[ Upstream commit b926213d6fede9c9427d7c12eaf7d9f0895deb4e ]
A request is zeroed in safexcel_ahash_exit_inv(). This request total size is EIP197_AHASH_REQ_SIZE while the memset zeroing it uses sizeof(struct ahash_request), which happens to be less than EIP197_AHASH_REQ_SIZE. This patch fixes it.
--- drivers/crypto/inside-secure/safexcel_hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/inside-secure/safexcel_hash.c +1 -1
@@ -486,7 +486,7 @@ static int safexcel_ahash_exit_inv(struct crypto_tfm *tfm)struct safexcel_inv_result result = {};int ring = ctx->base.ring; -memset (req,0 ,sizeof (struct ahash_request )); +memset (req,0 ,EIP197_AHASH_REQ_SIZE );/* create invalidation request */ init_completion (&result.completion);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 414/639 crypto: inside-secure - fix queued len computation
In reply to Greg Kroah-HartmanFrom: Antoine Tenart <[email protected]>
[ Upstream commit ccd65a206a5025cf953a2e4f37e894921b131a5c ]
This patch fixes the queued len computation, which could theoretically be wrong if req->len[1] - req->processed[1] > 1. Be future-proof here, and fix it.
--- drivers/crypto/inside-secure/safexcel_hash.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/crypto/inside-secure/safexcel_hash.c +5 -3
@@ -50,10 +50,12 @@ struct safexcel_ahash_req {static inline u64 safexcel_queued_len (struct safexcel_ahash_req *req) { -if (req->len[1 ] > req->processed[1 ]) -return 0xffffffff - (req->len[0 ] - req->processed[0 ]); +u64 len, processed; -return req->len[0 ] - req->processed[0 ]; + len = (0xffffffff * req->len[1 ]) + req->len[0 ]; + processed = (0xffffffff * req->processed[1 ]) + req->processed[0 ]; + +return len - processed; } static void safexcel_hash_token(struct safexcel_command_desc *cdesc,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 415/639 arm64: dts: renesas: ebisu: Remove renesas, no-ether-link property
In reply to Greg Kroah-HartmanFrom: Takeshi Kihara <[email protected]>
[ Upstream commit 90d4fa39d028f2e46c57c3d0e1b759e5287d98b7 ]
It is incorrect to specify the no-ether-link property for the AVB device on the Ebisu board. This is because the property should only be used when a board does not provide a proper AVB_LINK signal. However, the Ebisu board does provide this signal.
As per 87c059e9c39d ("arm64: dts: renesas: salvator-x: Remove renesas, no-ether-link property") this fixes a bug:
Steps to reproduce:
- start AVB TX stream (Using aplay via MSE),
- disconnect+reconnect the eth cable,
- after a reconnection the eth connection goes iteratively up/down without user interaction,
- this may heal after some seconds or even stay for minutes.
As the documentation specifies, the "renesas,no-ether-link" option should be used when a board does not provide a proper AVB_LINK signal. There is no need for this option enabled on RCAR H3/M3 Salvator-X/XS and ULCB starter kits since the AVB_LINK is correctly handled by HW.
Choosing to keep or remove the "renesas,no-ether-link" option will have impact on the code flow in the following ways:
- keeping this option enabled may lead to unexpected behavior since the RX & TX are enabled/disabled directly from adjust_link function without any HW interrogation,
- removing this option, the RX & TX will only be enabled/disabled after HW interrogation. The HW check is made through the LMON pin in PSR register which specifies AVB_LINK signal value (0 - at low level; 1 - at high level).
In conclusion, the present change is also a safety improvement because it removes the "renesas,no-ether-link" option leading to a proper way of detecting the link state based on HW interrogation and not on software heuristic.
--- arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts | 1 - 1 file changed, 1 deletion(-)
arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts +0 -1
@@ -33,7 +33,6 @@ &avb { pinctrl-0 = <&avb_pins>; pinctrl-names = "default"; - renesas,no-ether-link; phy-handle = <&phy0>; phy-mode = "rgmii-txid"; status = "okay";
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 416/639 mpls: fix warning with multi-label encap
In reply to Greg Kroah-HartmanFrom: George Wilkie <[email protected]>
[ Upstream commit 2f3f7d1fa0d1039b24a55d127ed190f196fc3e79 ]
If you configure a route with multiple labels, e.g.
ip route add 10.10.3.0/24 encap mpls 16/100 via 10.10.2.2 dev ens4
A warning is logged:
kernel: [ 130.561819] netlink: 'ip': attribute type 1 has an invalid length.
This happens because mpls_iptunnel_policy has set the type of MPLS_IPTUNNEL_DST to fixed size NLA_U32.
Change it to a minimum size.nla_get_labels() does the remaining validation.
--- net/mpls/mpls_iptunnel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mpls/mpls_iptunnel.c +1 -1
@@ -28,7 +28,7 @@#include "internal.h" static const struct nla_policy mpls_iptunnel_policy[MPLS_IPTUNNEL_MAX +1 ] = { - [MPLS_IPTUNNEL_DST ] = { .type =NLA_U32 }, + [MPLS_IPTUNNEL_DST ] = { .len =sizeof (u32) }, [MPLS_IPTUNNEL_TTL ] = { .type =NLA_U8 }, };
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 417/639 serial: stm32: fix a recursive locking in stm32_config_rs485
In reply to Greg Kroah-HartmanFrom: Borut Seljak <[email protected]>
[ Upstream commit 707aeea13a9c85520262e11899d86df3c4b48262 ]
Remove spin_lock_irqsave in stm32_config_rs485, it cause recursive locking. Already locked in uart_set_rs485_config.
--- drivers/tty/serial/stm32-usart.c | 3 --- 1 file changed, 3 deletions(-)
drivers/tty/serial/stm32-usart.c +0 -3
@@ -105,9 +105,7 @@ static int stm32_config_rs485(struct uart_port *port,struct stm32_usart_config *cfg = &stm32_port->info->cfg;u32 usartdiv, baud, cr1, cr3;bool over8; -unsigned long flags; -spin_lock_irqsave (&port->lock, flags);stm32_clr_bits (port, ofs->cr1,BIT (cfg->uart_enable_bit)); port->rs485 = *rs485conf;
@@ -147,7 +145,6 @@ static int stm32_config_rs485(struct uart_port *port, }stm32_set_bits (port, ofs->cr1,BIT (cfg->uart_enable_bit)); -spin_unlock_irqrestore (&port->lock, flags);return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 418/639 arm64: dts: meson-gxm-khadas-vim2: fix gpio-keys-polled node
In reply to Greg Kroah-HartmanFrom: Christian Hewitt <[email protected]>
[ Upstream commit 0afd24c2fb61bd5163bab08ea1ee54d60d3ea37e ]
Fix DTC warnings:
meson-gxm-khadas-vim2.dtb: Warning (avoid_unnecessary_addr_size):
/gpio-keys-polled: unnecessary #address-cells/#size-cells
without "ranges" or child "reg" property
--- arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts +1 -3
@@ -63,11 +63,9 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <100>; - button@0 { + power-button { label = "power"; linux,code = <KEY_POWER>; gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_LOW>;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 419/639 arm64: dts: meson-gxm-khadas-vim2: fix Bluetooth support
In reply to Greg Kroah-HartmanFrom: Christian Hewitt <[email protected]>
[ Upstream commit 33344e2111a3a07097a66f339ad213b047ccdfd2 ]
- Remove serial1 alias
- Add support for uart_A rts/cts
- Add bluetooth uart_A subnode qith shutdown gpio
--- arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts +7 -2
@@ -18,7 +18,6 @@ aliases { serial0 = &uart_AO; - serial1 = &uart_A; serial2 = &uart_AO_B; };
@@ -407,8 +406,14 @@ /* This one is connected to the Bluetooth module */ &uart_A { status = "okay"; - pinctrl-0 = <&uart_a_pins>; + pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>; pinctrl-names = "default"; + uart-has-rtscts; + + bluetooth { + compatible = "brcm,bcm43438-bt"; + shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>; + }; }; /* This is brought out on the Linux_RX (18) and Linux_TX (19) pins: */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 420/639 iommu/vt-d: Duplicate iommu_resv_region objects per device list
In reply to Greg Kroah-HartmanFrom: Eric Auger <[email protected]>
[ Upstream commit 5f64ce5411b467f1cfea6c63e2494c22b773582b ]
intel_iommu_get_resv_regions() aims to return the list of reserved regions accessible by a given @device. However several devices can access the same reserved memory region and when building the list it is not safe to use a single iommu_resv_region object, whose container is the RMRR. This iommu_resv_region must be duplicated per device reserved region list.
Let's remove the struct iommu_resv_region from the RMRR unit and allocate the iommu_resv_region directly in intel_iommu_get_resv_regions(). We hold the dmar_global_lock instead of the rcu-lock to allow sleeping.
--- drivers/iommu/intel-iommu.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-)
drivers/iommu/intel-iommu.c +17 -17
@@ -387,7 +387,6 @@ struct dmar_rmrr_unit {u64 end_address;/* reserved end address */ struct dmar_dev_scope *devices;/* target devices */ int devices_cnt;/* target device count */ -struct iommu_resv_region *resv;/* reserved region handle */ };struct dmar_atsr_unit {
@@ -4185,7 +4184,6 @@ static inline void init_iommu_pm_ops(void) {}int __init dmar_parse_one_rmrr (struct acpi_dmar_header *header,void *arg) {struct acpi_dmar_reserved_memory *rmrr; -int prot =DMA_PTE_READ |DMA_PTE_WRITE ;struct dmar_rmrr_unit *rmrru;size_t length;
@@ -4199,22 +4197,16 @@ int __init dmar_parse_one_rmrr(struct acpi_dmar_header *header, void *arg) rmrru->end_address = rmrr->end_address; length = rmrr->end_address - rmrr->base_address +1 ; - rmrru->resv =iommu_alloc_resv_region (rmrr->base_address, length, prot, -IOMMU_RESV_DIRECT ); -if (!rmrru->resv) - goto free_rmrru; rmrru->devices =dmar_alloc_dev_scope ((void *)(rmrr +1 ), ((void *)rmrr) + rmrr->header.length, &rmrru->devices_cnt);if (rmrru->devices_cnt && rmrru->devices ==NULL ) - goto free_all; + goto free_rmrru;list_add (&rmrru->list, &dmar_rmrr_units);return 0 ; -free_all: -kfree (rmrru->resv); free_rmrru:kfree (rmrru); out:
@@ -4432,7 +4424,6 @@ static void intel_iommu_free_dmars(void)list_for_each_entry_safe (rmrru, rmrr_n, &dmar_rmrr_units, list) {list_del (&rmrru->list);dmar_free_dev_scope (&rmrru->devices, &rmrru->devices_cnt); -kfree (rmrru->resv);kfree (rmrru); }
@@ -5206,22 +5197,33 @@ static void intel_iommu_remove_device(struct device *dev)static void intel_iommu_get_resv_regions (struct device *device,struct list_head *head) { +int prot =DMA_PTE_READ |DMA_PTE_WRITE ;struct iommu_resv_region *reg;struct dmar_rmrr_unit *rmrr;struct device *i_dev;int i; -rcu_read_lock (); +down_read (&dmar_global_lock);for_each_rmrr_units (rmrr) {for_each_active_dev_scope (rmrr->devices, rmrr->devices_cnt, i, i_dev) { +struct iommu_resv_region *resv; +size_t length; +if (i_dev != device)continue ; -list_add_tail (&rmrr->resv->list, head); + length = rmrr->end_address - rmrr->base_address +1 ; + resv =iommu_alloc_resv_region (rmrr->base_address, + length, prot, +IOMMU_RESV_DIRECT ); +if (!resv) +break ; + +list_add_tail (&resv->list, head); } } -rcu_read_unlock (); +up_read (&dmar_global_lock); reg = iommu_alloc_resv_region(IOAPIC_RANGE_START, IOAPIC_RANGE_END - IOAPIC_RANGE_START + 1,
@@ -5236,10 +5238,8 @@ static void intel_iommu_put_resv_regions(struct device *dev, {struct iommu_resv_region *entry, *next; -list_for_each_entry_safe (entry, next, head, list) { -if (entry->type ==IOMMU_RESV_MSI ) -kfree (entry); - } +list_for_each_entry_safe (entry, next, head, list) +kfree (entry); }#ifdef CONFIG_INTEL_IOMMU_SVM
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 421/639 phy: usb: phy-brcm-usb: Remove sysfs attributes upon driver removal
In reply to Greg Kroah-HartmanFrom: Florian Fainelli <[email protected]>
[ Upstream commit d9e100829fca6cbd270d7e005b0c0bb2d14924b8 ]
We are not destroying the sysfs attribute groupe we registered during the probe function which will make subsequent probe calls to that driver fail. Correct that with adding a remove function which only removes those attributes since the reference counting on clocks did its job already.
--- drivers/phy/broadcom/phy-brcm-usb.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/phy/broadcom/phy-brcm-usb.c +8 -0
@@ -378,6 +378,13 @@ static int brcm_usb_phy_probe(struct platform_device *pdev)return 0 ; } +static int brcm_usb_phy_remove (struct platform_device *pdev) +{ +sysfs_remove_group (&pdev->dev.kobj, &brcm_usb_phy_group); + +return 0 ; +} +#ifdef CONFIG_PM_SLEEP static int brcm_usb_phy_suspend (struct device *dev) {
@@ -443,6 +450,7 @@ MODULE_DEVICE_TABLE(of, brcm_usb_dt_ids);static struct platform_driver brcm_usb_driver = { .probe = brcm_usb_phy_probe, + .remove = brcm_usb_phy_remove, .driver = { .name ="brcmstb-usb-phy" , .owner =THIS_MODULE ,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 422/639 firmware: arm_scmi: fix bitfield definitions for SENSOR_DESC attributes
In reply to Greg Kroah-HartmanFrom: Sudeep Holla <[email protected]>
[ Upstream commit 430daaf96ad133be5ce7c3a5c60e94247f7c6f71 ]
As per the SCMI specification the bitfields for SENSOR_DESC attributes are as follows:attributes_low [7:0] Number of trip points supportedattributes_high [15:11] The power-of-10 multiplier in 2's-complement
format that is applied to the sensor units
Looks like the code developed during the draft versions of the specification slipped through and are wrong with respect to final released version. Fix them by adjusting the bitfields appropriately.
--- drivers/firmware/arm_scmi/sensors.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/firmware/arm_scmi/sensors.c +2 -2
@@ -30,10 +30,10 @@ struct scmi_msg_resp_sensor_description {__le32 id;__le32 attributes_low;#define SUPPORTS_ASYNC_READ (x) ((x) & BIT(31)) -#define NUM_TRIP_POINTS (x) (((x) >> 4) & 0xff) +#define NUM_TRIP_POINTS (x) ((x) & 0xff)__le32 attributes_high;#define SENSOR_TYPE (x) ((x) & 0xff) -#define SENSOR_SCALE (x) (((x) >> 11) & 0x3f) +#define SENSOR_SCALE (x) (((x) >> 11) & 0x1f)#define SENSOR_UPDATE_SCALE (x) (((x) >> 22) & 0x1f)#define SENSOR_UPDATE_BASE (x) (((x) >> 27) & 0x1f)u8 name[SCMI_MAX_STR_SIZE ];
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 423/639 firmware: arm_scmi: update rate_discrete in clock_describe_rates_get
In reply to Greg Kroah-HartmanFrom: Peng Fan <[email protected]>
[ Upstream commit c0759b9b5d411ab27c479125cee9bae391a96436 ]
The boolean rate_discrete needs to be assigned to clk->rate_discrete, so that clock driver can distinguish between the continuous range and discrete rates. It uses this in scmi_clk_round_rate could get the rounded value if it's a continuous range.
--- drivers/firmware/arm_scmi/clock.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/firmware/arm_scmi/clock.c +2 -0
@@ -185,6 +185,8 @@ scmi_clock_describe_rates_get(const struct scmi_handle *handle, u32 clk_id,if (rate_discrete) clk->list.num_rates = tot_rate_cnt; + clk->rate_discrete = rate_discrete; + err:scmi_xfer_put (handle, t);return ret;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 424/639 ntb_hw_switchtec: potential shift wrapping bug in switchtec_ntb_init_sndev()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit ff148d8ac53e59802645bd3200c811620317eb9f ]
This code triggers a Smatch warning:
drivers/ntb/hw/mscc/ntb_hw_switchtec.c:884 switchtec_ntb_init_sndev()
warn: should '(1 << sndev->peer_partition)' be a 64 bit type?The "part_map" and "tpart_vec" variables are u64 type so this seems like a valid warning.
--- drivers/ntb/hw/mscc/ntb_hw_switchtec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ntb/hw/mscc/ntb_hw_switchtec.c +1 -1
@@ -899,7 +899,7 @@ static int switchtec_ntb_init_sndev(struct switchtec_ntb *sndev) } sndev->peer_partition =ffs (tpart_vec) -1 ; -if (!(part_map & (1 << sndev->peer_partition))) { +if (!(part_map & (1ULL << sndev->peer_partition))) {dev_err (&sndev->stdev->dev,"ntb target partition is not NT partition\n" );return -ENODEV ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 425/639 ASoC: meson: axg-tdmin: right_j is not supported
In reply to Greg Kroah-HartmanFrom: Jerome Brunet <[email protected]>
[ Upstream commit 47c317b786b6c1efc2cb3cdb894fd323422fe5ea ]
Right justified format is actually not supported by the amlogic tdm input decoder.
--- sound/soc/meson/axg-tdmin.c | 1 - 1 file changed, 1 deletion(-)
sound/soc/meson/axg-tdmin.c +0 -1
@@ -119,7 +119,6 @@ static int axg_tdmin_prepare(struct regmap *map, struct axg_tdm_stream *ts)break ;case SND_SOC_DAIFMT_LEFT_J : -case SND_SOC_DAIFMT_RIGHT_J :case SND_SOC_DAIFMT_DSP_B : val =TDMIN_CTRL_IN_BIT_SKEW (2 );break ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 426/639 ASoC: meson: axg-tdmout: right_j is not supported
In reply to Greg Kroah-HartmanFrom: Jerome Brunet <[email protected]>
[ Upstream commit 7e0d7d0fbd06af0507611f85dba8daf24832abd9 ]
Right justified format is actually not supported by the amlogic tdm output encoder.
--- sound/soc/meson/axg-tdmout.c | 1 - 1 file changed, 1 deletion(-)
sound/soc/meson/axg-tdmout.c +0 -1
@@ -136,7 +136,6 @@ static int axg_tdmout_prepare(struct regmap *map, struct axg_tdm_stream *ts)break ;case SND_SOC_DAIFMT_LEFT_J : -case SND_SOC_DAIFMT_RIGHT_J :case SND_SOC_DAIFMT_DSP_B : val |=TDMOUT_CTRL0_INIT_BITNUM (2 );break ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 427/639 PCI: PM: Skip devices in D0 for suspend-to-idle
In reply to Greg Kroah-HartmanFrom: Rafael J. Wysocki <[email protected]>
[ Upstream commit 3e26c5feed2add218046ecf91bab3cfa9bf762a6 ]
Commit d491f2b75237 ("PCI: PM: Avoid possible suspend-to-idle issue") attempted to avoid a problem with devices whose drivers want them to stay in D0 over suspend-to-idle and resume, but it did not go as far as it should with that.
Namely, first of all, the power state of a PCI bridge with a downstream device in D0 must be D0 (based on the PCI PM spec r1.2, sec 6, table 6-1, if the bridge is not in D0, there can be no PCI transactions on its secondary bus), but that is not actively enforced during system-wide PM transitions, so use the skip_bus_pm flag introduced by commit d491f2b75237 for that.
Second, the configuration of devices left in D0 (whatever the reason) during suspend-to-idle need not be changed and attempting to put them into D0 again by force is pointless, so explicitly avoid doing that.
--- drivers/pci/pci-driver.c | 47 ++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 12 deletions(-)
drivers/pci/pci-driver.c +35 -12
@@ -526,7 +526,6 @@ static void pci_pm_default_resume_early(struct pci_dev *pci_dev)pci_power_up (pci_dev);pci_restore_state (pci_dev);pci_pme_restore (pci_dev); -pci_fixup_device (pci_fixup_resume_early, pci_dev); }/*
@@ -833,18 +832,16 @@ static int pci_pm_suspend_noirq(struct device *dev)if (pci_dev->skip_bus_pm) {/* -* The function is running for the second time in a row without +* Either the device is a bridge with a child in D0 below it, or +* the function is running for the second time in a row without * going through full resume, which is possible only during -* suspend-to-idle in a spurious wakeup case. Moreover, the -* device was originally left in D0, so its power state should -* not be changed here and the device register values saved -* originally should be restored on resume again. +* suspend-to-idle in a spurious wakeup case. The device should +* be in D0 at this point, but if it is a bridge, it may be +* necessary to save its state. */ - pci_dev->state_saved = true; - }else if (pci_dev->state_saved) { -if (pci_dev->current_state ==PCI_D0 ) - pci_dev->skip_bus_pm = true; - }else { +if (!pci_dev->state_saved) +pci_save_state (pci_dev); + }else if (!pci_dev->state_saved) {pci_save_state (pci_dev);if (pci_power_manageable (pci_dev))pci_prepare_to_sleep (pci_dev);
@@ -853,6 +850,22 @@ static int pci_pm_suspend_noirq(struct device *dev)dev_dbg (dev,"PCI PM: Suspend power state: %s\n" ,pci_power_name (pci_dev->current_state)); +if (pci_dev->current_state ==PCI_D0 ) { + pci_dev->skip_bus_pm = true; +/* +* Per PCI PM r1.2, table 6-1, a bridge must be in D0 if any +* downstream device is in D0, so avoid changing the power state +* of the parent bridge by setting the skip_bus_pm flag for it. +*/ +if (pci_dev->bus->self) + pci_dev->bus->self->skip_bus_pm = true; + } + +if (pci_dev->skip_bus_pm && !pm_suspend_via_firmware ()) { +dev_dbg (dev,"PCI PM: Skipped\n" ); + goto Fixup; + } +pci_pm_set_unknown_state (pci_dev);/*
@@ -900,7 +913,16 @@ static int pci_pm_resume_noirq(struct device *dev)if (dev_pm_smart_suspend_and_suspended (dev))pm_runtime_set_active (dev); -pci_pm_default_resume_early (pci_dev); +/* +* In the suspend-to-idle case, devices left in D0 during suspend will +* stay in D0, so it is not necessary to restore or update their +* configuration here and attempting to put them into D0 again may +* confuse some firmware, so avoid doing that. +*/ +if (!pci_dev->skip_bus_pm ||pm_suspend_via_firmware ()) +pci_pm_default_resume_early (pci_dev); + +pci_fixup_device (pci_fixup_resume_early, pci_dev);if (pci_has_legacy_pm_support (pci_dev))return pci_legacy_resume_early (dev);
@@ -1201,6 +1223,7 @@ static int pci_pm_restore_noirq(struct device *dev) }pci_pm_default_resume_early (pci_dev); +pci_fixup_device (pci_fixup_resume_early, pci_dev);if (pci_has_legacy_pm_support (pci_dev))return pci_legacy_resume_early (dev);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 428/639 qed: iWARP - Use READ_ONCE and smp_store_release to access ep->state
In reply to Greg Kroah-HartmanFrom: Michal Kalderon <[email protected]>
[ Upstream commit 6117561e1bb30b2fe7f51e1961f34dbedd0bec8a ]
Destroy QP waits for it's ep object state to be set to CLOSED before proceeding. ep->state can be updated from a different context. Add smp_store_release/READ_ONCE to synchronize.
--- drivers/net/ethernet/qlogic/qed/qed_iwarp.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/net/ethernet/qlogic/qed/qed_iwarp.c +11 -5
@@ -532,7 +532,8 @@ int qed_iwarp_destroy_qp(struct qed_hwfn *p_hwfn, struct qed_rdma_qp *qp)/* Make sure ep is closed before returning and freeing memory. */ if (ep) { -while (ep->state !=QED_IWARP_EP_CLOSED && wait_count++ <200 ) +while (READ_ONCE (ep->state) !=QED_IWARP_EP_CLOSED && + wait_count++ <200 )msleep (100 );if (ep->state !=QED_IWARP_EP_CLOSED )
@@ -1023,8 +1024,6 @@ qed_iwarp_mpa_complete(struct qed_hwfn *p_hwfn, params.ep_context = ep; - ep->state =QED_IWARP_EP_CLOSED ; -switch (fw_return_code) {case RDMA_RETURN_OK : ep->qp->max_rd_atomic_req = ep->cm_info.ord;
@@ -1084,6 +1083,10 @@ qed_iwarp_mpa_complete(struct qed_hwfn *p_hwfn,break ; } +if (fw_return_code !=RDMA_RETURN_OK ) +/* paired with READ_ONCE in destroy_qp */ +smp_store_release (&ep->state,QED_IWARP_EP_CLOSED ); + ep->event_cb (ep->cb_context, ¶ms);/* on passive side, if there is no associated QP (REJECT) we need to
@@ -2828,7 +2831,9 @@ static void qed_iwarp_qp_in_error(struct qed_hwfn *p_hwfn, params.status = (fw_return_code ==IWARP_QP_IN_ERROR_GOOD_CLOSE ) ?0 : -ECONNRESET ; - ep->state =QED_IWARP_EP_CLOSED ; +/* paired with READ_ONCE in destroy_qp */ +smp_store_release (&ep->state,QED_IWARP_EP_CLOSED ); +spin_lock_bh (&p_hwfn->p_rdma_info->iwarp.iw_lock);list_del (&ep->list_entry);spin_unlock_bh (&p_hwfn->p_rdma_info->iwarp.iw_lock);
@@ -2917,7 +2922,8 @@ qed_iwarp_tcp_connect_unsuccessful(struct qed_hwfn *p_hwfn, params.event =QED_IWARP_EVENT_ACTIVE_COMPLETE ; params.ep_context = ep; params.cm_info = &ep->cm_info; - ep->state =QED_IWARP_EP_CLOSED ; +/* paired with READ_ONCE in destroy_qp */ +smp_store_release (&ep->state,QED_IWARP_EP_CLOSED );switch (fw_return_code) {case IWARP_CONN_ERROR_TCP_CONNECT_INVALID_PACKET :
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 429/639 qed: iWARP - fix uninitialized callback
In reply to Greg Kroah-HartmanFrom: Michal Kalderon <[email protected]>
[ Upstream commit 43cf40d93fadbb0d3edf0942a4612f8ff67478a1 ]
Fix uninitialized variable warning by static checker.
--- drivers/net/ethernet/qlogic/qed/qed_iwarp.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/qlogic/qed/qed_iwarp.c +1 -0
@@ -2641,6 +2641,7 @@ qed_iwarp_ll2_start(struct qed_hwfn *p_hwfn, cbs.rx_release_cb = qed_iwarp_ll2_rel_rx_pkt; cbs.tx_comp_cb = qed_iwarp_ll2_comp_tx_pkt; cbs.tx_release_cb = qed_iwarp_ll2_rel_tx_pkt; + cbs.slowpath_cb =NULL ; cbs.cookie = p_hwfn;memset (&data,0 ,sizeof (data));
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 430/639 powerpc/cacheinfo: add cacheinfo_teardown, cacheinfo_rebuild
In reply to Greg Kroah-HartmanFrom: Nathan Lynch <[email protected]>
[ Upstream commit d4aa219a074a5abaf95a756b9f0d190b5c03a945 ]
Allow external callers to force the cacheinfo code to release all its references to cache nodes, e.g. before processing device tree updates post-migration, and to rebuild the hierarchy afterward.
CPU online/offline must be blocked by callers; enforce this.
--- arch/powerpc/kernel/cacheinfo.c | 21 +++++++++++++++++++++ arch/powerpc/kernel/cacheinfo.h | 4 ++++ 2 files changed, 25 insertions(+)
arch/powerpc/kernel/cacheinfo.c +21 -0
@@ -865,4 +865,25 @@ void cacheinfo_cpu_offline(unsigned int cpu_id)if (cache) cache_cpu_clear(cache, cpu_id); } + +void cacheinfo_teardown (void ) +{ +unsigned int cpu; + +lockdep_assert_cpus_held (); + +for_each_online_cpu (cpu) +cacheinfo_cpu_offline (cpu); +} + +void cacheinfo_rebuild (void ) +{ +unsigned int cpu; + +lockdep_assert_cpus_held (); + +for_each_online_cpu (cpu) +cacheinfo_cpu_online (cpu); +} +#endif /* (CONFIG_PPC_PSERIES && CONFIG_SUSPEND) || CONFIG_HOTPLUG_CPU */
arch/powerpc/kernel/cacheinfo.h +4 -0
@@ -6,4 +6,8 @@extern void cacheinfo_cpu_online (unsigned int cpu_id);extern void cacheinfo_cpu_offline (unsigned int cpu_id); +/* Allow migration/suspend to tear down and rebuild the hierarchy. */ +extern void cacheinfo_teardown (void ); +extern void cacheinfo_rebuild (void ); +#endif /* _PPC_CACHEINFO_H */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 431/639 powerpc/pseries/mobility: rebuild cacheinfo hierarchy post-migration
In reply to Greg Kroah-HartmanFrom: Nathan Lynch <[email protected]>
[ Upstream commit e610a466d16a086e321f0bd421e2fc75cff28605 ]
It's common for the platform to replace the cache device nodes after a migration. Since the cacheinfo code is never informed about this, it never drops its references to the source system's cache nodes, causing it to wind up in an inconsistent state resulting in warnings and oopses as soon as CPU online/offline occurs after the migration, e.g.
cache for /cpus/l3-cache@3113(Unified) refers to cache for /cpus/l2-cache@200d(Unified)
WARNING: CPU: 15 PID: 86 at arch/powerpc/kernel/cacheinfo.c:176 release_cache+0x1bc/0x1d0
[...]
NIP release_cache+0x1bc/0x1d0
LR release_cache+0x1b8/0x1d0
Call Trace:
release_cache+0x1b8/0x1d0 (unreliable)
cacheinfo_cpu_offline+0x1c4/0x2c0
unregister_cpu_online+0x1b8/0x260
cpuhp_invoke_callback+0x114/0xf40
cpuhp_thread_fun+0x270/0x310
smpboot_thread_fn+0x2c8/0x390
kthread+0x1b8/0x1c0
ret_from_kernel_thread+0x5c/0x68Using device tree notifiers won't work since we want to rebuild the hierarchy only after all the removals and additions have occurred and the device tree is in a consistent state. Call cacheinfo_teardown() before processing device tree updates, and rebuild the hierarchy afterward.
--- arch/powerpc/platforms/pseries/mobility.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/powerpc/platforms/pseries/mobility.c +10 -0
@@ -24,6 +24,7 @@#include <asm/machdep.h> #include <asm/rtas.h> #include "pseries.h" +#include "../../kernel/cacheinfo.h" static struct kobject *mobility_kobj;
@@ -360,11 +361,20 @@ void post_mobility_fixup(void)*/ cpus_read_lock (); +/* +* It's common for the destination firmware to replace cache +* nodes. Release all of the cacheinfo hierarchy's references +* before updating the device tree. +*/ +cacheinfo_teardown (); + rc =pseries_devicetree_update (MIGRATION_SCOPE );if (rc)printk (KERN_ERR "Post-mobility device tree update " "failed: %d\n" , rc); +cacheinfo_rebuild (); +cpus_read_unlock ();/* Possibly switch to a new RFI flush type */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 432/639 bpf: fix the check that forwarding is enabled in bpf_ipv6_fib_lookup
In reply to Greg Kroah-HartmanFrom: Anton Protopopov <[email protected]>
[ Upstream commit 56f0f84e69c7a7f229dfa524b13b0ceb6ce9b09e ]
The bpf_ipv6_fib_lookup function should return BPF_FIB_LKUP_RET_FWD_DISABLED when forwarding is disabled for the input device. However instead of checking if forwarding is enabled on the input device, it checked the global net->ipv6.devconf_all->forwarding flag. Change it to behave as expected.
--- net/core/filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/filter.c +1 -1
@@ -4367,7 +4367,7 @@ static int bpf_ipv6_fib_lookup(struct net *net, struct bpf_fib_lookup *params,return -ENODEV ; idev =__in6_dev_get_safely (dev); -if (unlikely (!idev || !net->ipv6.devconf_all->forwarding)) +if (unlikely (!idev || !idev->cnf.forwarding))return BPF_FIB_LKUP_RET_FWD_DISABLED ;if (flags &BPF_FIB_LOOKUP_OUTPUT ) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 433/639 IB/hfi1: Handle port down properly in pio
In reply to Greg Kroah-HartmanFrom: Mike Marciniszyn <[email protected]>
[ Upstream commit 942a899335707fc9cfc97cb382a60734b2ff4e03 ]
The call to sc_buffer_alloc currently returns NULL (no buffer) or a buffer descriptor.
There is a third case when the port is down. Currently that returns NULL and this prevents the caller from properly handling the sc_buffer_alloc() failure. A verbs code link test after the call is racy so the indication needs to come from the state check inside the allocation routine to be valid.
Fix by encoding the ECOMM failure like SDMA. IS_ERR_OR_NULL() tests
are added at all call sites. For verbs send, this needs to treat any error by returning a completion without any MMIO copy.
--- drivers/infiniband/hw/hfi1/pio.c | 5 +++-- drivers/infiniband/hw/hfi1/rc.c | 2 +- drivers/infiniband/hw/hfi1/ud.c | 4 ++-- drivers/infiniband/hw/hfi1/verbs.c | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-)
drivers/infiniband/hw/hfi1/pio.c +3 -2
@@ -1434,7 +1434,8 @@ void sc_stop(struct send_context *sc, int flag)* @cb: optional callback to call when the buffer is finished sending * @arg: argument for cb * -* Return a pointer to a PIO buffer if successful, NULL if not enough room. +* Return a pointer to a PIO buffer, NULL if not enough room, -ECOMM +* when link is down. */ struct pio_buf *sc_buffer_alloc (struct send_context *sc,u32 dw_len,pio_release_cb cb,void *arg)
@@ -1450,7 +1451,7 @@ struct pio_buf *sc_buffer_alloc(struct send_context *sc, u32 dw_len,spin_lock_irqsave (&sc->alloc_lock, flags);if (!(sc->flags &SCF_ENABLED )) {spin_unlock_irqrestore (&sc->alloc_lock, flags); - goto done; +return ERR_PTR (-ECOMM ); } retry:
drivers/infiniband/hw/hfi1/rc.c +1 -1
@@ -914,7 +914,7 @@ void hfi1_send_rc_ack(struct hfi1_packet *packet, bool is_fecn) pbc =create_pbc (ppd, pbc_flags, qp->srate_mbps,sc_to_vlt (ppd->dd, sc5), plen); pbuf =sc_buffer_alloc (rcd->sc, plen,NULL ,NULL ); -if (!pbuf) { +if (IS_ERR_OR_NULL (pbuf)) {/* * We have no room to send at the moment. Pass * responsibility for sending the ACK to the send engine
drivers/infiniband/hw/hfi1/ud.c +2 -2
@@ -703,7 +703,7 @@ void return_cnp_16B(struct hfi1_ibport *ibp, struct rvt_qp *qp, pbc =create_pbc (ppd, pbc_flags, qp->srate_mbps, vl, plen);if (ctxt) { pbuf =sc_buffer_alloc (ctxt, plen,NULL ,NULL ); -if (pbuf) { +if (!IS_ERR_OR_NULL (pbuf)) {trace_pio_output_ibhdr (ppd->dd, &hdr, sc5); ppd->dd->pio_inline_send (ppd->dd, pbuf, pbc, &hdr, hwords);
@@ -758,7 +758,7 @@ void return_cnp(struct hfi1_ibport *ibp, struct rvt_qp *qp, u32 remote_qpn, pbc =create_pbc (ppd, pbc_flags, qp->srate_mbps, vl, plen);if (ctxt) { pbuf =sc_buffer_alloc (ctxt, plen,NULL ,NULL ); -if (pbuf) { +if (!IS_ERR_OR_NULL (pbuf)) {trace_pio_output_ibhdr (ppd->dd, &hdr, sc5); ppd->dd->pio_inline_send (ppd->dd, pbuf, pbc, &hdr, hwords);
drivers/infiniband/hw/hfi1/verbs.c +2 -2
@@ -1096,10 +1096,10 @@ int hfi1_verbs_send_pio(struct rvt_qp *qp, struct hfi1_pkt_state *ps,if (cb)iowait_pio_inc (&priv->s_iowait); pbuf =sc_buffer_alloc (sc, plen, cb, qp); -if (unlikely (!pbuf)) { +if (unlikely (IS_ERR_OR_NULL (pbuf))) {if (cb)verbs_pio_complete (qp,0 ); -if (ppd->host_link_state !=HLS_UP_ACTIVE ) { +if (IS_ERR (pbuf)) {/* * If we have filled the PIO buffers to capacity and are * not in an active state this request is not going to
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 434/639 drm/msm/mdp5: Fix mdp5_cfg_init error return
In reply to Greg Kroah-HartmanFrom: Jeffrey Hugo <[email protected]>
[ Upstream commit fc19cbb785d7bbd1a1af26229b5240a3ab332744 ]
If mdp5_cfg_init fails because of an unknown major version, a null pointer dereference occurs. This is because the caller of init expects error pointers, but init returns NULL on error. Fix this by returning the expected values on error.
--- drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c +1 -1
@@ -635,7 +635,7 @@ fail:if (cfg_handler)mdp5_cfg_destroy (cfg_handler); -return NULL ; +return ERR_PTR (ret); }static struct mdp5_cfg_platform *mdp5_get_config (struct platform_device *dev)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 435/639 net: netem: fix backlog accounting for corrupted GSO frames
In reply to Greg Kroah-HartmanFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 177b8007463c4f36c9a2c7ce7aa9875a4cad9bd5 ]
When GSO frame has to be corrupted netem uses skb_gso_segment() to produce the list of frames, and re-enqueues the segments one by one. The backlog length has to be adjusted to account for new frames.
The current calculation is incorrect, leading to wrong backlog lengths in the parent qdisc (both bytes and packets), and incorrect packet backlog count in netem itself.
Parent backlog goes negative, netem's packet backlog counts all non-first segments twice (thus remaining non-zero even after qdisc is emptied).
Move the variables used to count the adjustment into local scope to make 100% sure they aren't used at any stage in backports.
--- net/sched/sch_netem.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
net/sched/sch_netem.c +8 -5
@@ -436,8 +436,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch,struct netem_skb_cb *cb;struct sk_buff *skb2;struct sk_buff *segs =NULL ; -unsigned int len =0 , last_len, prev_len =qdisc_pkt_len (skb); -int nb =0 ; +unsigned int prev_len =qdisc_pkt_len (skb);int count =1 ;int rc =NET_XMIT_SUCCESS ;int rc_drop =NET_XMIT_DROP ;
@@ -494,6 +493,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch, segs =netem_segment (skb, sch, to_free);if (!segs)return rc_drop; +qdisc_skb_cb (segs)->pkt_len = segs->len; }else { segs = skb; }
@@ -583,6 +583,11 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch, finish_segs:if (segs) { +unsigned int len, last_len; +int nb =0 ; + + len = skb->len; +while (segs) { skb2 = segs->next; segs->next =NULL ;
@@ -598,9 +603,7 @@ finish_segs: } segs = skb2; } - sch->q.qlen += nb; -if (nb >1 ) -qdisc_tree_reduce_backlog (sch,1 - nb, prev_len - len); +qdisc_tree_reduce_backlog (sch, -nb, prev_len - len); }return NET_XMIT_SUCCESS ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 436/639 net/udp_gso: Allow TX timestamp with UDP GSO
In reply to Greg Kroah-HartmanFrom: Fred Klassen <[email protected]>
[ Upstream commit 76e21533a48bb42d1fa894f93f6233bf4554f45e ]
Fixes an issue where TX Timestamps are not arriving on the error queue when UDP_SEGMENT CMSG type is combined with CMSG type SO_TIMESTAMPING. This can be illustrated with an updated updgso_bench_tx program which includes the '-T' option to test for this condition. It also introduces the '-P' option which will call poll() before reading the error queue.
./udpgso_bench_tx -4ucTPv -S 1472 -l2 -D 172.16.120.18 poll timeout
udp tx: 0 MB/s 1 calls/s 1 msg/s
The "poll timeout" message above indicates that TX timestamp never arrived.
This patch preserves tx_flags for the first UDP GSO segment. Only the first segment is timestamped, even though in some cases there may be benefital in timestamping both the first and last segment.
Factors in deciding on first segment timestamp only:
- Timestamping both first and last segmented is not feasible. Hardware can only have one outstanding TS request at a time.
- Timestamping last segment may under report network latency of the previous segments. Even though the doorbell is suppressed, the ring producer counter has been incremented.
- Timestamping the first segment has the upside in that it reports timestamps from the application's view, e.g. RTT.
- Timestamping the first segment has the downside that it may underreport tx host network latency. It appears that we have to pick one or the other. And possibly follow-up with a config flag to choose behavior.
v2: Remove tests as noted by Willem de Bruijn <[email protected]>
Moving tests from net to net-next
v3: Update only relevant tx_flag bits as per
Willem de Bruijn <[email protected]>
v4: Update comments and commit message as per
Willem de Bruijn <[email protected]>
--- net/ipv4/udp_offload.c | 5 +++++ 1 file changed, 5 insertions(+)
net/ipv4/udp_offload.c +5 -0
@@ -227,6 +227,11 @@ struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb, seg = segs; uh =udp_hdr (seg); +/* preserve TX timestamp flags and TS key for first segment */ +skb_shinfo (seg)->tskey =skb_shinfo (gso_skb)->tskey; +skb_shinfo (seg)->tx_flags |= + (skb_shinfo (gso_skb)->tx_flags &SKBTX_ANY_TSTAMP ); +/* compute checksum adjustment based on old length versus new */ newlen =htons (sizeof (*uh) + mss); check =csum16_add (csum16_sub (uh->check, uh->len), newlen);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 437/639 net/af_iucv: build proper skbs for HiperTransport
In reply to Greg Kroah-HartmanFrom: Julian Wiedmann <[email protected]>
[ Upstream commit 238965b71b968dc5b3c0fe430e946f488322c4b5 ]
The HiperSockets-based transport path in af_iucv is still too closely entangled with qeth.
With commit a647a02512ca ("s390/qeth: speed-up L3 IQD xmit"), the relevant xmit code in qeth has begun to use skb_cow_head(). So to avoid unnecessary skb head expansions, af_iucv must learn to
1) respect dev->needed_headroom when allocating skbs, and
2) drop the header reference before cloning the skb.
While at it, also stop hard-coding the LL-header creation stage and just use the appropriate helper.
--- net/iucv/af_iucv.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
net/iucv/af_iucv.c +11 -2
@@ -13,6 +13,7 @@#define pr_fmt (fmt) KMSG_COMPONENT ": " fmt#include <linux/module.h> +#include <linux/netdevice.h> #include <linux/types.h> #include <linux/list.h> #include <linux/errno.h>
@@ -355,6 +356,9 @@ static int afiucv_hs_send(struct iucv_message *imsg, struct sock *sock, err = -ENODEV ; goto err_free; } + +dev_hard_header (skb, skb->dev,ETH_P_AF_IUCV ,NULL ,NULL , skb->len); +if (!(skb->dev->flags &IFF_UP ) || !netif_carrier_ok (skb->dev)) { err = -ENETDOWN ; goto err_free;
@@ -367,6 +371,8 @@ static int afiucv_hs_send(struct iucv_message *imsg, struct sock *sock,skb_trim (skb, skb->dev->mtu); } skb->protocol =cpu_to_be16 (ETH_P_AF_IUCV ); + +__skb_header_release (skb); nskb =skb_clone (skb,GFP_ATOMIC );if (!nskb) { err = -ENOMEM ;
@@ -466,12 +472,14 @@ static void iucv_sever_path(struct sock *sk, int with_user_data)/* Send controlling flags through an IUCV socket for HIPER transport */ static int iucv_send_ctrl (struct sock *sk,u8 flags) { +struct iucv_sock *iucv =iucv_sk (sk);int err =0 ;int blen;struct sk_buff *skb;u8 shutdown =0 ; - blen =sizeof (struct af_iucv_trans_hdr ) +ETH_HLEN ; + blen =sizeof (struct af_iucv_trans_hdr ) + +LL_RESERVED_SPACE (iucv->hs_dev);if (sk->sk_shutdown &SEND_SHUTDOWN ) {/* controlling flags should be sent anyway */ shutdown = sk->sk_shutdown;
@@ -1131,7 +1139,8 @@ static int iucv_sock_sendmsg(struct socket *sock, struct msghdr *msg,* segmented records using the MSG_EOR flag), but * for SOCK_STREAM we might want to improve it in future */ if (iucv->transport ==AF_IUCV_TRANS_HIPER ) { - headroom =sizeof (struct af_iucv_trans_hdr ) +ETH_HLEN ; + headroom =sizeof (struct af_iucv_trans_hdr ) + +LL_RESERVED_SPACE (iucv->hs_dev); linear = len; }else {if (len <PAGE_SIZE ) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 438/639 net/af_iucv: always register net_device notifier
In reply to Greg Kroah-HartmanFrom: Julian Wiedmann <[email protected]>
[ Upstream commit 06996c1d4088a0d5f3e7789d7f96b4653cc947cc ]
Even when running as VM guest (ie pr_iucv != NULL), af_iucv can still open HiperTransport-based connections. For robust operation these connections require the af_iucv_netdev_notifier, so register it unconditionally.
Also handle any error that register_netdevice_notifier() returns.
--- net/iucv/af_iucv.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-)
net/iucv/af_iucv.c +20 -7
@@ -2465,6 +2465,13 @@ out:return err; } +static void afiucv_iucv_exit (void ) +{ +device_unregister (af_iucv_dev); +driver_unregister (&af_iucv_driver); + pr_iucv->iucv_unregister (&af_iucv_handler,0 ); +} +static int __init afiucv_init (void ) {int err;
@@ -2498,11 +2505,18 @@ static int __init afiucv_init(void) err =afiucv_iucv_init ();if (err) goto out_sock; - }else -register_netdevice_notifier (&afiucv_netdev_notifier); + } + + err =register_netdevice_notifier (&afiucv_netdev_notifier); +if (err) + goto out_notifier; +dev_add_pack (&iucv_packet_type);return 0 ; +out_notifier: +if (pr_iucv) +afiucv_iucv_exit (); out_sock:sock_unregister (PF_IUCV ); out_proto:
@@ -2516,12 +2530,11 @@ out: static void __exit afiucv_exit(void) {if (pr_iucv) { -device_unregister (af_iucv_dev); -driver_unregister (&af_iucv_driver); - pr_iucv->iucv_unregister (&af_iucv_handler,0 ); +afiucv_iucv_exit ();symbol_put (iucv_if); - }else -unregister_netdevice_notifier (&afiucv_netdev_notifier); + } + +unregister_netdevice_notifier (&afiucv_netdev_notifier);dev_remove_pack (&iucv_packet_type);sock_unregister (PF_IUCV );proto_unregister (&iucv_proto);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 439/639 ASoC: ti: davinci-mcasp: Fix slot mask settings when using multiple AXRs
In reply to Greg Kroah-HartmanFrom: Peter Ujfalusi <[email protected]>
[ Upstream commit fd14f4436fd47d5418023c90e933e66d3645552e ]
If multiple serializers are connected in the system and the number of channels will need to use more than one serializer the mask to enable the serializers were left to 0 if tdm_mask is provided
--- sound/soc/davinci/davinci-mcasp.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
sound/soc/davinci/davinci-mcasp.c +6 -7
@@ -874,14 +874,13 @@ static int mcasp_i2s_hw_param(struct davinci_mcasp *mcasp, int stream, active_slots =hweight32 (mcasp->tdm_mask[stream]); active_serializers = (channels + active_slots -1 ) / active_slots; -if (active_serializers ==1 ) { +if (active_serializers ==1 ) active_slots = channels; -for (i =0 ; i < total_slots; i++) { -if ((1 << i) & mcasp->tdm_mask[stream]) { - mask |= (1 << i); -if (--active_slots <=0 ) -break ; - } +for (i =0 ; i < total_slots; i++) { +if ((1 << i) & mcasp->tdm_mask[stream]) { + mask |= (1 << i); +if (--active_slots <=0 ) +break ; } } }else {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 440/639 rtc: pcf8563: Fix interrupt trigger method
In reply to Greg Kroah-HartmanFrom: Chen-Yu Tsai <[email protected]>
[ Upstream commit 65f662cbf829834fa4d94190eb7691e5a9cb92d8 ]
The PCF8563 datasheet says the interrupt line is active low and stays active until the events are cleared, i.e. a level trigger interrupt.
Fix the flags used to request the interrupt.
--- drivers/rtc/rtc-pcf8563.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-pcf8563.c +1 -1
@@ -605,7 +605,7 @@ static int pcf8563_probe(struct i2c_client *client,if (client->irq >0 ) { err =devm_request_threaded_irq (&client->dev, client->irq,NULL , pcf8563_irq, -IRQF_SHARED |IRQF_ONESHOT |IRQF_TRIGGER_FALLING , +IRQF_SHARED |IRQF_ONESHOT |IRQF_TRIGGER_LOW , pcf8563_driver.driver.name, client);if (err) { dev_err(&client->dev, "unable to request IRQ %d\n",
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 441/639 rtc: pcf8563: Clear event flags and disable interrupts before requesting irq
In reply to Greg Kroah-HartmanFrom: Chen-Yu Tsai <[email protected]>
[ Upstream commit 3572e8aea3bf925dac1dbf86127657c39fe5c254 ]
Besides the alarm, the PCF8563 also has a timer triggered interrupt. In cases where the previous system left the timer and interrupts on, or somehow the bits got enabled, the interrupt would keep triggering as the kernel doesn't know about it.
Clear both the alarm and timer event flags, and disable the interrupts, before requesting the interrupt line.
--- drivers/rtc/rtc-pcf8563.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/rtc/rtc-pcf8563.c +5 -6
@@ -563,7 +563,6 @@ static int pcf8563_probe(struct i2c_client *client,struct pcf8563 *pcf8563;int err;unsigned char buf; -unsigned char alm_pending;dev_dbg (&client->dev,"%s\n" , __func__);
@@ -587,13 +586,13 @@ static int pcf8563_probe(struct i2c_client *client,return err; } - err =pcf8563_get_alarm_mode (client,NULL , &alm_pending); -if (err) { -dev_err (&client->dev,"%s: read error\n" , __func__); +/* Clear flags and disable interrupts */ + buf =0 ; + err =pcf8563_write_block_data (client,PCF8563_REG_ST2 ,1 , &buf); +if (err <0 ) { +dev_err (&client->dev,"%s: write error\n" , __func__);return err; } -if (alm_pending) -pcf8563_set_alarm_mode (client,0 ); pcf8563->rtc = devm_rtc_device_register(&client->dev, pcf8563_driver.driver.name,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 442/639 ARM: dts: iwg20d-q7-common: Fix SDHI1 VccQ regularor
In reply to Greg Kroah-HartmanFrom: Fabrizio Castro <[email protected]>
[ Upstream commit d211650a87edc7f4130651c0ccbc0a4583fd72d3 ]
SDR50 isn't working anymore because the GPIO regulator driver is using descriptors since
commit d6cd33ad7102 ("regulator: gpio: Convert to use descriptors") which in turn causes the system to use the polarity of the GPIOs (as specified in the DT) for selecting the states, but the polarity specified in the DT is wrong.
This patch fixes the regulator DT definition, and that fixes SDR50.
--- arch/arm/boot/dts/iwg20d-q7-common.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/iwg20d-q7-common.dtsi +1 -1
@@ -87,7 +87,7 @@ regulator-min-microvolt = <1800000>; regulator-max-microvolt = <3300000>; - gpios = <&gpio2 30 GPIO_ACTIVE_LOW>; + gpios = <&gpio2 30 GPIO_ACTIVE_HIGH>; gpios-states = <1>; states = <3300000 1 1800000 0>;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 443/639 net/sched: cbs: Fix error path of cbs_module_init
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit 45d5cb137c3638b3a310f41b31d8e79daf647f14 ]
If register_qdisc fails, we should unregister
netdevice notifier.
--- net/sched/sch_cbs.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
net/sched/sch_cbs.c +7 -2
@@ -552,12 +552,17 @@ static struct notifier_block cbs_device_notifier = {static int __init cbs_module_init (void ) { -int err =register_netdevice_notifier (&cbs_device_notifier); +int err; + err =register_netdevice_notifier (&cbs_device_notifier);if (err)return err; -return register_qdisc (&cbs_qdisc_ops); + err =register_qdisc (&cbs_qdisc_ops); +if (err) +unregister_netdevice_notifier (&cbs_device_notifier); + +return err; } static void __exit cbs_module_exit(void)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 444/639 arm64: dts: allwinner: h6: Pine H64: Add interrupt line for RTC
In reply to Greg Kroah-HartmanFrom: Chen-Yu Tsai <[email protected]>
[ Upstream commit 0bb9d1876c0605815ea0452f68cb819a775a75f9 ]
The external PCF8563 RTC chip's interrupt line is connected to the NMI line on the SoC.
Add the interrupt line to the device tree.
--- arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts +2 -0
@@ -176,6 +176,8 @@ pcf8563: rtc@51 { compatible = "nxp,pcf8563"; reg = <0x51>; + interrupt-parent = <&r_intc>; + interrupts = <0 IRQ_TYPE_LEVEL_LOW>; #clock-cells = <0>; }; };
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 445/639 drm/msm/a3xx: remove TPL1 regs from snapshot
In reply to Greg Kroah-HartmanFrom: Rob Clark <[email protected]>
[ Upstream commit f47bee2ba447bebc304111c16ef1e1a73a9744dd ]
These regs are write-only, and the hw throws a hissy-fit (ie. reboots) when we try to read them for GPU state snapshot, in response to a GPU hang. It is rather impolite when GPU recovery triggers an insta- reboot, so lets remove the TPL1 registers from the snapshot.
--- drivers/gpu/drm/msm/adreno/a3xx_gpu.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-)
drivers/gpu/drm/msm/adreno/a3xx_gpu.c +11 -13
@@ -395,19 +395,17 @@ static const unsigned int a3xx_registers[] = {0x2200 ,0x2212 ,0x2214 ,0x2217 ,0x221a ,0x221a ,0x2240 ,0x227e ,0x2280 ,0x228b ,0x22c0 ,0x22c0 ,0x22c4 ,0x22ce ,0x22d0 ,0x22d8 ,0x22df ,0x22e6 ,0x22e8 ,0x22e9 ,0x22ec ,0x22ec ,0x22f0 ,0x22f7 , -0x22ff ,0x22ff ,0x2340 ,0x2343 ,0x2348 ,0x2349 ,0x2350 ,0x2356 , -0x2360 ,0x2360 ,0x2440 ,0x2440 ,0x2444 ,0x2444 ,0x2448 ,0x244d , -0x2468 ,0x2469 ,0x246c ,0x246d ,0x2470 ,0x2470 ,0x2472 ,0x2472 , -0x2474 ,0x2475 ,0x2479 ,0x247a ,0x24c0 ,0x24d3 ,0x24e4 ,0x24ef , -0x2500 ,0x2509 ,0x250c ,0x250c ,0x250e ,0x250e ,0x2510 ,0x2511 , -0x2514 ,0x2515 ,0x25e4 ,0x25e4 ,0x25ea ,0x25ea ,0x25ec ,0x25ed , -0x25f0 ,0x25f0 ,0x2600 ,0x2612 ,0x2614 ,0x2617 ,0x261a ,0x261a , -0x2640 ,0x267e ,0x2680 ,0x268b ,0x26c0 ,0x26c0 ,0x26c4 ,0x26ce , -0x26d0 ,0x26d8 ,0x26df ,0x26e6 ,0x26e8 ,0x26e9 ,0x26ec ,0x26ec , -0x26f0 ,0x26f7 ,0x26ff ,0x26ff ,0x2740 ,0x2743 ,0x2748 ,0x2749 , -0x2750 ,0x2756 ,0x2760 ,0x2760 ,0x300c ,0x300e ,0x301c ,0x301d , -0x302a ,0x302a ,0x302c ,0x302d ,0x3030 ,0x3031 ,0x3034 ,0x3036 , -0x303c ,0x303c ,0x305e ,0x305f , +0x22ff ,0x22ff ,0x2340 ,0x2343 ,0x2440 ,0x2440 ,0x2444 ,0x2444 , +0x2448 ,0x244d ,0x2468 ,0x2469 ,0x246c ,0x246d ,0x2470 ,0x2470 , +0x2472 ,0x2472 ,0x2474 ,0x2475 ,0x2479 ,0x247a ,0x24c0 ,0x24d3 , +0x24e4 ,0x24ef ,0x2500 ,0x2509 ,0x250c ,0x250c ,0x250e ,0x250e , +0x2510 ,0x2511 ,0x2514 ,0x2515 ,0x25e4 ,0x25e4 ,0x25ea ,0x25ea , +0x25ec ,0x25ed ,0x25f0 ,0x25f0 ,0x2600 ,0x2612 ,0x2614 ,0x2617 , +0x261a ,0x261a ,0x2640 ,0x267e ,0x2680 ,0x268b ,0x26c0 ,0x26c0 , +0x26c4 ,0x26ce ,0x26d0 ,0x26d8 ,0x26df ,0x26e6 ,0x26e8 ,0x26e9 , +0x26ec ,0x26ec ,0x26f0 ,0x26f7 ,0x26ff ,0x26ff ,0x2740 ,0x2743 , +0x300c ,0x300e ,0x301c ,0x301d ,0x302a ,0x302a ,0x302c ,0x302d , +0x3030 ,0x3031 ,0x3034 ,0x3036 ,0x303c ,0x303c ,0x305e ,0x305f , ~0 /* sentinel */ };
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 446/639 ip6_fib: Dont discard nodes with valid routing information in fib6_locate_1()
In reply to Greg Kroah-HartmanFrom: Stefano Brivio <[email protected]>
[ Upstream commit 40cb35d5dc04e7f89cbc7b1fc9b4b48d9f1e5343 ]
When we perform an inexact match on FIB nodes via fib6_locate_1(), longer prefixes will be preferred to shorter ones. However, it might happen that a node, with higher fn_bit value than some other, has no valid routing information.
In this case, we'll pick that node, but it will be discarded by the check on RTN_RTINFO in fib6_locate(), and we might miss nodes with valid routing information but with lower fn_bit value.
This is apparent when a routing exception is created for a default route:
# ip -6 route list fc00:1::/64 dev veth_A-R1 proto kernel metric 256 pref medium fc00:2::/64 dev veth_A-R2 proto kernel metric 256 pref medium fc00:4::1 via fc00:2::2 dev veth_A-R2 metric 1024 pref medium fe80::/64 dev veth_A-R1 proto kernel metric 256 pref medium fe80::/64 dev veth_A-R2 proto kernel metric 256 pref medium default via fc00:1::2 dev veth_A-R1 metric 1024 pref medium # ip -6 route list cache fc00:4::1 via fc00:2::2 dev veth_A-R2 metric 1024 expires 593sec mtu 1500 pref medium fc00:3::1 via fc00:1::2 dev veth_A-R1 metric 1024 expires 593sec mtu 1500 pref medium # ip -6 route flush cache # node for default route is discarded Failed to send flush request: No such process # ip -6 route list cache fc00:3::1 via fc00:1::2 dev veth_A-R1 metric 1024 expires 586sec mtu 1500 pref medium
Check right away if the node has a RTN_RTINFO flag, before replacing the 'prev' pointer, that indicates the longest matching prefix found so far.
--- net/ipv6/ip6_fib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv6/ip6_fib.c +2 -1
@@ -1529,7 +1529,8 @@ static struct fib6_node *fib6_locate_1(struct fib6_node *root,if (plen == fn->fn_bit)return fn; - prev = fn; +if (fn->fn_flags &RTN_RTINFO ) + prev = fn; next:/*
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 447/639 perf/ioctl: Add check for the sample_period value
In reply to Greg Kroah-HartmanFrom: Ravi Bangoria <[email protected]>
[ Upstream commit 913a90bc5a3a06b1f04c337320e9aeee2328dd77 ]
perf_event_open() limits the sample_period to 63 bits. See:
0819b2e30ccb ("perf: Limit perf_event_attr::sample_period to 63 bits")
Make ioctl() consistent with it.
Also on PowerPC, negative sample_period could cause a recursive PMIs leading to a hang (reported when running perf-fuzzer).
--- kernel/events/core.c | 3 +++ 1 file changed, 3 insertions(+)
kernel/events/core.c +3 -0
@@ -5012,6 +5012,9 @@ static int perf_event_period(struct perf_event *event, u64 __user *arg)if (perf_event_check_period (event, value))return -EINVAL ; +if (!event->attr.freq && (value & (1ULL <<63 ))) +return -EINVAL ; +event_function_call (event, __perf_event_period, &value);return 0 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 448/639 dmaengine: hsu: Revert "set HSU_CH_MTSR to memory width"
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit c24a5c735f87d0549060de31367c095e8810b895 ]
The commit
080edf75d337 ("dmaengine: hsu: set HSU_CH_MTSR to memory width")
has been mistakenly submitted. The further investigations show that the original code does better job since the memory side transfer size has never been configured by DMA users.
As per latest revision of documentation: "Channel minimum transfer size (CHnMTSR)... For IOSF UART, maximum value that can be programmed is 64 and minimum value that can be programmed is 1."
This reverts commit 080edf75d337d35faa6fc3df99342b10d2848d16.
--- drivers/dma/hsu/hsu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/hsu/hsu.c +2 -2
@@ -64,10 +64,10 @@ static void hsu_dma_chan_start(struct hsu_dma_chan *hsuc)if (hsuc->direction ==DMA_MEM_TO_DEV ) { bsr = config->dst_maxburst; - mtsr = config->src_addr_width; + mtsr = config->dst_addr_width; }else if (hsuc->direction ==DMA_DEV_TO_MEM ) { bsr = config->src_maxburst; - mtsr = config->dst_addr_width; + mtsr = config->src_addr_width; }hsu_chan_disable (hsuc);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 449/639 clk: qcom: Fix -Wunused-const-variable
In reply to Greg Kroah-HartmanFrom: Nathan Huckleberry <[email protected]>
[ Upstream commit da642427bd7710ec4f4140f693f59aa8521a358c ]
Clang produces the following warning
drivers/clk/qcom/gcc-msm8996.c:133:32: warning: unused variable 'gcc_xo_gpll0_gpll2_gpll3_gpll0_early_div_map' [-Wunused-const-variable] static const structparent_map gcc_xo_gpll0_gpll2_gpll3_gpll0_early_div_map[] =
{ ^drivers/clk/qcom/gcc-msm8996.c:141:27: warning: unused variable 'gcc_xo_gpll0_gpll2_gpll3_gpll0_early_div' [-Wunused-const-variable] static const char * const gcc_xo_gpll0_gpll2_gpll3_gpll0_early_div[] = { ^ drivers/clk/qcom/gcc-msm8996.c:187:32: warning: unused variable 'gcc_xo_gpll0_gpll2_gpll3_gpll1_gpll4_gpll0_early_div_map' [-Wunused-const-variable] static const struct parent_map gcc_xo_gpll0_gpll2_gpll3_gpll1_gpll4_gpll0_early_div_map[] = { ^ drivers/clk/qcom/gcc-msm8996.c:197:27: warning: unused variable 'gcc_xo_gpll0_gpll2_gpll3_gpll1_gpll4_gpll0_early_div' [-Wunused-const-variable] static const char * const gcc_xo_gpll0_gpll2_gpll3_gpll1_gpll4_gpll0_early_div[] = {
It looks like these were never used.
--- drivers/clk/qcom/gcc-msm8996.c | 36 ---------------------------------- 1 file changed, 36 deletions(-)
drivers/clk/qcom/gcc-msm8996.c +0 -36
@@ -138,22 +138,6 @@ static const char * const gcc_xo_gpll0_gpll4_gpll0_early_div[] = {"gpll0_early_div" }; -static const struct parent_map gcc_xo_gpll0_gpll2_gpll3_gpll0_early_div_map[] = { - {P_XO ,0 }, - {P_GPLL0 ,1 }, - {P_GPLL2 ,2 }, - {P_GPLL3 ,3 }, - {P_GPLL0_EARLY_DIV ,6 } -}; - -static const char *const gcc_xo_gpll0_gpll2_gpll3_gpll0_early_div[] = { -"xo" , -"gpll0" , -"gpll2" , -"gpll3" , -"gpll0_early_div" -}; -static const struct parent_map gcc_xo_gpll0_gpll1_early_div_gpll1_gpll4_gpll0_early_div_map[] = { {P_XO ,0 }, {P_GPLL0 ,1 },
@@ -192,26 +176,6 @@ static const char * const gcc_xo_gpll0_gpll2_gpll3_gpll1_gpll2_early_gpll0_early"gpll0_early_div" }; -static const struct parent_map gcc_xo_gpll0_gpll2_gpll3_gpll1_gpll4_gpll0_early_div_map[] = { - {P_XO ,0 }, - {P_GPLL0 ,1 }, - {P_GPLL2 ,2 }, - {P_GPLL3 ,3 }, - {P_GPLL1 ,4 }, - {P_GPLL4 ,5 }, - {P_GPLL0_EARLY_DIV ,6 } -}; - -static const char *const gcc_xo_gpll0_gpll2_gpll3_gpll1_gpll4_gpll0_early_div[] = { -"xo" , -"gpll0" , -"gpll2" , -"gpll3" , -"gpll1" , -"gpll4" , -"gpll0_early_div" -}; -static struct clk_fixed_factor xo = { .mult =1 , .div =1 ,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 450/639 nvmem: imx-ocotp: Ensure WAIT bits are preserved when setting timing
In reply to Greg Kroah-HartmanFrom: Bryan O'Donoghue <[email protected]>
[ Upstream commit 0493c4792b4eb260441e57f52cc11a9ded48b5a7 ]
The i.MX6 and i.MX8 both have a bit-field spanning bits 27:22 called the WAIT field.
The WAIT field according to the documentation for both parts "specifies time interval between auto read and write access in one time program. It is given in number of ipg_clk periods."
This patch ensures that the relevant field is read and written back to the timing register.
--- drivers/nvmem/imx-ocotp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvmem/imx-ocotp.c +2 -1
@@ -189,7 +189,8 @@ static void imx_ocotp_set_imx6_timing(struct ocotp_priv *priv) strobe_prog = clk_rate / (1000000000 /10000 ) +2 * (DEF_RELAX +1 ) -1 ; strobe_read = clk_rate / (1000000000 /40 ) +2 * (DEF_RELAX +1 ) -1 ; - timing = strobe_prog &0x00000FFF ; + timing =readl (priv->base +IMX_OCOTP_ADDR_TIMING ) &0x0FC00000 ; + timing |= strobe_prog &0x00000FFF ; timing |= (relax <<12 ) &0x0000F000 ; timing |= (strobe_read <<16 ) &0x003F0000 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 451/639 nvmem: imx-ocotp: Change TIMING calculation to u-boot algorithm
In reply to Greg Kroah-HartmanFrom: Bryan O'Donoghue <[email protected]>
[ Upstream commit 159dbaf57b2f4f67ecb59b2c87d071e45ed41d7e ]
The RELAX field of the OCOTP block is turning out as a zero on i.MX8MM. This messes up the subsequent re-load of the fuse shadow registers.
After some discussion with people @ NXP its clear we have missed a trick here in Linux.
The OCOTP fuse programming time has a physical minimum 'burn time' that is not related to the ipg_clk.
We need to define the RELAX, STROBE_READ and STROBE_PROG fields in terms of desired timings to allow for the burn-in to safely complete. Right now only the RELAX field is calculated in terms of an absolute time and we are ending up with a value of zero.
This patch inherits the u-boot timings for the OCOTP_TIMING calculation on the i.MX6 and i.MX8. Those timings are known to work and critically specify values such as STROBE_PROG as a minimum timing.
--- drivers/nvmem/imx-ocotp.c | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-)
drivers/nvmem/imx-ocotp.c +32 -4
@@ -50,7 +50,9 @@#define IMX_OCOTP_BM_CTRL_ERROR 0x00000200#define IMX_OCOTP_BM_CTRL_REL_SHADOWS 0x00000400 -#define DEF_RELAX 20/* > 16.5ns */ +#define TIMING_STROBE_PROG_US 10/* Min time to blow a fuse */ +#define TIMING_STROBE_READ_NS 37/* Min time before read */ +#define TIMING_RELAX_NS 17#define DEF_FSOURCE 1001/* > 1000 ns */ #define DEF_STROBE_PROG 10000/* IPG clocks */ #define IMX_OCOTP_WR_UNLOCK 0x3E770000
@@ -182,12 +184,38 @@ static void imx_ocotp_set_imx6_timing(struct ocotp_priv *priv)* fields with timing values to match the current frequency of the * ipg_clk. OTP writes will work at maximum bus frequencies as long * as the HW_OCOTP_TIMING parameters are set correctly. +* +* Note: there are minimum timings required to ensure an OTP fuse burns +* correctly that are independent of the ipg_clk. Those values are not +* formally documented anywhere however, working from the minimum +* timings given in u-boot we can say: +* +* - Minimum STROBE_PROG time is 10 microseconds. Intuitively 10 +* microseconds feels about right as representative of a minimum time +* to physically burn out a fuse. +* +* - Minimum STROBE_READ i.e. the time to wait post OTP fuse burn before +* performing another read is 37 nanoseconds +* +* - Minimum RELAX timing is 17 nanoseconds. This final RELAX minimum +* timing is not entirely clear the documentation says "This +* count value specifies the time to add to all default timing +* parameters other than the Tpgm and Trd. It is given in number +* of ipg_clk periods." where Tpgm and Trd refer to STROBE_PROG +* and STROBE_READ respectively. What the other timing parameters +* are though, is not specified. Experience shows a zero RELAX +* value will mess up a re-load of the shadow registers post OTP +* burn. */ clk_rate =clk_get_rate (priv->clk); - relax = clk_rate / (1000000000 /DEF_RELAX ) -1 ; - strobe_prog = clk_rate / (1000000000 /10000 ) +2 * (DEF_RELAX +1 ) -1 ; - strobe_read = clk_rate / (1000000000 /40 ) +2 * (DEF_RELAX +1 ) -1 ; + relax =DIV_ROUND_UP (clk_rate *TIMING_RELAX_NS ,1000000000 ) -1 ; + strobe_read =DIV_ROUND_UP (clk_rate *TIMING_STROBE_READ_NS , +1000000000 ); + strobe_read +=2 * (relax +1 ) -1 ; + strobe_prog =DIV_ROUND_CLOSEST (clk_rate *TIMING_STROBE_PROG_US , +1000000 ); + strobe_prog +=2 * (relax +1 ) -1 ; timing =readl (priv->base +IMX_OCOTP_ADDR_TIMING ) &0x0FC00000 ; timing |= strobe_prog &0x00000FFF ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 452/639 tools: bpftool: use correct argument in cgroup errors
In reply to Greg Kroah-HartmanFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 6c6874f401e5a0caab3b6a0663169e1fb5e930bb ]
cgroup code tries to use argv[0] as the cgroup path, but if it fails uses argv[1] to report errors.
--- tools/bpf/bpftool/cgroup.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/bpf/bpftool/cgroup.c +3 -3
@@ -164,7 +164,7 @@ static int do_show(int argc, char **argv) cgroup_fd =open (argv[0 ],O_RDONLY );if (cgroup_fd <0 ) { -p_err ("can't open cgroup %s" , argv[1 ]); +p_err ("can't open cgroup %s" , argv[0 ]); goto exit; }
@@ -345,7 +345,7 @@ static int do_attach(int argc, char **argv) cgroup_fd =open (argv[0 ],O_RDONLY );if (cgroup_fd <0 ) { -p_err ("can't open cgroup %s" , argv[1 ]); +p_err ("can't open cgroup %s" , argv[0 ]); goto exit; }
@@ -403,7 +403,7 @@ static int do_detach(int argc, char **argv) cgroup_fd =open (argv[0 ],O_RDONLY );if (cgroup_fd <0 ) { -p_err ("can't open cgroup %s" , argv[1 ]); +p_err ("can't open cgroup %s" , argv[0 ]); goto exit; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 453/639 backlight: pwm_bl: Fix heuristic to determine number of brightness levels
In reply to Greg Kroah-HartmanFrom: Matthias Kaehlcke <[email protected]>
[ Upstream commit 73fbfc499448455f1e1c77717040e09e25f1d976 ]
With commit 88ba95bedb79 ("backlight: pwm_bl: Compute brightness of LED linearly to human eye") the number of set bits (aka hweight()) in the PWM period is used in the heuristic to determine the number of brightness levels, when the brightness table isn't specified in the DT. The number of set bits doesn't provide a reliable clue about the length of the period, instead change the heuristic to:
nlevels = period / fls(period)
Also limit the maximum number of brightness levels to 4096 to avoid excessively large tables.
With this the number of levels increases monotonically with the PWM period, until the maximum of 4096 levels is reached:
period (ns) # levels
100 16
500 62
1000 111
5000 416
10000 769
50000 3333
100000 4096
--- drivers/video/backlight/pwm_bl.c | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-)
drivers/video/backlight/pwm_bl.c +6 -18
@@ -199,29 +199,17 @@ int pwm_backlight_brightness_default(struct device *dev, struct platform_pwm_backlight_data *data, unsigned int period) { -unsigned int counter =0 ; -unsigned int i, n; +unsigned int i;u64 retval;/* -* Count the number of bits needed to represent the period number. The -* number of bits is used to calculate the number of levels used for the -* brightness-levels table, the purpose of this calculation is have a -* pre-computed table with enough levels to get linear brightness -* perception. The period is divided by the number of bits so for a -* 8-bit PWM we have 255 / 8 = 32 brightness levels or for a 16-bit PWM -* we have 65535 / 16 = 4096 brightness levels. -* -* Note that this method is based on empirical testing on different -* devices with PWM of 8 and 16 bits of resolution. +* Once we have 4096 levels there's little point going much higher... +* neither interactive sliders nor animation benefits from having +* more values in the table. */ - n = period; -while (n) { - counter += n %2 ; - n >>=1 ; - } + data->max_brightness = +min ((int )DIV_ROUND_UP (period,fls (period)),4096 ); - data->max_brightness =DIV_ROUND_UP (period, counter); data->levels =devm_kcalloc (dev, data->max_brightness,sizeof (*data->levels),GFP_KERNEL );if (!data->levels)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 454/639 fork,memcg: alloc_thread_stack_node needs to set tsk->stack
In reply to Greg Kroah-HartmanFrom: Andrea Arcangeli <[email protected]>
[ Upstream commit 1bf4580e00a248a2c86269125390eb3648e1877c ]
Commit 5eed6f1dff87 ("fork,memcg: fix crash in free_thread_stack on memcg charge fail") corrected two instances, but there was a third instance of this bug.
Without setting tsk->stack, if memcg_charge_kernel_stack fails, it'll execute free_thread_stack() on a dangling pointer.
Enterprise kernels are compiled with VMAP_STACK=y so this isn't critical, but custom VMAP_STACK=n builds should have some performance advantage, with the drawback of risking to fail fork because compaction didn't succeed. So as long as VMAP_STACK=n is a supported option it's worth fixing it upstream.
--- kernel/fork.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
kernel/fork.c +5 -1
@@ -240,7 +240,11 @@ static unsigned long *alloc_thread_stack_node(struct task_struct *tsk, int node)struct page *page =alloc_pages_node (node,THREADINFO_GFP ,THREAD_SIZE_ORDER ); -return page ?page_address (page) :NULL ; +if (likely (page)) { + tsk->stack =page_address (page); +return tsk->stack; + } +return NULL ;#endif }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 455/639 bnxt_en: Fix ethtool selftest crash under error conditions.
In reply to Greg Kroah-HartmanFrom: Michael Chan <[email protected]>
[ Upstream commit d27e2ca1166aefd54d9c48fb6647dee8115a5dfc ]
After ethtool loopback packet tests, we re-open the nic for the next IRQ test. If the open fails, we must not proceed with the IRQ test or we will crash with NULL pointer dereference. Fix it by checking the bnxt_open_nic() return code before proceeding.
--- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +3 -3
@@ -2600,7 +2600,7 @@ static void bnxt_self_test(struct net_device *dev, struct ethtool_test *etest,bool offline = false;u8 test_results =0 ;u8 test_mask =0 ; -int rc, i; +int rc =0 , i;if (!bp->num_tests || !BNXT_SINGLE_PF (bp))return ;
@@ -2671,9 +2671,9 @@ static void bnxt_self_test(struct net_device *dev, struct ethtool_test *etest, }bnxt_hwrm_phy_loopback (bp, false, false);bnxt_half_close_nic (bp); -bnxt_open_nic (bp, false, true); + rc =bnxt_open_nic (bp, false, true); } -if (bnxt_test_irq (bp)) { +if (rc ||bnxt_test_irq (bp)) { buf[BNXT_IRQ_TEST_IDX ] =1 ; etest->flags |=ETH_TEST_FL_FAILED ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 456/639 bnxt_en: Suppress error messages when querying DSCP DCB capabilities.
In reply to Greg Kroah-HartmanFrom: Michael Chan <[email protected]>
[ Upstream commit 4ca5fa39e1aea2f85eb9c4257075c4077c6531da ]
Some firmware versions do not support this so use the silent variant to send the message to firmware to suppress the harmless error. This error message is unnecessarily alarming the user.
--- drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c +1 -1
@@ -396,7 +396,7 @@ static int bnxt_hwrm_queue_dscp_qcaps(struct bnxt *bp)bnxt_hwrm_cmd_hdr_init (bp, &req,HWRM_QUEUE_DSCP_QCAPS ,-1 ,-1 );mutex_lock (&bp->hwrm_cmd_lock); - rc =_hwrm_send_message (bp, &req,sizeof (req),HWRM_CMD_TIMEOUT ); + rc =_hwrm_send_message_silent (bp, &req,sizeof (req),HWRM_CMD_TIMEOUT );if (!rc) { bp->max_dscp_value = (1 << resp->num_dscp_bits) -1 ;if (bp->max_dscp_value <0x3f )
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 457/639 iommu/amd: Make iommu_disable safer
In reply to Greg Kroah-HartmanFrom: Kevin Mitchell <[email protected]>
[ Upstream commit 3ddbe913e55516d3e2165d43d4d5570761769878 ]
Make it safe to call iommu_disable during early init error conditions before mmio_base is set, but after the struct amd_iommu has been added to the amd_iommu_list. For example, this happens if firmware fails to fill in mmio_phys in the ACPI table leading to a NULL pointer dereference in iommu_feature_disable.
--- drivers/iommu/amd_iommu_init.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/iommu/amd_iommu_init.c +3 -0
@@ -422,6 +422,9 @@ static void iommu_enable(struct amd_iommu *iommu)static void iommu_disable (struct amd_iommu *iommu) { +if (!iommu->mmio_base) +return ; +/* Disable command buffer */ iommu_feature_disable (iommu,CONTROL_CMDBUF_EN );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 458/639 mfd: intel-lpss: Release IDA resources
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 02f36911c1b41fcd8779fa0c135aab0554333fa5 ]
ida instances allocate some internal memory for ->free_bitmap in addition to the base 'struct ida'. Use ida_destroy() to release that memory at module_exit().
--- drivers/mfd/intel-lpss.c | 1 + 1 file changed, 1 insertion(+)
drivers/mfd/intel-lpss.c +1 -0
@@ -545,6 +545,7 @@ module_init(intel_lpss_init); static void __exit intel_lpss_exit(void) { +ida_destroy (&intel_lpss_devid_ida);debugfs_remove (intel_lpss_debugfs); }module_exit (intel_lpss_exit);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 459/639 rxrpc: Fix uninitialized error code in rxrpc_send_data_packet()
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit 3427beb6375d04e9627c67343872e79341a684ea ]
With gcc 4.1:
net/rxrpc/output.c: In function ‘rxrpc_send_data_packet’:
net/rxrpc/output.c:338: warning: ‘ret’ may be used uninitialized in this function
Indeed, if the first jump to the send_fragmentable label is made, and the address family is not handled in the switch() statement, ret will be used uninitialized.
Fix this by BUG()'ing as is done in other places in rxrpc where internal support for future address families will need adding. It should not be possible to reach this normally as the address families are checked up-front.
--- net/rxrpc/output.c | 3 +++ 1 file changed, 3 insertions(+)
net/rxrpc/output.c +3 -0
@@ -524,6 +524,9 @@ send_fragmentable: }break ;#endif + +default : +BUG (); }if (ret <0 )
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 460/639 xprtrdma: Fix use-after-free in rpcrdma_post_recvs
In reply to Greg Kroah-HartmanFrom: Chuck Lever <[email protected]>
[ Upstream commit 2d0abe36cf13fb7b577949fd1539326adddcc9bc ]
Dereference wr->next /before/ the memory backing wr has been released. This issue was found by code inspection. It is not expected to be a significant problem because it is in an error path that is almost never executed.
--- net/sunrpc/xprtrdma/verbs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/sunrpc/xprtrdma/verbs.c +2 -1
@@ -1558,10 +1558,11 @@ rpcrdma_post_recvs(struct rpcrdma_xprt *r_xprt, bool temp) rc =ib_post_recv (r_xprt->rx_ia.ri_id->qp, wr, (const struct ib_recv_wr **)&bad_wr);if (rc) { -for (wr = bad_wr; wr; wr = wr->next) { +for (wr = bad_wr; wr;) {struct rpcrdma_rep *rep; rep = container_of(wr, struct rpcrdma_rep, rr_recv_wr); + wr = wr->next;rpcrdma_recv_buffer_put (rep); --count; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 461/639 um: Fix IRQ controller regression on console read
In reply to Greg Kroah-HartmanFrom: Jouni Malinen <[email protected]>
[ Upstream commit bebe4681d0e7e1be2608282dc86645728bc7f623 ]
The conversion of UML to use epoll based IRQ controller claimed that clone_one_chan() can safely call um_free_irq() while starting to ignore the delay_free_irq parameter that explicitly noted that the IRQ cannot be freed because this is being called from chan_interrupt(). This resulted in free_irq() getting called in interrupt context ("Trying to free IRQ 6 from IRQ context!").
Fix this by restoring previously used delay_free_irq processing.
--- arch/um/drivers/chan_kern.c | 52 +++++++++++++++++++++++++++++++------ arch/um/kernel/irq.c | 4 +++ 2 files changed, 48 insertions(+), 8 deletions(-)
arch/um/drivers/chan_kern.c +44 -8
@@ -171,19 +171,55 @@ int enable_chan(struct line *line)return err; } +/* Items are added in IRQ context, when free_irq can't be called, and +* removed in process context, when it can. +* This handles interrupt sources which disappear, and which need to +* be permanently disabled. This is discovered in IRQ context, but +* the freeing of the IRQ must be done later. +*/ +static DEFINE_SPINLOCK (irqs_to_free_lock); +static LIST_HEAD (irqs_to_free); + +void free_irqs (void ) +{ +struct chan *chan; +LIST_HEAD (list); +struct list_head *ele; +unsigned long flags; + +spin_lock_irqsave (&irqs_to_free_lock, flags); +list_splice_init (&irqs_to_free, &list); +spin_unlock_irqrestore (&irqs_to_free_lock, flags); + +list_for_each (ele, &list) { + chan = list_entry(ele, struct chan, free_list); + +if (chan->input && chan->enabled) +um_free_irq (chan->line->driver->read_irq, chan); +if (chan->output && chan->enabled) +um_free_irq (chan->line->driver->write_irq, chan); + chan->enabled =0 ; + } +} +static void close_one_chan (struct chan *chan,int delay_free_irq) { +unsigned long flags; +if (!chan->opened)return ; -/* we can safely call free now - it will be marked -* as free and freed once the IRQ stopped processing -*/ -if (chan->input && chan->enabled) -um_free_irq (chan->line->driver->read_irq, chan); -if (chan->output && chan->enabled) -um_free_irq (chan->line->driver->write_irq, chan); - chan->enabled =0 ; +if (delay_free_irq) { +spin_lock_irqsave (&irqs_to_free_lock, flags); +list_add (&chan->free_list, &irqs_to_free); +spin_unlock_irqrestore (&irqs_to_free_lock, flags); + }else { +if (chan->input && chan->enabled) +um_free_irq (chan->line->driver->read_irq, chan); +if (chan->output && chan->enabled) +um_free_irq (chan->line->driver->write_irq, chan); + chan->enabled =0 ; + }if (chan->ops->close !=NULL ) (*chan->ops->close)(chan->fd, chan->data);
arch/um/kernel/irq.c +4 -0
@@ -21,6 +21,8 @@#include <irq_user.h> +extern void free_irqs (void ); +/* When epoll triggers we do not know why it did so * we can also have different IRQs for read and write. * This is why we keep a small irq_fd array for each fd -
@@ -100,6 +102,8 @@ void sigio_handler(int sig, struct siginfo *unused_si, struct uml_pt_regs *regs) } } } + +free_irqs (); }static int assign_epoll_events_to_irq (struct irq_entry *irq_entry)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 462/639 PM: ACPI/PCI: Resume all devices during hibernation
In reply to Greg Kroah-HartmanFrom: Rafael J. Wysocki <[email protected]>
[ Upstream commit 501debd4aa5edc755037c39ea5a8fba23b41e580 ]
Both the PCI bus type and the ACPI PM domain avoid resuming runtime-suspended devices with DPM_FLAG_SMART_SUSPEND set during hibernation (before creating the snapshot image of system memory), but that turns out to be a mistake. It leads to functional issues and adds complexity that's hard to justify.
For this reason, resume all runtime-suspended PCI devices and all devices in the ACPI PM domains before creating a snapshot image of system memory during hibernation.
--- drivers/acpi/device_pm.c | 13 +++++++------ drivers/pci/pci-driver.c | 16 ++++++++-------- 2 files changed, 15 insertions(+), 14 deletions(-)
drivers/acpi/device_pm.c +7 -6
@@ -1116,13 +1116,14 @@ EXPORT_SYMBOL_GPL(acpi_subsys_resume_early);int acpi_subsys_freeze (struct device *dev) {/* -* This used to be done in acpi_subsys_prepare() for all devices and -* some drivers may depend on it, so do it here. Ideally, however, -* runtime-suspended devices should not be touched during freeze/thaw -* transitions. +* Resume all runtime-suspended devices before creating a snapshot +* image of system memory, because the restore kernel generally cannot +* be expected to always handle them consistently and they need to be +* put into the runtime-active metastate during system resume anyway, +* so it is better to ensure that the state saved in the image will be +* always consistent with that. */ -if (!dev_pm_test_driver_flags (dev,DPM_FLAG_SMART_SUSPEND )) -pm_runtime_resume (dev); +pm_runtime_resume (dev);return pm_generic_freeze (dev); }
drivers/pci/pci-driver.c +8 -8
@@ -996,15 +996,15 @@ static int pci_pm_freeze(struct device *dev) }/* -* This used to be done in pci_pm_prepare() for all devices and some -* drivers may depend on it, so do it here. Ideally, runtime-suspended -* devices should not be touched during freeze/thaw transitions, -* however. +* Resume all runtime-suspended devices before creating a snapshot +* image of system memory, because the restore kernel generally cannot +* be expected to always handle them consistently and they need to be +* put into the runtime-active metastate during system resume anyway, +* so it is better to ensure that the state saved in the image will be +* always consistent with that. */ -if (!dev_pm_smart_suspend_and_suspended (dev)) { -pm_runtime_resume (dev); - pci_dev->state_saved = false; - } +pm_runtime_resume (dev); + pci_dev->state_saved = false;if (pm->freeze) {int error;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 463/639 ACPI: PM: Simplify and fix PM domain hibernation callbacks
In reply to Greg Kroah-HartmanFrom: Rafael J. Wysocki <[email protected]>
[ Upstream commit 3cd7957e85e67120bb9f6bfb75d81dcc19af282b ]
First, after a previous change causing all runtime-suspended devices in the ACPI PM domain (and ACPI LPSS devices) to be resumed before creating a snapshot image of memory during hibernation, it is not necessary to worry about the case in which them might be left in runtime-suspend any more, so get rid of the code related to that from ACPI PM domain and ACPI LPSS hibernation callbacks.
Second, it is not correct to use pm_generic_resume_early() and acpi_subsys_resume_noirq() in hibernation "restore" callbacks (which currently happens in the ACPI PM domain and ACPI LPSS), so introduce proper _restore_late and _restore_noirq callbacks for the ACPI PM domain and ACPI LPSS.
--- drivers/acpi/acpi_lpss.c | 61 ++++++++++++++++++++++++++++++++++------ drivers/acpi/device_pm.c | 61 ++++++---------------------------------- include/linux/acpi.h | 10 ------- 3 files changed, 61 insertions(+), 71 deletions(-)
drivers/acpi/acpi_lpss.c +52 -9
@@ -1086,16 +1086,62 @@ static int acpi_lpss_resume_noirq(struct device *dev)struct lpss_private_data *pdata =acpi_driver_data (ACPI_COMPANION (dev));int ret; - ret =acpi_subsys_resume_noirq (dev); +/* Follow acpi_subsys_resume_noirq(). */ +if (dev_pm_may_skip_resume (dev)) +return 0 ; + +if (dev_pm_smart_suspend_and_suspended (dev)) +pm_runtime_set_active (dev); + + ret =pm_generic_resume_noirq (dev);if (ret)return ret; -if (!dev_pm_may_skip_resume (dev) && pdata->dev_desc->resume_from_noirq) - ret =acpi_lpss_do_resume_early (dev); +if (!pdata->dev_desc->resume_from_noirq) +return 0 ; - return ret; +/* +* The driver's ->resume_early callback will be invoked by +* acpi_lpss_do_resume_early(), with the assumption that the driver +* really wanted to run that code in ->resume_noirq, but it could not +* run before acpi_dev_resume() and the driver expected the latter to be +* called in the "early" phase. +*/ +return acpi_lpss_do_resume_early (dev); +} + +static int acpi_lpss_do_restore_early (struct device *dev) +{ +int ret =acpi_lpss_resume (dev); + +return ret ? ret :pm_generic_restore_early (dev); +} + +static int acpi_lpss_restore_early (struct device *dev) +{ +struct lpss_private_data *pdata =acpi_driver_data (ACPI_COMPANION (dev)); + +if (pdata->dev_desc->resume_from_noirq) +return 0 ; + +return acpi_lpss_do_restore_early (dev); } +static int acpi_lpss_restore_noirq (struct device *dev) +{ +struct lpss_private_data *pdata =acpi_driver_data (ACPI_COMPANION (dev)); +int ret; + + ret =pm_generic_restore_noirq (dev); +if (ret) +return ret; + +if (!pdata->dev_desc->resume_from_noirq) +return 0 ; + +/* This is analogous to what happens in acpi_lpss_resume_noirq(). */ +return acpi_lpss_do_restore_early (dev); +}#endif /* CONFIG_PM_SLEEP */ static int acpi_lpss_runtime_suspend (struct device *dev)
@@ -1129,14 +1175,11 @@ static struct dev_pm_domain acpi_lpss_pm_domain = { .resume_noirq = acpi_lpss_resume_noirq, .resume_early = acpi_lpss_resume_early, .freeze = acpi_subsys_freeze, - .freeze_late = acpi_subsys_freeze_late, - .freeze_noirq = acpi_subsys_freeze_noirq, - .thaw_noirq = acpi_subsys_thaw_noirq, .poweroff = acpi_subsys_suspend, .poweroff_late = acpi_lpss_suspend_late, .poweroff_noirq = acpi_lpss_suspend_noirq, - .restore_noirq = acpi_lpss_resume_noirq, - .restore_early = acpi_lpss_resume_early, + .restore_noirq = acpi_lpss_restore_noirq, + .restore_early = acpi_lpss_restore_early, #endif .runtime_suspend = acpi_lpss_runtime_suspend, .runtime_resume = acpi_lpss_runtime_resume,
drivers/acpi/device_pm.c +9 -52
101 lines not on this page · raw message
include/linux/acpi.h +0 -10
@@ -917,26 +917,16 @@ int acpi_subsys_prepare(struct device *dev);void acpi_subsys_complete (struct device *dev);int acpi_subsys_suspend_late (struct device *dev);int acpi_subsys_suspend_noirq (struct device *dev); -int acpi_subsys_resume_noirq (struct device *dev); -int acpi_subsys_resume_early (struct device *dev);int acpi_subsys_suspend (struct device *dev);int acpi_subsys_freeze (struct device *dev); -int acpi_subsys_freeze_late (struct device *dev); -int acpi_subsys_freeze_noirq (struct device *dev); -int acpi_subsys_thaw_noirq (struct device *dev);#else static inline int acpi_dev_resume_early (struct device *dev) {return 0 ; }static inline int acpi_subsys_prepare (struct device *dev) {return 0 ; }static inline void acpi_subsys_complete (struct device *dev) {}static inline int acpi_subsys_suspend_late (struct device *dev) {return 0 ; }static inline int acpi_subsys_suspend_noirq (struct device *dev) {return 0 ; } -static inline int acpi_subsys_resume_noirq (struct device *dev) {return 0 ; } -static inline int acpi_subsys_resume_early (struct device *dev) {return 0 ; }static inline int acpi_subsys_suspend (struct device *dev) {return 0 ; }static inline int acpi_subsys_freeze (struct device *dev) {return 0 ; } -static inline int acpi_subsys_freeze_late (struct device *dev) {return 0 ; } -static inline int acpi_subsys_freeze_noirq (struct device *dev) {return 0 ; } -static inline int acpi_subsys_thaw_noirq (struct device *dev) {return 0 ; }#endif #ifdef CONFIG_ACPI
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 464/639 ACPI: PM: Introduce "poweroff" callbacks for ACPI PM domain and LPSS
In reply to Greg Kroah-HartmanFrom: Rafael J. Wysocki <[email protected]>
[ Upstream commit c95b7595f85c688d5c569ddbbd6ab6a4bdae2f36 ]
In general, it is not correct to call pm_generic_suspend(), pm_generic_suspend_late() and pm_generic_suspend_noirq() during the hibernation's "poweroff" transition, because device drivers may provide special callbacks to be invoked then and the wrappers in question cause system suspend callbacks to be run. Unfortunately, that happens in the ACPI PM domain and ACPI LPSS.
To address this potential issue, introduce "poweroff" callbacks for the ACPI PM and LPSS that will use pm_generic_poweroff(), pm_generic_poweroff_late() and pm_generic_poweroff_noirq() as appropriate.
--- drivers/acpi/acpi_lpss.c | 50 +++++++++++++++++++++++++++++++--- drivers/acpi/device_pm.c | 58 +++++++++++++++++++++++++++++++++++++--- include/linux/acpi.h | 2 ++ 3 files changed, 104 insertions(+), 6 deletions(-)
drivers/acpi/acpi_lpss.c +47 -3
@@ -1056,6 +1056,13 @@ static int acpi_lpss_suspend_noirq(struct device *dev)int ret;if (pdata->dev_desc->resume_from_noirq) { +/* +* The driver's ->suspend_late callback will be invoked by +* acpi_lpss_do_suspend_late(), with the assumption that the +* driver really wanted to run that code in ->suspend_noirq, but +* it could not run after acpi_dev_suspend() and the driver +* expected the latter to be called in the "late" phase. +*/ ret =acpi_lpss_do_suspend_late (dev);if (ret)return ret;
@@ -1142,6 +1149,43 @@ static int acpi_lpss_restore_noirq(struct device *dev)/* This is analogous to what happens in acpi_lpss_resume_noirq(). */ return acpi_lpss_do_restore_early (dev); } + +static int acpi_lpss_do_poweroff_late (struct device *dev) +{ +int ret =pm_generic_poweroff_late (dev); + +return ret ? ret :acpi_lpss_suspend (dev,device_may_wakeup (dev)); +} + +static int acpi_lpss_poweroff_late (struct device *dev) +{ +struct lpss_private_data *pdata =acpi_driver_data (ACPI_COMPANION (dev)); + +if (dev_pm_smart_suspend_and_suspended (dev)) +return 0 ; + +if (pdata->dev_desc->resume_from_noirq) +return 0 ; + +return acpi_lpss_do_poweroff_late (dev); +} + +static int acpi_lpss_poweroff_noirq (struct device *dev) +{ +struct lpss_private_data *pdata =acpi_driver_data (ACPI_COMPANION (dev)); + +if (dev_pm_smart_suspend_and_suspended (dev)) +return 0 ; + +if (pdata->dev_desc->resume_from_noirq) { +/* This is analogous to the acpi_lpss_suspend_noirq() case. */ +int ret =acpi_lpss_do_poweroff_late (dev); +if (ret) +return ret; + } + +return pm_generic_poweroff_noirq (dev); +}#endif /* CONFIG_PM_SLEEP */ static int acpi_lpss_runtime_suspend (struct device *dev)
@@ -1175,9 +1219,9 @@ static struct dev_pm_domain acpi_lpss_pm_domain = { .resume_noirq = acpi_lpss_resume_noirq, .resume_early = acpi_lpss_resume_early, .freeze = acpi_subsys_freeze, - .poweroff = acpi_subsys_suspend, - .poweroff_late = acpi_lpss_suspend_late, - .poweroff_noirq = acpi_lpss_suspend_noirq, + .poweroff = acpi_subsys_poweroff, + .poweroff_late = acpi_lpss_poweroff_late, + .poweroff_noirq = acpi_lpss_poweroff_noirq, .restore_noirq = acpi_lpss_restore_noirq, .restore_early = acpi_lpss_restore_early,#endif
drivers/acpi/device_pm.c +55 -3
70 lines not on this page · raw message
include/linux/acpi.h +2 -0
@@ -919,6 +919,7 @@ int acpi_subsys_suspend_late(struct device *dev);int acpi_subsys_suspend_noirq (struct device *dev);int acpi_subsys_suspend (struct device *dev);int acpi_subsys_freeze (struct device *dev); +int acpi_subsys_poweroff (struct device *dev);#else static inline int acpi_dev_resume_early (struct device *dev) {return 0 ; }static inline int acpi_subsys_prepare (struct device *dev) {return 0 ; }
@@ -927,6 +928,7 @@ static inline int acpi_subsys_suspend_late(struct device *dev) { return 0; }static inline int acpi_subsys_suspend_noirq (struct device *dev) {return 0 ; }static inline int acpi_subsys_suspend (struct device *dev) {return 0 ; }static inline int acpi_subsys_freeze (struct device *dev) {return 0 ; } +static inline int acpi_subsys_poweroff (struct device *dev) {return 0 ; }#endif #ifdef CONFIG_ACPI
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 465/639 fsi/core: Fix error paths on CFAM init
In reply to Greg Kroah-HartmanFrom: Jeremy Kerr <[email protected]>
[ Upstream commit 371975b0b07520c85098652d561639837a60a905 ]
Change d1dcd67825 re-worked the struct fsi_slave initialisation in fsi_slave_init, but introduced a few inconsitencies: the slave->dev is now registered through cdev_device_add, but we may kfree() the device out from underneath the cdev registration. We may also leave an IDA allocated.
This change fixes the error paths, so that we kfree() only before the device is registered with the core code. We also move the smode write to before we start creating proper devices, as it's the most likely to fail. We also remove the IDA-allocated minor on error, and properly clean up the of_node.
--- drivers/fsi/fsi-core.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-)
drivers/fsi/fsi-core.c +20 -12
@@ -1060,6 +1060,14 @@ static int fsi_slave_init(struct fsi_master *master, int link, uint8_t id) } + rc =fsi_slave_set_smode (slave); +if (rc) { +dev_warn (&master->dev, +"can't set smode on slave:%02x:%02x %d\n" , + link, id, rc); + goto err_free; + } +/* Allocate a minor in the FSI space */ rc =__fsi_get_new_minor (slave, fsi_dev_cfam, &slave->dev.devt, &slave->cdev_idx);
@@ -1071,17 +1079,14 @@ static int fsi_slave_init(struct fsi_master *master, int link, uint8_t id) rc =cdev_device_add (&slave->cdev, &slave->dev);if (rc) {dev_err (&slave->dev,"Error %d creating slave device\n" , rc); - goto err_free; + goto err_free_ida; } - rc =fsi_slave_set_smode (slave); -if (rc) { -dev_warn (&master->dev, -"can't set smode on slave:%02x:%02x %d\n" , - link, id, rc); -kfree (slave); -return -ENODEV ; - } +/* Now that we have the cdev registered with the core, any fatal +* failures beyond this point will need to clean up through +* cdev_device_del(). Fortunately though, nothing past here is fatal. +*/ +if (master->link_config) master->link_config(master, link, slave->t_send_delay,
@@ -1098,10 +1103,13 @@ static int fsi_slave_init(struct fsi_master *master, int link, uint8_t id)dev_dbg (&master->dev,"failed during slave scan with: %d\n" , rc); -return rc; +return 0 ; - err_free: -put_device (&slave->dev); +err_free_ida: +fsi_free_minor (slave->dev.devt); +err_free: +of_node_put (slave->dev.of_node); +kfree (slave);return rc; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 466/639 devres: allow const resource arguments
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 9dea44c91469512d346e638694c22c30a5273992 ]
devm_ioremap_resource() does not currently take 'const' arguments, which results in a warning from the first driver trying to do it anyway:
drivers/gpio/gpio-amd-fch.c: In function 'amd_fch_gpio_probe':drivers/gpio/gpio-amd-fch.c:171:49: error: passing argument 2 of 'devm_ioremap_resource' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
priv->base = devm_ioremap_resource(&pdev->dev, &amd_fch_gpio_iores);
^~~~~~~~~~~~~~~~~~~Change the prototype to allow it, as there is no real reason not to.
--- include/linux/device.h | 3 ++- lib/devres.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
include/linux/device.h +2 -1
@@ -701,7 +701,8 @@ extern unsigned long devm_get_free_pages(struct device *dev, gfp_t gfp_mask, unsigned int order);extern void devm_free_pages (struct device *dev,unsigned long addr); -void __iomem *devm_ioremap_resource (struct device *dev,struct resource *res); +void __iomem *devm_ioremap_resource (struct device *dev, +const struct resource *res); void __iomem *devm_of_iomap(struct device *dev, struct device_node *node, int index,
lib/devres.c +2 -1
@@ -131,7 +131,8 @@ EXPORT_SYMBOL(devm_iounmap);* if (IS_ERR(base)) * return PTR_ERR(base); */ -void __iomem *devm_ioremap_resource (struct device *dev,struct resource *res) +void __iomem *devm_ioremap_resource (struct device *dev, +const struct resource *res) {resource_size_t size;const char *name;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 467/639 fsi: sbefifo: Dont fail operations when in SBE IPL state
In reply to Greg Kroah-HartmanFrom: Eddie James <[email protected]>
[ Upstream commit 7ce98fb6c53d2311b3e9faae90b1a9c1a96534db ]
SBE fifo operations should be allowed while the SBE is in any of the "IPL" states. Operations should succeed in this state.
--- drivers/fsi/fsi-sbefifo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/fsi/fsi-sbefifo.c +2 -2
@@ -289,11 +289,11 @@ static int sbefifo_check_sbe_state(struct sbefifo *sbefifo)switch ((sbm &CFAM_SBM_SBE_STATE_MASK ) >>CFAM_SBM_SBE_STATE_SHIFT ) {case SBE_STATE_UNKNOWN :return -ESHUTDOWN ; +case SBE_STATE_DMT : +return -EBUSY ;case SBE_STATE_IPLING :case SBE_STATE_ISTEP :case SBE_STATE_MPIPL : -case SBE_STATE_DMT : -return -EBUSY ;case SBE_STATE_RUNTIME :case SBE_STATE_DUMP :/* Not sure about that one */ break ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 468/639 RDMA/hns: Fixs hw access invalid dma memory error
In reply to Greg Kroah-HartmanFrom: Xi Wang <[email protected]>
[ Upstream commit ec5bc2cc69b4fc494e04d10fc5226f6f9cf67c56 ]
When smmu is enable, if execute the perftest command and then use 'kill -9' to exit, follow this operation repeatedly, the kernel will have a high probability to print the following smmu event:
arm-smmu-v3 arm-smmu-v3.1.auto: event 0x10 received:
arm-smmu-v3 arm-smmu-v3.1.auto: 0x00007d0000000010 arm-smmu-v3 arm-smmu-v3.1.auto: 0x0000020900000080 arm-smmu-v3 arm-smmu-v3.1.auto: 0x00000000f47cf000 arm-smmu-v3 arm-smmu-v3.1.auto: 0x00000000f47cf000
This is because the hw will periodically refresh the qpc cache until the next reset.
This patch fixed it by removing the action that release qpc memory in the 'hns_roce_qp_free' function.
--- drivers/infiniband/hw/hns/hns_roce_qp.c | 1 - 1 file changed, 1 deletion(-)
drivers/infiniband/hw/hns/hns_roce_qp.c +0 -1
@@ -262,7 +262,6 @@ void hns_roce_qp_free(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp)hns_roce_table_put (hr_dev, &qp_table->trrl_table, hr_qp->qpn);hns_roce_table_put (hr_dev, &qp_table->irrl_table, hr_qp->qpn); -hns_roce_table_put (hr_dev, &qp_table->qp_table, hr_qp->qpn); } }EXPORT_SYMBOL_GPL (hns_roce_qp_free);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 469/639 PCI: mobiveil: Remove the flag MSI_FLAG_MULTI_PCI_MSI
In reply to Greg Kroah-HartmanFrom: Hou Zhiqiang <[email protected]>
[ Upstream commit a131fb6364c1be0924dcb969ecf6b988c556a5d5 ]
The Mobiveil internal MSI controller requires separate target addresses, one per MSI vector; this is clearly incompatible with the Multiple MSI feature, which requires the same target address for all vectors requested by an endpoint (ie the Message Address field in the MSI Capability structure), so the multi MSI feature is clearly not supported by the host controller driver.
Remove the flag MSI_FLAG_MULTI_PCI_MSI and with it multi MSI support, fixing the misconfiguration.
--- drivers/pci/controller/pcie-mobiveil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/pcie-mobiveil.c +1 -1
@@ -643,7 +643,7 @@ static struct irq_chip mobiveil_msi_irq_chip = {static struct msi_domain_info mobiveil_msi_domain_info = { .flags = (MSI_FLAG_USE_DEF_DOM_OPS |MSI_FLAG_USE_DEF_CHIP_OPS | -MSI_FLAG_MULTI_PCI_MSI |MSI_FLAG_PCI_MSIX ), +MSI_FLAG_PCI_MSIX ), .chip = &mobiveil_msi_irq_chip, };
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 470/639 PCI: mobiveil: Fix devfn check in mobiveil_pcie_valid_device()
In reply to Greg Kroah-HartmanFrom: Hou Zhiqiang <[email protected]>
[ Upstream commit cbd50b3ca3964c79dac65fda277637577e029e8c ]
Current check for devfn number in mobiveil_pci_valid_device() is wrong in that it flags as invalid functions present in PCI device 0 in the root bus while it is perfectly valid to access all functions in PCI device 0 in the root bus.
Update the check in mobiveil_pci_valid_device() to fix the issue.
--- drivers/pci/controller/pcie-mobiveil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/pcie-mobiveil.c +1 -1
@@ -174,7 +174,7 @@ static bool mobiveil_pcie_valid_device(struct pci_bus *bus, unsigned int devfn)* Do not read more than one device on the bus directly * attached to RC */ -if ((bus->primary == pcie->root_bus_nr) && (devfn >0 )) +if ((bus->primary == pcie->root_bus_nr) && (PCI_SLOT (devfn) >0 ))return false;return true;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 471/639 PCI: mobiveil: Fix the valid check for inbound and outbound windows
In reply to Greg Kroah-HartmanFrom: Hou Zhiqiang <[email protected]>
[ Upstream commit ccd34dac2ed596b1f26079912bdf638e002a3979 ]
In program_ib/ob_windows() check the window index from the function parameter instead of the total number of initialized windows to determine if the specified window is valid.
--- drivers/pci/controller/pcie-mobiveil.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/controller/pcie-mobiveil.c +2 -2
@@ -395,7 +395,7 @@ static void program_ib_windows(struct mobiveil_pcie *pcie, int win_num,int amap_ctrl_dw;u64 size64 = ~(size -1 ); -if ((pcie->ib_wins_configured +1 ) > pcie->ppio_wins) { +if (win_num >= pcie->ppio_wins) {dev_err (&pcie->pdev->dev,"ERROR: max inbound windows reached !\n" );return ;
@@ -429,7 +429,7 @@ static void program_ob_windows(struct mobiveil_pcie *pcie, int win_num,u32 value, type;u64 size64 = ~(size -1 ); -if ((pcie->ob_wins_configured +1 ) > pcie->apio_wins) { +if (win_num >= pcie->apio_wins) {dev_err (&pcie->pdev->dev,"ERROR: max outbound windows reached !\n" );return ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 472/639 ceph: fix "ceph.dir.rctime" vxattr value
In reply to Greg Kroah-HartmanFrom: David Disseldorp <[email protected]>
[ Upstream commit 718807289d4130be1fe13f24f018733116958070 ]
The vxattr value incorrectly places a "09" prefix to the nanoseconds field, instead of providing it as a zero-pad width specifier after '%'.
--- fs/ceph/xattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ceph/xattr.c +1 -1
@@ -221,7 +221,7 @@ static size_t ceph_vxattrcb_dir_rbytes(struct ceph_inode_info *ci, char *val,static size_t ceph_vxattrcb_dir_rctime (struct ceph_inode_info *ci,char *val,size_t size) { -return snprintf (val, size,"%lld.09%ld" , ci->i_rctime.tv_sec, +return snprintf (val, size,"%lld.%09ld" , ci->i_rctime.tv_sec, ci->i_rctime.tv_nsec); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 473/639 net: pasemi: fix an use-after-free in pasemi_mac_phy_init()
In reply to Greg Kroah-HartmanFrom: Wen Yang <[email protected]>
[ Upstream commit faf5577f2498cea23011b5c785ef853ded22700b ]
The phy_dn variable is still being used in of_phy_connect() after the of_node_put() call, which may result in use-after-free.
--- drivers/net/ethernet/pasemi/pasemi_mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/pasemi/pasemi_mac.c +1 -1
@@ -1053,7 +1053,6 @@ static int pasemi_mac_phy_init(struct net_device *dev) dn =pci_device_to_OF_node (mac->pdev); phy_dn =of_parse_phandle (dn,"phy-handle" ,0 ); -of_node_put (phy_dn); mac->link =0 ; mac->speed =0 ;
@@ -1062,6 +1061,7 @@ static int pasemi_mac_phy_init(struct net_device *dev) phydev =of_phy_connect (dev, phy_dn, &pasemi_adjust_link,0 ,PHY_INTERFACE_MODE_SGMII ); +of_node_put (phy_dn);if (!phydev) {printk (KERN_ERR "%s: Could not attach to phy\n" , dev->name);return -ENODEV ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 474/639 net/tls: fix socket wmem accounting on fallback with netem
In reply to Greg Kroah-HartmanFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 5c4b4608fe100838c62591877101128467e56c00 ]
netem runs skb_orphan_partial() which "disconnects" the skb from normal TCP write memory accounting. We should not adjust sk->sk_wmem_alloc on the fallback path for such skbs.
--- net/tls/tls_device_fallback.c | 4 ++++ 1 file changed, 4 insertions(+)
net/tls/tls_device_fallback.c +4 -0
@@ -208,6 +208,10 @@ static void complete_skb(struct sk_buff *nskb, struct sk_buff *skb, int headln)update_chksum (nskb, headln); +/* sock_efree means skb must gone through skb_orphan_partial() */ +if (nskb->destructor == sock_efree) +return ; + delta = nskb->truesize - skb->truesize;if (likely (delta <0 ))WARN_ON_ONCE (refcount_sub_and_test (-delta, &sk->sk_wmem_alloc));
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 475/639 x86/pgtable/32: Fix LOWMEM_PAGES constant
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 26515699863d68058e290e18e83f444925920be5 ]
clang points out that the computation of LOWMEM_PAGES causes a signed integer overflow on 32-bit x86:
arch/x86/kernel/head32.c:83:20: error: signed shift result (0x100000000) requires 34 bits to represent, but 'int' only has 32 bits [-Werror,-Wshift-overflow]
(PAGE_TABLE_SIZE(LOWMEM_PAGES) << PAGE_SHIFT);
^~~~~~~~~~~~
arch/x86/include/asm/pgtable_32.h:109:27: note: expanded from macro 'LOWMEM_PAGES'
#define LOWMEM_PAGES ((((2<<31) - __PAGE_OFFSET) >> PAGE_SHIFT))
~^ ~~arch/x86/include/asm/pgtable_32.h:98:34: note: expanded from macro 'PAGE_TABLE_SIZE'
#define PAGE_TABLE_SIZE(pages) ((pages) / PTRS_PER_PGD)
Use the _ULL() macro to make it a 64-bit constant.
--- arch/x86/include/asm/pgtable_32.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/pgtable_32.h +1 -1
@@ -106,6 +106,6 @@ do { \* with only a host target support using a 32-bit type for internal * representation. */ -#define LOWMEM_PAGES ((((2<<31) - __PAGE_OFFSET) >> PAGE_SHIFT)) +#define LOWMEM_PAGES ((((_ULL(2)<<31) - __PAGE_OFFSET) >> PAGE_SHIFT))#endif /* _ASM_X86_PGTABLE_32_H */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 476/639 xdp: fix possible cq entry leak
In reply to Greg Kroah-HartmanFrom: Ilya Maximets <[email protected]>
[ Upstream commit 675716400da6f15b9d3db04ef74ee74ca9a00af3 ]
Completion queue address reservation could not be undone. In case of bad 'queue_id' or skb allocation failure, reserved entry will be leaked reducing the total capacity of completion queue.
Fix that by moving reservation to the point where failure is not possible. Additionally, 'queue_id' checking moved out from the loop since there is no point to check it there.
--- net/xdp/xsk.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
net/xdp/xsk.c +4 -7
@@ -218,6 +218,9 @@ static int xsk_generic_xmit(struct sock *sk, struct msghdr *m,mutex_lock (&xs->mutex); +if (xs->queue_id >= xs->dev->real_num_tx_queues) + goto out; +while (xskq_peek_desc (xs->tx, &desc)) {char *buffer;u64 addr;
@@ -228,12 +231,6 @@ static int xsk_generic_xmit(struct sock *sk, struct msghdr *m, goto out; } -if (xskq_reserve_addr (xs->umem->cq)) - goto out; - -if (xs->queue_id >= xs->dev->real_num_tx_queues) - goto out; - len = desc.len; skb =sock_alloc_send_skb (sk, len,1 , &err);if (unlikely (!skb)) {
@@ -245,7 +242,7 @@ static int xsk_generic_xmit(struct sock *sk, struct msghdr *m, addr = desc.addr; buffer =xdp_umem_get_data (xs->umem, addr); err =skb_store_bits (skb,0 , buffer, len); -if (unlikely (err)) { +if (unlikely (err) ||xskq_reserve_addr (xs->umem->cq)) {kfree_skb (skb); goto out; }
Signature · 1 line
2.20.1