4.19.87-stable review
Subsystems (7)
Greg Kroah-Hartman
maintainerPATCH 1/306 mlxsw: spectrum_router: Fix determining underlay for a GRE tunnel
In reply to Greg Kroah-HartmanFrom: Petr Machata <[email protected]>
[ Upstream commit 1fc1657775dc1b19e9ac1d46b4054ed8ae5d99ab ]
The helper mlxsw_sp_ipip_dev_ul_tb_id() determines the underlay VRF of a GRE tunnel. For a tunnel without a bound device, it uses the same VRF that the tunnel is in. However in Linux, a GRE tunnel without a bound device uses the main VRF as the underlay. Fix the function accordingly.
mlxsw further assumed that moving a tunnel to a different VRF could cause conflict in local tunnel endpoint address, which cannot be offloaded. However, the only way that an underlay could be changed by moving the tunnel device itself is if the tunnel device does not have a bound device. But in that case the underlay is always the main VRF, so there is no opportunity to introduce a conflict by moving such device. Thus this check constitutes a dead code, and can be removed, which do.
--- drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 19 ------------------ 1 file changed, 1 insertion(+), 18 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +1 -18
@@ -970,7 +970,7 @@ u32 mlxsw_sp_ipip_dev_ul_tb_id(const strif (d)return l3mdev_fib_table (d) ? :RT_TABLE_MAIN ;else -return l3mdev_fib_table (ol_dev) ? :RT_TABLE_MAIN ; +return RT_TABLE_MAIN ; } static struct mlxsw_sp_rif *
@@ -1532,27 +1532,10 @@ static int mlxsw_sp_netdevice_ipip_ol_vr {struct mlxsw_sp_ipip_entry *ipip_entry =mlxsw_sp_ipip_entry_find_by_ol_dev (mlxsw_sp, ol_dev); -enum mlxsw_sp_l3proto ul_proto; -union mlxsw_sp_l3addr saddr; -u32 ul_tb_id;if (!ipip_entry)return 0 ; -/* For flat configuration cases, moving overlay to a different VRF might -* cause local address conflict, and the conflicting tunnels need to be -* demoted. -*/ - ul_tb_id =mlxsw_sp_ipip_dev_ul_tb_id (ol_dev); - ul_proto = mlxsw_sp->router->ipip_ops_arr[ipip_entry->ipipt]->ul_proto; - saddr =mlxsw_sp_ipip_netdev_saddr (ul_proto, ol_dev); -if (mlxsw_sp_ipip_demote_tunnel_by_saddr (mlxsw_sp, ul_proto, - saddr, ul_tb_id, - ipip_entry)) { -mlxsw_sp_ipip_entry_demote_tunnel (mlxsw_sp, ipip_entry); -return 0 ; - } -return __mlxsw_sp_ipip_entry_update_tunnel (mlxsw_sp, ipip_entry, true, false, false, extack); }
Greg Kroah-Hartman
maintainerPATCH 2/306 net/mlx4_en: fix mlx4 ethtool -N insertion
In reply to Greg Kroah-HartmanFrom: Luigi Rizzo <[email protected]>
[ Upstream commit 34e59836565e36fade1464e054a3551c1a0364be ]
ethtool expects ETHTOOL_GRXCLSRLALL to set ethtool_rxnfc->data with the total number of entries in the rx classifier table. Surprisingly, mlx4 is missing this part (in principle ethtool could still move forward and try the insert).
Tested: compiled and run command:
phh13:~# ethtool -N eth1 flow-type udp4 queue 4 Added rule with ID 255
--- drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +1 -0
@@ -1745,6 +1745,7 @@ static int mlx4_en_get_rxnfc(struct net_ err =mlx4_en_get_flow (dev, cmd, cmd->fs.location);break ;case ETHTOOL_GRXCLSRLALL : + cmd->data =MAX_NUM_OF_FS_RULES ;while ((!err || err == -ENOENT ) && priority < cmd->rule_cnt) { err =mlx4_en_get_flow (dev, cmd, i);if (!err)
Greg Kroah-Hartman
maintainerPATCH 3/306 net/mlx4_en: Fix wrong limitation for number of TX rings
In reply to Greg Kroah-HartmanFrom: Tariq Toukan <[email protected]>
[ Upstream commit 2744bf42680f64ebf2ee8a00354897857c073331 ]
XDP_TX rings should not be limited by max_num_tx_rings_p_up. To make sure total number of TX rings never exceed MAX_TX_RINGS, add similar check in mlx4_en_alloc_tx_queue_per_tc(), where a new value is assigned for num_up.
--- drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 8 ++++---- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 9 +++++++++ 2 files changed, 13 insertions(+), 4 deletions(-)
drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +4 -4
@@ -1812,6 +1812,7 @@ static int mlx4_en_set_channels(struct nstruct mlx4_en_dev *mdev = priv->mdev;struct mlx4_en_port_profile new_prof;struct mlx4_en_priv *tmp; +int total_tx_count;int port_up =0 ;int xdp_count;int err =0 ;
@@ -1826,13 +1827,12 @@ static int mlx4_en_set_channels(struct nmutex_lock (&mdev->state_lock); xdp_count = priv->tx_ring_num[TX_XDP ] ? channel->rx_count :0 ; -if (channel->tx_count * priv->prof->num_up + xdp_count > - priv->mdev->profile.max_num_tx_rings_p_up * priv->prof->num_up) { + total_tx_count = channel->tx_count * priv->prof->num_up + xdp_count; +if (total_tx_count >MAX_TX_RINGS ) { err = -EINVAL ;en_err (priv,"Total number of TX and XDP rings (%d) exceeds the maximum supported (%d)\n" , - channel->tx_count * priv->prof->num_up + xdp_count, -MAX_TX_RINGS ); + total_tx_count,MAX_TX_RINGS ); goto out; }
drivers/net/ethernet/mellanox/mlx4/en_netdev.c +9 -0
@@ -92,6 +92,7 @@ int mlx4_en_alloc_tx_queue_per_tc(structstruct mlx4_en_dev *mdev = priv->mdev;struct mlx4_en_port_profile new_prof;struct mlx4_en_priv *tmp; +int total_count;int port_up =0 ;int err =0 ;
@@ -105,6 +106,14 @@ int mlx4_en_alloc_tx_queue_per_tc(structMLX4_EN_NUM_UP_HIGH ; new_prof.tx_ring_num[TX ] = new_prof.num_tx_rings_p_up * new_prof.num_up; + total_count = new_prof.tx_ring_num[TX ] + new_prof.tx_ring_num[TX_XDP ]; +if (total_count >MAX_TX_RINGS ) { + err = -EINVAL ; +en_err (priv, +"Total number of TX and XDP rings (%d) exceeds the maximum supported (%d)\n" , + total_count,MAX_TX_RINGS ); + goto out; + } err =mlx4_en_try_alloc_resources (priv, tmp, &new_prof, true);if (err) goto out;
Greg Kroah-Hartman
maintainerPATCH 4/306 net: rtnetlink: prevent underflows in do_setvfinfo()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit d658c8f56ec7b3de8051a24afb25da9ba3c388c5 ]
The "ivm->vf" variable is a u32, but the problem is that a number of drivers cast it to an int and then forget to check for negatives. An example of this is in the cxgb4 driver.
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
2890 static int cxgb4_mgmt_get_vf_config(struct net_device *dev,
2891 int vf, struct ifla_vf_info *ivi)
^^^^^^
2892 {
2893 struct port_info *pi = netdev_priv(dev);
2894 struct adapter *adap = pi->adapter;
2895 struct vf_info *vfinfo;
2896
2897 if (vf >= adap->num_vfs)
^^^^^^^^^^^^^^^^^^^
2898 return -EINVAL;
2899 vfinfo = &adap->vfinfo[vf];
^^^^^^^^^^^^^^^^^^^^^^^^^^There are 48 functions affected.
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c:8435 hclge_set_vf_vlan_filter() warn: can 'vfid' underflow 's32min-2147483646' drivers/net/ethernet/freescale/enetc/enetc_pf.c:377 enetc_pf_set_vf_mac() warn: can 'vf' underflow 's32min-2147483646' drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c:2899 cxgb4_mgmt_get_vf_config() warn: can 'vf' underflow 's32min-254' drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c:2960 cxgb4_mgmt_set_vf_rate() warn: can 'vf' underflow 's32min-254' drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c:3019 cxgb4_mgmt_set_vf_rate() warn: can 'vf' underflow 's32min-254' drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c:3038 cxgb4_mgmt_set_vf_vlan() warn: can 'vf' underflow 's32min-254' drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c:3086 cxgb4_mgmt_set_vf_link_state() warn: can 'vf' underflow 's32min-254' drivers/net/ethernet/chelsio/cxgb/cxgb2.c:791 get_eeprom() warn: can 'i' underflow 's32min-(-4),0,4-s32max' drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c:82 bnxt_set_vf_spoofchk() warn: can 'vf_id' underflow 's32min-65534' drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c:164 bnxt_set_vf_trust() warn: can 'vf_id' underflow 's32min-65534' drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c:186 bnxt_get_vf_config() warn: can 'vf_id' underflow 's32min-65534' drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c:228 bnxt_set_vf_mac() warn: can 'vf_id' underflow 's32min-65534' drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c:264 bnxt_set_vf_vlan() warn: can 'vf_id' underflow 's32min-65534' drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c:293 bnxt_set_vf_bw() warn: can 'vf_id' underflow 's32min-65534' drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c:333 bnxt_set_vf_link_state() warn: can 'vf_id' underflow 's32min-65534' drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c:2595 bnx2x_vf_op_prep() warn: can 'vfidx' underflow 's32min-63' drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c:2595 bnx2x_vf_op_prep() warn: can 'vfidx' underflow 's32min-63' drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c:2281 bnx2x_post_vf_bulletin() warn: can 'vf' underflow 's32min-63' drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c:2285 bnx2x_post_vf_bulletin() warn: can 'vf' underflow 's32min-63' drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c:2286 bnx2x_post_vf_bulletin() warn: can 'vf' underflow 's32min-63' drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c:2292 bnx2x_post_vf_bulletin() warn: can 'vf' underflow 's32min-63' drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c:2297 bnx2x_post_vf_bulletin() warn: can 'vf' underflow 's32min-63' drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c:1832 qlcnic_sriov_set_vf_mac() warn: can 'vf' underflow 's32min-254' drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c:1864 qlcnic_sriov_set_vf_tx_rate() warn: can 'vf' underflow 's32min-254' drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c:1937 qlcnic_sriov_set_vf_vlan() warn: can 'vf' underflow 's32min-254' drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c:2005 qlcnic_sriov_get_vf_config() warn: can 'vf' underflow 's32min-254' drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c:2036 qlcnic_sriov_set_vf_spoofchk() warn: can 'vf' underflow 's32min-254' drivers/net/ethernet/emulex/benet/be_main.c:1914 be_get_vf_config() warn: can 'vf' underflow 's32min-65534' drivers/net/ethernet/emulex/benet/be_main.c:1915 be_get_vf_config() warn: can 'vf' underflow 's32min-65534' drivers/net/ethernet/emulex/benet/be_main.c:1922 be_set_vf_tvt() warn: can 'vf' underflow 's32min-65534' drivers/net/ethernet/emulex/benet/be_main.c:1951 be_clear_vf_tvt() warn: can 'vf' underflow 's32min-65534' drivers/net/ethernet/emulex/benet/be_main.c:2063 be_set_vf_tx_rate() warn: can 'vf' underflow 's32min-65534' drivers/net/ethernet/emulex/benet/be_main.c:2091 be_set_vf_link_state() warn: can 'vf' underflow 's32min-65534' drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c:2609 ice_set_vf_port_vlan() warn: can 'vf_id' underflow 's32min-65534' drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c:3050 ice_get_vf_cfg() warn: can 'vf_id' underflow 's32min-65534' drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c:3103 ice_set_vf_spoofchk() warn: can 'vf_id' underflow 's32min-65534' drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c:3181 ice_set_vf_mac() warn: can 'vf_id' underflow 's32min-65534' drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c:3237 ice_set_vf_trust() warn: can 'vf_id' underflow 's32min-65534' drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c:3286 ice_set_vf_link_state() warn: can 'vf_id' underflow 's32min-65534' drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:3919 i40e_validate_vf() warn: can 'vf_id' underflow 's32min-2147483646' drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:3957 i40e_ndo_set_vf_mac() warn: can 'vf_id' underflow 's32min-2147483646' drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:4104 i40e_ndo_set_vf_port_vlan() warn: can 'vf_id' underflow 's32min-2147483646' drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:4263 i40e_ndo_set_vf_bw() warn: can 'vf_id' underflow 's32min-2147483646' drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:4309 i40e_ndo_get_vf_config() warn: can 'vf_id' underflow 's32min-2147483646' drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:4371 i40e_ndo_set_vf_link_state() warn: can 'vf_id' underflow 's32min-2147483646' drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:4441 i40e_ndo_set_vf_spoofchk() warn: can 'vf_id' underflow 's32min-2147483646' drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:4441 i40e_ndo_set_vf_spoofchk() warn: can 'vf_id' underflow 's32min-2147483646' drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:4504 i40e_ndo_set_vf_trust() warn: can 'vf_id' underflow 's32min-2147483646'
--- net/core/rtnetlink.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-)
net/core/rtnetlink.c +22 -1
@@ -2126,6 +2126,8 @@ static int do_setvfinfo(struct net_devicif (tb[IFLA_VF_MAC ]) {struct ifla_vf_mac *ivm =nla_data (tb[IFLA_VF_MAC ]); +if (ivm->vf >=INT_MAX ) +return -EINVAL ; err = -EOPNOTSUPP ;if (ops->ndo_set_vf_mac) err = ops->ndo_set_vf_mac(dev, ivm->vf,
@@ -2137,6 +2139,8 @@ static int do_setvfinfo(struct net_devicif (tb[IFLA_VF_VLAN ]) {struct ifla_vf_vlan *ivv =nla_data (tb[IFLA_VF_VLAN ]); +if (ivv->vf >=INT_MAX ) +return -EINVAL ; err = -EOPNOTSUPP ;if (ops->ndo_set_vf_vlan) err = ops->ndo_set_vf_vlan(dev, ivv->vf, ivv->vlan,
@@ -2169,6 +2173,8 @@ static int do_setvfinfo(struct net_devicif (len ==0 )return -EINVAL ; +if (ivvl[0 ]->vf >=INT_MAX ) +return -EINVAL ; err = ops->ndo_set_vf_vlan (dev, ivvl[0 ]->vf, ivvl[0 ]->vlan, ivvl[0 ]->qos, ivvl[0 ]->vlan_proto);if (err <0 )
@@ -2179,6 +2185,8 @@ static int do_setvfinfo(struct net_devicstruct ifla_vf_tx_rate *ivt =nla_data (tb[IFLA_VF_TX_RATE ]);struct ifla_vf_info ivf; +if (ivt->vf >=INT_MAX ) +return -EINVAL ; err = -EOPNOTSUPP ;if (ops->ndo_get_vf_config) err = ops->ndo_get_vf_config (dev, ivt->vf, &ivf);
@@ -2197,6 +2205,8 @@ static int do_setvfinfo(struct net_devicif (tb[IFLA_VF_RATE ]) {struct ifla_vf_rate *ivt =nla_data (tb[IFLA_VF_RATE ]); +if (ivt->vf >=INT_MAX ) +return -EINVAL ; err = -EOPNOTSUPP ;if (ops->ndo_set_vf_rate) err = ops->ndo_set_vf_rate(dev, ivt->vf,
@@ -2209,6 +2219,8 @@ static int do_setvfinfo(struct net_devicif (tb[IFLA_VF_SPOOFCHK ]) {struct ifla_vf_spoofchk *ivs =nla_data (tb[IFLA_VF_SPOOFCHK ]); +if (ivs->vf >=INT_MAX ) +return -EINVAL ; err = -EOPNOTSUPP ;if (ops->ndo_set_vf_spoofchk) err = ops->ndo_set_vf_spoofchk(dev, ivs->vf,
@@ -2220,6 +2232,8 @@ static int do_setvfinfo(struct net_devicif (tb[IFLA_VF_LINK_STATE ]) {struct ifla_vf_link_state *ivl =nla_data (tb[IFLA_VF_LINK_STATE ]); +if (ivl->vf >=INT_MAX ) +return -EINVAL ; err = -EOPNOTSUPP ;if (ops->ndo_set_vf_link_state) err = ops->ndo_set_vf_link_state(dev, ivl->vf,
@@ -2233,6 +2247,8 @@ static int do_setvfinfo(struct net_devic err = -EOPNOTSUPP ; ivrssq_en =nla_data (tb[IFLA_VF_RSS_QUERY_EN ]); +if (ivrssq_en->vf >=INT_MAX ) +return -EINVAL ;if (ops->ndo_set_vf_rss_query_en) err = ops->ndo_set_vf_rss_query_en (dev, ivrssq_en->vf, ivrssq_en->setting);
@@ -2243,6 +2259,8 @@ static int do_setvfinfo(struct net_devicif (tb[IFLA_VF_TRUST ]) {struct ifla_vf_trust *ivt =nla_data (tb[IFLA_VF_TRUST ]); +if (ivt->vf >=INT_MAX ) +return -EINVAL ; err = -EOPNOTSUPP ;if (ops->ndo_set_vf_trust) err = ops->ndo_set_vf_trust (dev, ivt->vf, ivt->setting);
@@ -2253,15 +2271,18 @@ static int do_setvfinfo(struct net_devicif (tb[IFLA_VF_IB_NODE_GUID ]) {struct ifla_vf_guid *ivt =nla_data (tb[IFLA_VF_IB_NODE_GUID ]); +if (ivt->vf >=INT_MAX ) +return -EINVAL ;if (!ops->ndo_set_vf_guid)return -EOPNOTSUPP ; -return handle_vf_guid (dev, ivt,IFLA_VF_IB_NODE_GUID ); }if (tb[IFLA_VF_IB_PORT_GUID ]) {struct ifla_vf_guid *ivt =nla_data (tb[IFLA_VF_IB_PORT_GUID ]); +if (ivt->vf >=INT_MAX ) +return -EINVAL ;if (!ops->ndo_set_vf_guid)return -EOPNOTSUPP ;
Greg Kroah-Hartman
maintainerPATCH 6/306 net: sched: ensure opts_len <= IP_TUNNEL_OPTS_MAX in act_tunnel_key
In reply to Greg Kroah-HartmanFrom: Xin Long <[email protected]>
[ Upstream commit 4f0e97d070984d487df027f163e52bb72d1713d8 ]
info->options_len is 'u8' type, and when opts_len with a value > IP_TUNNEL_OPTS_MAX, 'info->options_len = opts_len' will cast int to u8 and set a wrong value to info->options_len.
Kernel crashed in my test when doing:
# opts="0102:80:00800022"
# for i in {1..99}; do opts="$opts,0102:80:00800022"; done
# ip link add name geneve0 type geneve dstport 0 external
# tc qdisc add dev eth0 ingress
# tc filter add dev eth0 protocol ip parent ffff: \
flower indev eth0 ip_proto udp action tunnel_key \
set src_ip 10.0.99.192 dst_ip 10.0.99.193 \
dst_port 6081 id 11 geneve_opts $opts \
action mirred egress redirect dev geneve0So we should do the similar check as cls_flower does, return error when opts_len > IP_TUNNEL_OPTS_MAX in tunnel_key_copy_opts().
--- net/sched/act_tunnel_key.c | 4 ++++ 1 file changed, 4 insertions(+)
net/sched/act_tunnel_key.c +4 -0
@@ -137,6 +137,10 @@ static int tunnel_key_copy_opts(const stif (opt_len <0 )return opt_len; opts_len += opt_len; +if (opts_len >IP_TUNNEL_OPTS_MAX ) { +NL_SET_ERR_MSG (extack,"Tunnel options exceeds max size" ); +return -EINVAL ; + }if (dst) { dst_len -= opt_len; dst += opt_len;
Greg Kroah-Hartman
maintainercover 4.19.87-stable review
This is the start of the stable review cycle for the 4.19.87 release. There are 306 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 29 Nov 2019 20:18:09 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.87-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.19.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.19.87-rc1
Michael Ellerman <[email protected]>
KVM: PPC: Book3S HV: Flush link stack on guest exit to host kernel
Michael Ellerman <[email protected]>
powerpc/book3s64: Fix link stack flush on context switch
Christopher M. Riedl <[email protected]>
powerpc/64s: support nospectre_v2 cmdline option
Bernd Porr <[email protected]>
staging: comedi: usbduxfast: usbduxfast_ai_cmdtest rounding error
Aleksander Morgado <[email protected]>
USB: serial: option: add support for Foxconn T77W968 LTE modules
Aleksander Morgado <[email protected]>
USB: serial: option: add support for DW5821e with eSIM support
Johan Hovold <[email protected]>
USB: serial: mos7840: fix remote wakeup
Johan Hovold <[email protected]>
USB: serial: mos7720: fix remote wakeup
Pavel Löbl <[email protected]>
USB: serial: mos7840: add USB ID to support Moxa UPort 2210
Oliver Neukum <[email protected]>
appledisplay: fix error handling in the scheduled work
Oliver Neukum <[email protected]>
USB: chaoskey: fix error case of a timeout
Greg Kroah-Hartman <[email protected]>
usb-serial: cp201x: support Mark-10 digital force gauge
Suwan Kim <[email protected]>
usbip: Fix uninitialized symbol 'nents' in stub_recv_cmd_submit()
Hewenliang <[email protected]>
usbip: tools: fix fd leakage in the function of read_attr_usbip_status
Oliver Neukum <[email protected]>
USBIP: add config dependency for SGL_ALLOC
Halil Pasic <[email protected]>
virtio_ring: fix return code on DMA mapping fails
Sean Young <[email protected]>
media: imon: invalid dereference in imon_touch_event
Vito Caputo <[email protected]>
media: cxusb: detect cxusb_ctrl_msg error in query
Oliver Neukum <[email protected]>
media: b2c2-flexcop-usb: add sanity checking
Laurent Pinchart <[email protected]>
media: uvcvideo: Fix error path in control parsing failure
Kai Shen <[email protected]>
cpufreq: Add NULL checks to show() and store() methods of cpufreq
Alan Stern <[email protected]>
media: usbvision: Fix races among open, close, and disconnect
Alexander Popov <[email protected]>
media: vivid: Fix wrong locking that causes race conditions on streaming stop
Vandana BN <[email protected]>
media: vivid: Set vid_cap_streaming and vid_out_streaming to true
Jouni Hogander <[email protected]>
net-sysfs: Fix reference count leak in rx|netdev_queue_add_kobject
Oliver Neukum <[email protected]>
nfc: port100: handle command failure cleanly
Takashi Iwai <[email protected]>
ALSA: usb-audio: Fix NULL dereference at parsing BADD
Yang Tao <[email protected]>
futex: Prevent robust futex exit race
Arnd Bergmann <[email protected]>
y2038: futex: Move compat implementation into futex.c
Andy Lutomirski <[email protected]>
x86/entry/32: Fix FIXUP_ESPFIX_STACK with user CR3
Ingo Molnar <[email protected]>
x86/pti/32: Calculate the various PTI cpu_entry_area sizes correctly, make the CPU_ENTRY_AREA_PAGES assert precise
Andy Lutomirski <[email protected]>
selftests/x86/sigreturn/32: Invalidate DS and ES when abusing the kernel
Andy Lutomirski <[email protected]>
selftests/x86/mov_ss_trap: Fix the SYSENTER test
Thomas Gleixner <[email protected]>
x86/cpu_entry_area: Add guard page for entry stack on 32bit
Thomas Gleixner <[email protected]>
x86/pti/32: Size initial_page_table correctly
Andy Lutomirski <[email protected]>
x86/doublefault/32: Fix stack canaries in the double fault handler
Navid Emamdoost <[email protected]>
nbd: prevent memory leak
Waiman Long <[email protected]>
x86/speculation: Fix redundant MDS mitigation message
Waiman Long <[email protected]>
x86/speculation: Fix incorrect MDS/TAA mitigation status
Alexander Kapshuk <[email protected]>
x86/insn: Fix awk regexp warnings
Alexey Brodkin <[email protected]>
ARC: perf: Accommodate big-endian CPU
Chester Lin <[email protected]>
ARM: 8904/1: skip nomap memblocks while finding the lowmem/highmem boundary
Gang He <[email protected]>
ocfs2: remove ocfs2_is_o2cb_active()
Max Uvarov <[email protected]>
net: phy: dp83867: increase SGMII autoneg timer duration
Max Uvarov <[email protected]>
net: phy: dp83867: fix speed 10 in sgmii mode
David Hildenbrand <[email protected]>
mm/memory_hotplug: don't access uninitialized memmaps in shrink_zone_span()
John Pittman <[email protected]>
md/raid10: prevent access of uninitialized resync_pages offset
Denis Efremov <[email protected]>
ath9k_hw: fix uninitialized variable data
Hui Peng <[email protected]>
ath10k: Fix a NULL-ptr-deref bug in ath10k_usb_alloc_urb_from_pipe
Sean Christopherson <[email protected]>
KVM: MMU: Do not treat ZONE_DEVICE pages as being reserved
Tomas Bortoli <[email protected]>
Bluetooth: Fix invalid-free in bcsp_close()
Vinayak Menon <[email protected]>
mm/page_io.c: do not free shared swap slots
Johannes Berg <[email protected]>
cfg80211: call disconnect_wk when AP stops
David Ahern <[email protected]>
ipv6: Fix handling of LLA with VRF and sockets bound to VRF
zhong jiang <[email protected]>
mm/memory_hotplug: Do not unlock when fails to take the device_hotplug_lock
Masahiro Yamada <[email protected]>
i2c: uniphier-f: fix timeout error after reading 8 bytes
Vignesh R <[email protected]>
spi: omap2-mcspi: Fix DMA and FIFO event trigger size mismatch
Igor Konopko <[email protected]>
nvme-pci: fix surprise removal
Kishon Vijay Abraham I <[email protected]>
PCI: keystone: Use quirk to limit MRRS for K2G
Nathan Chancellor <[email protected]>
pinctrl: zynq: Use define directive for PIN_CONFIG_IO_STANDARD
Nathan Chancellor <[email protected]>
pinctrl: lpc18xx: Use define directive for PIN_CONFIG_GPIO_PIN_INT
Nathan Chancellor <[email protected]>
pinctrl: bcm2835: Use define directive for BCM2835_PINCONF_PARAM_PULL
Brian Masney <[email protected]>
pinctrl: qcom: spmi-gpio: fix gpio-hog related boot issues
Sriram R <[email protected]>
cfg80211: Prevent regulatory restore during STA disconnect in concurrent interfaces
Quentin Monnet <[email protected]>
tools: bpftool: pass an argument to silence open_obj_pinned()
Frank Rowand <[email protected]>
of: unittest: initialize args before calling of_*parse_*()
Frank Rowand <[email protected]>
of: unittest: allow base devicetree to have symbol metadata
David Barmann <[email protected]>
sock: Reset dst when changing sk_mark via setsockopt
YueHaibing <[email protected]>
net: bcmgenet: return correct value 'ret' from bcmgenet_power_down
Colin Ian King <[email protected]>
ACPICA: Use %d for signed int print formatting instead of %u
Dmitry Osipenko <[email protected]>
clk: tegra20: Turn EMC clock gate into divider
Mike Manning <[email protected]>
vrf: mark skb for multicast or link-local as enslaved to VRF
Tycho Andersen <[email protected]>
dlm: don't leak kernel pointer to userspace
Tycho Andersen <[email protected]>
dlm: fix invalid free
Badhri Jagan Sridharan <[email protected]>
usb: typec: tcpm: charge current handling for sink during hard reset
James Smart <[email protected]>
scsi: lpfc: Correct loss of fc4 type on remote port address change
James Smart <[email protected]>
scsi: lpfc: Fix odd recovery in duplicate FLOGIs in point-to-point
James Smart <[email protected]>
scsi: lpfc: fcoe: Fix link down issue after 1000+ link bounces
Shivasharan S <[email protected]>
scsi: megaraid_sas: Fix goto labels in error handling
Shivasharan S <[email protected]>
scsi: megaraid_sas: Fix msleep granularity
Suganath Prabu <[email protected]>
scsi: mpt3sas: Fix driver modifying persistent data in Manufacturing page11
Suganath Prabu <[email protected]>
scsi: mpt3sas: Don't modify EEDPTagMode field setting on SAS3.5 HBA devices
Suganath Prabu <[email protected]>
scsi: mpt3sas: Fix Sync cache command failure during driver unload
Florian Fainelli <[email protected]>
net: dsa: bcm_sf2: Turn on PHY to allow successful registration
Shaokun Zhang <[email protected]>
rtlwifi: rtl8192de: Fix misleading REG_MCUFWDL information
Dan Carpenter <[email protected]>
wireless: airo: potential buffer overflow in sprintf()
Ali MJ Al-Nasrawy <[email protected]>
brcmsmac: never log "tid x is not agg'able" by default
Gustavo A. R. Silva <[email protected]>
rtl8xxxu: Fix missing break in switch
Christophe JAILLET <[email protected]>
wlcore: Fix the return value in case of error in 'wlcore_vendor_cmd_smart_config_start()'
Brian Norris <[email protected]>
ath10k: snoc: fix unbalanced clock error handling
Lior David <[email protected]>
wil6210: fix locking in wmi_call
Maya Erez <[email protected]>
wil6210: fix RGF_CAF_ICR address for Talyn-MB
Maya Erez <[email protected]>
wil6210: fix L2 RX status handling
Ahmad Masri <[email protected]>
wil6210: fix debugfs memory access alignment
Arnd Bergmann <[email protected]>
btrfs: avoid link error with CONFIG_NO_AUTO_INLINE
Chiranjeevi Rapolu <[email protected]>
media: ov13858: Check for possible null pointer
Nickhu <[email protected]>
nds32: Fix bug in bitfield.h
Taehee Yoo <[email protected]>
net: bpfilter: fix iptables failure if bpfilter_umh is disabled
Andrei Vagin <[email protected]>
sock_diag: fix autoloading of the raw_diag module
Richard Guy Briggs <[email protected]>
audit: print empty EXECVE args
Florian Fainelli <[email protected]>
soc: bcm: brcmstb: Fix re-entry point with a THUMB2_KERNEL
Icenowy Zheng <[email protected]>
clk: sunxi-ng: enable so-said LDOs for A64 SoC's pll-mipi clock
Leonard Crestez <[email protected]>
ARM: dts: imx6sx-sdb: Fix enet phy regulator
Arnd Bergmann <[email protected]>
openvswitch: fix linking without CONFIG_NF_CONNTRACK_LABELS
Valentin Schneider <[email protected]>
sched/fair: Don't increase sd->balance_interval on newidle balance
Peter Zijlstra <[email protected]>
sched/topology: Fix off by one bug
Eric Dumazet <[email protected]>
net: do not abort bulk send on BQL status
Larry Chen <[email protected]>
ocfs2: fix clusters leak in ocfs2_defrag_extent()
Changwei Ge <[email protected]>
ocfs2: don't put and assigning null to bh allocated outside
Changwei Ge <[email protected]>
ocfs2: don't use iocb when EIOCBQUEUED returns
Guozhonghua <[email protected]>
ocfs2: without quota support, avoid calling quota recovery
Roman Gushchin <[email protected]>
mm: handle no memcg case in memcg_kmem_charge() properly
Len Brown <[email protected]>
tools/power turbosat: fix AMD APIC-id output
Victor Kamensky <[email protected]>
arm64: makefile fix build of .i file in external module case
Keith Busch <[email protected]>
nvme-pci: fix conflicting p2p resource adds
Michael Kelley <[email protected]>
irq/matrix: Fix memory overallocation
Dave Jiang <[email protected]>
ntb: intel: fix return value for ndev_vec_mask()
Jon Mason <[email protected]>
ntb_netdev: fix sleep time mismatch
Huazhong Tan <[email protected]>
net: hns3: bugfix for hclge_mdio_write and hclge_mdio_read
Huazhong Tan <[email protected]>
net: hns3: bugfix for is_valid_csq_clean_head()
Huazhong Tan <[email protected]>
net: hns3: bugfix for reporting unknown vector0 interrupt repeatly problem
Huazhong Tan <[email protected]>
net: hns3: bugfix for buffer not free problem during resetting
Jacob Keller <[email protected]>
fm10k: ensure completer aborts are marked as non-fatal after a resume
Miroslav Lichvar <[email protected]>
igb: shorten maximum PHC timecounter update interval
David Hildenbrand <[email protected]>
powerpc/powernv: hold device_hotplug_lock when calling device_online()
David Hildenbrand <[email protected]>
mm/memory_hotplug: fix online/offline_pages called w.o. mem_hotplug_lock
David Hildenbrand <[email protected]>
mm/memory_hotplug: make add_memory() take the device_hotplug_lock
Borislav Petkov <[email protected]>
kernel/panic.c: do not append newline to the stack protector panic string
Colin Ian King <[email protected]>
fs/hfs/extent.c: fix array out of bounds read of array extent
Ernesto A. Fernández <[email protected]>
hfs: update timestamp on truncate()
Ernesto A. Fernández <[email protected]>
hfsplus: update timestamps on truncate()
Ernesto A. Fernández <[email protected]>
hfs: fix return value of hfs_get_block()
Ernesto A. Fernández <[email protected]>
hfsplus: fix return value of hfsplus_get_block()
Ernesto A. Fernández <[email protected]>
hfs: prevent btree data loss on ENOSPC
Ernesto A. Fernández <[email protected]>
hfsplus: prevent btree data loss on ENOSPC
Ernesto A. Fernández <[email protected]>
hfs: fix BUG on bnode parent update
Ernesto A. Fernández <[email protected]>
hfsplus: fix BUG on bnode parent update
Rasmus Villemoes <[email protected]>
lib/bitmap.c: fix remaining space computation in bitmap_print_to_pagebuf
Rasmus Villemoes <[email protected]>
linux/bitmap.h: fix type of nbits in bitmap_shift_right()
Rasmus Villemoes <[email protected]>
linux/bitmap.h: handle constant zero-size bitmaps correctly
Dan Carpenter <[email protected]>
mm/gup_benchmark.c: prevent integer overflow in ioctl
Ming Lei <[email protected]>
block: call rq_qos_exit() after queue is frozen
Michael Ellerman <[email protected]>
selftests/powerpc/cache_shape: Fix out-of-tree build
Michael Ellerman <[email protected]>
selftests/powerpc/switch_endian: Fix out-of-tree build
Joel Stanley <[email protected]>
selftests/powerpc/signal: Fix out-of-tree build
Joel Stanley <[email protected]>
selftests/powerpc/ptrace: Fix out-of-tree build
Joel Stanley <[email protected]>
powerpc/xmon: Relax frame size for clang
Hangbin Liu <[email protected]>
ipv4/igmp: fix v1/v2 switchback timeout based on rfc3376, 8.12
Darrick J. Wong <[email protected]>
vfs: avoid problematic remapping requests into partial EOF block
Anton Ivanov <[email protected]>
um: Make line/tty semantics use true write IRQ
Masahiro Yamada <[email protected]>
i2c: uniphier-f: fix race condition when IRQ is cleared
Masahiro Yamada <[email protected]>
i2c: uniphier-f: fix occasional timeout error
Masahiro Yamada <[email protected]>
i2c: uniphier-f: make driver robust against concurrency
Jianchao Wang <[email protected]>
block: fix the DISCARD request merge
Sabrina Dubroca <[email protected]>
macsec: let the administrator set UP state even if lowerdev is down
Sabrina Dubroca <[email protected]>
macsec: update operstate when lower device changes
Andrea Arcangeli <[email protected]>
mm: thp: fix MADV_DONTNEED vs migrate_misplaced_transhuge_page race condition
Keith Busch <[email protected]>
tools/testing/selftests/vm/gup_benchmark.c: fix 'write' flag usage
Dave Chinner <[email protected]>
mm/page-writeback.c: fix range_cyclic writeback vs writepages deadlock
Jia-Ju Bai <[email protected]>
fs/ocfs2/dlm/dlmdebug.c: fix a sleep-in-atomic-context bug in dlm_print_one_mle()
Andrey Ryabinin <[email protected]>
arm64: lib: use C string functions with KASAN enabled
David S. Miller <[email protected]>
sparc64: Rework xchg() definition to avoid warnings.
Felipe Rechia <[email protected]>
powerpc/process: Fix flush_all_to_thread for SPE
Martin Lau <[email protected]>
bpf, btf: fix a missing check bug in btf_parse
Taehee Yoo <[email protected]>
bpf: devmap: fix wrong interface selection in notifier_call
Tristram Ha <[email protected]>
net: ethernet: cadence: fix socket buffer corruption problem
Geert Uytterhoeven <[email protected]>
thermal: rcar_thermal: Prevent hardware access during system suspend
Sergei Shtylyov <[email protected]>
thermal: rcar_thermal: fix duplicate IRQ request
Peng Hao <[email protected]>
selftests: fix warning: "_GNU_SOURCE" redefined
Andrea Parri <[email protected]>
selftests: kvm: Fix -Wformat warnings
Jerry Hoemann <[email protected]>
selftests: watchdog: Fix error message.
Shuah Khan (Samsung OSG) <[email protected]>
selftests: watchdog: fix message when /dev/watchdog open fails
Masami Hiramatsu <[email protected]>
selftests/ftrace: Fix to test kprobe $comm arg only if available
Keiji Hayashibara <[email protected]>
spi: uniphier: fix incorrect property items
Garry McNulty <[email protected]>
fs/cifs: fix uninitialised variable warnings
Masahisa Kojima <[email protected]>
net: socionext: Stop PHY before resetting netsec
Marek Szyprowski <[email protected]>
mfd: max8997: Enale irq-wakeup unconditionally
Andy Shevchenko <[email protected]>
mfd: intel_soc_pmic_bxtwc: Chain power button IRQs as well
Fabio Estevam <[email protected]>
mfd: mc13xxx-core: Fix PMIC shutdown when reading ADC values
Sapthagiri Baratam <[email protected]>
mfd: arizona: Correct calling of runtime_put_sync
Ivan Khoronzhuk <[email protected]>
net: ethernet: ti: cpsw: unsync mcast entries while switch promisc mode
Dan Carpenter <[email protected]>
qlcnic: fix a return in qlcnic_dcb_get_capability()
Nathan Chancellor <[email protected]>
mISDN: Fix type of switch control variable in ctrl_teimanager
Chao Yu <[email protected]>
f2fs: spread f2fs_set_inode_flags()
Chao Yu <[email protected]>
f2fs: fix to spread clear_cold_data()
Dan Carpenter <[email protected]>
thermal: armada: fix a test in probe()
Vincent Chen <[email protected]>
RISC-V: Avoid corrupting the upper 32-bit of phys_addr_t in ioremap
Nathan Chancellor <[email protected]>
rtc: s35390a: Change buf's type to u8 in s35390a_init
Luis Henriques <[email protected]>
ceph: only allow punch hole mode in fallocate
Yan, Zheng <[email protected]>
ceph: fix dentry leak in ceph_readdir_prepopulate
Quentin Monnet <[email protected]>
tools: bpftool: fix completion for "bpftool map update"
Quentin Monnet <[email protected]>
selftests/bpf: fix return value comparison for tests in test_libbpf.sh
Nicholas Piggin <[email protected]>
powerpc/64s/radix: Fix radix__flush_tlb_collapsed_pmd double flushing pmd
Michael Ellerman <[email protected]>
powerpc/mm/radix: Fix small page at boundary when splitting
Michael Ellerman <[email protected]>
powerpc/mm/radix: Fix overuse of small pages in splitting logic
Michael Ellerman <[email protected]>
powerpc/mm/radix: Fix off-by-one in split mapping logic
Aravinda Prasad <[email protected]>
powerpc/pseries: Export raw per-CPU VPA data via debugfs
Gustavo A. R. Silva <[email protected]>
scsi: hisi_sas: Fix NULL pointer dereference
David S. Miller <[email protected]>
sparc: Fix parport build warnings.
Jithu Joseph <[email protected]>
x86/intel_rdt: Prevent pseudo-locking from using stale pointers
Vignesh R <[email protected]>
spi: omap2-mcspi: Set FIFO DMA trigger level to word length
Christoph Hellwig <[email protected]>
swiotlb: do not panic on mapping failures
Thomas Richter <[email protected]>
s390/perf: Return error when debug_register fails
Nathan Chancellor <[email protected]>
atm: zatm: Fix empty body Clang warnings
J. Bruce Fields <[email protected]>
sunrpc: safely reallow resvport min/max inversion
Trond Myklebust <[email protected]>
SUNRPC: Fix a compile warning for cmpxchg64()
Peng Hao <[email protected]>
selftests/bpf: fix file resource leak in load_kallsyms
Heinz Mauelshagen <[email protected]>
dm raid: avoid bitmap with raid4/5/6 journal device
Xin Long <[email protected]>
sctp: use sk_wmem_queued to check for writable space
Colin Ian King <[email protected]>
usbip: tools: fix atoi() on non-null terminated string
Mattias Jacobsson <[email protected]>
USB: misc: appledisplay: fix backlight update_status return code
Jon Derrick <[email protected]>
PCI: vmd: Detach resources after stopping root bus
Benjamin Herrenschmidt <[email protected]>
macintosh/windfarm_smu_sat: Fix debug output
Philipp Klocke <[email protected]>
ALSA: i2c/cs8427: Fix int to char conversion
Ulf Hansson <[email protected]>
PM / Domains: Deal with multiple states but no governor in genpd
Hans de Goede <[email protected]>
ACPI / scan: Create platform device for INT33FE ACPI nodes
Steven Rostedt (VMware) <[email protected]>
kprobes, x86/ptrace.h: Make regs_get_kernel_stack_nth() not fault on bad stack
Brian Foster <[email protected]>
xfs: clear ail delwri queued bufs on unmount of shutdown fs
Dave Chinner <[email protected]>
xfs: fix use-after-free race in xfs_buf_rele
Netanel Belgazal <[email protected]>
net: ena: Fix Kconfig dependency on X86
Kyeongdon Kim <[email protected]>
net: fix warning in af_unix
Marek Behún <[email protected]>
net: dsa: mv88e6xxx: Fix 88E6141/6341 2500mbps SERDES speed
Finn Thain <[email protected]>
scsi: zorro_esp: Limit DMA transfers to 65535 bytes
Christoph Hellwig <[email protected]>
scsi: dc395x: fix DMA API usage in sg_update_list
Christoph Hellwig <[email protected]>
scsi: dc395x: fix dma API usage in srb_done
Marcel Ziswiler <[email protected]>
ASoC: tegra_sgtl5000: fix device_node refcounting
Alexandre Belloni <[email protected]>
clk: at91: audio-pll: fix audio pmc type
Lubomir Rintel <[email protected]>
clk: mmp2: fix the clock id for sdh2_clk and sdh3_clk
Honghui Zhang <[email protected]>
PCI: mediatek: Fixup MSI enablement logic by enabling MSI before clocks
Keith Busch <[email protected]>
nvme-pci: fix hot removal during error handling
Bart Van Assche <[email protected]>
nvmet-fcloop: suppress a compiler warning
Bart Van Assche <[email protected]>
nvmet: avoid integer overflow in the discard code
Nathan Chancellor <[email protected]>
crypto: ccree - avoid implicit enum conversion
Nathan Chancellor <[email protected]>
scsi: iscsi_tcp: Explicitly cast param in iscsi_sw_tcp_host_get_param
Nathan Chancellor <[email protected]>
scsi: bfa: Avoid implicit enum conversion in bfad_im_post_vendor_event
Nathan Chancellor <[email protected]>
scsi: isci: Change sci_controller_start_task's return type to sci_status
Nathan Chancellor <[email protected]>
scsi: isci: Use proper enumerated type in atapi_d2h_reg_frame_handler
Joseph Lo <[email protected]>
clk: tegra: Fixes for MBIST work around
Uros Bizjak <[email protected]>
KVM/x86: Fix invvpid and invept register operand size in 64-bit mode
Sean Christopherson <[email protected]>
KVM: nVMX: move check_vmentry_postreqs() call to nested_vmx_enter_non_root_mode()
Sean Christopherson <[email protected]>
KVM: nVMX: reset cache/shadows when switching loaded VMCS
Jakub Kicinski <[email protected]>
nfp: bpf: protect against mis-initializing atomic counters
Gustavo A. R. Silva <[email protected]>
scsi: ips: fix missing break in switch
Rahul Verma <[email protected]>
qed: Align local and global PTT to propagate through the APIs.
Omar Sandoval <[email protected]>
amiflop: clean up on errors during setup
Hans de Goede <[email protected]>
pwm: lpss: Only set update bit if we are actually changing the settings
Christophe JAILLET <[email protected]>
pinctrl: sunxi: Fix a memory leak in 'sunxi_pinctrl_build_state()'
Selvin Xavier <[email protected]>
RDMA/bnxt_re: Avoid resource leak in case the NQ registration fails
Devesh Sharma <[email protected]>
RDMA/bnxt_re: Fix qp async event reporting
Selvin Xavier <[email protected]>
RDMA/bnxt_re: Avoid NULL check after accessing the pointer
Xiang Chen <[email protected]>
scsi: hisi_sas: Free slot later in slot_complete_vx_hw()
Xiang Chen <[email protected]>
scsi: hisi_sas: Fix the race between IO completion and timeout for SMP/internal IO
Luo Jiaxing <[email protected]>
scsi: hisi_sas: Feed back linkrate(max/min) when re-attached
Angelo Dureghello <[email protected]>
m68k: fix command-line parsing when passed from u-boot
Julien Folly <[email protected]>
w1: IAD Register is yet readable trough iad sys file. Fix snprintf (%u for unsigned, count for max size).
Wenwen Wang <[email protected]>
misc: mic: fix a DMA pool free failure
Duncan Laurie <[email protected]>
gsmi: Fix bug in append_to_eventlog sysfs handler
Nikolay Borisov <[email protected]>
btrfs: handle error of get_old_root
Su Yue <[email protected]>
btrfs: defrag: use btrfs_mod_outstanding_extents in cluster_pages_for_defrag
Honghui Zhang <[email protected]>
PCI: mediatek: Fix class type for MT7622 to PCI_CLASS_BRIDGE_PCI
Chaotian Jing <[email protected]>
mmc: mediatek: fix cannot receive new request when msdc_cmd_is_ready fail
Chaotian Jing <[email protected]>
mmc: mediatek: fill the actual clock for mmc debugfs
Sergei Shtylyov <[email protected]>
spi: sh-msiof: fix deferred probing
Jens Axboe <[email protected]>
cdrom: don't attempt to fiddle with cdo->capability
Jens Axboe <[email protected]>
skd: fixup usage of legacy IO API
Carl Huang <[email protected]>
ath10k: allocate small size dma memory in ath10k_pci_diag_write_mem
Rakesh Pillai <[email protected]>
ath10k: set probe request oui during driver start
Ali MJ Al-Nasrawy <[email protected]>
brcmsmac: AP mode: update beacon when TIM changes
Lorenzo Bianconi <[email protected]>
mt76x0: phy: fix restore phase in mt76x0_phy_recalibrate_after_assoc
Felix Fietkau <[email protected]>
mt76: do not store aggregation sequence number for null-data frames
Dan Carpenter <[email protected]>
EDAC, thunderx: Fix memory leak in thunderx_l2c_threaded_isr()
Sam Bobroff <[email protected]>
powerpc/eeh: Fix use of EEH_PE_KEEP on wrong field
Sam Bobroff <[email protected]>
powerpc/eeh: Fix null deref for devices removed during EEH
Joel Stanley <[email protected]>
powerpc/boot: Disable vector instructions
Joel Stanley <[email protected]>
powerpc/boot: Fix opal console in boot wrapper
Dan Carpenter <[email protected]>
powerpc: Fix signedness bug in update_flash_db()
Al Viro <[email protected]>
synclink_gt(): fix compat_ioctl()
Al Viro <[email protected]>
pty: fix compat ioctls
Andreas Gruenbacher <[email protected]>
gfs2: Fix marking bitmaps non-full
Alan Douglas <[email protected]>
PCI: cadence: Write MSI data with 32bits
Gustavo A. R. Silva <[email protected]>
pinctrl: madera: Fix uninitialized variable bug in madera_mux_set_mux
Sergey Senozhatsky <[email protected]>
printk: fix integer overflow in setup_log_buf()
Sergey Senozhatsky <[email protected]>
printk: lock/unlock console only for new logbuf entries
Michael Schupikov <[email protected]>
crypto: testmgr - fix sizeof() on COMP_BUF_SIZE
Takashi Sakamoto <[email protected]>
ALSA: isight: fix leak of reference to firewire unit in error path of .probe callback
Adrian Bunk <[email protected]>
mwifiex: Fix NL80211_TX_POWER_LIMITED
Chris Wilson <[email protected]>
drm/i915/userptr: Try to acquire the page lock around set_page_dirty()
Chris Wilson <[email protected]>
drm/i915/pmu: "Frequency" is reported as accumulated cycles
Evan Quan <[email protected]>
drm/amd/powerplay: issue no PPSMC_MSG_GetCurrPkgPwr on unsupported ASICs
Andrey Ryabinin <[email protected]>
mm/ksm.c: don't WARN if page is still mapped in remove_stable_node()
Joseph Qi <[email protected]>
Revert "fs: ocfs2: fix possible null-pointer dereferences in ocfs2_xa_prepare_entry()"
Laurent Vivier <[email protected]>
virtio_console: allocate inbufs in add_port() only if it is needed
Sun Ke <[email protected]>
nbd:fix memory leak in nbd_get_socket()
Laura Abbott <[email protected]>
tools: gpio: Correctly add make dependencies for gpio_utils
Thierry Reding <[email protected]>
gpio: max77620: Fixup debounce delays
Stefano Garzarella <[email protected]>
vhost/vsock: split packets to send using multiple buffers
Maor Gottlieb <[email protected]>
net/mlx5: Fix auto group size calculation
Eran Ben Elisha <[email protected]>
net/mlxfw: Verify FSM error code translation doesn't exceed array size
Roi Dayan <[email protected]>
net/mlx5e: Fix set vf link state error flow
Martin Habets <[email protected]>
sfc: Only cancel the PPS workqueue if it exists
Xin Long <[email protected]>
net: sched: ensure opts_len <= IP_TUNNEL_OPTS_MAX in act_tunnel_key
Davide Caratti <[email protected]>
net/sched: act_pedit: fix WARN() in the traffic path
Dan Carpenter <[email protected]>
net: rtnetlink: prevent underflows in do_setvfinfo()
Tariq Toukan <[email protected]>
net/mlx4_en: Fix wrong limitation for number of TX rings
Luigi Rizzo <[email protected]>
net/mlx4_en: fix mlx4 ethtool -N insertion
Petr Machata <[email protected]>
mlxsw: spectrum_router: Fix determining underlay for a GRE tunnel
-------------
Diffstat:
Documentation/admin-guide/hw-vuln/mds.rst | 7 +- .../admin-guide/hw-vuln/tsx_async_abort.rst | 5 +- Documentation/admin-guide/kernel-parameters.txt | 11 + .../devicetree/bindings/spi/spi-uniphier.txt | 14 +- Makefile | 4 +- arch/arc/kernel/perf_event.c | 4 +- arch/arm/boot/dts/imx6sx-sdb.dtsi | 7 +- arch/arm/mm/mmu.c | 3 + arch/arm64/Makefile | 2 + arch/arm64/include/asm/string.h | 14 +- arch/arm64/kernel/arm64ksyms.c | 7 +- arch/arm64/lib/memchr.S | 2 +- arch/arm64/lib/memcmp.S | 2 +- arch/arm64/lib/strchr.S | 2 +- arch/arm64/lib/strcmp.S | 2 +- arch/arm64/lib/strlen.S | 2 +- arch/arm64/lib/strncmp.S | 2 +- arch/arm64/lib/strnlen.S | 2 +- arch/arm64/lib/strrchr.S | 2 +- arch/m68k/kernel/uboot.c | 2 +- arch/nds32/include/asm/bitfield.h | 4 +- arch/powerpc/boot/Makefile | 4 +- arch/powerpc/boot/opal.c | 8 - arch/powerpc/include/asm/asm-prototypes.h | 3 + arch/powerpc/include/asm/security_features.h | 3 + arch/powerpc/kernel/eeh_driver.c | 4 + arch/powerpc/kernel/eeh_pe.c | 2 +- arch/powerpc/kernel/entry_64.S | 6 + arch/powerpc/kernel/process.c | 3 +- arch/powerpc/kernel/security.c | 74 +++++- arch/powerpc/kvm/book3s_hv_rmhandlers.S | 28 +++ arch/powerpc/mm/pgtable-radix.c | 8 +- arch/powerpc/mm/tlb-radix.c | 1 - arch/powerpc/platforms/powernv/memtrace.c | 2 + arch/powerpc/platforms/ps3/os-area.c | 2 +- arch/powerpc/platforms/pseries/hotplug-memory.c | 2 +- arch/powerpc/platforms/pseries/lpar.c | 54 +++++ arch/powerpc/xmon/Makefile | 6 + arch/riscv/mm/ioremap.c | 2 +- arch/s390/kernel/perf_cpum_sf.c | 6 +- arch/sparc/include/asm/cmpxchg_64.h | 7 +- arch/sparc/include/asm/parport.h | 2 + arch/um/drivers/line.c | 4 +- arch/x86/entry/entry_32.S | 21 +- arch/x86/include/asm/cpu_entry_area.h | 18 +- arch/x86/include/asm/pgtable_32_types.h | 8 +- arch/x86/include/asm/ptrace.h | 42 +++- arch/x86/kernel/cpu/bugs.c | 30 ++- arch/x86/kernel/cpu/intel_rdt.c | 7 + arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c | 12 +- arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c | 10 + arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 38 +++- arch/x86/kernel/doublefault.c | 3 + arch/x86/kernel/head_32.S | 10 + arch/x86/kvm/mmu.c | 8 +- arch/x86/kvm/vmx.c | 22 +- arch/x86/mm/cpu_entry_area.c | 4 +- arch/x86/tools/gen-insn-attr-x86.awk | 4 +- block/blk-core.c | 3 + block/blk-merge.c | 46 +++- block/blk-sysfs.c | 2 - crypto/testmgr.c | 6 +- drivers/acpi/acpi_memhotplug.c | 2 +- drivers/acpi/scan.c | 1 + drivers/atm/zatm.c | 42 ++-- drivers/base/memory.c | 22 +- drivers/base/power/domain.c | 6 + drivers/block/amiflop.c | 84 ++++--- drivers/block/nbd.c | 6 +- drivers/block/skd_main.c | 4 +- drivers/bluetooth/hci_bcsp.c | 3 + drivers/cdrom/cdrom.c | 27 ++- drivers/char/virtio_console.c | 28 ++- drivers/clk/at91/clk-audio-pll.c | 2 +- drivers/clk/mmp/clk-of-mmp2.c | 4 +- drivers/clk/sunxi-ng/ccu-sun50i-a64.c | 7 +- drivers/clk/tegra/clk-tegra20.c | 36 ++- drivers/clk/tegra/clk-tegra210.c | 6 +- drivers/cpufreq/cpufreq.c | 6 + drivers/crypto/ccree/cc_hw_queue_defs.h | 6 +- drivers/edac/thunderx_edac.c | 4 +- drivers/firmware/google/gsmi.c | 5 +- drivers/gpio/gpio-max77620.c | 6 +- drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 23 +- drivers/gpu/drm/i915/i915_gem_userptr.c | 22 +- drivers/gpu/drm/i915/i915_pmu.c | 4 +- drivers/i2c/busses/i2c-uniphier-f.c | 72 ++++-- drivers/infiniband/hw/bnxt_re/bnxt_re.h | 2 + drivers/infiniband/hw/bnxt_re/main.c | 44 ++-- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 13 +- drivers/isdn/mISDN/tei.c | 7 +- drivers/macintosh/windfarm_smu_sat.c | 25 +-- drivers/md/dm-raid.c | 2 +- drivers/md/raid10.c | 2 +- drivers/media/i2c/ov13858.c | 6 +- drivers/media/platform/vivid/vivid-kthread-cap.c | 8 +- drivers/media/platform/vivid/vivid-kthread-out.c | 8 +- drivers/media/platform/vivid/vivid-sdr-cap.c | 8 +- drivers/media/platform/vivid/vivid-vid-cap.c | 3 - drivers/media/platform/vivid/vivid-vid-out.c | 3 - drivers/media/rc/imon.c | 3 +- drivers/media/usb/b2c2/flexcop-usb.c | 3 + drivers/media/usb/dvb-usb/cxusb.c | 3 +- drivers/media/usb/usbvision/usbvision-video.c | 21 +- drivers/media/usb/uvc/uvc_driver.c | 28 +-- drivers/mfd/arizona-core.c | 8 +- drivers/mfd/intel_soc_pmic_bxtwc.c | 41 +++- drivers/mfd/max8997.c | 8 +- drivers/mfd/mc13xxx-core.c | 3 +- drivers/misc/mic/scif/scif_fence.c | 2 +- drivers/mmc/host/mtk-sd.c | 15 +- drivers/net/dsa/bcm_sf2.c | 4 + drivers/net/dsa/mv88e6xxx/chip.c | 4 +- drivers/net/dsa/mv88e6xxx/port.c | 25 ++- drivers/net/dsa/mv88e6xxx/port.h | 1 + drivers/net/ethernet/amazon/Kconfig | 2 +- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 2 +- drivers/net/ethernet/cadence/macb_main.c | 2 +- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 24 +- .../net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c | 12 +- .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 2 +- .../ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c | 4 +- drivers/net/ethernet/intel/fm10k/fm10k_iov.c | 48 ++-- drivers/net/ethernet/intel/igb/igb_ptp.c | 8 +- drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 9 +- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 9 + drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 10 +- drivers/net/ethernet/mellanox/mlx5/core/fs_core.h | 1 + drivers/net/ethernet/mellanox/mlxfw/mlxfw_fsm.c | 2 + .../net/ethernet/mellanox/mlxsw/spectrum_router.c | 19 +- drivers/net/ethernet/netronome/nfp/bpf/main.h | 7 +- drivers/net/ethernet/netronome/nfp/bpf/offload.c | 18 +- drivers/net/ethernet/netronome/nfp/bpf/verifier.c | 58 ++++- drivers/net/ethernet/qlogic/qed/qed.h | 2 +- drivers/net/ethernet/qlogic/qed/qed_main.c | 22 +- drivers/net/ethernet/qlogic/qed/qed_mcp.c | 27 +-- drivers/net/ethernet/qlogic/qed/qed_mcp.h | 5 +- drivers/net/ethernet/qlogic/qed/qed_vf.c | 2 +- drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c | 2 +- drivers/net/ethernet/sfc/ptp.c | 3 +- drivers/net/ethernet/socionext/netsec.c | 19 +- drivers/net/ethernet/ti/cpsw.c | 1 + drivers/net/macsec.c | 20 +- drivers/net/ntb_netdev.c | 2 +- drivers/net/phy/dp83867.c | 37 +++ drivers/net/vrf.c | 19 +- drivers/net/wireless/ath/ath10k/mac.c | 14 +- drivers/net/wireless/ath/ath10k/pci.c | 23 +- drivers/net/wireless/ath/ath10k/snoc.c | 2 +- drivers/net/wireless/ath/ath10k/usb.c | 8 + drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 2 +- drivers/net/wireless/ath/wil6210/debugfs.c | 15 +- drivers/net/wireless/ath/wil6210/main.c | 11 +- drivers/net/wireless/ath/wil6210/txrx_edma.c | 23 +- drivers/net/wireless/ath/wil6210/wil6210.h | 1 + drivers/net/wireless/ath/wil6210/wmi.c | 9 +- .../broadcom/brcm80211/brcmsmac/mac80211_if.c | 30 ++- .../wireless/broadcom/brcm80211/brcmsmac/main.h | 1 + drivers/net/wireless/cisco/airo.c | 2 +- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 13 +- drivers/net/wireless/marvell/mwifiex/ioctl.h | 1 + drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 11 +- drivers/net/wireless/mediatek/mt76/mt76x0/phy.c | 7 +- drivers/net/wireless/mediatek/mt76/tx.c | 3 +- .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 1 + .../net/wireless/realtek/rtlwifi/rtl8192de/fw.c | 2 +- drivers/net/wireless/ti/wlcore/vendor_cmd.c | 2 +- drivers/nfc/port100.c | 2 +- drivers/ntb/hw/intel/ntb_hw_gen1.c | 2 +- drivers/nvme/host/core.c | 2 +- drivers/nvme/host/pci.c | 8 +- drivers/nvme/target/fcloop.c | 1 + drivers/nvme/target/io-cmd-file.c | 3 +- drivers/of/unittest.c | 58 ++++- drivers/pci/controller/dwc/pci-keystone.c | 3 + drivers/pci/controller/pcie-cadence-ep.c | 2 +- drivers/pci/controller/pcie-mediatek.c | 143 ++++++------ drivers/pci/controller/vmd.c | 2 +- drivers/pinctrl/bcm/pinctrl-bcm2835.c | 6 +- drivers/pinctrl/cirrus/pinctrl-madera-core.c | 2 +- drivers/pinctrl/pinctrl-lpc18xx.c | 10 +- drivers/pinctrl/pinctrl-zynq.c | 9 +- drivers/pinctrl/qcom/pinctrl-spmi-gpio.c | 21 +- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 11 +- drivers/platform/x86/intel_cht_int33fe.c | 24 +- drivers/pwm/pwm-lpss.c | 12 +- drivers/rtc/rtc-s35390a.c | 2 +- drivers/scsi/bfa/bfa_defs_svc.h | 2 +- drivers/scsi/bfa/bfad_im.h | 2 +- drivers/scsi/dc395x.c | 12 +- drivers/scsi/hisi_sas/hisi_sas_main.c | 56 ++++- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 2 +- drivers/scsi/ips.c | 1 + drivers/scsi/isci/host.c | 8 +- drivers/scsi/isci/host.h | 2 +- drivers/scsi/isci/request.c | 4 +- drivers/scsi/isci/task.c | 4 +- drivers/scsi/iscsi_tcp.c | 3 +- drivers/scsi/lpfc/lpfc.h | 1 + drivers/scsi/lpfc/lpfc_els.c | 95 ++++++-- drivers/scsi/lpfc/lpfc_hbadisc.c | 29 +++ drivers/scsi/lpfc/lpfc_init.c | 2 +- drivers/scsi/lpfc/lpfc_nportdisc.c | 5 +- drivers/scsi/lpfc/lpfc_sli.c | 11 +- drivers/scsi/lpfc/lpfc_sli4.h | 1 + drivers/scsi/megaraid/megaraid_sas_base.c | 9 +- drivers/scsi/mpt3sas/mpt3sas_base.c | 2 +- drivers/scsi/mpt3sas/mpt3sas_config.c | 4 - drivers/scsi/mpt3sas/mpt3sas_scsih.c | 36 ++- drivers/scsi/zorro_esp.c | 8 +- drivers/soc/bcm/brcmstb/pm/pm-arm.c | 2 +- drivers/spi/spi-omap2-mcspi.c | 26 +-- drivers/spi/spi-sh-msiof.c | 4 +- drivers/staging/comedi/drivers/usbduxfast.c | 21 +- drivers/thermal/armada_thermal.c | 4 +- drivers/thermal/rcar_thermal.c | 6 +- drivers/tty/pty.c | 14 +- drivers/tty/synclink_gt.c | 16 +- drivers/usb/misc/appledisplay.c | 15 +- drivers/usb/misc/chaoskey.c | 24 +- drivers/usb/serial/cp210x.c | 1 + drivers/usb/serial/mos7720.c | 4 - drivers/usb/serial/mos7840.c | 16 +- drivers/usb/serial/option.c | 7 + drivers/usb/typec/tcpm.c | 9 +- drivers/usb/usbip/Kconfig | 1 + drivers/usb/usbip/stub_rx.c | 50 +++-- drivers/vhost/vsock.c | 66 ++++-- drivers/virtio/virtio_ring.c | 2 +- drivers/w1/slaves/w1_ds2438.c | 66 ++++-- drivers/xen/balloon.c | 3 + fs/btrfs/ctree.c | 4 + fs/btrfs/ioctl.c | 2 +- fs/btrfs/super.c | 6 +- fs/ceph/file.c | 45 +--- fs/ceph/inode.c | 1 - fs/cifs/smb2pdu.c | 6 +- fs/dlm/member.c | 5 +- fs/dlm/user.c | 2 +- fs/f2fs/data.c | 8 +- fs/f2fs/dir.c | 1 + fs/f2fs/f2fs.h | 2 +- fs/f2fs/namei.c | 2 + fs/f2fs/segment.c | 4 +- fs/f2fs/super.c | 5 +- fs/gfs2/rgrp.c | 13 +- fs/hfs/brec.c | 1 + fs/hfs/btree.c | 41 ++-- fs/hfs/btree.h | 1 + fs/hfs/catalog.c | 16 ++ fs/hfs/extent.c | 10 +- fs/hfs/inode.c | 2 + fs/hfsplus/attributes.c | 10 + fs/hfsplus/brec.c | 1 + fs/hfsplus/btree.c | 44 ++-- fs/hfsplus/catalog.c | 24 ++ fs/hfsplus/extents.c | 8 +- fs/hfsplus/hfsplus_fs.h | 2 + fs/hfsplus/inode.c | 1 + fs/ocfs2/buffer_head_io.c | 77 +++++-- fs/ocfs2/dlm/dlmdebug.c | 2 +- fs/ocfs2/dlmglue.c | 2 +- fs/ocfs2/file.c | 4 +- fs/ocfs2/journal.c | 51 +++-- fs/ocfs2/move_extents.c | 17 ++ fs/ocfs2/stackglue.c | 6 - fs/ocfs2/stackglue.h | 3 - fs/ocfs2/xattr.c | 56 +++-- fs/read_write.c | 33 +++ fs/xfs/xfs_buf.c | 45 +++- fs/xfs/xfs_trans_ail.c | 28 ++- include/linux/bitmap.h | 9 +- include/linux/futex.h | 8 - include/linux/inetdevice.h | 4 +- include/linux/kvm_host.h | 1 + include/linux/memory_hotplug.h | 1 + include/linux/mfd/intel_soc_pmic.h | 1 + include/linux/mfd/max8997.h | 1 - include/linux/mfd/mc13xxx.h | 1 + kernel/Makefile | 3 - kernel/auditsc.c | 2 +- kernel/bpf/btf.c | 55 +++-- kernel/bpf/devmap.c | 3 +- kernel/dma/swiotlb.c | 33 +-- kernel/futex.c | 247 ++++++++++++++++++++- kernel/futex_compat.c | 202 ----------------- kernel/irq/matrix.c | 2 +- kernel/panic.c | 2 +- kernel/printk/printk.c | 12 +- kernel/sched/fair.c | 13 +- kernel/sched/topology.c | 2 +- lib/bitmap.c | 10 +- mm/gup_benchmark.c | 3 + mm/ksm.c | 14 +- mm/memcontrol.c | 2 +- mm/memory_hotplug.c | 76 +++++-- mm/migrate.c | 25 ++- mm/page-writeback.c | 33 ++- mm/page_io.c | 7 +- net/core/dev.c | 2 +- net/core/net-sysfs.c | 24 +- net/core/rtnetlink.c | 23 +- net/core/sock.c | 7 +- net/ipv4/igmp.c | 53 +++-- net/ipv4/ip_sockglue.c | 6 +- net/ipv6/tcp_ipv6.c | 3 +- net/openvswitch/conntrack.c | 3 +- net/sched/act_pedit.c | 12 +- net/sched/act_tunnel_key.c | 4 + net/sctp/socket.c | 38 +--- net/sunrpc/auth_gss/gss_krb5_seal.c | 1 + net/sunrpc/xprtsock.c | 34 +-- net/unix/af_unix.c | 2 + net/vmw_vsock/virtio_transport_common.c | 15 +- net/wireless/ap.c | 2 + net/wireless/core.h | 2 + net/wireless/sme.c | 8 +- sound/firewire/isight.c | 10 +- sound/i2c/cs8427.c | 2 +- sound/soc/tegra/tegra_sgtl5000.c | 17 +- sound/usb/mixer.c | 3 + tools/bpf/bpftool/bash-completion/bpftool | 2 +- tools/bpf/bpftool/common.c | 15 +- tools/bpf/bpftool/main.h | 2 +- tools/gpio/Build | 1 + tools/gpio/Makefile | 10 +- tools/objtool/arch/x86/tools/gen-insn-attr-x86.awk | 4 +- tools/power/acpi/tools/acpidump/apmain.c | 2 +- tools/power/x86/turbostat/turbostat.c | 93 +++++--- tools/testing/selftests/bpf/test_libbpf.sh | 2 +- tools/testing/selftests/bpf/trace_helpers.c | 1 + .../ftrace/test.d/kprobe/kprobe_args_syntax.tc | 3 + tools/testing/selftests/kvm/dirty_log_test.c | 4 +- .../testing/selftests/powerpc/cache_shape/Makefile | 9 +- tools/testing/selftests/powerpc/ptrace/Makefile | 13 +- tools/testing/selftests/powerpc/signal/Makefile | 11 +- .../selftests/powerpc/switch_endian/Makefile | 1 + tools/testing/selftests/proc/fd-001-lookup.c | 2 +- tools/testing/selftests/proc/fd-003-kthread.c | 2 +- tools/testing/selftests/vm/gup_benchmark.c | 1 + tools/testing/selftests/watchdog/watchdog-test.c | 16 +- tools/testing/selftests/x86/mov_ss_trap.c | 3 +- tools/testing/selftests/x86/sigreturn.c | 13 ++ tools/usb/usbip/libsrc/usbip_host_common.c | 8 +- virt/kvm/kvm_main.c | 26 ++- 347 files changed, 3163 insertions(+), 1630 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 16/306 Revert "fs: ocfs2: fix possible null-pointer dereferences in ocfs2_xa_prepare_entry()"
From: Joseph Qi <[email protected]>
commit 94b07b6f9e2e996afff7395de6b35f34f4cb10bf upstream.
This reverts commit 56e94ea132bb5c2c1d0b60a6aeb34dcb7d71a53d.
Commit 56e94ea132bb ("fs: ocfs2: fix possible null-pointer dereferences in ocfs2_xa_prepare_entry()") introduces a regression that fail to create directory with mount option user_xattr and acl. Actually the reported NULL pointer dereference case can be correctly handled by loc->xl_ops->xlo_add_entry(), so revert it.
--- fs/ocfs2/xattr.c | 56 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 23 deletions(-)
fs/ocfs2/xattr.c +33 -23
@@ -1498,6 +1498,18 @@ static int ocfs2_xa_check_space(struct oreturn loc->xl_ops->xlo_check_space (loc, xi); } +static void ocfs2_xa_add_entry (struct ocfs2_xa_loc *loc,u32 name_hash) +{ + loc->xl_ops->xlo_add_entry (loc, name_hash); + loc->xl_entry->xe_name_hash =cpu_to_le32 (name_hash); +/* +* We can't leave the new entry's xe_name_offset at zero or +* add_namevalue() will go nuts. We set it to the size of our +* storage so that it can never be less than any other entry. +*/ + loc->xl_entry->xe_name_offset =cpu_to_le16 (loc->xl_size); +} +static void ocfs2_xa_add_namevalue (struct ocfs2_xa_loc *loc,struct ocfs2_xattr_info *xi) {
@@ -2129,31 +2141,29 @@ static int ocfs2_xa_prepare_entry(structif (rc) goto out; -if (!loc->xl_entry) { - rc = -EINVAL ; - goto out; - } - -if (ocfs2_xa_can_reuse_entry (loc, xi)) { - orig_value_size = loc->xl_entry->xe_value_size; - rc =ocfs2_xa_reuse_entry (loc, xi, ctxt); -if (rc) - goto out; - goto alloc_value; - } +if (loc->xl_entry) { +if (ocfs2_xa_can_reuse_entry (loc, xi)) { + orig_value_size = loc->xl_entry->xe_value_size; + rc =ocfs2_xa_reuse_entry (loc, xi, ctxt); +if (rc) + goto out; + goto alloc_value; + } -if (!ocfs2_xattr_is_local (loc->xl_entry)) { - orig_clusters =ocfs2_xa_value_clusters (loc); - rc =ocfs2_xa_value_truncate (loc,0 , ctxt); -if (rc) { -mlog_errno (rc); -ocfs2_xa_cleanup_value_truncate (loc, -"overwriting" , - orig_clusters); - goto out; +if (!ocfs2_xattr_is_local (loc->xl_entry)) { + orig_clusters =ocfs2_xa_value_clusters (loc); + rc =ocfs2_xa_value_truncate (loc,0 , ctxt); +if (rc) { +mlog_errno (rc); +ocfs2_xa_cleanup_value_truncate (loc, +"overwriting" , + orig_clusters); + goto out; + } } - } -ocfs2_xa_wipe_namevalue (loc); +ocfs2_xa_wipe_namevalue (loc); + }else +ocfs2_xa_add_entry (loc, name_hash);/* * If we get here, we have a blank entry. Fill it. We grow our
Greg Kroah-Hartman
maintainerPATCH 17/306 mm/ksm.c: dont WARN if page is still mapped in remove_stable_node()
In reply to Greg Kroah-HartmanFrom: Andrey Ryabinin <[email protected]>
commit 9a63236f1ad82d71a98aa80320b6cb618fb32f44 upstream.
It's possible to hit the WARN_ON_ONCE(page_mapped(page)) in remove_stable_node() when it races with __mmput() and squeezes in between ksm_exit() and exit_mmap().
WARNING: CPU: 0 PID: 3295 at mm/ksm.c:888 remove_stable_node+0x10c/0x150 Call Trace: remove_all_stable_nodes+0x12b/0x330 run_store+0x4ef/0x7b0 kernfs_fop_write+0x200/0x420 vfs_write+0x154/0x450 ksys_write+0xf9/0x1d0 do_syscall_64+0x99/0x510 entry_SYSCALL_64_after_hwframe+0x49/0xbe
Remove the warning as there is nothing scary going on.
--- mm/ksm.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
mm/ksm.c +7 -7
@@ -870,13 +870,13 @@ static int remove_stable_node(struct stareturn 0 ; } -if (WARN_ON_ONCE (page_mapped (page))) { -/* -* This should not happen: but if it does, just refuse to let -* merge_across_nodes be switched - there is no need to panic. -*/ - err = -EBUSY ; - }else { +/* +* Page could be still mapped if this races with __mmput() running in +* between ksm_exit() and exit_mmap(). Just refuse to let +* merge_across_nodes/max_page_sharing be switched. +*/ + err = -EBUSY ; +if (!page_mapped (page)) {/* * The stable node did not yet appear stale to get_ksm_page(), * since that allows for an unmapped ksm page to be recognized
Greg Kroah-Hartman
maintainerPATCH 20/306 drm/i915/userptr: Try to acquire the page lock around set_page_dirty()
In reply to Greg Kroah-HartmanFrom: Chris Wilson <[email protected]>
commit 2d691aeca4aecbb8d0414a777a46981a8e142b05 upstream.
set_page_dirty says:
For pages with a mapping this should be done under the page lock for the benefit of asynchronous memory errors who prefer a consistent dirty state. This rule can be broken in some special cases, but should be better not to.
Under those rules, it is only safe for us to use the plain set_page_dirty calls for shmemfs/anonymous memory. Userptr may be used with real mappings and so needs to use the locked version (set_page_dirty_lock).
However, following a try_to_unmap() we may want to remove the userptr and so call put_pages(). However, try_to_unmap() acquires the page lock and so we must avoid recursively locking the pages ourselves -- which means that we cannot safely acquire the lock around set_page_dirty(). Since we can't be sure of the lock, we have to risk skip dirtying the page, or else risk calling set_page_dirty() without a lock and so risk fs corruption.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=203317
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=112012
--- drivers/gpu/drm/i915/i915_gem_userptr.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_userptr.c +21 -1
@@ -691,8 +691,28 @@ i915_gem_userptr_put_pages(struct drm_i9i915_gem_gtt_finish_pages (obj, pages);for_each_sgt_page (page, sgt_iter, pages) { -if (obj->mm.dirty) +if (obj->mm.dirty &&trylock_page (page)) { +/* +* As this may not be anonymous memory (e.g. shmem) +* but exist on a real mapping, we have to lock +* the page in order to dirty it -- holding +* the page reference is not sufficient to +* prevent the inode from being truncated. +* Play safe and take the lock. +* +* However...! +* +* The mmu-notifier can be invalidated for a +* migrate_page, that is alreadying holding the lock +* on the page. Such a try_to_unmap() will result +* in us calling put_pages() and so recursively try +* to lock the page. We avoid that deadlock with +* a trylock_page() and in exchange we risk missing +* some page dirtying. +*/ set_page_dirty (page); +unlock_page (page); + }mark_page_accessed (page);put_page (page);
Greg Kroah-Hartman
maintainerPATCH 23/306 crypto: testmgr - fix sizeof() on COMP_BUF_SIZE
In reply to Greg Kroah-HartmanFrom: Michael Schupikov <[email protected]>
[ Upstream commit 22a8118d329334833cd30f2ceb36d28e8cae8a4f ]
After allocation, output and decomp_output both point to memory chunks of size COMP_BUF_SIZE. Then, only the first bytes are zeroed out using sizeof(COMP_BUF_SIZE) as parameter to memset(), because sizeof(COMP_BUF_SIZE) provides the size of the constant and not the size of allocated memory.
Instead, the whole allocated memory is meant to be zeroed out. Use COMP_BUF_SIZE as parameter to memset() directly in order to accomplish this.
--- crypto/testmgr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
crypto/testmgr.c +3 -3
@@ -1400,8 +1400,8 @@ static int test_comp(struct crypto_comp *tfm,int ilen;unsigned int dlen =COMP_BUF_SIZE ; -memset (output,0 ,sizeof (COMP_BUF_SIZE )); -memset (decomp_output,0 ,sizeof (COMP_BUF_SIZE )); +memset (output,0 ,COMP_BUF_SIZE ); +memset (decomp_output,0 ,COMP_BUF_SIZE ); ilen = ctemplate[i].inlen; ret = crypto_comp_compress(tfm, ctemplate[i].input,
@@ -1445,7 +1445,7 @@ static int test_comp(struct crypto_comp *tfm,int ilen;unsigned int dlen =COMP_BUF_SIZE ; -memset (decomp_output,0 ,sizeof (COMP_BUF_SIZE )); +memset (decomp_output,0 ,COMP_BUF_SIZE ); ilen = dtemplate[i].inlen; ret = crypto_comp_decompress(tfm, dtemplate[i].input,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 24/306 printk: lock/unlock console only for new logbuf entries
In reply to Greg Kroah-HartmanFrom: Sergey Senozhatsky <[email protected]>
[ Upstream commit 3ac37a93fa9217e576bebfd4ba3e80edaaeb2289 ]
Prior to commit 5c2992ee7fd8a29 ("printk: remove console flushing special cases for partial buffered lines") we would do console_cont_flush() for each pr_cont() to print cont fragments, so console_unlock() would actually print data:
pr_cont(); console_lock(); console_unlock() console_cont_flush(); // print cont fragment ... pr_cont(); console_lock(); console_unlock() console_cont_flush(); // print cont fragment
We don't do console_cont_flush() anymore, so when we do pr_cont() console_unlock() does nothing (unless we flushed the cont buffer):
pr_cont(); console_lock(); console_unlock(); // noop ... pr_cont(); console_lock(); console_unlock(); // noop ... pr_cont(); cont_flush(); console_lock(); console_unlock(); // print data
We also wakeup klogd purposelessly for pr_cont() output - un-flushed cont buffer is not stored in log_buf; there is nothing to pull.
Thus we can console_lock()/console_unlock()/wake_up_klogd() only when we know that we log_store()-ed a message and there is something to print to the consoles/syslog.
To: Steven Rostedt <[email protected]>
--- kernel/printk/printk.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
kernel/printk/printk.c +7 -3
@@ -1901,8 +1901,9 @@ asmlinkage int vprintk_emit(int facility, int level, const char *fmt, va_list args) { int printed_len; -bool in_sched = false; +bool in_sched = false, pending_output;unsigned long flags; +u64 curr_log_seq;if (level ==LOGLEVEL_SCHED ) { level =LOGLEVEL_DEFAULT ;
@@ -1914,11 +1915,13 @@ asmlinkage int vprintk_emit(int facility, int level,/* This stops the holder of console_sem just where we want him */ logbuf_lock_irqsave (flags); + curr_log_seq = log_next_seq; printed_len =vprintk_store (facility, level, dict, dictlen, fmt, args); + pending_output = (curr_log_seq != log_next_seq);logbuf_unlock_irqrestore (flags);/* If called from the scheduler, we can not call up(). */ -if (!in_sched) { +if (!in_sched && pending_output) {/* * Disable preemption to avoid being preempted while holding * console_sem which would prevent anyone from printing to
@@ -1935,7 +1938,8 @@ asmlinkage int vprintk_emit(int facility, int level,preempt_enable (); } -wake_up_klogd (); +if (pending_output) +wake_up_klogd ();return printed_len; }EXPORT_SYMBOL (vprintk_emit);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 7/306 sfc: Only cancel the PPS workqueue if it exists
In reply to Greg Kroah-HartmanFrom: Martin Habets <[email protected]>
[ Upstream commit 723eb53690041740a13ac78efeaf6804f5d684c9 ]
The workqueue only exists for the primary PF. For other functions we hit a WARN_ON in kernel/workqueue.c.
--- drivers/net/ethernet/sfc/ptp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/sfc/ptp.c +2 -1
@@ -1534,7 +1534,8 @@ void efx_ptp_remove(struct efx_nic *efx) (void )efx_ptp_disable (efx);cancel_work_sync (&efx->ptp_data->work); -cancel_work_sync (&efx->ptp_data->pps_work); +if (efx->ptp_data->pps_workwq) +cancel_work_sync (&efx->ptp_data->pps_work);skb_queue_purge (&efx->ptp_data->rxq);skb_queue_purge (&efx->ptp_data->txq);
Greg Kroah-Hartman
maintainerPATCH 25/306 printk: fix integer overflow in setup_log_buf()
In reply to Greg Kroah-HartmanFrom: Sergey Senozhatsky <[email protected]>
[ Upstream commit d2130e82e9454304e9b91ba9da551b5989af8c27 ]
The way we calculate logbuf free space percentage overflows signed integer:
int free;
free = __LOG_BUF_LEN - log_next_idx;
pr_info("early log buf free: %u(%u%%)\n",
free, (free * 100) / __LOG_BUF_LEN);We support LOG_BUF_LEN of up to 1<<25 bytes. Since setup_log_buf() is called during early init, logbuf is mostly empty, so
__LOG_BUF_LEN - log_next_idx
is close to 1<<25. Thus when we multiply it by 100, we overflow signed integer value range: 100 is 2^6 + 2^5 + 2^2.
Example, booting with LOG_BUF_LEN 1<<25 and log_buf_len=2G boot param:
[ 0.075317] log_buf_len: -2147483648 bytes [ 0.075319] early log buf free: 33549896(-28%)
Make "free" unsigned integer and use appropriate printk() specifier.
To: Steven Rostedt <[email protected]>
--- kernel/printk/printk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/printk/printk.c +1 -1
@@ -1105,7 +1105,7 @@ void __init setup_log_buf(int early) {unsigned long flags;char *new_log_buf; -int free; +unsigned int free;if (log_buf != __log_buf)return ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 26/306 pinctrl: madera: Fix uninitialized variable bug in madera_mux_set_mux
In reply to Greg Kroah-HartmanFrom: Gustavo A. R. Silva <[email protected]>
[ Upstream commit 4fe81669df50889ff1072c030c59df5f1fa6534e ]
There is a potential execution path in which variable *ret* is checked in an IF statement, and then its value is used to report an error at line 659 without being properly initialized previously:
659 if (ret)
660 dev_err(priv->dev, "Failed to write to 0x%x (%d)\n", reg, ret);
Fix this by initializing variable *ret* to 0 in order to avoid unpredictable or unintended results.
Addresses-Coverity-ID: 1471969 ("Uninitialized scalar variable")
--- drivers/pinctrl/cirrus/pinctrl-madera-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/cirrus/pinctrl-madera-core.c +1 -1
@@ -608,7 +608,7 @@ static int madera_mux_set_mux(struct pinctrl_dev *pctldev,unsigned int n_chip_groups = priv->chip->n_pin_groups;const char *func_name = madera_mux_funcs[selector].name;unsigned int reg; -int i, ret; +int i, ret =0 ; dev_dbg(priv->dev, "%s selecting %u (%s) for group %u (%s)\n", __func__, selector, func_name, group,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 28/306 gfs2: Fix marking bitmaps non-full
In reply to Greg Kroah-HartmanFrom: Andreas Gruenbacher <[email protected]>
[ Upstream commit ec23df2b0cf3e1620f5db77972b7fb735f267eff ]
Reservations in gfs can span multiple gfs2_bitmaps (but they won't span multiple resource groups). When removing a reservation, we want to clear the GBF_FULL flags of all involved gfs2_bitmaps, not just that of the first bitmap.
--- fs/gfs2/rgrp.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
fs/gfs2/rgrp.c +11 -2
@@ -642,7 +642,10 @@ static void __rs_deltree(struct gfs2_blkreserv *rs)RB_CLEAR_NODE (&rs->rs_node);if (rs->rs_free) { -struct gfs2_bitmap *bi =rbm_bi (&rs->rs_rbm); +u64 last_block =gfs2_rbm_to_block (&rs->rs_rbm) + + rs->rs_free -1 ; +struct gfs2_rbm last_rbm = { .rgd = rs->rs_rbm.rgd, }; +struct gfs2_bitmap *start, *last;/* return reserved blocks to the rgrp */ BUG_ON (rs->rs_rbm.rgd->rd_reserved < rs->rs_free);
@@ -653,7 +656,13 @@ static void __rs_deltree(struct gfs2_blkreserv *rs)it will force the number to be recalculated later. */ rgd->rd_extfail_pt += rs->rs_free; rs->rs_free =0 ; -clear_bit (GBF_FULL , &bi->bi_flags); +if (gfs2_rbm_from_block (&last_rbm, last_block)) +return ; + start =rbm_bi (&rs->rs_rbm); + last =rbm_bi (&last_rbm); +do +clear_bit (GBF_FULL , &start->bi_flags); +while (start++ != last); } }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 29/306 pty: fix compat ioctls
In reply to Greg Kroah-HartmanFrom: Al Viro <[email protected]>
[ Upstream commit 50f45326afab723df529eca54095e2feac24da2d ]
pointer-taking ones need compat_ptr(); int-taking one doesn't.
--- drivers/tty/pty.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/tty/pty.c +12 -2
@@ -28,6 +28,7 @@#include <linux/mount.h> #include <linux/file.h> #include <linux/ioctl.h> +#include <linux/compat.h> #undef TTY_DEBUG_HANGUP#ifdef TTY_DEBUG_HANGUP
@@ -488,6 +489,7 @@ static int pty_bsd_ioctl(struct tty_struct *tty,return -ENOIOCTLCMD ; } +#ifdef CONFIG_COMPAT static long pty_bsd_compat_ioctl (struct tty_struct *tty,unsigned int cmd,unsigned long arg) {
@@ -495,8 +497,11 @@ static long pty_bsd_compat_ioctl(struct tty_struct *tty,* PTY ioctls don't require any special translation between 32-bit and * 64-bit userspace, they are already compatible. */ -return pty_bsd_ioctl (tty, cmd, arg); + return pty_bsd_ioctl(tty, cmd, (unsigned long)compat_ptr(arg)); } +#else +#define pty_bsd_compat_ioctl NULL +#endif static int legacy_count =CONFIG_LEGACY_PTY_COUNT ;/*
@@ -676,6 +681,7 @@ static int pty_unix98_ioctl(struct tty_struct *tty,return -ENOIOCTLCMD ; } +#ifdef CONFIG_COMPAT static long pty_unix98_compat_ioctl (struct tty_struct *tty,unsigned int cmd,unsigned long arg) {
@@ -683,8 +689,12 @@ static long pty_unix98_compat_ioctl(struct tty_struct *tty,* PTY ioctls don't require any special translation between 32-bit and * 64-bit userspace, they are already compatible. */ -return pty_unix98_ioctl (tty, cmd, arg); +return pty_unix98_ioctl (tty, cmd, + cmd == TIOCSIG ? arg : (unsigned long)compat_ptr(arg)); } +#else +#define pty_unix98_compat_ioctl NULL +#endif /** * ptm_unix98_lookup - find a pty master
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 30/306 synclink_gt(): fix compat_ioctl()
In reply to Greg Kroah-HartmanFrom: Al Viro <[email protected]>
[ Upstream commit 27230e51349fde075598c1b59d15e1ff802f3f6e ]
compat_ptr() for pointer-taking ones...
--- drivers/tty/synclink_gt.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)
drivers/tty/synclink_gt.c +4 -12
@@ -1186,14 +1186,13 @@ static long slgt_compat_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) {struct slgt_info *info = tty->driver_data; -int rc = -ENOIOCTLCMD ; +int rc;if (sanity_check (info, tty->name,"compat_ioctl" ))return -ENODEV ;DBGINFO (("%s compat_ioctl() cmd=%08X\n" , info->device_name, cmd));switch (cmd) { -case MGSL_IOCSPARAMS32 : rc =set_params32 (info,compat_ptr (arg));break ;
@@ -1213,18 +1212,11 @@ static long slgt_compat_ioctl(struct tty_struct *tty,case MGSL_IOCWAITGPIO :case MGSL_IOCGXSYNC :case MGSL_IOCGXCTRL : -case MGSL_IOCSTXIDLE : -case MGSL_IOCTXENABLE : -case MGSL_IOCRXENABLE : -case MGSL_IOCTXABORT : -case TIOCMIWAIT : -case MGSL_IOCSIF : -case MGSL_IOCSXSYNC : -case MGSL_IOCSXCTRL : - rc =ioctl (tty, cmd, arg); + rc =ioctl (tty, cmd, (unsigned long )compat_ptr (arg));break ; +default : + rc =ioctl (tty, cmd, arg); } -DBGINFO (("%s compat_ioctl() cmd=%08X rc=%d\n" , info->device_name, cmd, rc));return rc; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 32/306 powerpc/boot: Fix opal console in boot wrapper
In reply to Greg Kroah-HartmanFrom: Joel Stanley <[email protected]>
[ Upstream commit 1a855eaccf353f7ed1d51a3d4b3af727ccbd81ca ]
As of commit 10c77dba40ff ("powerpc/boot: Fix build failure in 32-bit boot wrapper") the opal code is hidden behind CONFIG_PPC64_BOOT_WRAPPER, but the boot wrapper avoids include/linux, so it does not get the normal Kconfig flags.
We can drop the guard entirely as in commit f8e8e69cea49 ("powerpc/boot:
Only build OPAL code when necessary") the makefile only includes opal.c in the build if CONFIG_PPC64_BOOT_WRAPPER is set.
--- arch/powerpc/boot/opal.c | 8 -------- 1 file changed, 8 deletions(-)
arch/powerpc/boot/opal.c +0 -8
@@ -13,8 +13,6 @@#include <libfdt.h> #include "../include/asm/opal-api.h" -#ifdef CONFIG_PPC64_BOOT_WRAPPER -/* Global OPAL struct used by opal-call.S */ struct opal {u64 base;
@@ -101,9 +99,3 @@ int opal_console_init(void *devp, struct serial_console_data *scdp)return 0 ; } -#else -int opal_console_init (void *devp,struct serial_console_data *scdp) -{ -return -1 ; -} -#endif /* __powerpc64__ */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 33/306 powerpc/boot: Disable vector instructions
In reply to Greg Kroah-HartmanFrom: Joel Stanley <[email protected]>
[ Upstream commit e8e132e6885962582784b6fa16a80d07ea739c0f ]
This will avoid auto-vectorisation when building with higher optimisation levels.
We don't know if the machine can support VSX and even if it's present it's probably not going to be enabled at this point in boot.
These flag were both added prior to GCC 4.6 which is the minimum compiler version supported by upstream, thanks to Segher for the details.
--- arch/powerpc/boot/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/boot/Makefile +2 -2
@@ -32,8 +32,8 @@ else endif BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ - -fno-strict-aliasing -Os -msoft-float -pipe \ - -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \ + -fno-strict-aliasing -Os -msoft-float -mno-altivec -mno-vsx \ + -pipe -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \ -D$(compress-y) ifdef CONFIG_PPC64_BOOT_WRAPPER
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 8/306 net/mlx5e: Fix set vf link state error flow
In reply to Greg Kroah-HartmanFrom: Roi Dayan <[email protected]>
[ Upstream commit 751021218f7e66ee9bbaa2be23056e447cd75ec4 ]
Before this commit the ndo always returned success. Fix that.
--- drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +1 -1
@@ -1861,7 +1861,7 @@ int mlx5_eswitch_set_vport_state(struct unlock:mutex_unlock (&esw->state_lock); -return 0 ; +return err; } int mlx5_eswitch_get_vport_config(struct mlx5_eswitch *esw,
Greg Kroah-Hartman
maintainerPATCH 35/306 powerpc/eeh: Fix use of EEH_PE_KEEP on wrong field
In reply to Greg Kroah-HartmanFrom: Sam Bobroff <[email protected]>
[ Upstream commit 473af09b56dc4be68e4af33220ceca6be67aa60d ]
eeh_add_to_parent_pe() sometimes removes the EEH_PE_KEEP flag, but it incorrectly removes it from pe->type, instead of pe->state.
However, rather than clearing it from the correct field, remove it. Inspection of the code shows that it can't ever have had any effect (even if it had been cleared from the correct field), because the field is never tested after it is cleared by the statement in question.
The clear statement was added by commit 807a827d4e74 ("powerpc/eeh:
Keep PE during hotplug"), but it didn't explain why it was necessary.
--- arch/powerpc/kernel/eeh_pe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/eeh_pe.c +1 -1
@@ -379,7 +379,7 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)while (parent) {if (!(parent->type &EEH_PE_INVALID ))break ; - parent->type &= ~(EEH_PE_INVALID |EEH_PE_KEEP ); + parent->type &= ~EEH_PE_INVALID ; parent = parent->parent; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 38/306 mt76x0: phy: fix restore phase in mt76x0_phy_recalibrate_after_assoc
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 4df942733fd26d9378a4a00619be348c771e0190 ]
Fix restore value configured in MT_BBP(IBI, 9) register in mt76x0_phy_recalibrate_after_assoc routine.
--- drivers/net/wireless/mediatek/mt76/mt76x0/phy.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76x0/phy.c +3 -4
@@ -793,9 +793,8 @@ void mt76x0_phy_recalibrate_after_assoc(struct mt76x0_dev *dev)mt76_wr (dev,MT_TX_ALC_CFG_0 ,0 );usleep_range (500 ,700 ); - reg_val =mt76_rr (dev,0x2124 ); - reg_val &=0xffffff7e ; -mt76_wr (dev,0x2124 , reg_val); + reg_val =mt76_rr (dev,MT_BBP (IBI ,9 )); +mt76_wr (dev,MT_BBP (IBI ,9 ),0xffffff7e );mt76x0_mcu_calibrate (dev,MCU_CAL_RXDCOC ,0 );
@@ -806,7 +805,7 @@ void mt76x0_phy_recalibrate_after_assoc(struct mt76x0_dev *dev)mt76x0_mcu_calibrate (dev,MCU_CAL_RXIQ , is_5ghz);mt76x0_mcu_calibrate (dev,MCU_CAL_RX_GROUP_DELAY , is_5ghz); -mt76_wr (dev,0x2124 , reg_val); +mt76_wr (dev,MT_BBP (IBI ,9 ), reg_val);mt76_wr (dev,MT_TX_ALC_CFG_0 , tx_alc);msleep (100 );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 39/306 brcmsmac: AP mode: update beacon when TIM changes
In reply to Greg Kroah-HartmanFrom: Ali MJ Al-Nasrawy <[email protected]>
[ Upstream commit 2258ee58baa554609a3cc3996276e4276f537b6d ]
Beacons are not updated to reflect TIM changes. This is not compliant with power-saving client stations as the beacons do not have valid TIM and can cause the network to stall at random occasions and to have highly variable latencies.
Fix it by updating beacon templates on mac80211 set_tim callback.
Addresses an issue described in:
https://marc.info/?i=20180911163534.21312d08%20()%20manjaro
--- .../broadcom/brcm80211/brcmsmac/mac80211_if.c | 26 +++++++++++++++++++ .../broadcom/brcm80211/brcmsmac/main.h | 1 + 2 files changed, 27 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c +26 -0
@@ -502,6 +502,7 @@ brcms_ops_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) }spin_lock_bh (&wl->lock); + wl->wlc->vif = vif; wl->mute_tx = false;brcms_c_mute (wl->wlc, false);if (vif->type ==NL80211_IFTYPE_STATION )
@@ -519,6 +520,11 @@ brcms_ops_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)static void brcms_ops_remove_interface (struct ieee80211_hw *hw,struct ieee80211_vif *vif) { +struct brcms_info *wl = hw->priv; + +spin_lock_bh (&wl->lock); + wl->wlc->vif =NULL ; +spin_unlock_bh (&wl->lock); }static int brcms_ops_config (struct ieee80211_hw *hw,u32 changed)
@@ -937,6 +943,25 @@ static void brcms_ops_set_tsf(struct ieee80211_hw *hw,spin_unlock_bh (&wl->lock); } +static int brcms_ops_beacon_set_tim (struct ieee80211_hw *hw, +struct ieee80211_sta *sta,bool set) +{ +struct brcms_info *wl = hw->priv; +struct sk_buff *beacon =NULL ; +u16 tim_offset =0 ; + +spin_lock_bh (&wl->lock); +if (wl->wlc->vif) + beacon =ieee80211_beacon_get_tim (hw, wl->wlc->vif, + &tim_offset,NULL ); +if (beacon) +brcms_c_set_new_beacon (wl->wlc, beacon, tim_offset, + wl->wlc->vif->bss_conf.dtim_period); +spin_unlock_bh (&wl->lock); + +return 0 ; +} +static const struct ieee80211_ops brcms_ops = { .tx = brcms_ops_tx, .start = brcms_ops_start,
@@ -955,6 +980,7 @@ static const struct ieee80211_ops brcms_ops = { .flush = brcms_ops_flush, .get_tsf = brcms_ops_get_tsf, .set_tsf = brcms_ops_set_tsf, + .set_tim = brcms_ops_beacon_set_tim, };void brcms_dpc (unsigned long data)
drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.h +1 -0
@@ -563,6 +563,7 @@ struct brcms_c_info {struct wiphy *wiphy;struct scb pri_scb; +struct ieee80211_vif *vif;struct sk_buff *beacon;u16 beacon_tim_offset;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 41/306 ath10k: allocate small size dma memory in ath10k_pci_diag_write_mem
In reply to Greg Kroah-HartmanFrom: Carl Huang <[email protected]>
[ Upstream commit 0738b4998c6d1caf9ca2447b946709a7278c70f1 ]
ath10k_pci_diag_write_mem may allocate big size of the dma memory based on the parameter nbytes. Take firmware diag download as example, the biggest size is about 500K. In some systems, the allocation is likely to fail because it can't acquire such a large contiguous dma memory.
The fix is to allocate a small size dma memory. In the loop, driver copies the data to the allocated dma memory and writes to the destination until all the data is written.
Tested with QCA6174 PCI with firmware-6.bin_WLAN.RM.4.4.1-00119-QCARMSWP-1, this also affects QCA9377 PCI.
--- drivers/net/wireless/ath/ath10k/pci.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-)
drivers/net/wireless/ath/ath10k/pci.c +11 -12
@@ -1054,10 +1054,9 @@ int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address,struct ath10k_ce *ce =ath10k_ce_priv (ar);int ret =0 ;u32 *buf; -unsigned int completed_nbytes, orig_nbytes, remaining_bytes; +unsigned int completed_nbytes, alloc_nbytes, remaining_bytes;struct ath10k_ce_pipe *ce_diag;void *data_buf =NULL ; -u32 ce_data;/* Host buffer address in CE space */ dma_addr_t ce_data_base =0 ;int i;
@@ -1071,9 +1070,10 @@ int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address,* 1) 4-byte alignment * 2) Buffer in DMA-able space */ - orig_nbytes = nbytes; + alloc_nbytes = min_t(unsigned int, nbytes, DIAG_TRANSFER_LIMIT); + data_buf = (unsigned char *)dma_alloc_coherent (ar->dev, - orig_nbytes, + alloc_nbytes, &ce_data_base,GFP_ATOMIC );if (!data_buf) {
@@ -1081,9 +1081,6 @@ int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address, goto done; } -/* Copy caller's data to allocated DMA buf */ -memcpy (data_buf, data, orig_nbytes); -/* * The address supplied by the caller is in the * Target CPU virtual address space.
@@ -1096,12 +1093,14 @@ int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address,*/ address =ath10k_pci_targ_cpu_to_ce_addr (ar, address); - remaining_bytes = orig_nbytes; - ce_data = ce_data_base; + remaining_bytes = nbytes;while (remaining_bytes) {/* FIXME: check cast */ nbytes =min_t (int, remaining_bytes,DIAG_TRANSFER_LIMIT ); +/* Copy caller's data to allocated DMA buf */ +memcpy (data_buf, data, nbytes); +/* Set up to receive directly into Target(!) address */ ret = ce_diag->ops->ce_rx_post_buf (ce_diag, &address, address);if (ret !=0 )
@@ -1111,7 +1110,7 @@ int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address,* Request CE to send caller-supplied data that * was copied to bounce buffer to Target(!) address. */ - ret =ath10k_ce_send_nolock (ce_diag,NULL , (u32 )ce_data, + ret =ath10k_ce_send_nolock (ce_diag,NULL , ce_data_base, nbytes,0 ,0 );if (ret !=0 ) goto done;
@@ -1152,12 +1151,12 @@ int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address, remaining_bytes -= nbytes; address += nbytes; - ce_data += nbytes; + data += nbytes; } done:if (data_buf) { -dma_free_coherent (ar->dev, orig_nbytes, data_buf, +dma_free_coherent (ar->dev, alloc_nbytes, data_buf, ce_data_base); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 42/306 skd: fixup usage of legacy IO API
In reply to Greg Kroah-HartmanFrom: Jens Axboe <[email protected]>
[ Upstream commit 6d1f9dfde7343c4ebfb8f84dcb333af571bb3b22 ]
We need to be using the mq variant of request requeue here.
--- drivers/block/skd_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/block/skd_main.c +2 -2
@@ -1416,7 +1416,7 @@ static void skd_resolve_req_exception(struct skd_device *skdev,case SKD_CHECK_STATUS_BUSY_IMMINENT :skd_log_skreq (skdev, skreq,"retry(busy)" ); -blk_requeue_request (skdev->queue, req); +blk_mq_requeue_request (req, true);dev_info (&skdev->pdev->dev,"drive BUSY imminent\n" ); skdev->state =SKD_DRVR_STATE_BUSY_IMMINENT ; skdev->timer_countdown =SKD_TIMER_MINUTES (20 );
@@ -1426,7 +1426,7 @@ static void skd_resolve_req_exception(struct skd_device *skdev,case SKD_CHECK_STATUS_REQUEUE_REQUEST :if ((unsigned long ) ++req->special <SKD_MAX_RETRIES ) {skd_log_skreq (skdev, skreq,"retry" ); -blk_requeue_request (skdev->queue, req); +blk_mq_requeue_request (req, true);break ; }/* fall through */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 43/306 cdrom: dont attempt to fiddle with cdo->capability
In reply to Greg Kroah-HartmanFrom: Jens Axboe <[email protected]>
[ Upstream commit 8f94004e2a51a3ea195cf3447eb5d5906f36d8b3 ]
We can't modify cdo->capability as it is defined as a const. Change the modification hack to just WARN_ON_ONCE() if we hit any of the invalid combinations.
This fixes a regression for pcd, which doesn't work after the constify patch.
--- drivers/cdrom/cdrom.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-)
drivers/cdrom/cdrom.c +13 -14
@@ -411,10 +411,10 @@ static int cdrom_get_disc_info(struct cdrom_device_info *cdi,* hack to have the capability flags defined const, while we can still * change it here without gcc complaining at every line. */ -#define ENSURE (call, bits) \ -do { \ - if (cdo->call == NULL) \ - *change_capability &= ~(bits); \ +#define ENSURE (cdo, call, bits) \ +do { \ + if (cdo->call == NULL) \ + WARN_ON_ONCE((cdo)->capability & (bits)); \ } while (0)/*
@@ -590,7 +590,6 @@ int register_cdrom(struct cdrom_device_info *cdi) {static char banner_printed;const struct cdrom_device_ops *cdo = cdi->ops; -int *change_capability = (int *)&cdo->capability;/* hack */ cd_dbg (CD_OPEN ,"entering register_cdrom\n" );
@@ -602,16 +601,16 @@ int register_cdrom(struct cdrom_device_info *cdi)cdrom_sysctl_register (); } -ENSURE (drive_status,CDC_DRIVE_STATUS ); +ENSURE (cdo, drive_status,CDC_DRIVE_STATUS );if (cdo->check_events ==NULL && cdo->media_changed ==NULL ) - *change_capability = ~(CDC_MEDIA_CHANGED |CDC_SELECT_DISC ); -ENSURE (tray_move,CDC_CLOSE_TRAY |CDC_OPEN_TRAY ); -ENSURE (lock_door,CDC_LOCK ); -ENSURE (select_speed,CDC_SELECT_SPEED ); -ENSURE (get_last_session,CDC_MULTI_SESSION ); -ENSURE (get_mcn,CDC_MCN ); -ENSURE (reset,CDC_RESET ); -ENSURE (generic_packet,CDC_GENERIC_PACKET ); +WARN_ON_ONCE (cdo->capability & (CDC_MEDIA_CHANGED |CDC_SELECT_DISC )); +ENSURE (cdo, tray_move,CDC_CLOSE_TRAY |CDC_OPEN_TRAY ); +ENSURE (cdo, lock_door,CDC_LOCK ); +ENSURE (cdo, select_speed,CDC_SELECT_SPEED ); +ENSURE (cdo, get_last_session,CDC_MULTI_SESSION ); +ENSURE (cdo, get_mcn,CDC_MCN ); +ENSURE (cdo, reset,CDC_RESET ); +ENSURE (cdo, generic_packet,CDC_GENERIC_PACKET ); cdi->mc_flags =0 ; cdi->options =CDO_USE_FFLAGS ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 44/306 spi: sh-msiof: fix deferred probing
In reply to Greg Kroah-HartmanFrom: Sergei Shtylyov <[email protected]>
[ Upstream commit f34c6e6257aa477cdfe7e9bbbecd3c5648ecda69 ]
Since commit 9ec36cafe43b ("of/irq: do irq resolution in platform_get_irq") platform_get_irq() can return -EPROBE_DEFER. However, the driver overrides an error returned by that function with -ENOENT which breaks the deferred probing. Propagate upstream an error code returned by platform_get_irq() and remove the bogus "platform" from the error message, while at it...
--- drivers/spi/spi-sh-msiof.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi-sh-msiof.c +2 -2
@@ -1343,8 +1343,8 @@ static int sh_msiof_spi_probe(struct platform_device *pdev) i =platform_get_irq (pdev,0 );if (i <0 ) { -dev_err (&pdev->dev,"cannot get platform IRQ\n" ); - ret = -ENOENT ; +dev_err (&pdev->dev,"cannot get IRQ\n" ); + ret = i; goto err1; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 45/306 mmc: mediatek: fill the actual clock for mmc debugfs
In reply to Greg Kroah-HartmanFrom: Chaotian Jing <[email protected]>
[ Upstream commit 56f6cbbed0463f1c78d602b17c315916cc1cd238 ]
as the mmc core layer has the mmc->actual_clock, so fill it and drop msdc_host->sclk.
--- drivers/mmc/host/mtk-sd.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/mmc/host/mtk-sd.c +7 -6
@@ -390,7 +390,6 @@ struct msdc_host {struct clk *src_clk_cg;/* msdc source clock control gate */ u32 mclk;/* mmc subsystem clock frequency */ u32 src_clk_freq;/* source clock frequency */ -u32 sclk;/* SD/MS bus clock frequency */ unsigned char timing;bool vqmmc_enabled;u32 latch_ck;
@@ -635,10 +634,10 @@ static void msdc_set_timeout(struct msdc_host *host, u32 ns, u32 clks) host->timeout_ns = ns; host->timeout_clks = clks; -if (host->sclk ==0 ) { +if (host->mmc->actual_clock ==0 ) { timeout =0 ; }else { - clk_ns =1000000000UL / host->sclk; + clk_ns =1000000000UL / host->mmc->actual_clock; timeout = (ns + clk_ns -1 ) / clk_ns + clks;/* in 1048576 sclk cycle unit */ timeout = (timeout + (0x1 <<20 ) -1 ) >>20 ;
@@ -683,6 +682,7 @@ static void msdc_set_mclk(struct msdc_host *host, unsigned char timing, u32 hz)if (!hz) {dev_dbg (host->dev,"set mclk to 0\n" ); host->mclk =0 ; + host->mmc->actual_clock =0 ;sdr_clr_bits (host->base +MSDC_CFG ,MSDC_CFG_CKPDN );return ; }
@@ -761,7 +761,7 @@ static void msdc_set_mclk(struct msdc_host *host, unsigned char timing, u32 hz)while (!(readl (host->base +MSDC_CFG ) &MSDC_CFG_CKSTB ))cpu_relax ();sdr_set_bits (host->base +MSDC_CFG ,MSDC_CFG_CKPDN ); - host->sclk = sclk; + host->mmc->actual_clock = sclk; host->mclk = hz; host->timing = timing;/* need because clk changed. */
@@ -772,7 +772,7 @@ static void msdc_set_mclk(struct msdc_host *host, unsigned char timing, u32 hz)* mmc_select_hs400() will drop to 50Mhz and High speed mode, * tune result of hs200/200Mhz is not suitable for 50Mhz */ -if (host->sclk <=52000000 ) { +if (host->mmc->actual_clock <=52000000 ) {writel (host->def_tune_para.iocon, host->base +MSDC_IOCON );writel (host->def_tune_para.pad_tune, host->base + tune_reg); }else {
@@ -787,7 +787,8 @@ static void msdc_set_mclk(struct msdc_host *host, unsigned char timing, u32 hz)sdr_set_field (host->base + tune_reg,MSDC_PAD_TUNE_CMDRRDLY , host->hs400_cmd_int_delay); -dev_dbg (host->dev,"sclk: %d, timing: %d\n" , host->sclk, timing); +dev_dbg (host->dev,"sclk: %d, timing: %d\n" , host->mmc->actual_clock, + timing); } static inline u32 msdc_cmd_find_resp(struct msdc_host *host,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 9/306 net/mlxfw: Verify FSM error code translation doesnt exceed array size
In reply to Greg Kroah-HartmanFrom: Eran Ben Elisha <[email protected]>
[ Upstream commit 30e9e0550bf693c94bc15827781fe42dd60be634 ]
Array mlxfw_fsm_state_err_str contains value to string translation, when values are provided by mlxfw_dev. If value is larger than MLXFW_FSM_STATE_ERR_MAX, return "unknown error" as expected instead of reading an address than exceed array size.
--- drivers/net/ethernet/mellanox/mlxfw/mlxfw_fsm.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/mellanox/mlxfw/mlxfw_fsm.c +2 -0
@@ -86,6 +86,8 @@ retry:return err;if (fsm_state_err !=MLXFW_FSM_STATE_ERR_OK ) { + fsm_state_err = min_t(enum mlxfw_fsm_state_err, + fsm_state_err,MLXFW_FSM_STATE_ERR_MAX );pr_err ("Firmware flash failed: %s\n" , mlxfw_fsm_state_err_str[fsm_state_err]);return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 47/306 PCI: mediatek: Fix class type for MT7622 to PCI_CLASS_BRIDGE_PCI
In reply to Greg Kroah-HartmanFrom: Honghui Zhang <[email protected]>
[ Upstream commit a7f172ab6a8e755e60311f27512034b0441ef421 ]
commit 101c92dc80c8 ("PCI: mediatek: Set up vendor ID and class type for MT7622") erroneously set the class type for MT7622 to PCI_CLASS_BRIDGE_HOST.
The PCIe controller of MT7622 integrates a Root Port that has type 1 configuration space header and related bridge windows.
The HW default value of this bridge's class type is invalid.
Fix its class type and set it to PCI_CLASS_BRIDGE_PCI to match the hardware implementation.
--- drivers/pci/controller/pcie-mediatek.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/pcie-mediatek.c +1 -1
@@ -432,7 +432,7 @@ static int mtk_pcie_startup_port_v2(struct mtk_pcie_port *port) val =PCI_VENDOR_ID_MEDIATEK ;writew (val, port->base +PCIE_CONF_VEND_ID ); - val =PCI_CLASS_BRIDGE_HOST ; + val =PCI_CLASS_BRIDGE_PCI ;writew (val, port->base +PCIE_CONF_CLASS_ID ); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 48/306 btrfs: defrag: use btrfs_mod_outstanding_extents in cluster_pages_for_defrag
In reply to Greg Kroah-HartmanFrom: Su Yue <[email protected]>
[ Upstream commit 28c4a3e21ad030d7571ee9b1b246a5cbfd886627 ]
Since commit 8b62f87bad9c ("Btrfs: rework outstanding_extents"), manual operations of outstanding_extent in btrfs_inode are replaced by btrfs_mod_outstanding_extents().
The one in cluster_pages_for_defrag seems to be lost, so replace it of btrfs_mod_outstanding_extents().
--- fs/btrfs/ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/ioctl.c +1 -1
@@ -1337,7 +1337,7 @@ static int cluster_pages_for_defrag(struct inode *inode,if (i_done != page_cnt) {spin_lock (&BTRFS_I (inode)->lock); -BTRFS_I (inode)->outstanding_extents++; +btrfs_mod_outstanding_extents (BTRFS_I (inode),1 );spin_unlock (&BTRFS_I (inode)->lock); btrfs_delalloc_release_space(inode, data_reserved, start_index << PAGE_SHIFT,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 49/306 btrfs: handle error of get_old_root
In reply to Greg Kroah-HartmanFrom: Nikolay Borisov <[email protected]>
[ Upstream commit 315bed43fea532650933e7bba316a7601d439edf ]
In btrfs_search_old_slot get_old_root is always used with the assumption it cannot fail. However, this is not true in rare circumstance it can fail and return null. This will lead to null point dereference when the header is read. Fix this by checking the return value and properly handling NULL by setting ret to -EIO and returning gracefully.
Coverity-id: 1087503
--- fs/btrfs/ctree.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/btrfs/ctree.c +4 -0
@@ -3031,6 +3031,10 @@ int btrfs_search_old_slot(struct btrfs_root *root, const struct btrfs_key *key, again: b =get_old_root (root, time_seq); +if (!b) { + ret = -EIO ; + goto done; + } level =btrfs_header_level (b); p->locks[level] =BTRFS_READ_LOCK ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 10/306 net/mlx5: Fix auto group size calculation
In reply to Greg Kroah-HartmanFrom: Maor Gottlieb <[email protected]>
[ Upstream commit 97fd8da281f80e7e69e0114bc906575734d4dfaf ]
Once all the large flow groups (defined by the user when the flow table is created - max_num_groups) were created, then all the following new flow groups will have only one flow table entry, even though the flow table has place to larger groups.
Fix the condition to prefer large flow group.
--- drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 10 ++++++---- drivers/net/ethernet/mellanox/mlx5/core/fs_core.h | 1 + 2 files changed, 7 insertions(+), 4 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +6 -4
@@ -520,7 +520,7 @@ static void del_sw_flow_group(struct fs_rhashtable_destroy (&fg->ftes_hash);ida_destroy (&fg->fte_allocator); -if (ft->autogroup.active) +if (ft->autogroup.active && fg->max_ftes == ft->autogroup.group_size) ft->autogroup.num_groups--; err = rhltable_remove(&ft->fgs_hash, &fg->hash,
@@ -1065,6 +1065,8 @@ mlx5_create_auto_grouped_flow_table(stru ft->autogroup.active = true; ft->autogroup.required_groups = max_num_groups; +/* We save place for flow groups in addition to max types */ + ft->autogroup.group_size = ft->max_fte / (max_num_groups +1 );return ft; }
@@ -1270,8 +1272,7 @@ static struct mlx5_flow_group *alloc_autreturn ERR_PTR (-ENOENT );if (ft->autogroup.num_groups < ft->autogroup.required_groups) -/* We save place for flow groups in addition to max types */ - group_size = ft->max_fte / (ft->autogroup.required_groups +1 ); + group_size = ft->autogroup.group_size;/* ft->max_fte == ft->autogroup.max_types */ if (group_size ==0 )
@@ -1298,7 +1299,8 @@ static struct mlx5_flow_group *alloc_autif (IS_ERR (fg)) goto out; - ft->autogroup.num_groups++; +if (group_size == ft->autogroup.group_size) + ft->autogroup.num_groups++; out:return fg;
drivers/net/ethernet/mellanox/mlx5/core/fs_core.h +1 -0
@@ -121,6 +121,7 @@ struct mlx5_flow_table {struct {bool active;unsigned int required_groups; +unsigned int group_size;unsigned int num_groups; } autogroup;/* Protect fwd_rules */
Greg Kroah-Hartman
maintainerPATCH 12/306 gpio: max77620: Fixup debounce delays
In reply to Greg Kroah-HartmanFrom: Thierry Reding <[email protected]>
commit b0391479ae04dfcbd208b9571c375064caad9a57 upstream.
When converting milliseconds to microseconds in commit fffa6af94894 ("gpio: max77620: Use correct unit for debounce times") some ~1 ms gaps were introduced between the various ranges supported by the controller. Fix this by changing the start of each range to the value immediately following the end of the previous range. This way a debounce time of, say 8250 us will translate into 16 ms instead of returning an -EINVAL error.
Typically the debounce delay is only ever set through device tree and specified in milliseconds, so we can never really hit this issue because debounce times are always a multiple of 1000 us.
The only notable exception for this is drivers/mmc/host/mmc-spi.c where the CD GPIO is requested, which passes a 1 us debounce time. According to a comment preceeding that code this should actually be 1 ms (i.e. 1000 us).
--- drivers/gpio/gpio-max77620.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpio/gpio-max77620.c +3 -3
@@ -163,13 +163,13 @@ static int max77620_gpio_set_debounce(stcase 0 : val = MAX77620_CNFG_GPIO_DBNC_None;break ; - case 1000 ... 8000: + case 1 ... 8000: val = MAX77620_CNFG_GPIO_DBNC_8ms;break ; - case 9000 ... 16000: + case 8001 ... 16000: val = MAX77620_CNFG_GPIO_DBNC_16ms;break ; - case 17000 ... 32000: + case 16001 ... 32000: val = MAX77620_CNFG_GPIO_DBNC_32ms;break ;default :
Greg Kroah-Hartman
maintainerPATCH 11/306 vhost/vsock: split packets to send using multiple buffers
In reply to Greg Kroah-HartmanFrom: Stefano Garzarella <[email protected]>
commit 6dbd3e66e7785a2f055bf84d98de9b8fd31ff3f5 upstream.
If the packets to sent to the guest are bigger than the buffer available, we can split them, using multiple buffers and fixing the length in the packet header.
This is safe since virtio-vsock supports only stream sockets.
--- drivers/vhost/vsock.c | 66 +++++++++++++++++++++++--------- net/vmw_vsock/virtio_transport_common.c | 15 +++++-- 2 files changed, 60 insertions(+), 21 deletions(-)
drivers/vhost/vsock.c +48 -18
@@ -103,7 +103,7 @@ vhost_transport_do_send_pkt(struct vhoststruct iov_iter iov_iter;unsigned out, in;size_t nbytes; -size_t len; +size_t iov_len, payload_len;int head;spin_lock_bh (&vsock->send_pkt_list_lock);
@@ -148,8 +148,24 @@ vhost_transport_do_send_pkt(struct vhostbreak ; } - len =iov_length (&vq->iov[out], in); -iov_iter_init (&iov_iter,READ , &vq->iov[out], in, len); + iov_len =iov_length (&vq->iov[out], in); +if (iov_len <sizeof (pkt->hdr)) { +virtio_transport_free_pkt (pkt); +vq_err (vq,"Buffer len [%zu] too small\n" , iov_len); +break ; + } + +iov_iter_init (&iov_iter,READ , &vq->iov[out], in, iov_len); + payload_len = pkt->len - pkt->off; + +/* If the packet is greater than the space available in the +* buffer, we split it using multiple buffers. +*/ +if (payload_len > iov_len -sizeof (pkt->hdr)) + payload_len = iov_len -sizeof (pkt->hdr); + +/* Set the correct length in the header */ + pkt->hdr.len =cpu_to_le32 (payload_len); nbytes =copy_to_iter (&pkt->hdr,sizeof (pkt->hdr), &iov_iter);if (nbytes !=sizeof (pkt->hdr)) {
@@ -158,33 +174,47 @@ vhost_transport_do_send_pkt(struct vhostbreak ; } - nbytes =copy_to_iter (pkt->buf, pkt->len, &iov_iter); -if (nbytes != pkt->len) { + nbytes =copy_to_iter (pkt->buf + pkt->off, payload_len, + &iov_iter); +if (nbytes != payload_len) {virtio_transport_free_pkt (pkt);vq_err (vq,"Faulted on copying pkt buf\n" );break ; } -vhost_add_used (vq, head,sizeof (pkt->hdr) + pkt->len); +vhost_add_used (vq, head,sizeof (pkt->hdr) + payload_len); added = true; -if (pkt->reply) { -int val; - - val =atomic_dec_return (&vsock->queued_replies); - -/* Do we have resources to resume tx processing? */ -if (val +1 == tx_vq->num) - restart_tx = true; - } -/* Deliver to monitoring devices all correctly transmitted * packets. */ virtio_transport_deliver_tap_pkt (pkt); - total_len += pkt->len; -virtio_transport_free_pkt (pkt); + pkt->off += payload_len; + total_len += payload_len; + +/* If we didn't send all the payload we can requeue the packet +* to send it with the next available buffer. +*/ +if (pkt->off < pkt->len) { +spin_lock_bh (&vsock->send_pkt_list_lock); +list_add (&pkt->list, &vsock->send_pkt_list); +spin_unlock_bh (&vsock->send_pkt_list_lock); + }else { +if (pkt->reply) { +int val; + + val =atomic_dec_return (&vsock->queued_replies); + +/* Do we have resources to resume tx +* processing? +*/ +if (val +1 == tx_vq->num) + restart_tx = true; + } + +virtio_transport_free_pkt (pkt); + } }while (likely (!vhost_exceeds_weight (vq, ++pkts, total_len)));if (added)vhost_signal (&vsock->dev, vq);
net/vmw_vsock/virtio_transport_common.c +12 -3
@@ -92,8 +92,17 @@ static struct sk_buff *virtio_transport_struct virtio_vsock_pkt *pkt = opaque;struct af_vsockmon_hdr *hdr;struct sk_buff *skb; +size_t payload_len; +void *payload_buf; - skb =alloc_skb (sizeof (*hdr) +sizeof (pkt->hdr) + pkt->len, +/* A packet could be split to fit the RX buffer, so we can retrieve +* the payload length from the header and the buffer pointer taking +* care of the offset in the original packet. +*/ + payload_len =le32_to_cpu (pkt->hdr.len); + payload_buf = pkt->buf + pkt->off; + + skb =alloc_skb (sizeof (*hdr) +sizeof (pkt->hdr) + payload_len,GFP_ATOMIC );if (!skb)return NULL ;
@@ -133,8 +142,8 @@ static struct sk_buff *virtio_transport_skb_put_data (skb, &pkt->hdr,sizeof (pkt->hdr)); -if (pkt->len) { -skb_put_data (skb, pkt->buf, pkt->len); +if (payload_len) { +skb_put_data (skb, payload_buf, payload_len); }return skb;
Greg Kroah-Hartman
maintainerPATCH 5/306 net/sched: act_pedit: fix WARN() in the traffic path
In reply to Greg Kroah-HartmanFrom: Davide Caratti <[email protected]>
[ Upstream commit f67169fef8dbcc1ac6a6a109ecaad0d3b259002c ]
when configuring act_pedit rules, the number of keys is validated only on addition of a new entry. This is not sufficient to avoid hitting a WARN() in the traffic path: for example, it is possible to replace a valid entry with a new one having 0 extended keys, thus causing splats in dmesg like:
pedit BUG: index 42
WARNING: CPU: 2 PID: 4054 at net/sched/act_pedit.c:410 tcf_pedit_act+0xc84/0x1200 [act_pedit] [...] RIP: 0010:tcf_pedit_act+0xc84/0x1200 [act_pedit] Code: 89 fa 48 c1 ea 03 0f b6 04 02 84 c0 74 08 3c 03 0f 8e ac 00 00 00 48 8b 44 24 10 48 c7 c7 a0 c4 e4 c0 8b 70 18 e8 1c 30 95 ea <0f> 0b e9 a0 fa ff ff e8 00 03 f5 ea e9 14 f4 ff ff 48 89 58 40 e9 RSP: 0018:ffff888077c9f320 EFLAGS: 00010286 RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffffffac2983a2 RDX: 0000000000000001 RSI: 0000000000000008 RDI: ffff888053927bec RBP: dffffc0000000000 R08: ffffed100a726209 R09: ffffed100a726209 R10: 0000000000000001 R11: ffffed100a726208 R12: ffff88804beea780 R13: ffff888079a77400 R14: ffff88804beea780 R15: ffff888027ab2000 FS: 00007fdeec9bd740(0000) GS:ffff888053900000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ffdb3dfd000 CR3: 000000004adb4006 CR4: 00000000001606e0 Call Trace: tcf_action_exec+0x105/0x3f0 tcf_classify+0xf2/0x410 __dev_queue_xmit+0xcbf/0x2ae0 ip_finish_output2+0x711/0x1fb0 ip_output+0x1bf/0x4b0 ip_send_skb+0x37/0xa0 raw_sendmsg+0x180c/0x2430 sock_sendmsg+0xdb/0x110 __sys_sendto+0x257/0x2b0 __x64_sys_sendto+0xdd/0x1b0 do_syscall_64+0xa5/0x4e0 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x7fdeeb72e993 Code: 48 8b 0d e0 74 2c 00 f7 d8 64 89 01 48 83 c8 ff c3 66 0f 1f 44 00 00 83 3d 0d d6 2c 00 00 75 13 49 89 ca b8 2c 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 34 c3 48 83 ec 08 e8 4b cc 00 00 48 89 04 24 RSP: 002b:00007ffdb3de8a18 EFLAGS: 00000246 ORIG_RAX: 000000000000002c RAX: ffffffffffffffda RBX: 000055c81972b700 RCX: 00007fdeeb72e993 RDX: 0000000000000040 RSI: 000055c81972b700 RDI: 0000000000000003 RBP: 00007ffdb3dea130 R08: 000055c819728510 R09: 0000000000000010 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000040 R13: 000055c81972b6c0 R14: 000055c81972969c R15: 0000000000000080
Fix this moving the check on 'nkeys' earlier in tcf_pedit_init(), so that attempts to install rules having 0 keys are always rejected with -EINVAL.
--- net/sched/act_pedit.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
net/sched/act_pedit.c +5 -7
@@ -46,7 +46,7 @@ static struct tcf_pedit_key_ex *tcf_pediint err = -EINVAL ;int rem; -if (!nla || !n) +if (!nla)return NULL ; keys_ex =kcalloc (n,sizeof (*k),GFP_KERNEL );
@@ -169,6 +169,10 @@ static int tcf_pedit_init(struct net *ne } parm =nla_data (pattr); +if (!parm->nkeys) { +NL_SET_ERR_MSG_MOD (extack,"Pedit requires keys to be passed" ); +return -EINVAL ; + } ksize = parm->nkeys *sizeof (struct tc_pedit_key );if (nla_len (pattr) <sizeof (*parm) + ksize) {NL_SET_ERR_MSG_ATTR (extack, pattr,"Length of TCA_PEDIT_PARMS or TCA_PEDIT_PARMS_EX pedit attribute is invalid" );
@@ -182,12 +186,6 @@ static int tcf_pedit_init(struct net *ne index = parm->index; err =tcf_idr_check_alloc (tn, &index, a, bind);if (!err) { -if (!parm->nkeys) { -tcf_idr_cleanup (tn, index); -NL_SET_ERR_MSG_MOD (extack,"Pedit requires keys to be passed" ); - ret = -EINVAL ; - goto out_free; - } ret =tcf_idr_create (tn, index, est, a, &act_pedit_ops, bind, false);if (ret) {
Greg Kroah-Hartman
maintainerPATCH 14/306 nbd:fix memory leak in nbd_get_socket()
In reply to Greg Kroah-HartmanFrom: Sun Ke <[email protected]>
commit dff10bbea4be47bdb615b036c834a275b7c68133 upstream.
Before returning NULL, put the sock first.
--- drivers/block/nbd.c | 1 + 1 file changed, 1 insertion(+)
drivers/block/nbd.c +1 -0
@@ -945,6 +945,7 @@ static struct socket *nbd_get_socket(strif (sock->ops->shutdown == sock_no_shutdown) {dev_err (disk_to_dev (nbd->disk),"Unsupported socket: shutdown callout must be supported.\n" ); *err = -EINVAL ; +sockfd_put (sock);return NULL ; }
Greg Kroah-Hartman
maintainerPATCH 13/306 tools: gpio: Correctly add make dependencies for gpio_utils
In reply to Greg Kroah-HartmanFrom: Laura Abbott <[email protected]>
commit 0161a94e2d1c713bd34d72bc0239d87c31747bf7 upstream.
gpio tools fail to build correctly with make parallelization:
$ make -s -j24 ld: gpio-utils.o: file not recognized: file truncated make[1]: *** [/home/labbott/linux_upstream/tools/build/Makefile.build:145: lsgpio-in.o] Error 1 make: *** [Makefile:43: lsgpio-in.o] Error 2 make: *** Waiting for unfinished jobs....
This is because gpio-utils.o is used across multiple targets. Fix this by making gpio-utios.o a proper dependency.
--- tools/gpio/Build | 1 + tools/gpio/Makefile | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-)
tools/gpio/Build +1 -0
@@ -1,3 +1,4 @@ +gpio-utils-y += gpio-utils.o lsgpio-y += lsgpio.o gpio-utils.o gpio-hammer-y += gpio-hammer.o gpio-utils.o gpio-event-mon-y += gpio-event-mon.o gpio-utils.o
tools/gpio/Makefile +7 -3
@@ -35,11 +35,15 @@ $(OUTPUT)include/linux/gpio.h: ../../inc prepare: $(OUTPUT)include/linux/gpio.h +GPIO_UTILS_IN := $(output)gpio-utils-in.o +$(GPIO_UTILS_IN): prepare FORCE + $(Q)$(MAKE) $(build)=gpio-utils + # # lsgpio # LSGPIO_IN := $(OUTPUT)lsgpio-in.o -$(LSGPIO_IN): prepare FORCE +$(LSGPIO_IN): prepare FORCE $(OUTPUT)gpio-utils-in.o $(Q)$(MAKE) $(build)=lsgpio $(OUTPUT)lsgpio: $(LSGPIO_IN) $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
@@ -48,7 +52,7 @@ $(OUTPUT)lsgpio: $(LSGPIO_IN) # gpio-hammer # GPIO_HAMMER_IN := $(OUTPUT)gpio-hammer-in.o -$(GPIO_HAMMER_IN): prepare FORCE +$(GPIO_HAMMER_IN): prepare FORCE $(OUTPUT)gpio-utils-in.o $(Q)$(MAKE) $(build)=gpio-hammer $(OUTPUT)gpio-hammer: $(GPIO_HAMMER_IN) $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
@@ -57,7 +61,7 @@ $(OUTPUT)gpio-hammer: $(GPIO_HAMMER_IN) # gpio-event-mon # GPIO_EVENT_MON_IN := $(OUTPUT)gpio-event-mon-in.o -$(GPIO_EVENT_MON_IN): prepare FORCE +$(GPIO_EVENT_MON_IN): prepare FORCE $(OUTPUT)gpio-utils-in.o $(Q)$(MAKE) $(build)=gpio-event-mon $(OUTPUT)gpio-event-mon: $(GPIO_EVENT_MON_IN) $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
Greg Kroah-Hartman
maintainerPATCH 60/306 pinctrl: sunxi: Fix a memory leak in sunxi_pinctrl_build_state()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit a93a676b079144009f55fff2ab0e34c3b7258c8a ]
If 'krealloc()' fails, 'pctl->functions' is set to NULL. We should instead use a temp variable in order to be able to free the previously allocated memeory, in case of OOM.
--- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/pinctrl/sunxi/pinctrl-sunxi.c +7 -4
@@ -1042,6 +1042,7 @@ static int sunxi_pinctrl_add_function(struct sunxi_pinctrl *pctl,static int sunxi_pinctrl_build_state (struct platform_device *pdev) {struct sunxi_pinctrl *pctl =platform_get_drvdata (pdev); +void *ptr;int i;/*
@@ -1108,13 +1109,15 @@ static int sunxi_pinctrl_build_state(struct platform_device *pdev) }/* And now allocated and fill the array for real */ - pctl->functions =krealloc (pctl->functions, - pctl->nfunctions *sizeof (*pctl->functions), -GFP_KERNEL ); -if (!pctl->functions) { + ptr =krealloc (pctl->functions, + pctl->nfunctions *sizeof (*pctl->functions), +GFP_KERNEL ); +if (!ptr) {kfree (pctl->functions); + pctl->functions =NULL ;return -ENOMEM ; } + pctl->functions = ptr;for (i =0 ; i < pctl->desc->npins; i++) {const struct sunxi_desc_pin *pin = pctl->desc->pins + i;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 51/306 misc: mic: fix a DMA pool free failure
In reply to Greg Kroah-HartmanFrom: Wenwen Wang <[email protected]>
[ Upstream commit 6b995f4eec34745f6cb20d66d5277611f0b3c3fa ]
In _scif_prog_signal(), the boolean variable 'x100' is used to indicate whether the MIC Coprocessor is X100. If 'x100' is true, the status descriptor will be used to write the value to the destination. Otherwise, a DMA pool will be allocated for this purpose. Specifically, if the DMA pool is allocated successfully, two memory addresses will be returned. One is for the CPU and the other is for the device to access the DMA pool. The former is stored to the variable 'status' and the latter is stored to the variable 'src'. After the allocation, the address in 'src' is saved to 'status->src_dma_addr', which is actually in the DMA pool, and 'src' is then modified.
Later on, if an error occurs, the execution flow will transfer to the label 'dma_fail', which will check 'x100' and free up the allocated DMA pool if 'x100' is false. The point here is that 'status->src_dma_addr' is used for freeing up the DMA pool. As mentioned before, 'status->src_dma_addr' is in the DMA pool. And thus, the device is able to modify this data. This can potentially cause failures when freeing up the DMA pool because of the modified device address.
This patch avoids the above issue by using the variable 'src' (with necessary calculation) to free up the DMA pool.
--- drivers/misc/mic/scif/scif_fence.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/mic/scif/scif_fence.c +1 -1
@@ -272,7 +272,7 @@ static int _scif_prog_signal(scif_epd_t epd, dma_addr_t dst, u64 val) dma_fail:if (!x100)dma_pool_free (ep->remote_dev->signal_pool, status, - status->src_dma_addr); + src - offsetof(struct scif_status , val)); alloc_fail:return err; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 61/306 pwm: lpss: Only set update bit if we are actually changing the settings
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 2153bbc12f77fb2203276befc0f0dddbfb023bb1 ]
According to the datasheet the update bit must be set if the on-time-div or the base-unit changes.
Now that we properly order device resume on Cherry Trail so that the GFX0 _PS0 method no longer exits with an error, we end up with a sequence of events where we are writing the same values twice in a row.
First the _PS0 method restores the duty cycle of 0% the GPU driver set on suspend and then the GPU driver first updates just the enabled bit in the pwm_state from 0 to 1, causing us to write the same values again, before restoring the pre-suspend duty-cycle in a separate pwm_apply call.
When writing the update bit the second time, without changing any of the values the update bit clears immediately / instantly, instead of staying 1 for a while as usual. After this the next setting of the update bit seems to be ignored, causing the restoring of the pre-suspend duty-cycle to not get applied. This makes the backlight come up with a 0% dutycycle after suspend/resume.
Any further brightness changes after this do work.
This commit moves the setting of the update bit into pwm_lpss_prepare() and only sets the bit if we have actually changed any of the values.
This avoids the setting of the update bit the second time we configure the PWM to 0% dutycycle, this fixes the backlight coming up with 0% duty-cycle after a suspend/resume.
--- drivers/pwm/pwm-lpss.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/pwm/pwm-lpss.c +7 -5
@@ -97,7 +97,7 @@ static void pwm_lpss_prepare(struct pwm_lpss_chip *lpwm, struct pwm_device *pwm,unsigned long long on_time_div;unsigned long c = lpwm->info->clk_rate, base_unit_range;unsigned long long base_unit, freq =NSEC_PER_SEC ; -u32 ctrl; +u32 orig_ctrl, ctrl;do_div (freq, period_ns);
@@ -114,13 +114,17 @@ static void pwm_lpss_prepare(struct pwm_lpss_chip *lpwm, struct pwm_device *pwm,do_div (on_time_div, period_ns); on_time_div =255ULL - on_time_div; - ctrl =pwm_lpss_read (pwm); + orig_ctrl = ctrl =pwm_lpss_read (pwm); ctrl &= ~PWM_ON_TIME_DIV_MASK ; ctrl &= ~(base_unit_range <<PWM_BASE_UNIT_SHIFT ); base_unit &= base_unit_range; ctrl |= (u32 ) base_unit <<PWM_BASE_UNIT_SHIFT ; ctrl |= on_time_div; -pwm_lpss_write (pwm, ctrl); + +if (orig_ctrl != ctrl) { +pwm_lpss_write (pwm, ctrl); +pwm_lpss_write (pwm, ctrl |PWM_SW_UPDATE ); + } }static inline void pwm_lpss_cond_enable (struct pwm_device *pwm,bool cond)
@@ -144,7 +148,6 @@ static int pwm_lpss_apply(struct pwm_chip *chip, struct pwm_device *pwm,return ret; }pwm_lpss_prepare (lpwm, pwm, state->duty_cycle, state->period); -pwm_lpss_write (pwm,pwm_lpss_read (pwm) |PWM_SW_UPDATE );pwm_lpss_cond_enable (pwm, lpwm->info->bypass == false); ret =pwm_lpss_wait_for_update (pwm);if (ret) {
@@ -157,7 +160,6 @@ static int pwm_lpss_apply(struct pwm_chip *chip, struct pwm_device *pwm,if (ret)return ret;pwm_lpss_prepare (lpwm, pwm, state->duty_cycle, state->period); -pwm_lpss_write (pwm,pwm_lpss_read (pwm) |PWM_SW_UPDATE );return pwm_lpss_wait_for_update (pwm); } }else if (pwm_is_enabled (pwm)) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 62/306 amiflop: clean up on errors during setup
In reply to Greg Kroah-HartmanFrom: Omar Sandoval <[email protected]>
[ Upstream commit 53d0f8dbde89cf6c862c7a62e00c6123e02cba41 ]
The error handling in fd_probe_drives() doesn't clean up at all. Fix it up in preparation for converting to blk-mq. While we're here, get rid of the commented out amiga_floppy_remove().
--- drivers/block/amiflop.c | 84 ++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 44 deletions(-)
drivers/block/amiflop.c +40 -44
@@ -1701,11 +1701,41 @@ static const struct block_device_operations floppy_fops = { .check_events = amiga_check_events, }; +static struct gendisk *fd_alloc_disk (int drive) +{ +struct gendisk *disk; + + disk =alloc_disk (1 ); +if (!disk) + goto out; + + disk->queue =blk_init_queue (do_fd_request, &amiflop_lock); +if (IS_ERR (disk->queue)) { + disk->queue =NULL ; + goto out_put_disk; + } + + unit[drive].trackbuf =kmalloc (FLOPPY_MAX_SECTORS *512 ,GFP_KERNEL ); +if (!unit[drive].trackbuf) + goto out_cleanup_queue; + +return disk; + +out_cleanup_queue: +blk_cleanup_queue (disk->queue); + disk->queue =NULL ; +out_put_disk: +put_disk (disk); +out: + unit[drive].type->code =FD_NODRIVE ; +return NULL ; +} +static int __init fd_probe_drives (void ) {int drive,drives,nomem; -printk (KERN_INFO "FD: probing units\nfound " ); +pr_info ("FD: probing units\nfound" ); drives=0 ; nomem=0 ;for (drive=0 ;drive<FD_MAX_UNITS ;drive++) {
@@ -1713,27 +1743,17 @@ static int __init fd_probe_drives(void)fd_probe (drive);if (unit[drive].type->code ==FD_NODRIVE )continue ; - disk =alloc_disk (1 ); + + disk =fd_alloc_disk (drive);if (!disk) { - unit[drive].type->code =FD_NODRIVE ; +pr_cont (" no mem for fd%d" , drive); + nomem =1 ;continue ; } unit[drive].gendisk = disk; - - disk->queue =blk_init_queue (do_fd_request, &amiflop_lock); -if (!disk->queue) { - unit[drive].type->code =FD_NODRIVE ; -continue ; - } - drives++; -if ((unit[drive].trackbuf =kmalloc (FLOPPY_MAX_SECTORS *512 ,GFP_KERNEL )) ==NULL ) { -printk ("no mem for " ); - unit[drive].type = &drive_types[num_dr_types -1 ];/* FD_NODRIVE */ - drives--; - nomem =1 ; - } -printk ("fd%d " ,drive); + +pr_cont (" fd%d" ,drive); disk->major =FLOPPY_MAJOR ; disk->first_minor = drive; disk->fops = &floppy_fops;
@@ -1744,11 +1764,11 @@ static int __init fd_probe_drives(void) }if ((drives >0 ) || (nomem ==0 )) {if (drives ==0 ) -printk ("no drives" ); -printk ("\n" ); +pr_cont (" no drives" ); +pr_cont ("\n" );return drives; } -printk ("\n" ); +pr_cont ("\n" );return -ENOMEM ; }
@@ -1831,30 +1851,6 @@ static int __init amiga_floppy_probe(struct platform_device *pdev)return ret; } -#if 0 /* not safe to unload */ -static int __exit amiga_floppy_remove(struct platform_device *pdev) -{ -int i; - -for ( i =0 ; i <FD_MAX_UNITS ; i++) { -if (unit[i].type->code !=FD_NODRIVE ) { -struct request_queue *q = unit[i].gendisk->queue; -del_gendisk (unit[i].gendisk); -put_disk (unit[i].gendisk); -kfree (unit[i].trackbuf); -if (q) -blk_cleanup_queue (q); - } - } -blk_unregister_region (MKDEV (FLOPPY_MAJOR ,0 ),256 ); -free_irq (IRQ_AMIGA_CIAA_TB ,NULL ); -free_irq (IRQ_AMIGA_DSKBLK ,NULL ); - custom.dmacon =DMAF_DISK ;/* disable DMA */ -amiga_chip_free (raw_buf); -unregister_blkdev (FLOPPY_MAJOR ,"fd" ); -} -#endif -static struct platform_driver amiga_floppy_driver = { .driver = { .name ="amiga-floppy" ,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 64/306 scsi: ips: fix missing break in switch
In reply to Greg Kroah-HartmanFrom: Gustavo A. R. Silva <[email protected]>
[ Upstream commit 5d25ff7a544889bc4b749fda31778d6a18dddbcb ]
Add missing break statement in order to prevent the code from falling through to case TEST_UNIT_READY.
Addresses-Coverity-ID: 1357338 ("Missing break in switch")
--- drivers/scsi/ips.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/ips.c +1 -0
@@ -3485,6 +3485,7 @@ ips_send_cmd(ips_ha_t * ha, ips_scb_t * scb)case START_STOP : scb->scsi_cmd->result =DID_OK <<16 ; +break ;case TEST_UNIT_READY :case INQUIRY :
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 65/306 nfp: bpf: protect against mis-initializing atomic counters
In reply to Greg Kroah-HartmanFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 527db74b71ee5a279f818aae51f2c26b4e5c7648 ]
Atomic operations on the NFP are currently always in big endian. The driver keeps track of regions of memory storing atomic values and byte swaps them accordingly. There are corner cases where the map values may be initialized before the driver knows they are used as atomic counters. This can happen either when the datapath is performing the update and the stack contents are unknown or when map is updated before the program which will use it for atomic values is loaded.
To avoid situation where user initializes the value to 0 1 2 3 and then after loading a program which uses the word as an atomic counter starts reading 3 2 1 0 - only allow atomic counters to be initialized to endian-neutral values.
For updates from the datapath the stack information may not be as precise, so just allow initializing such values to 0.
Example code which would break:
struct bpf_map_def SEC("maps") rxcnt = {
.type = BPF_MAP_TYPE_HASH,
.key_size = sizeof(__u32),
.value_size = sizeof(__u64),
.max_entries = 1,
};int xdp_prog1()
{
__u64 nonzeroval = 3;
__u32 key = 0;
__u64 *value;
value = bpf_map_lookup_elem(&rxcnt, &key);
if (!value)
bpf_map_update_elem(&rxcnt, &key, &nonzeroval, BPF_ANY);
else
__sync_fetch_and_add(value, 1);
return XDP_PASS;
}$ offload bpftool map dump key: 00 00 00 00 value: 00 00 00 03 00 00 00 00
should be:
$ offload bpftool map dump key: 00 00 00 00 value: 03 00 00 00 00 00 00 00
--- drivers/net/ethernet/netronome/nfp/bpf/main.h | 7 ++- .../net/ethernet/netronome/nfp/bpf/offload.c | 18 +++++- .../net/ethernet/netronome/nfp/bpf/verifier.c | 58 +++++++++++++++++-- 3 files changed, 76 insertions(+), 7 deletions(-)
drivers/net/ethernet/netronome/nfp/bpf/main.h +6 -1
@@ -206,6 +206,11 @@ enum nfp_bpf_map_use { NFP_MAP_USE_ATOMIC_CNT, }; +struct nfp_bpf_map_word { +unsigned char type :4 ; +unsigned char non_zero_update :1 ; +}; +/** * struct nfp_bpf_map - private per-map data attached to BPF maps for offload * @offmap: pointer to the offloaded BPF map
@@ -219,7 +224,7 @@ struct nfp_bpf_map {struct nfp_app_bpf *bpf;u32 tid;struct list_head l; -enum nfp_bpf_map_use use_map[]; +struct nfp_bpf_map_word use_map[]; };struct nfp_bpf_neutral_map {
drivers/net/ethernet/netronome/nfp/bpf/offload.c +17 -1
@@ -299,10 +299,25 @@ static void nfp_map_bpf_byte_swap(struct nfp_bpf_map *nfp_map, void *value)unsigned int i;for (i =0 ; i <DIV_ROUND_UP (nfp_map->offmap->map.value_size,4 ); i++) -if (nfp_map->use_map[i] ==NFP_MAP_USE_ATOMIC_CNT ) +if (nfp_map->use_map[i].type ==NFP_MAP_USE_ATOMIC_CNT ) word[i] = (__force u32 )cpu_to_be32 (word[i]); } +/* Mark value as unsafely initialized in case it becomes atomic later +* and we didn't byte swap something non-byte swap neutral. +*/ +static void +nfp_map_bpf_byte_swap_record (struct nfp_bpf_map *nfp_map,void *value) +{ +u32 *word = value; +unsigned int i; + +for (i =0 ; i <DIV_ROUND_UP (nfp_map->offmap->map.value_size,4 ); i++) +if (nfp_map->use_map[i].type ==NFP_MAP_UNUSED && + word[i] != (__force u32 )cpu_to_be32 (word[i])) + nfp_map->use_map[i].non_zero_update =1 ; +} +static int nfp_bpf_map_lookup_entry (struct bpf_offloaded_map *offmap,void *key,void *value)
@@ -322,6 +337,7 @@ nfp_bpf_map_update_entry(struct bpf_offloaded_map *offmap, void *key, void *value, u64 flags) { nfp_map_bpf_byte_swap(offmap->dev_priv, value); +nfp_map_bpf_byte_swap_record (offmap->dev_priv, value);return nfp_bpf_ctrl_update_entry (offmap, key, value, flags); }
drivers/net/ethernet/netronome/nfp/bpf/verifier.c +53 -5
81 lines not on this page · raw message
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 66/306 KVM: nVMX: reset cache/shadows when switching loaded VMCS
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
[ Upstream commit b7031fd40fcc741b0f9b0c04c8d844e445858b84 ]
Reset the vm_{entry,exit}_controls_shadow variables as well as the segment cache after loading a new VMCS in vmx_switch_vmcs(). The shadows/cache track VMCS data, i.e. they're stale every time we switch to a new VMCS regardless of reason.
This fixes a bug where stale control shadows would be consumed after a nested VMExit due to a failed consistency check.
--- arch/x86/kvm/vmx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/x86/kvm/vmx.c +4 -4
@@ -11013,6 +11013,10 @@ static void vmx_switch_vmcs(struct kvm_vcpu *vcpu, struct loaded_vmcs *vmcs) vmx->loaded_vmcs = vmcs;vmx_vcpu_load (vcpu, cpu);put_cpu (); + +vm_entry_controls_reset_shadow (vmx); +vm_exit_controls_reset_shadow (vmx); +vmx_segment_cache_clear (vmx); }/*
@@ -12699,7 +12703,6 @@ static int enter_vmx_non_root_mode(struct kvm_vcpu *vcpu, u32 *exit_qual) vmx->nested.vmcs01_guest_bndcfgs =vmcs_read64 (GUEST_BNDCFGS );vmx_switch_vmcs (vcpu, &vmx->nested.vmcs02); -vmx_segment_cache_clear (vmx);if (vmcs12->cpu_based_vm_exec_control &CPU_BASED_USE_TSC_OFFSETING ) vcpu->arch.tsc_offset += vmcs12->tsc_offset;
@@ -13530,9 +13533,6 @@ static void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 exit_reason, }vmx_switch_vmcs (vcpu, &vmx->vmcs01); -vm_entry_controls_reset_shadow (vmx); -vm_exit_controls_reset_shadow (vmx); -vmx_segment_cache_clear (vmx);/* Update any VMCS fields that might have changed while L2 ran */ vmcs_write32 (VM_EXIT_MSR_LOAD_COUNT , vmx->msr_autoload.host.nr);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 68/306 KVM/x86: Fix invvpid and invept register operand size in 64-bit mode
In reply to Greg Kroah-HartmanFrom: Uros Bizjak <[email protected]>
[ Upstream commit 5ebb272b2ea7e02911a03a893f8d922d49f9bb4a ]
Register operand size of invvpid and invept instruction in 64-bit mode has always 64 bits. Adjust inline function argument type to reflect correct size.
--- arch/x86/kvm/vmx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kvm/vmx.c +2 -2
@@ -2079,7 +2079,7 @@ static int __find_msr_index(struct vcpu_vmx *vmx, u32 msr)return -1 ; } -static inline void __invvpid (int ext,u16 vpid,gva_t gva) +static inline void __invvpid (unsigned long ext,u16 vpid,gva_t gva) {struct {u64 vpid :16 ;
@@ -2094,7 +2094,7 @@ static inline void __invvpid(int ext, u16 vpid, gva_t gva)BUG_ON (error); } -static inline void __invept (int ext,u64 eptp,gpa_t gpa) +static inline void __invept (unsigned long ext,u64 eptp,gpa_t gpa) {struct {u64 eptp, gpa;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 69/306 clk: tegra: Fixes for MBIST work around
In reply to Greg Kroah-HartmanFrom: Joseph Lo <[email protected]>
[ Upstream commit a4dbbceeee3e0ba670875a147237d6566de78840 ]
Fix some incorrect data in LVL2 offset and bit mask.
--- drivers/clk/tegra/clk-tegra210.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/clk/tegra/clk-tegra210.c +3 -3
@@ -2603,7 +2603,7 @@ static struct tegra210_domain_mbist_war tegra210_pg_mbist_war[] = { [TEGRA_POWERGATE_MPE] = { .handle_lvl2_ovr = tegra210_generic_mbist_war, .lvl2_offset = LVL2_CLK_GATE_OVRE, - .lvl2_mask = BIT(2), + .lvl2_mask = BIT(29), }, [TEGRA_POWERGATE_SOR] = { .handle_lvl2_ovr = tegra210_generic_mbist_war,
@@ -2654,14 +2654,14 @@ static struct tegra210_domain_mbist_war tegra210_pg_mbist_war[] = { .num_clks = ARRAY_SIZE(nvdec_slcg_clkids), .clk_init_data = nvdec_slcg_clkids, .handle_lvl2_ovr = tegra210_generic_mbist_war, - .lvl2_offset = LVL2_CLK_GATE_OVRC, + .lvl2_offset = LVL2_CLK_GATE_OVRE, .lvl2_mask = BIT(9) | BIT(31), }, [TEGRA_POWERGATE_NVJPG] = { .num_clks = ARRAY_SIZE(nvjpg_slcg_clkids), .clk_init_data = nvjpg_slcg_clkids, .handle_lvl2_ovr = tegra210_generic_mbist_war, - .lvl2_offset = LVL2_CLK_GATE_OVRC, + .lvl2_offset = LVL2_CLK_GATE_OVRE, .lvl2_mask = BIT(9) | BIT(31), }, [TEGRA_POWERGATE_AUD] = {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 52/306 w1: IAD Register is yet readable trough iad sys file. Fix snprintf (%u for unsigned, count for max size).
In reply to Greg Kroah-HartmanFrom: Julien Folly <[email protected]>
[ Upstream commit 6eaafbb6998e999467cf78a76e155ee00e372b14 ]
IAD Register is yet readable trough the "iad" sys file.
A write to the "iad" sys file enables or disables the current measurement, but it was not possible to get the measured value by reading it.
Fix: %u in snprintf for unsigned values (vdd and vad)
Fix: Avoid possibles overflows (Usage of the 'count' variables)
--- drivers/w1/slaves/w1_ds2438.c | 66 +++++++++++++++++++++++++++-------- 1 file changed, 52 insertions(+), 14 deletions(-)
drivers/w1/slaves/w1_ds2438.c +52 -14
@@ -186,8 +186,8 @@ static int w1_ds2438_change_config_bit(struct w1_slave *sl, u8 mask, u8 value)return -1 ; } -static uint16_t w1_ds2438_get_voltage (struct w1_slave *sl, -int adc_input,uint16_t *voltage) +static int w1_ds2438_get_voltage (struct w1_slave *sl, +int adc_input,uint16_t *voltage) {unsigned int retries =W1_DS2438_RETRIES ;u8 w1_buf[DS2438_PAGE_SIZE +1 /*for CRC*/ ];
@@ -235,6 +235,25 @@ static uint16_t w1_ds2438_get_voltage(struct w1_slave *sl,return ret; } +static int w1_ds2438_get_current (struct w1_slave *sl,int16_t *voltage) +{ +u8 w1_buf[DS2438_PAGE_SIZE +1 /*for CRC*/ ]; +int ret; + +mutex_lock (&sl->master->bus_mutex); + +if (w1_ds2438_get_page (sl,0 , w1_buf) ==0 ) { +/* The voltage measured across current sense resistor RSENS. */ + *voltage = (((int16_t ) w1_buf[DS2438_CURRENT_MSB ]) <<8 ) | ((int16_t ) w1_buf[DS2438_CURRENT_LSB ]); + ret =0 ; + }else + ret =-1 ; + +mutex_unlock (&sl->master->bus_mutex); + +return ret; +} +static ssize_t iad_write (struct file *filp,struct kobject *kobj,struct bin_attribute *bin_attr,char *buf,loff_t off,size_t count)
@@ -257,6 +276,27 @@ static ssize_t iad_write(struct file *filp, struct kobject *kobj,return ret; } +static ssize_t iad_read (struct file *filp,struct kobject *kobj, +struct bin_attribute *bin_attr,char *buf, +loff_t off,size_t count) +{ +struct w1_slave *sl =kobj_to_w1_slave (kobj); +int ret; +int16_t voltage; + +if (off !=0 ) +return 0 ; +if (!buf) +return -EINVAL ; + +if (w1_ds2438_get_current (sl, &voltage) ==0 ) { + ret =snprintf (buf, count,"%i\n" , voltage); + }else + ret = -EIO ; + +return ret; +} +static ssize_t page0_read (struct file *filp,struct kobject *kobj,struct bin_attribute *bin_attr,char *buf,loff_t off,size_t count)
@@ -272,9 +312,13 @@ static ssize_t page0_read(struct file *filp, struct kobject *kobj,mutex_lock (&sl->master->bus_mutex); +/* Read no more than page0 size */ +if (count >DS2438_PAGE_SIZE ) + count =DS2438_PAGE_SIZE ; +if (w1_ds2438_get_page (sl,0 , w1_buf) ==0 ) { -memcpy (buf, &w1_buf,DS2438_PAGE_SIZE ); - ret =DS2438_PAGE_SIZE ; +memcpy (buf, &w1_buf, count); + ret = count; }else ret = -EIO ;
@@ -289,7 +333,6 @@ static ssize_t temperature_read(struct file *filp, struct kobject *kobj, {struct w1_slave *sl =kobj_to_w1_slave (kobj);int ret; -ssize_t c =PAGE_SIZE ;int16_t temp;if (off !=0 )
@@ -298,8 +341,7 @@ static ssize_t temperature_read(struct file *filp, struct kobject *kobj,return -EINVAL ;if (w1_ds2438_get_temperature (sl, &temp) ==0 ) { - c -=snprintf (buf +PAGE_SIZE - c, c,"%d\n" , temp); - ret =PAGE_SIZE - c; + ret =snprintf (buf, count,"%i\n" , temp); }else ret = -EIO ;
@@ -312,7 +354,6 @@ static ssize_t vad_read(struct file *filp, struct kobject *kobj, {struct w1_slave *sl =kobj_to_w1_slave (kobj);int ret; -ssize_t c =PAGE_SIZE ;uint16_t voltage;if (off !=0 )
@@ -321,8 +362,7 @@ static ssize_t vad_read(struct file *filp, struct kobject *kobj,return -EINVAL ;if (w1_ds2438_get_voltage (sl,DS2438_ADC_INPUT_VAD , &voltage) ==0 ) { - c -=snprintf (buf +PAGE_SIZE - c, c,"%d\n" , voltage); - ret =PAGE_SIZE - c; + ret =snprintf (buf, count,"%u\n" , voltage); }else ret = -EIO ;
@@ -335,7 +375,6 @@ static ssize_t vdd_read(struct file *filp, struct kobject *kobj, {struct w1_slave *sl =kobj_to_w1_slave (kobj);int ret; -ssize_t c =PAGE_SIZE ;uint16_t voltage;if (off !=0 )
@@ -344,15 +383,14 @@ static ssize_t vdd_read(struct file *filp, struct kobject *kobj,return -EINVAL ;if (w1_ds2438_get_voltage (sl,DS2438_ADC_INPUT_VDD , &voltage) ==0 ) { - c -=snprintf (buf +PAGE_SIZE - c, c,"%d\n" , voltage); - ret =PAGE_SIZE - c; + ret =snprintf (buf, count,"%u\n" , voltage); }else ret = -EIO ;return ret; } -static BIN_ATTR(iad, S_IRUGO | S_IWUSR | S_IWGRP, NULL, iad_write, 1); +static BIN_ATTR(iad, S_IRUGO | S_IWUSR | S_IWGRP, iad_read, iad_write, 0); static BIN_ATTR_RO(page0, DS2438_PAGE_SIZE); static BIN_ATTR_RO(temperature, 0/* real length varies */); static BIN_ATTR_RO(vad, 0/* real length varies */);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 70/306 scsi: isci: Use proper enumerated type in atapi_d2h_reg_frame_handler
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit e9e9a103528c7e199ead6e5374c9c52cf16b5802 ]
Clang warns when one enumerated type is implicitly converted to another.
drivers/scsi/isci/request.c:1629:13: warning: implicit conversion from enumeration type 'enum sci_io_status' to different enumeration type 'enum sci_status' [-Wenum-conversion]
status = SCI_IO_FAILURE_RESPONSE_VALID;
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/isci/request.c:1631:12: warning: implicit conversion from
enumeration type 'enum sci_io_status' to different enumeration type
'enum sci_status' [-Wenum-conversion]
status = SCI_IO_FAILURE_RESPONSE_VALID;
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~status is of type sci_status but SCI_IO_FAILURE_RESPONSE_VALID is of type sci_io_status. Use SCI_FAILURE_IO_RESPONSE_VALID, which is from sci_status and has SCI_IO_FAILURE_RESPONSE_VALID's exact value since that is what SCI_IO_FAILURE_RESPONSE_VALID is mapped to in the isci.h file.
--- drivers/scsi/isci/request.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/isci/request.c +2 -2
@@ -1626,9 +1626,9 @@ static enum sci_status atapi_d2h_reg_frame_handler(struct isci_request *ireq,if (status ==SCI_SUCCESS ) {if (ireq->stp.rsp.status &ATA_ERR ) - status =SCI_IO_FAILURE_RESPONSE_VALID ; + status =SCI_FAILURE_IO_RESPONSE_VALID ; }else { - status =SCI_IO_FAILURE_RESPONSE_VALID ; + status =SCI_FAILURE_IO_RESPONSE_VALID ; }if (status !=SCI_SUCCESS ) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 73/306 scsi: iscsi_tcp: Explicitly cast param in iscsi_sw_tcp_host_get_param
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit 20054597f169090109fc3f0dfa1a48583f4178a4 ]
Clang warns when one enumerated type is implicitly converted to another.
drivers/scsi/iscsi_tcp.c:803:15: warning: implicit conversion from enumeration type 'enum iscsi_host_param' to different enumeration type 'enum iscsi_param' [-Wenum-conversion]
&addr, param, buf);
^~~~~1 warning generated.
iscsi_conn_get_addr_param handles ISCSI_HOST_PARAM_IPADDRESS just fine so add an explicit cast to iscsi_param to make it clear to Clang that this is expected behavior.
--- drivers/scsi/iscsi_tcp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/iscsi_tcp.c +2 -1
@@ -800,7 +800,8 @@ static int iscsi_sw_tcp_host_get_param(struct Scsi_Host *shost,return rc;return iscsi_conn_get_addr_param ((struct sockaddr_storage *) - &addr, param, buf); + &addr, + (enum iscsi_param )param, buf);default :return iscsi_host_get_param (shost, param, buf); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 74/306 crypto: ccree - avoid implicit enum conversion
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit 18e732b8035d175181aae2ded127994cb01694f7 ]
Clang warns when one enumerated type is implicitly converted to another and this happens in several locations in this driver, ultimately related to the set_cipher_{mode,config0} functions. set_cipher_mode expects a mode of type drv_cipher_mode and set_cipher_config0 expects a mode of type drv_crypto_direction.
drivers/crypto/ccree/cc_ivgen.c:58:35: warning: implicit conversion from enumeration type 'enum cc_desc_direction' to different enumeration type 'enum drv_crypto_direction' [-Wenum-conversion]
set_cipher_config0(&iv_seq[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT);
drivers/crypto/ccree/cc_hash.c:99:28: warning: implicit conversion from enumeration type 'enum cc_hash_conf_pad' to different enumeration type 'enum drv_crypto_direction' [-Wenum-conversion]
set_cipher_config0(desc, HASH_DIGEST_RESULT_LITTLE_ENDIAN);
drivers/crypto/ccree/cc_aead.c:1643:30: warning: implicit conversion from enumeration type 'enum drv_hash_hw_mode' to different enumeration type 'enum drv_cipher_mode' [-Wenum-conversion]
set_cipher_mode(&desc[idx], DRV_HASH_HW_GHASH);
Since this fundamentally isn't a problem because these values just represent simple integers for a shift operation, make it clear to Clang that this is okay by making the mode parameter in both functions an int.
--- drivers/crypto/ccree/cc_hw_queue_defs.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/crypto/ccree/cc_hw_queue_defs.h +2 -4
@@ -449,8 +449,7 @@ static inline void set_flow_mode(struct cc_hw_desc *pdesc,* @pdesc: pointer HW descriptor struct * @mode: Any one of the modes defined in [CC7x-DESC] */ -static inline void set_cipher_mode (struct cc_hw_desc *pdesc, -enum drv_cipher_mode mode) +static inline void set_cipher_mode (struct cc_hw_desc *pdesc,int mode) { pdesc->word[4 ] |=FIELD_PREP (WORD4_CIPHER_MODE , mode); }
@@ -461,8 +460,7 @@ static inline void set_cipher_mode(struct cc_hw_desc *pdesc,* @pdesc: pointer HW descriptor struct * @mode: Any one of the modes defined in [CC7x-DESC] */ -static inline void set_cipher_config0 (struct cc_hw_desc *pdesc, -enum drv_crypto_direction mode) +static inline void set_cipher_config0 (struct cc_hw_desc *pdesc,int mode) { pdesc->word[4 ] |=FIELD_PREP (WORD4_CIPHER_CONF0 , mode); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 75/306 nvmet: avoid integer overflow in the discard code
In reply to Greg Kroah-HartmanFrom: Bart Van Assche <[email protected]>
[ Upstream commit 8eacd1bd21d6913ec27e6120e9a8733352e191d3 ]
Although I'm not sure whether it is a good idea to support large discard commands, I think integer overflow for discard ranges larger than 4 GB should be avoided. This patch avoids that smatch reports the following:
drivers/nvme/target/io-cmd-file.c:249:1 nvmet_file_execute_discard() warn: should '((range.nlb)) << req->ns->blksize_shift' be a 64 bit type?
--- drivers/nvme/target/io-cmd-file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/target/io-cmd-file.c +2 -1
@@ -246,7 +246,8 @@ static void nvmet_file_execute_discard(struct nvmet_req *req)break ; offset =le64_to_cpu (range.slba) << req->ns->blksize_shift; - len =le32_to_cpu (range.nlb) << req->ns->blksize_shift; + len =le32_to_cpu (range.nlb); + len <<= req->ns->blksize_shift;if (offset + len > req->ns->size) { ret =NVME_SC_LBA_RANGE |NVME_SC_DNR ;break ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 76/306 nvmet-fcloop: suppress a compiler warning
In reply to Greg Kroah-HartmanFrom: Bart Van Assche <[email protected]>
[ Upstream commit 1216e9ef18b84f4fb5934792368fb01eb3540520 ]
Building with W=1 enables the compiler warning -Wimplicit-fallthrough=3. That option does not recognize the fall-through comment in the fcloop driver. Add a fall-through comment that is recognized for -Wimplicit-fallthrough=3. This patch avoids that the compiler reports the following warning when building with W=1:
drivers/nvme/target/fcloop.c:647:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (op == NVMET_FCOP_READDATA)
^
--- drivers/nvme/target/fcloop.c | 1 + 1 file changed, 1 insertion(+)
drivers/nvme/target/fcloop.c +1 -0
@@ -648,6 +648,7 @@ fcloop_fcp_op(struct nvmet_fc_target_port *tgtport,break ;/* Fall-Thru to RSP handling */ +/* FALLTHRU */ case NVMET_FCOP_RSP :if (fcpreq) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 77/306 nvme-pci: fix hot removal during error handling
In reply to Greg Kroah-HartmanFrom: Keith Busch <[email protected]>
[ Upstream commit cb4bfda62afa25b4eee3d635d33fccdd9485dd7c ]
A removal waits for the reset_work to complete. If a surprise removal occurs around the same time as an error triggered controller reset, and reset work happened to dispatch a command to the removed controller, the command won't be recovered since the timeout work doesn't do anything during error recovery. We wouldn't want to wait for timeout handling anyway, so this patch fixes this by disabling the controller and killing admin queues prior to syncing with the reset_work.
--- drivers/nvme/host/pci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/nvme/host/pci.c +1 -2
@@ -2583,13 +2583,12 @@ static void nvme_remove(struct pci_dev *pdev)struct nvme_dev *dev =pci_get_drvdata (pdev);nvme_change_ctrl_state (&dev->ctrl,NVME_CTRL_DELETING ); - -cancel_work_sync (&dev->ctrl.reset_work);pci_set_drvdata (pdev,NULL );if (!pci_device_is_present (pdev)) {nvme_change_ctrl_state (&dev->ctrl,NVME_CTRL_DEAD );nvme_dev_disable (dev, true); +nvme_dev_remove_admin (dev); }flush_work (&dev->ctrl.reset_work);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 79/306 clk: mmp2: fix the clock id for sdh2_clk and sdh3_clk
In reply to Greg Kroah-HartmanFrom: Lubomir Rintel <[email protected]>
[ Upstream commit 4917fb90eec7c26dac1497ada3bd4a325f670fcc ]
A typo that makes it impossible to get the correct clocks for MMP2_CLK_SDH2 and MMP2_CLK_SDH3.
--- drivers/clk/mmp/clk-of-mmp2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/mmp/clk-of-mmp2.c +2 -2
@@ -227,8 +227,8 @@ static struct mmp_param_gate_clk apmu_gate_clks[] = {/* The gate clocks has mux parent. */ {MMP2_CLK_SDH0, "sdh0_clk", "sdh_mix_clk", CLK_SET_RATE_PARENT, APMU_SDH0, 0x1b, 0x1b, 0x0, 0, &sdh_lock}, {MMP2_CLK_SDH1, "sdh1_clk", "sdh_mix_clk", CLK_SET_RATE_PARENT, APMU_SDH1, 0x1b, 0x1b, 0x0, 0, &sdh_lock}, - {MMP2_CLK_SDH1, "sdh2_clk", "sdh_mix_clk", CLK_SET_RATE_PARENT, APMU_SDH2, 0x1b, 0x1b, 0x0, 0, &sdh_lock}, - {MMP2_CLK_SDH1, "sdh3_clk", "sdh_mix_clk", CLK_SET_RATE_PARENT, APMU_SDH3, 0x1b, 0x1b, 0x0, 0, &sdh_lock}, + {MMP2_CLK_SDH2, "sdh2_clk", "sdh_mix_clk", CLK_SET_RATE_PARENT, APMU_SDH2, 0x1b, 0x1b, 0x0, 0, &sdh_lock}, + {MMP2_CLK_SDH3, "sdh3_clk", "sdh_mix_clk", CLK_SET_RATE_PARENT, APMU_SDH3, 0x1b, 0x1b, 0x0, 0, &sdh_lock}, {MMP2_CLK_DISP0, "disp0_clk", "disp0_div", CLK_SET_RATE_PARENT, APMU_DISP0, 0x1b, 0x1b, 0x0, 0, &disp0_lock}, {MMP2_CLK_DISP0_SPHY, "disp0_sphy_clk", "disp0_sphy_div", CLK_SET_RATE_PARENT, APMU_DISP0, 0x1024, 0x1024, 0x0, 0, &disp0_lock}, {MMP2_CLK_DISP1, "disp1_clk", "disp1_div", CLK_SET_RATE_PARENT, APMU_DISP1, 0x1b, 0x1b, 0x0, 0, &disp1_lock},
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 80/306 clk: at91: audio-pll: fix audio pmc type
In reply to Greg Kroah-HartmanFrom: Alexandre Belloni <[email protected]>
[ Upstream commit 7fa75007b7d7421aea59ff2b12ab1bd65a5abfa6 ]
The allocation for the audio pmc is using the size of struct clk_audio_pad instead of struct clk_audio_pmc. This works fine because the former is larger than the latter but it is safer to be correct.
--- drivers/clk/at91/clk-audio-pll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/at91/clk-audio-pll.c +1 -1
@@ -509,7 +509,7 @@ static void __init of_sama5d2_clk_audio_pll_pad_setup(struct device_node *np)static void __init of_sama5d2_clk_audio_pll_pmc_setup (struct device_node *np) { -struct clk_audio_pad *apmc_ck; +struct clk_audio_pmc *apmc_ck;struct clk_init_data init = {}; apmc_ck =kzalloc (sizeof (*apmc_ck),GFP_KERNEL );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 53/306 m68k: fix command-line parsing when passed from u-boot
In reply to Greg Kroah-HartmanFrom: Angelo Dureghello <[email protected]>
[ Upstream commit 381fdd62c38344a771aed06adaf14aae65c47454 ]
This patch fixes command_line array zero-terminated one byte over the end of the array, causing boot to hang.
--- arch/m68k/kernel/uboot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/m68k/kernel/uboot.c +1 -1
@@ -102,5 +102,5 @@ __init void process_uboot_commandline(char *commandp, int size) }parse_uboot_commandline (commandp, len); - commandp[size -1 ] =0 ; + commandp[len -1 ] =0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 81/306 ASoC: tegra_sgtl5000: fix device_node refcounting
In reply to Greg Kroah-HartmanFrom: Marcel Ziswiler <[email protected]>
[ Upstream commit a85227da2dcc291b762c8482a505bc7d0d2d4b07 ]
Similar to the following:
commit 4321723648b0 ("ASoC: tegra_alc5632: fix device_node refcounting")
commit 7c5dfd549617 ("ASoC: tegra: fix device_node refcounting")
--- sound/soc/tegra/tegra_sgtl5000.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
sound/soc/tegra/tegra_sgtl5000.c +15 -2
@@ -149,14 +149,14 @@ static int tegra_sgtl5000_driver_probe(struct platform_device *pdev)dev_err (&pdev->dev,"Property 'nvidia,i2s-controller' missing/invalid\n" ); ret = -EINVAL ; - goto err; + goto err_put_codec_of_node; } tegra_sgtl5000_dai.platform_of_node = tegra_sgtl5000_dai.cpu_of_node; ret =tegra_asoc_utils_init (&machine->util_data, &pdev->dev);if (ret) - goto err; + goto err_put_cpu_of_node; ret =snd_soc_register_card (card);if (ret) {
@@ -169,6 +169,13 @@ static int tegra_sgtl5000_driver_probe(struct platform_device *pdev) err_fini_utils:tegra_asoc_utils_fini (&machine->util_data); +err_put_cpu_of_node: +of_node_put (tegra_sgtl5000_dai.cpu_of_node); + tegra_sgtl5000_dai.cpu_of_node =NULL ; + tegra_sgtl5000_dai.platform_of_node =NULL ; +err_put_codec_of_node: +of_node_put (tegra_sgtl5000_dai.codec_of_node); + tegra_sgtl5000_dai.codec_of_node =NULL ; err:return ret; }
@@ -183,6 +190,12 @@ static int tegra_sgtl5000_driver_remove(struct platform_device *pdev)tegra_asoc_utils_fini (&machine->util_data); +of_node_put (tegra_sgtl5000_dai.cpu_of_node); + tegra_sgtl5000_dai.cpu_of_node =NULL ; + tegra_sgtl5000_dai.platform_of_node =NULL ; +of_node_put (tegra_sgtl5000_dai.codec_of_node); + tegra_sgtl5000_dai.codec_of_node =NULL ; +return ret; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 82/306 scsi: dc395x: fix dma API usage in srb_done
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
[ Upstream commit 3a5bd7021184dec2946f2a4d7a8943f8a5713e52 ]
We can't just transfer ownership to the CPU and then unmap, as this will break with swiotlb.
Instead unmap the command and sense buffer a little earlier in the I/O completion handler and get rid of the pci_dma_sync_sg_for_cpu call entirely.
--- drivers/scsi/dc395x.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/scsi/dc395x.c +2 -5
@@ -3447,14 +3447,12 @@ static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, } } -if (dir !=PCI_DMA_NONE &&scsi_sg_count (cmd)) -pci_dma_sync_sg_for_cpu (acb->dev,scsi_sglist (cmd), -scsi_sg_count (cmd), dir); - ckc_only =0 ;/* Check Error Conditions */ ckc_e: +pci_unmap_srb (acb, srb); +if (cmd->cmnd[0 ] ==INQUIRY ) {unsigned char *base =NULL ;struct ScsiInqData *ptr;
@@ -3507,7 +3505,6 @@ static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, cmd, cmd->result);srb_free_insert (acb, srb); } -pci_unmap_srb (acb, srb); cmd->scsi_done (cmd);waiting_process_next (acb);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 84/306 scsi: zorro_esp: Limit DMA transfers to 65535 bytes
In reply to Greg Kroah-HartmanFrom: Finn Thain <[email protected]>
[ Upstream commit b7ded0e8b0d11b6df1c4e5aa23a26e6629c21985 ]
The core driver, esp_scsi, does not use the ESP_CONFIG2_FENAB bit, so the chip's Transfer Counter register is only 16 bits wide (not 24). A larger transfer cannot work and will theoretically result in a failed command and a "DMA length is zero" error.
--- drivers/scsi/zorro_esp.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/scsi/zorro_esp.c +1 -7
@@ -245,7 +245,7 @@ static int fastlane_esp_irq_pending(struct esp *esp)static u32 zorro_esp_dma_length_limit (struct esp *esp,u32 dma_addr,u32 dma_len) { -return dma_len >0xFFFFFF ?0xFFFFFF : dma_len; +return dma_len >0xFFFF ?0xFFFF : dma_len; }static void zorro_esp_reset_dma (struct esp *esp)
@@ -484,7 +484,6 @@ static void zorro_esp_send_blz1230_dma_cmd(struct esp *esp, u32 addr,scsi_esp_cmd (esp,ESP_CMD_DMA );zorro_esp_write8 (esp, (esp_count >>0 ) &0xff ,ESP_TCLOW );zorro_esp_write8 (esp, (esp_count >>8 ) &0xff ,ESP_TCMED ); -zorro_esp_write8 (esp, (esp_count >>16 ) &0xff ,ESP_TCHI );scsi_esp_cmd (esp, cmd); }
@@ -529,7 +528,6 @@ static void zorro_esp_send_blz1230II_dma_cmd(struct esp *esp, u32 addr,scsi_esp_cmd (esp,ESP_CMD_DMA );zorro_esp_write8 (esp, (esp_count >>0 ) &0xff ,ESP_TCLOW );zorro_esp_write8 (esp, (esp_count >>8 ) &0xff ,ESP_TCMED ); -zorro_esp_write8 (esp, (esp_count >>16 ) &0xff ,ESP_TCHI );scsi_esp_cmd (esp, cmd); }
@@ -574,7 +572,6 @@ static void zorro_esp_send_blz2060_dma_cmd(struct esp *esp, u32 addr,scsi_esp_cmd (esp,ESP_CMD_DMA );zorro_esp_write8 (esp, (esp_count >>0 ) &0xff ,ESP_TCLOW );zorro_esp_write8 (esp, (esp_count >>8 ) &0xff ,ESP_TCMED ); -zorro_esp_write8 (esp, (esp_count >>16 ) &0xff ,ESP_TCHI );scsi_esp_cmd (esp, cmd); }
@@ -599,7 +596,6 @@ static void zorro_esp_send_cyber_dma_cmd(struct esp *esp, u32 addr,zorro_esp_write8 (esp, (esp_count >>0 ) &0xff ,ESP_TCLOW );zorro_esp_write8 (esp, (esp_count >>8 ) &0xff ,ESP_TCMED ); -zorro_esp_write8 (esp, (esp_count >>16 ) &0xff ,ESP_TCHI );if (write) {/* DMA receive */
@@ -649,7 +645,6 @@ static void zorro_esp_send_cyberII_dma_cmd(struct esp *esp, u32 addr,zorro_esp_write8 (esp, (esp_count >>0 ) &0xff ,ESP_TCLOW );zorro_esp_write8 (esp, (esp_count >>8 ) &0xff ,ESP_TCMED ); -zorro_esp_write8 (esp, (esp_count >>16 ) &0xff ,ESP_TCHI );if (write) {/* DMA receive */
@@ -691,7 +686,6 @@ static void zorro_esp_send_fastlane_dma_cmd(struct esp *esp, u32 addr,zorro_esp_write8 (esp, (esp_count >>0 ) &0xff ,ESP_TCLOW );zorro_esp_write8 (esp, (esp_count >>8 ) &0xff ,ESP_TCMED ); -zorro_esp_write8 (esp, (esp_count >>16 ) &0xff ,ESP_TCHI );if (write) {/* DMA receive */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 87/306 net: ena: Fix Kconfig dependency on X86
In reply to Greg Kroah-HartmanFrom: Netanel Belgazal <[email protected]>
[ Upstream commit 8c590f9776386b8f697fd0b7ed6142ae6e3de79e ]
The Kconfig limitation of X86 is to too wide. The ENA driver only requires a little endian dependency.
Change the dependency to be on little endian CPU.
--- drivers/net/ethernet/amazon/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/amazon/Kconfig +1 -1
@@ -17,7 +17,7 @@ if NET_VENDOR_AMAZON config ENA_ETHERNET tristate "Elastic Network Adapter (ENA) support" - depends on (PCI_MSI && X86) + depends on PCI_MSI && !CPU_BIG_ENDIAN ---help--- This driver supports Elastic Network Adapter (ENA)"
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 54/306 scsi: hisi_sas: Feed back linkrate(max/min) when re-attached
In reply to Greg Kroah-HartmanFrom: Luo Jiaxing <[email protected]>
[ Upstream commit 5a54691f874ab29ec82f08bc6936866a3ccdaa91 ]
At directly attached situation, if the user modifies the sysfs interface of maximum_linkrate and minimum_linkrate to renegotiate the linkrate between SAS controller and target, the value of both files mentioned above should have change to user setting after renegotiate is over, but it remains unchanged.
To fix this bug, maximum_linkrate and minimum_linkrate will be directly fed back to relevant sas_phy structure.
--- drivers/scsi/hisi_sas/hisi_sas_main.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/scsi/hisi_sas/hisi_sas_main.c +3 -0
@@ -906,6 +906,9 @@ static void hisi_sas_phy_set_linkrate(struct hisi_hba *hisi_hba, int phy_no, _r.maximum_linkrate = max; _r.minimum_linkrate = min; + sas_phy->phy->maximum_linkrate = max; + sas_phy->phy->minimum_linkrate = min; + hisi_hba->hw->phy_disable (hisi_hba, phy_no);msleep (100 ); hisi_hba->hw->phy_set_linkrate (hisi_hba, phy_no, &_r);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 89/306 xfs: clear ail delwri queued bufs on unmount of shutdown fs
In reply to Greg Kroah-HartmanFrom: Brian Foster <[email protected]>
[ Upstream commit efc3289cf8d39c34502a7cc9695ca2fa125aad0c ]
In the typical unmount case, the AIL is forced out by the unmount sequence before the xfsaild task is stopped. Since AIL items are removed on writeback completion, this means that the AIL ->ail_buf_list delwri queue has been drained. This is not always true in the shutdown case, however.
It's possible for buffers to sit on a delwri queue for a period of time across submission attempts if said items are locked or have been relogged and pinned since first added to the queue. If the attempt to log such an item results in a log I/O error, the error processing can shutdown the fs, remove the item from the AIL, stale the buffer (dropping the LRU reference) and clear its delwri queue state. The latter bit means the buffer will be released from a delwri queue on the next submission attempt, but this might never occur if the filesystem has shutdown and the AIL is empty.
This means that such buffers are held indefinitely by the AIL delwri queue across destruction of the AIL. Aside from being a memory leak, these buffers can also hold references to in-core perag structures. The latter problem manifests as a generic/475 failure, reproducing the following asserts at unmount time:
XFS: Assertion failed: atomic_read(&pag->pag_ref) == 0,
file: fs/xfs/xfs_mount.c, line: 151 XFS: Assertion failed: atomic_read(&pag->pag_ref) == 0, file: fs/xfs/xfs_mount.c, line: 132
To prevent this problem, clear the AIL delwri queue as a final step before xfsaild() exit. The !empty state should never occur in the normal case, so add an assert to catch unexpected problems going forward.
[dgc: add comment explaining need for xfs_buf_delwri_cancel() after
calling xfs_buf_delwri_submit_nowait().]
--- fs/xfs/xfs_buf.c | 7 +++++++ fs/xfs/xfs_trans_ail.c | 28 ++++++++++++++++++++++------ 2 files changed, 29 insertions(+), 6 deletions(-)
fs/xfs/xfs_buf.c +7 -0
@@ -2025,6 +2025,13 @@ xfs_buf_delwri_submit_buffers(* is only safely useable for callers that can track I/O completion by higher * level means, e.g. AIL pushing as the @buffer_list is consumed in this * function. +* +* Note: this function will skip buffers it would block on, and in doing so +* leaves them on @buffer_list so they can be retried on a later pass. As such, +* it is up to the caller to ensure that the buffer list is fully submitted or +* cancelled appropriately when they are finished with the list. Failure to +* cancel or resubmit the list until it is empty will result in leaked buffers +* at unmount time. */ int xfs_buf_delwri_submit_nowait(
fs/xfs/xfs_trans_ail.c +22 -6
@@ -531,17 +531,33 @@ xfsaild(set_current_state (TASK_INTERRUPTIBLE );/* -* Check kthread_should_stop() after we set the task state -* to guarantee that we either see the stop bit and exit or -* the task state is reset to runnable such that it's not -* scheduled out indefinitely and detects the stop bit at -* next iteration. -* +* Check kthread_should_stop() after we set the task state to +* guarantee that we either see the stop bit and exit or the +* task state is reset to runnable such that it's not scheduled +* out indefinitely and detects the stop bit at next iteration. * A memory barrier is included in above task state set to * serialize again kthread_stop(). */ if (kthread_should_stop ()) {__set_current_state (TASK_RUNNING ); + +/* +* The caller forces out the AIL before stopping the +* thread in the common case, which means the delwri +* queue is drained. In the shutdown case, the queue may +* still hold relogged buffers that haven't been +* submitted because they were pinned since added to the +* queue. +* +* Log I/O error processing stales the underlying buffer +* and clears the delwri state, expecting the buf to be +* removed on the next submission attempt. That won't +* happen if we're shutting down, so this is the last +* opportunity to release such buffers from the queue. +*/ +ASSERT (list_empty (&ailp->ail_buf_list) || +XFS_FORCED_SHUTDOWN (ailp->ail_mount)); +xfs_buf_delwri_cancel (&ailp->ail_buf_list);break ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 92/306 PM / Domains: Deal with multiple states but no governor in genpd
In reply to Greg Kroah-HartmanFrom: Ulf Hansson <[email protected]>
[ Upstream commit 2c9b7f8772033cc8bafbd4eefe2ca605bf3eb094 ]
A caller of pm_genpd_init() that provides some states for the genpd via the ->states pointer in the struct generic_pm_domain, should also provide a governor. This because it's the job of the governor to pick a state that satisfies the constraints.
Therefore, let's print a warning to inform the user about such bogus configuration and avoid to bail out, by instead picking the shallowest state before genpd invokes the ->power_off() callback.
--- drivers/base/power/domain.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/base/power/domain.c +6 -0
@@ -467,6 +467,10 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,return -EAGAIN ; } +/* Default to shallowest state. */ +if (!genpd->gov) + genpd->state_idx =0 ; +if (genpd->power_off) {int ret;
@@ -1686,6 +1690,8 @@ int pm_genpd_init(struct generic_pm_domain *genpd, ret =genpd_set_default_power_state (genpd);if (ret)return ret; + }else if (!gov) { +pr_warn ("%s : no governor for states\n" , genpd->name); }device_initialize (&genpd->dev);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 93/306 ALSA: i2c/cs8427: Fix int to char conversion
In reply to Greg Kroah-HartmanFrom: Philipp Klocke <[email protected]>
[ Upstream commit eb7ebfa3c1989aa8e59d5e68ab3cddd7df1bfb27 ]
Compiling with clang yields the following warning:
sound/i2c/cs8427.c:140:31: warning: implicit conversion from 'int' to 'char' changes value from 160 to -96 [-Wconstant-conversion]
data[0] = CS8427_REG_AUTOINC | CS8427_REG_CORU_DATABUF;
~ ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~Because CS8427_REG_AUTOINC is defined as 128, it is too big for a char field.
So change data from char to unsigned char, that it can hold the value.
This patch does not change the generated code.
--- sound/i2c/cs8427.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/i2c/cs8427.c +1 -1
@@ -118,7 +118,7 @@ static int snd_cs8427_send_corudata(struct snd_i2c_device *device,struct cs8427 *chip = device->private_data;char *hw_data = udata ? chip->playback.hw_udata : chip->playback.hw_status; -char data[32 ]; +unsigned char data[32 ];int err, idx;if (!memcmp (hw_data, ndata, count))
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 91/306 ACPI / scan: Create platform device for INT33FE ACPI nodes
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 589edb56b424876cbbf61547b987a1f57d7ea99d ]
Bay and Cherry Trail devices with a Dollar Cove or Whiskey Cove PMIC have an ACPI node with a HID of INT33FE which is a "virtual" battery device implementing a standard ACPI battery interface which depends upon a proprietary, undocument OpRegion called BMOP. Since we do have docs for the actual fuel-gauges used on these boards we instead use native fuel-gauge drivers talking directly to the fuel-gauge ICs on boards which rely on this INT33FE device for their battery monitoring.
On boards with a Dollar Cove PMIC the INT33FE device's resources (_CRS) describe a non-existing I2C client at address 0x6b with a bus-speed of 100KHz. This is a problem on some boards since there are actual devices on that same bus which need a speed of 400KHz to function properly.
This commit adds the INT33FE HID to the list of devices with I2C resources which should be enumerated as a platform-device rather then letting the i2c-core instantiate an i2c-client matching the first I2C resource, so that its bus-speed will not influence the max speed of the I2C bus. This fixes e.g. the touchscreen not working on the Teclast X98 II Plus.
The INT33FE device on boards with a Whiskey Cove PMIC is somewhat special. Its first I2C resource is for a secondary I2C address of the PMIC itself, which is already described in an ACPI device with an INT34D3 HID.
But it has 3 more I2C resources describing 3 other chips for which we do need to instantiate I2C clients and which need device-connections added between them for things to work properly. This special case is handled by the drivers/platform/x86/intel_cht_int33fe.c code.
Before this commit that code was binding to the i2c-client instantiated for the secondary I2C address of the PMIC, since we now instantiate a platform device for the INT33FE device instead, this commit also changes the intel_cht_int33fe driver from an i2c driver to a platform driver.
This also brings the intel_cht_int33fe drv inline with how we instantiate multiple i2c clients from a single ACPI device in other cases, as done by the drivers/platform/x86/i2c-multi-instantiate.c code.
--- drivers/acpi/scan.c | 1 + drivers/platform/x86/intel_cht_int33fe.c | 24 +++++++++--------------- 2 files changed, 10 insertions(+), 15 deletions(-)
drivers/acpi/scan.c +1 -0
@@ -1550,6 +1550,7 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device)*/ static const struct acpi_device_id i2c_multi_instantiate_ids[] = { {"BSG1160" , }, + {"INT33FE" , }, {} };
drivers/platform/x86/intel_cht_int33fe.c +9 -15
@@ -24,6 +24,7 @@#include <linux/i2c.h> #include <linux/interrupt.h> #include <linux/module.h> +#include <linux/platform_device.h> #include <linux/regulator/consumer.h> #include <linux/slab.h>
@@ -88,9 +89,9 @@ static const struct property_entry fusb302_props[] = { { } }; -static int cht_int33fe_probe (struct i2c_client *client) +static int cht_int33fe_probe (struct platform_device *pdev) { -struct device *dev = &client->dev; +struct device *dev = &pdev->dev;struct i2c_board_info board_info;struct cht_int33fe_data *data;struct i2c_client *max17047;
@@ -207,7 +208,7 @@ static int cht_int33fe_probe(struct i2c_client *client)if (!data->pi3usb30532) goto out_unregister_fusb302; -i2c_set_clientdata (client, data); +platform_set_drvdata (pdev, data);return 0 ;
@@ -223,9 +224,9 @@ static int cht_int33fe_probe(struct i2c_client *client)return -EPROBE_DEFER ;/* Wait for the i2c-adapter to load */ } -static int cht_int33fe_remove (struct i2c_client *i2c) +static int cht_int33fe_remove (struct platform_device *pdev) { -struct cht_int33fe_data *data =i2c_get_clientdata (i2c); +struct cht_int33fe_data *data =platform_get_drvdata (pdev);i2c_unregister_device (data->pi3usb30532);i2c_unregister_device (data->fusb302);
@@ -237,29 +238,22 @@ static int cht_int33fe_remove(struct i2c_client *i2c)return 0 ; } -static const struct i2c_device_id cht_int33fe_i2c_id[] = { - { } -}; -MODULE_DEVICE_TABLE (i2c, cht_int33fe_i2c_id); -static const struct acpi_device_id cht_int33fe_acpi_ids[] = { {"INT33FE" , }, { } };MODULE_DEVICE_TABLE (acpi, cht_int33fe_acpi_ids); -static struct i2c_driver cht_int33fe_driver = { +static struct platform_driver cht_int33fe_driver = { .driver = { .name ="Intel Cherry Trail ACPI INT33FE driver" , .acpi_match_table =ACPI_PTR (cht_int33fe_acpi_ids), }, - .probe_new = cht_int33fe_probe, + .probe = cht_int33fe_probe, .remove = cht_int33fe_remove, - .id_table = cht_int33fe_i2c_id, - .disable_i2c_core_irq_mapping = true, }; -module_i2c_driver (cht_int33fe_driver); +module_platform_driver (cht_int33fe_driver);MODULE_DESCRIPTION ("Intel Cherry Trail ACPI INT33FE pseudo device driver" );MODULE_AUTHOR ("Hans de Goede <[email protected]>" );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 95/306 PCI: vmd: Detach resources after stopping root bus
In reply to Greg Kroah-HartmanFrom: Jon Derrick <[email protected]>
[ Upstream commit dc8af3a827df6d4bb925d3b81b7ec94a7cce9482 ]
The VMD removal path calls pci_stop_root_busi(), which tears down the pcie tree, including detaching all of the attached drivers. During driver detachment, devices may use pci_release_region() to release resources. This path relies on the resource being accessible in resource tree.
By detaching the child domain from the parent resource domain prior to stopping the bus, we are preventing the list traversal from finding the resource to be freed. If we instead detach the resource after stopping the bus, we will have properly freed the resource and detaching is simply accounting at that point.
Without this order, the resource is never freed and is orphaned on VMD removal, leading to a warning:
[ 181.940162] Trying to free nonexistent resource <e5a10000-e5a13fff>
--- drivers/pci/controller/vmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/vmd.c +1 -1
@@ -818,12 +818,12 @@ static void vmd_remove(struct pci_dev *dev) {struct vmd_dev *vmd =pci_get_drvdata (dev); -vmd_detach_resources (vmd);sysfs_remove_link (&vmd->dev->dev.kobj,"domain" );pci_stop_root_bus (vmd->bus);pci_remove_root_bus (vmd->bus);vmd_cleanup_srcu (vmd);vmd_teardown_dma_ops (vmd); +vmd_detach_resources (vmd);irq_domain_remove (vmd->irq_domain); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 56/306 scsi: hisi_sas: Free slot later in slot_complete_vx_hw()
In reply to Greg Kroah-HartmanFrom: Xiang Chen <[email protected]>
[ Upstream commit 3e178f3ecfcf91a258e832b0f0843a4cfd9059ac ]
If an SSP/SMP IO times out, it may be actually in reality be simultaneously processing completion of the slot in slot_complete_vx_hw().
Then if the slot is freed in slot_complete_vx_hw() (this IPTT is freed and it may be re-used by other slot), and we may abort the wrong slot in hisi_sas_abort_task().
So to solve the issue, free the slot after the check of SAS_TASK_STATE_ABORTED in slot_complete_vx_hw().
--- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +1 -1
@@ -2481,7 +2481,6 @@ slot_complete_v2_hw(struct hisi_hba *hisi_hba, struct hisi_sas_slot *slot) } out: -hisi_sas_slot_task_free (hisi_hba, task, slot); sts = ts->stat;spin_lock_irqsave (&task->task_state_lock, flags);if (task->task_state_flags &SAS_TASK_STATE_ABORTED ) {
@@ -2491,6 +2490,7 @@ slot_complete_v2_hw(struct hisi_hba *hisi_hba, struct hisi_sas_slot *slot) } task->task_state_flags |=SAS_TASK_STATE_DONE ;spin_unlock_irqrestore (&task->task_state_lock, flags); +hisi_sas_slot_task_free (hisi_hba, task, slot);if (!is_internal && (task->task_proto !=SAS_PROTOCOL_SMP )) {spin_lock_irqsave (&device->done_lock, flags);
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +1 -1
@@ -1749,7 +1749,6 @@ slot_complete_v3_hw(struct hisi_hba *hisi_hba, struct hisi_sas_slot *slot) } out: -hisi_sas_slot_task_free (hisi_hba, task, slot); sts = ts->stat;spin_lock_irqsave (&task->task_state_lock, flags);if (task->task_state_flags &SAS_TASK_STATE_ABORTED ) {
@@ -1759,6 +1758,7 @@ slot_complete_v3_hw(struct hisi_hba *hisi_hba, struct hisi_sas_slot *slot) } task->task_state_flags |=SAS_TASK_STATE_DONE ;spin_unlock_irqrestore (&task->task_state_lock, flags); +hisi_sas_slot_task_free (hisi_hba, task, slot);if (!is_internal && (task->task_proto !=SAS_PROTOCOL_SMP )) {spin_lock_irqsave (&device->done_lock, flags);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 58/306 RDMA/bnxt_re: Fix qp async event reporting
In reply to Greg Kroah-HartmanFrom: Devesh Sharma <[email protected]>
[ Upstream commit 4c01f2e3a906a0d2d798be5751c331cf501bc129 ]
Reports affiliated async event on the qp-async event channel instead of global event channel.
--- drivers/infiniband/hw/bnxt_re/main.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/infiniband/hw/bnxt_re/main.c +9 -4
@@ -989,12 +989,17 @@ static void bnxt_re_dispatch_event(struct ib_device *ibdev, struct ib_qp *qp,struct ib_event ib_event; ib_event.device = ibdev; -if (qp) +if (qp) { ib_event.element.qp = qp; -else + ib_event.event = event; +if (qp->event_handler) + qp->event_handler (&ib_event, qp->qp_context); + + }else { ib_event.element.port_num = port_num; - ib_event.event = event; -ib_dispatch_event (&ib_event); + ib_event.event = event; +ib_dispatch_event (&ib_event); + } }#define HWRM_QUEUE_PRI2COS_QCFG_INPUT_FLAGS_IVLAN 0x02
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 59/306 RDMA/bnxt_re: Avoid resource leak in case the NQ registration fails
In reply to Greg Kroah-HartmanFrom: Selvin Xavier <[email protected]>
[ Upstream commit 5df950994934814a8b91f0cf9f653842d2ba082d ]
In case the NQ alloc/enable fails, free up the already allocated/enabled NQ before reporting failure. Also, track the alloc/enable using proper state checking.
--- drivers/infiniband/hw/bnxt_re/bnxt_re.h | 2 ++ drivers/infiniband/hw/bnxt_re/main.c | 31 ++++++++++++++++++------- 2 files changed, 24 insertions(+), 9 deletions(-)
drivers/infiniband/hw/bnxt_re/bnxt_re.h +2 -0
@@ -120,6 +120,8 @@ struct bnxt_re_dev {#define BNXT_RE_FLAG_HAVE_L2_REF 3#define BNXT_RE_FLAG_RCFW_CHANNEL_EN 4#define BNXT_RE_FLAG_QOS_WORK_REG 5 +#define BNXT_RE_FLAG_RESOURCES_ALLOCATED 7 +#define BNXT_RE_FLAG_RESOURCES_INITIALIZED 8#define BNXT_RE_FLAG_ISSUE_ROCE_STATS 29struct net_device *netdev;unsigned int version, major, minor;
drivers/infiniband/hw/bnxt_re/main.c +22 -9
@@ -864,10 +864,8 @@ static void bnxt_re_cleanup_res(struct bnxt_re_dev *rdev) {int i; -if (rdev->nq[0 ].hwq.max_elements) { -for (i =1 ; i < rdev->num_msix; i++) -bnxt_qplib_disable_nq (&rdev->nq[i -1 ]); - } +for (i =1 ; i < rdev->num_msix; i++) +bnxt_qplib_disable_nq (&rdev->nq[i -1 ]);if (rdev->qplib_res.rcfw)bnxt_qplib_cleanup_res (&rdev->qplib_res);
@@ -876,6 +874,7 @@ static void bnxt_re_cleanup_res(struct bnxt_re_dev *rdev)static int bnxt_re_init_res (struct bnxt_re_dev *rdev) {int rc =0 , i; +int num_vec_enabled =0 ;bnxt_qplib_init_res (&rdev->qplib_res);
@@ -891,9 +890,13 @@ static int bnxt_re_init_res(struct bnxt_re_dev *rdev) "Failed to enable NQ with rc = 0x%x", rc); goto fail; } + num_vec_enabled++; }return 0 ; fail: +for (i = num_vec_enabled; i >=0 ; i--) +bnxt_qplib_disable_nq (&rdev->nq[i]); +return rc; }
@@ -925,6 +928,7 @@ static void bnxt_re_free_res(struct bnxt_re_dev *rdev)static int bnxt_re_alloc_res (struct bnxt_re_dev *rdev) {int rc =0 , i; +int num_vec_created =0 ;/* Configure and allocate resources for qplib */ rdev->qplib_res.rcfw = &rdev->rcfw;
@@ -951,7 +955,7 @@ static int bnxt_re_alloc_res(struct bnxt_re_dev *rdev)if (rc) {dev_err (rdev_to_dev (rdev),"Alloc Failed NQ%d rc:%#x" , i, rc); - goto dealloc_dpi; + goto free_nq; } rc = bnxt_re_net_ring_alloc (rdev, rdev->nq[i].hwq.pbl[PBL_LVL_0].pg_map_arr,
@@ -964,14 +968,17 @@ static int bnxt_re_alloc_res(struct bnxt_re_dev *rdev)dev_err (rdev_to_dev (rdev),"Failed to allocate NQ fw id with rc = 0x%x" , rc); +bnxt_qplib_free_nq (&rdev->nq[i]); goto free_nq; } + num_vec_created++; }return 0 ; free_nq: -for (i =0 ; i < rdev->num_msix -1 ; i++) +for (i = num_vec_created; i >=0 ; i--) { +bnxt_re_net_ring_free (rdev, rdev->nq[i].ring_id);bnxt_qplib_free_nq (&rdev->nq[i]); -dealloc_dpi: + }bnxt_qplib_dealloc_dpi (&rdev->qplib_res, &rdev->qplib_res.dpi_tbl, &rdev->dpi_privileged);
@@ -1206,8 +1213,11 @@ static void bnxt_re_ib_unreg(struct bnxt_re_dev *rdev)if (test_and_clear_bit (BNXT_RE_FLAG_QOS_WORK_REG , &rdev->flags))cancel_delayed_work (&rdev->worker); -bnxt_re_cleanup_res (rdev); -bnxt_re_free_res (rdev); +if (test_and_clear_bit (BNXT_RE_FLAG_RESOURCES_INITIALIZED , + &rdev->flags)) +bnxt_re_cleanup_res (rdev); +if (test_and_clear_bit (BNXT_RE_FLAG_RESOURCES_ALLOCATED , &rdev->flags)) +bnxt_re_free_res (rdev);if (test_and_clear_bit (BNXT_RE_FLAG_RCFW_CHANNEL_EN , &rdev->flags)) { rc =bnxt_qplib_deinit_rcfw (&rdev->rcfw);
@@ -1337,12 +1347,15 @@ static int bnxt_re_ib_reg(struct bnxt_re_dev *rdev)pr_err ("Failed to allocate resources: %#x\n" , rc); goto fail; } +set_bit (BNXT_RE_FLAG_RESOURCES_ALLOCATED , &rdev->flags); rc =bnxt_re_init_res (rdev);if (rc) {pr_err ("Failed to initialize resources: %#x\n" , rc); goto fail; } +set_bit (BNXT_RE_FLAG_RESOURCES_INITIALIZED , &rdev->flags); +if (!rdev->is_virtfn) { rc =bnxt_re_setup_qos (rdev);if (rc)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 57/306 RDMA/bnxt_re: Avoid NULL check after accessing the pointer
In reply to Greg Kroah-HartmanFrom: Selvin Xavier <[email protected]>
[ Upstream commit eae4ad1b0c9a77ef0cbac212d58d46976eaacfc1 ]
This is reported by smatch check. rcfw->creq_bar_reg_iomem is accessed in bnxt_qplib_rcfw_stop_irq and this variable check afterwards doesn't make sense. Also, rcfw->creq_bar_reg_iomem will never be NULL. So Removing this check.
--- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +6 -7
@@ -614,13 +614,8 @@ void bnxt_qplib_disable_rcfw_channel(struct bnxt_qplib_rcfw *rcfw)bnxt_qplib_rcfw_stop_irq (rcfw, true); -if (rcfw->cmdq_bar_reg_iomem) -iounmap (rcfw->cmdq_bar_reg_iomem); - rcfw->cmdq_bar_reg_iomem =NULL ; - -if (rcfw->creq_bar_reg_iomem) -iounmap (rcfw->creq_bar_reg_iomem); - rcfw->creq_bar_reg_iomem =NULL ; +iounmap (rcfw->cmdq_bar_reg_iomem); +iounmap (rcfw->creq_bar_reg_iomem); indx =find_first_bit (rcfw->cmdq_bitmap, rcfw->bmap_size);if (indx != rcfw->bmap_size)
@@ -629,6 +624,8 @@ void bnxt_qplib_disable_rcfw_channel(struct bnxt_qplib_rcfw *rcfw)kfree (rcfw->cmdq_bitmap); rcfw->bmap_size =0 ; + rcfw->cmdq_bar_reg_iomem =NULL ; + rcfw->creq_bar_reg_iomem =NULL ; rcfw->aeq_handler =NULL ; rcfw->vector =0 ; }
@@ -714,6 +711,8 @@ int bnxt_qplib_enable_rcfw_channel(struct pci_dev *pdev,dev_err (&rcfw->pdev->dev,"QPLIB: CREQ BAR region %d mapping failed" , rcfw->creq_bar_reg); +iounmap (rcfw->cmdq_bar_reg_iomem); + rcfw->cmdq_bar_reg_iomem =NULL ;return -ENOMEM ; } rcfw->creq_qp_event_processed =0 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 107/306 x86/intel_rdt: Prevent pseudo-locking from using stale pointers
In reply to Greg Kroah-HartmanFrom: Jithu Joseph <[email protected]>
[ Upstream commit b61b8bba18fe2b63d38fdaf9b83de25e2d787dfe ]
When the last CPU in an rdt_domain goes offline, its rdt_domain struct gets freed. Current pseudo-locking code is unaware of this scenario and tries to dereference the freed structure in a few places.
Add checks to prevent pseudo-locking code from doing this.
While further work is needed to seamlessly restore resource groups (not just pseudo-locking) to their configuration when the domain is brought back online, the immediate issue of invalid pointers is addressed here.
--- arch/x86/kernel/cpu/intel_rdt.c | 7 ++++ arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c | 12 +++++-- arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c | 10 ++++++ arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 38 +++++++++++++++------ 4 files changed, 55 insertions(+), 12 deletions(-)
arch/x86/kernel/cpu/intel_rdt.c +7 -0
@@ -610,6 +610,13 @@ static void domain_remove_cpu(int cpu, struct rdt_resource *r)cancel_delayed_work (&d->cqm_limbo); } +/* +* rdt_domain "d" is going to be freed below, so clear +* its pointer from pseudo_lock_region struct. +*/ +if (d->plr) + d->plr->d =NULL ; +kfree (d->ctrl_val);kfree (d->mbps_val);kfree (d->rmid_busy_llc);
arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c +10 -2
@@ -408,8 +408,16 @@ int rdtgroup_schemata_show(struct kernfs_open_file *of,for_each_alloc_enabled_rdt_resource (r)seq_printf (s,"%s:uninitialized\n" , r->name); }else if (rdtgrp->mode ==RDT_MODE_PSEUDO_LOCKED ) { -seq_printf (s,"%s:%d=%x\n" , rdtgrp->plr->r->name, - rdtgrp->plr->d->id, rdtgrp->plr->cbm); +if (!rdtgrp->plr->d) { +rdt_last_cmd_clear (); +rdt_last_cmd_puts ("Cache domain offline\n" ); + ret = -ENODEV ; + }else { +seq_printf (s,"%s:%d=%x\n" , + rdtgrp->plr->r->name, + rdtgrp->plr->d->id, + rdtgrp->plr->cbm); + } }else { closid = rdtgrp->closid;for_each_alloc_enabled_rdt_resource (r) {
arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c +10 -0
@@ -1116,6 +1116,11 @@ static int pseudo_lock_measure_cycles(struct rdtgroup *rdtgrp, int sel) goto out; } +if (!plr->d) { + ret = -ENODEV ; + goto out; + } + plr->thread_done =0 ; cpu =cpumask_first (&plr->d->cpu_mask);if (!cpu_online (cpu)) {
@@ -1429,6 +1434,11 @@ static int pseudo_lock_dev_mmap(struct file *filp, struct vm_area_struct *vma) plr = rdtgrp->plr; +if (!plr->d) { +mutex_unlock (&rdtgroup_mutex); +return -ENODEV ; + } +/* * Task is required to run with affinity to the cpus associated * with the pseudo-locked region. If this is not the case the task
arch/x86/kernel/cpu/intel_rdt_rdtgroup.c +28 -10
@@ -268,17 +268,27 @@ static int rdtgroup_cpus_show(struct kernfs_open_file *of, struct seq_file *s, void *v) { struct rdtgroup *rdtgrp; +struct cpumask *mask;int ret =0 ; rdtgrp =rdtgroup_kn_lock_live (of->kn);if (rdtgrp) { -if (rdtgrp->mode ==RDT_MODE_PSEUDO_LOCKED ) -seq_printf (s,is_cpu_list (of) ?"%*pbl\n" :"%*pb\n" , -cpumask_pr_args (&rdtgrp->plr->d->cpu_mask)); -else +if (rdtgrp->mode ==RDT_MODE_PSEUDO_LOCKED ) { +if (!rdtgrp->plr->d) { +rdt_last_cmd_clear (); +rdt_last_cmd_puts ("Cache domain offline\n" ); + ret = -ENODEV ; + }else { + mask = &rdtgrp->plr->d->cpu_mask; +seq_printf (s,is_cpu_list (of) ? +"%*pbl\n" :"%*pb\n" , +cpumask_pr_args (mask)); + } + }else {seq_printf (s,is_cpu_list (of) ?"%*pbl\n" :"%*pb\n" ,cpumask_pr_args (&rdtgrp->cpu_mask)); + } }else { ret = -ENOENT ; }
@@ -1286,6 +1296,7 @@ static int rdtgroup_size_show(struct kernfs_open_file *of,struct rdt_resource *r;struct rdt_domain *d;unsigned int size; +int ret =0 ;bool sep;u32 ctrl;
@@ -1296,11 +1307,18 @@ static int rdtgroup_size_show(struct kernfs_open_file *of, }if (rdtgrp->mode ==RDT_MODE_PSEUDO_LOCKED ) { -seq_printf (s,"%*s:" , max_name_width, rdtgrp->plr->r->name); - size =rdtgroup_cbm_to_size (rdtgrp->plr->r, - rdtgrp->plr->d, - rdtgrp->plr->cbm); -seq_printf (s,"%d=%u\n" , rdtgrp->plr->d->id, size); +if (!rdtgrp->plr->d) { +rdt_last_cmd_clear (); +rdt_last_cmd_puts ("Cache domain offline\n" ); + ret = -ENODEV ; + }else { +seq_printf (s,"%*s:" , max_name_width, + rdtgrp->plr->r->name); + size =rdtgroup_cbm_to_size (rdtgrp->plr->r, + rdtgrp->plr->d, + rdtgrp->plr->cbm); +seq_printf (s,"%d=%u\n" , rdtgrp->plr->d->id, size); + } goto out; }
@@ -1330,7 +1348,7 @@ static int rdtgroup_size_show(struct kernfs_open_file *of, out:rdtgroup_kn_unlock (of->kn); -return 0 ; +return ret; }/* rdtgroup information files for one cache resource. */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 97/306 usbip: tools: fix atoi() on non-null terminated string
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit e325808c0051b16729ffd472ff887c6cae5c6317 ]
Currently the call to atoi is being passed a single char string that is not null terminated, so there is a potential read overrun along the stack when parsing for an integer value. Fix this by instead using a 2 char string that is initialized to all zeros to ensure that a 1 char read into the string is always terminated with a \0.
Detected by cppcheck:
"Invalid atoi() argument nr 1. A nul-terminated string is required."
--- tools/usb/usbip/libsrc/usbip_host_common.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/usb/usbip/libsrc/usbip_host_common.c +3 -3
@@ -43,7 +43,7 @@ static int32_t read_attr_usbip_status(struct usbip_usb_device *udev)int size;int fd;int length; -char status; +char status[2 ] = {0 };int value =0 ; size = snprintf(status_attr_path, sizeof(status_attr_path),
@@ -61,14 +61,14 @@ static int32_t read_attr_usbip_status(struct usbip_usb_device *udev)return -1 ; } - length =read (fd, &status,1 ); + length =read (fd, status,1 );if (length <0 ) {err ("error reading attribute %s" , status_attr_path);close (fd);return -1 ; } - value =atoi (&status); + value =atoi (status);return value; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 109/306 scsi: hisi_sas: Fix NULL pointer dereference
In reply to Greg Kroah-HartmanFrom: Gustavo A. R. Silva <[email protected]>
[ Upstream commit f4445bb93d82a984657b469e63118c2794a4c3d3 ]
There is a NULL pointer dereference in case *slot* happens to be NULL at lines 1053 and 1878:
struct hisi_sas_cq *cq =
&hisi_hba->cq[slot->dlvry_queue];
Notice that *slot* is being NULL checked at lines 1057 and 1881:
if (slot), which implies it may be NULL.
Fix this by placing the declaration and definition of variable cq, which contains the pointer dereference slot->dlvry_queue, after slot has been properly NULL checked.
Addresses-Coverity-ID: 1474515 ("Dereference before null check")
Addresses-Coverity-ID: 1474520 ("Dereference before null check")
--- drivers/scsi/hisi_sas/hisi_sas_main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/hisi_sas/hisi_sas_main.c +4 -4
@@ -1025,11 +1025,11 @@ static int hisi_sas_exec_internal_tmf_task(struct domain_device *device,if ((task->task_state_flags &SAS_TASK_STATE_ABORTED )) {if (!(task->task_state_flags &SAS_TASK_STATE_DONE )) {struct hisi_sas_slot *slot = task->lldd_task; -struct hisi_sas_cq *cq = - &hisi_hba->cq[slot->dlvry_queue];dev_err (dev,"abort tmf: TMF task timeout and not done\n" );if (slot) { +struct hisi_sas_cq *cq = + &hisi_hba->cq[slot->dlvry_queue];/* * flush tasklet to avoid free'ing task * before using task in IO completion
@@ -1856,10 +1856,10 @@ hisi_sas_internal_task_abort(struct hisi_hba *hisi_hba,if ((task->task_state_flags &SAS_TASK_STATE_ABORTED )) {if (!(task->task_state_flags &SAS_TASK_STATE_DONE )) {struct hisi_sas_slot *slot = task->lldd_task; -struct hisi_sas_cq *cq = - &hisi_hba->cq[slot->dlvry_queue];if (slot) { +struct hisi_sas_cq *cq = + &hisi_hba->cq[slot->dlvry_queue];/* * flush tasklet to avoid free'ing task * before using task in IO completion
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 108/306 sparc: Fix parport build warnings.
In reply to Greg Kroah-HartmanFrom: David S. Miller <[email protected]>
[ Upstream commit 46b8306480fb424abd525acc1763da1c63a27d8a ]
If PARPORT_PC_FIFO is not enabled, do not provide the dma lock macros and lock definition. Otherwise:
./arch/sparc/include/asm/parport.h:24:24: warning: ‘dma_spin_lock’ defined but not used [-Wunused-variable]
static DEFINE_SPINLOCK(dma_spin_lock);
^~~~~~~~~~~~~./include/linux/spinlock_types.h:81:39: note: in definition of macro ‘DEFINE_SPINLOCK’
#define DEFINE_SPINLOCK(x) spinlock_t x = __SPIN_LOCK_UNLOCKED(x)
--- arch/sparc/include/asm/parport.h | 2 ++ 1 file changed, 2 insertions(+)
arch/sparc/include/asm/parport.h +2 -0
@@ -21,6 +21,7 @@*/ #define HAS_DMA +#ifdef CONFIG_PARPORT_PC_FIFO static DEFINE_SPINLOCK (dma_spin_lock);#define claim_dma_lock () \
@@ -31,6 +32,7 @@ static DEFINE_SPINLOCK(dma_spin_lock);#define release_dma_lock (__flags) \ spin_unlock_irqrestore(&dma_spin_lock, __flags); +#endif static struct sparc_ebus_info { struct ebus_dma_info info;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 110/306 powerpc/pseries: Export raw per-CPU VPA data via debugfs
In reply to Greg Kroah-HartmanFrom: Aravinda Prasad <[email protected]>
[ Upstream commit c6c26fb55e8e4b3fc376be5611685990a17de27a ]
This patch exports the raw per-CPU VPA data via debugfs. A per-CPU file is created which exports the VPA data of that CPU to help debug some of the VPA related issues or to analyze the per-CPU VPA related statistics.
v3: Removed offline CPU check.
v2: Included offline CPU check and other review comments.
--- arch/powerpc/platforms/pseries/lpar.c | 54 +++++++++++++++++++++++++++ 1 file changed, 54 insertions(+)
arch/powerpc/platforms/pseries/lpar.c +54 -0
@@ -48,6 +48,7 @@#include <asm/kexec.h> #include <asm/fadump.h> #include <asm/asm-prototypes.h> +#include <asm/debugfs.h> #include "pseries.h"
@@ -1032,3 +1033,56 @@ static int __init reserve_vrma_context_id(void)return 0 ; }machine_device_initcall (pseries, reserve_vrma_context_id); + +#ifdef CONFIG_DEBUG_FS +/* debugfs file interface for vpa data */ +static ssize_t vpa_file_read (struct file *filp,char __user *buf,size_t len, +loff_t *pos) +{ +int cpu = (long )filp->private_data; +struct lppaca *lppaca = &lppaca_of (cpu); + +return simple_read_from_buffer (buf, len, pos, lppaca, +sizeof (struct lppaca )); +} + +static const struct file_operations vpa_fops = { + .open = simple_open, + .read = vpa_file_read, + .llseek = default_llseek, +}; + +static int __init vpa_debugfs_init (void ) +{ +char name[16 ]; +long i; +static struct dentry *vpa_dir; + +if (!firmware_has_feature (FW_FEATURE_SPLPAR )) +return 0 ; + + vpa_dir =debugfs_create_dir ("vpa" , powerpc_debugfs_root); +if (!vpa_dir) { +pr_warn ("%s: can't create vpa root dir\n" , __func__); +return -ENOMEM ; + } + +/* set up the per-cpu vpa file*/ +for_each_possible_cpu (i) { +struct dentry *d; + +sprintf (name,"cpu-%ld" , i); + + d =debugfs_create_file (name,0400 , vpa_dir, (void *)i, + &vpa_fops); +if (!d) { +pr_warn ("%s: can't create per-cpu vpa file\n" , + __func__); +return -ENOMEM ; + } + } + +return 0 ; +} +machine_arch_initcall (pseries, vpa_debugfs_init); +#endif /* CONFIG_DEBUG_FS */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 112/306 powerpc/mm/radix: Fix overuse of small pages in splitting logic
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
[ Upstream commit 3b5657ed5b4e27ccf593a41ff3c5aa27dae8df18 ]
When we have CONFIG_STRICT_KERNEL_RWX enabled, we want to split the linear mapping at the text/data boundary so we can map the kernel text read only.
But the current logic uses small pages for the entire text section, regardless of whether a larger page size would fit. eg. with the boundary at 16M we could use 2M pages, but instead we use 64K pages up to the 16M boundary:
Mapped 0x0000000000000000-0x0000000001000000 with 64.0 KiB pages Mapped 0x0000000001000000-0x0000000040000000 with 2.00 MiB pages Mapped 0x0000000040000000-0x0000000100000000 with 1.00 GiB pages
This is because the test is checking if addr is < __init_begin and addr + mapping_size is >= _stext. But that is true for all pages between _stext and __init_begin.
Instead what we want to check is if we are crossing the text/data boundary, which is at __init_begin. With that fixed we see:
Mapped 0x0000000000000000-0x0000000000e00000 with 2.00 MiB pages Mapped 0x0000000000e00000-0x0000000001000000 with 64.0 KiB pages Mapped 0x0000000001000000-0x0000000040000000 with 2.00 MiB pages Mapped 0x0000000040000000-0x0000000100000000 with 1.00 GiB pages
ie. we're correctly using 2MB pages below __init_begin, but we still drop down to 64K pages unnecessarily at the boundary.
--- arch/powerpc/mm/pgtable-radix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/mm/pgtable-radix.c +2 -2
@@ -295,14 +295,14 @@ static int __meminit create_physical_mapping(unsigned long start,if (split_text_mapping && (mapping_size ==PUD_SIZE ) && (addr <__pa_symbol (__init_begin)) && - (addr + mapping_size) >=__pa_symbol (_stext)) { + (addr + mapping_size) >=__pa_symbol (__init_begin)) { max_mapping_size =PMD_SIZE ; goto retry; }if (split_text_mapping && (mapping_size ==PMD_SIZE ) && (addr <__pa_symbol (__init_begin)) && - (addr + mapping_size) >=__pa_symbol (_stext)) { + (addr + mapping_size) >=__pa_symbol (__init_begin)) { mapping_size =PAGE_SIZE ; psize = mmu_virtual_psize; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 111/306 powerpc/mm/radix: Fix off-by-one in split mapping logic
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
[ Upstream commit 5c6499b7041b43807dfaeda28aa87fc0e62558f7 ]
When we have CONFIG_STRICT_KERNEL_RWX enabled, we try to split the kernel linear (1:1) mapping so that the kernel text is in a separate page to kernel data, so we can mark the former read-only.
We could achieve that just by always using 64K pages for the linear mapping, but we try to be smarter. Instead we use huge pages when possible, and only switch to smaller pages when necessary.
However we have an off-by-one bug in that logic, which causes us to calculate the wrong boundary between text and data.
For example with the end of the kernel text at 16M we see:
radix-mmu: Mapped 0x0000000000000000-0x0000000001200000 with 64.0 KiB pages
radix-mmu: Mapped 0x0000000001200000-0x0000000040000000 with 2.00 MiB pages
radix-mmu: Mapped 0x0000000040000000-0x0000000100000000 with 1.00 GiB pages
ie. we mapped from 0 to 18M with 64K pages, even though the boundary between text and data is at 16M.
With the fix we see we're correctly hitting the 16M boundary:
radix-mmu: Mapped 0x0000000000000000-0x0000000001000000 with 64.0 KiB pages
radix-mmu: Mapped 0x0000000001000000-0x0000000040000000 with 2.00 MiB pages
radix-mmu: Mapped 0x0000000040000000-0x0000000100000000 with 1.00 GiB pages
--- arch/powerpc/mm/pgtable-radix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/mm/pgtable-radix.c +2 -2
@@ -294,14 +294,14 @@ static int __meminit create_physical_mapping(unsigned long start, }if (split_text_mapping && (mapping_size ==PUD_SIZE ) && - (addr <=__pa_symbol (__init_begin)) && + (addr <__pa_symbol (__init_begin)) && (addr + mapping_size) >=__pa_symbol (_stext)) { max_mapping_size =PMD_SIZE ; goto retry; }if (split_text_mapping && (mapping_size ==PMD_SIZE ) && - (addr <=__pa_symbol (__init_begin)) && + (addr <__pa_symbol (__init_begin)) && (addr + mapping_size) >=__pa_symbol (_stext)) { mapping_size =PAGE_SIZE ; psize = mmu_virtual_psize;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 114/306 powerpc/64s/radix: Fix radix__flush_tlb_collapsed_pmd double flushing pmd
In reply to Greg Kroah-HartmanFrom: Nicholas Piggin <[email protected]>
[ Upstream commit dd76ff5af35350fd6d5bb5b069e73b6017f66893 ]
--- arch/powerpc/mm/tlb-radix.c | 1 - 1 file changed, 1 deletion(-)
arch/powerpc/mm/tlb-radix.c +0 -1
@@ -1072,7 +1072,6 @@ void radix__flush_tlb_collapsed_pmd(struct mm_struct *mm, unsigned long addr) goto local; }_tlbie_va_range (addr, end, pid,PAGE_SIZE , mmu_virtual_psize, true); - goto local; }else { local:_tlbiel_va_range (addr, end, pid,PAGE_SIZE , mmu_virtual_psize, true);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 115/306 selftests/bpf: fix return value comparison for tests in test_libbpf.sh
In reply to Greg Kroah-HartmanFrom: Quentin Monnet <[email protected]>
[ Upstream commit c5fa5d602221362f8341ecd9e32d83194abf5bd9 ]
The return value for each test in test_libbpf.sh is compared with
if (( $? == 0 )) ; then ...
This works well with bash, but not with dash, that /bin/sh is aliased to on some systems (such as Ubuntu).
Let's replace this comparison by something that works on both shells.
--- tools/testing/selftests/bpf/test_libbpf.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/test_libbpf.sh +1 -1
@@ -6,7 +6,7 @@ export TESTNAME=test_libbpf # Determine selftest success via shell exit code exit_handler() { - if (( $? == 0 )); then + if [ $? -eq 0 ]; then echo "selftests: $TESTNAME [PASS]"; else echo "$TESTNAME: failed at file $LAST_LOADED" 1>&2
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 116/306 tools: bpftool: fix completion for "bpftool map update"
In reply to Greg Kroah-HartmanFrom: Quentin Monnet <[email protected]>
[ Upstream commit fe8ecccc10b3adc071de05ca7af728ca1a4ac9aa ]
When trying to complete "bpftool map update" commands, the call to printf would print an error message that would show on the command line if no map is found to complete the command line.
Fix it by making sure we have map ids to complete the line with, before we try to print something.
--- tools/bpf/bpftool/bash-completion/bpftool | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/bpf/bpftool/bash-completion/bpftool +1 -1
@@ -143,7 +143,7 @@ _bpftool_map_update_map_type() local type type=$(bpftool -jp map show $keyword $ref | \ command sed -n 's/.*"type": "\(.*\)",$/\1/p') - printf $type + [[ -n $type ]] && printf $type } _bpftool_map_update_get_id()
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 118/306 ceph: only allow punch hole mode in fallocate
In reply to Greg Kroah-HartmanFrom: Luis Henriques <[email protected]>
[ Upstream commit bddff633ab7bc60a18a86ac8b322695b6f8594d0 ]
Current implementation of cephfs fallocate isn't correct as it doesn't really reserve the space in the cluster, which means that a subsequent call to a write may actually fail due to lack of space. In fact, it is currently possible to fallocate an amount space that is larger than the free space in the cluster. It has behaved this way since the initial commit ad7a60de882a ("ceph: punch hole support").
Since there's no easy solution to fix this at the moment, this patch simply removes support for all fallocate operations but FALLOC_FL_PUNCH_HOLE (which implies FALLOC_FL_KEEP_SIZE).
--- fs/ceph/file.c | 45 +++++++++------------------------------------ 1 file changed, 9 insertions(+), 36 deletions(-)
fs/ceph/file.c +9 -36
@@ -1735,7 +1735,6 @@ static long ceph_fallocate(struct file *file, int mode,struct ceph_file_info *fi = file->private_data;struct inode *inode =file_inode (file);struct ceph_inode_info *ci =ceph_inode (inode); -struct ceph_fs_client *fsc =ceph_inode_to_client (inode);struct ceph_cap_flush *prealloc_cf;int want, got =0 ;int dirty;
@@ -1743,10 +1742,7 @@ static long ceph_fallocate(struct file *file, int mode,loff_t endoff =0 ;loff_t size; -if ((offset + length) >max (i_size_read (inode), fsc->max_file_size)) -return -EFBIG ; - -if (mode & ~(FALLOC_FL_KEEP_SIZE |FALLOC_FL_PUNCH_HOLE )) +if (mode != (FALLOC_FL_KEEP_SIZE |FALLOC_FL_PUNCH_HOLE ))return -EOPNOTSUPP ;if (!S_ISREG (inode->i_mode))
@@ -1763,18 +1759,6 @@ static long ceph_fallocate(struct file *file, int mode, goto unlock; } -if (!(mode & (FALLOC_FL_PUNCH_HOLE |FALLOC_FL_KEEP_SIZE )) && -ceph_quota_is_max_bytes_exceeded (inode, offset + length)) { - ret = -EDQUOT ; - goto unlock; - } - -if (ceph_osdmap_flag (&fsc->client->osdc,CEPH_OSDMAP_FULL ) && - !(mode &FALLOC_FL_PUNCH_HOLE )) { - ret = -ENOSPC ; - goto unlock; - } -if (ci->i_inline_version !=CEPH_INLINE_NONE ) { ret =ceph_uninline_data (file,NULL );if (ret <0 )
@@ -1782,12 +1766,12 @@ static long ceph_fallocate(struct file *file, int mode, } size =i_size_read (inode); -if (!(mode &FALLOC_FL_KEEP_SIZE )) { - endoff = offset + length; - ret =inode_newsize_ok (inode, endoff); -if (ret) - goto unlock; - } + +/* Are we punching a hole beyond EOF? */ +if (offset >= size) + goto unlock; +if ((offset + length) > size) + length = size - offset;if (fi->fmode &CEPH_FILE_MODE_LAZY ) want =CEPH_CAP_FILE_BUFFER |CEPH_CAP_FILE_LAZYIO ;
@@ -1798,16 +1782,8 @@ static long ceph_fallocate(struct file *file, int mode,if (ret <0 ) goto unlock; -if (mode &FALLOC_FL_PUNCH_HOLE ) { -if (offset < size) -ceph_zero_pagecache_range (inode, offset, length); - ret =ceph_zero_objects (inode, offset, length); - }else if (endoff > size) { -truncate_pagecache_range (inode, size,-1 ); -if (ceph_inode_set_size (inode, endoff)) -ceph_check_caps (ceph_inode (inode), -CHECK_CAPS_AUTHONLY ,NULL ); - } +ceph_zero_pagecache_range (inode, offset, length); + ret =ceph_zero_objects (inode, offset, length);if (!ret) {spin_lock (&ci->i_ceph_lock);
@@ -1817,9 +1793,6 @@ static long ceph_fallocate(struct file *file, int mode,spin_unlock (&ci->i_ceph_lock);if (dirty)__mark_inode_dirty (inode, dirty); -if ((endoff > size) && -ceph_quota_is_max_bytes_approaching (inode, endoff)) -ceph_check_caps (ci,CHECK_CAPS_NODELAY ,NULL ); }ceph_put_cap_refs (ci, got);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 120/306 RISC-V: Avoid corrupting the upper 32-bit of phys_addr_t in ioremap
In reply to Greg Kroah-HartmanFrom: Vincent Chen <[email protected]>
[ Upstream commit 827a438156e4c423b6875a092e272933952a2910 ]
For 32bit, the upper 32-bit of phys_addr_t will be flushed to zero after AND with PAGE_MASK because the data type of PAGE_MASK is unsigned long. To fix this problem, the page alignment is done by subtracting the page offset instead of AND with PAGE_MASK.
--- arch/riscv/mm/ioremap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/mm/ioremap.c +1 -1
@@ -42,7 +42,7 @@ static void __iomem *__ioremap_caller(phys_addr_t addr, size_t size,/* Page-align mappings */ offset = addr & (~PAGE_MASK ); - addr &=PAGE_MASK ; + addr -= offset; size =PAGE_ALIGN (size + offset); area =get_vm_area_caller (size,VM_IOREMAP , caller);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 121/306 thermal: armada: fix a test in probe()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit d1d2c290b3c04b65fa6132eeebe50a070746d8f6 ]
The platform_get_resource() function doesn't return error pointers, it returns NULL on error.
--- drivers/thermal/armada_thermal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/thermal/armada_thermal.c +2 -2
@@ -526,8 +526,8 @@ static int armada_thermal_probe_legacy(struct platform_device *pdev,/* First memory region points towards the status register */ res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -if (IS_ERR (res)) -return PTR_ERR (res); +if (!res) +return -EIO ;/* * Edit the resource start address and length to map over all the
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 122/306 f2fs: fix to spread clear_cold_data()
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
[ Upstream commit 2baf07818549c8bb8d7b3437e889b86eab56d38e ]
We need to drop PG_checked flag on page as well when we clear PG_uptodate flag, in order to avoid treating the page as GCing one later.
--- fs/f2fs/data.c | 8 +++++++- fs/f2fs/dir.c | 1 + fs/f2fs/segment.c | 4 +++- 3 files changed, 11 insertions(+), 2 deletions(-)
fs/f2fs/data.c +7 -1
@@ -1782,6 +1782,7 @@ int f2fs_do_write_data_page(struct f2fs_io_info *fio)/* This page is already truncated */ if (fio->old_blkaddr ==NULL_ADDR ) {ClearPageUptodate (page); +clear_cold_data (page); goto out_writepage; } got_it:
@@ -1957,8 +1958,10 @@ static int __write_data_page(struct page *page, bool *submitted, out:inode_dec_dirty_pages (inode); -if (err) +if (err) {ClearPageUptodate (page); +clear_cold_data (page); + }if (wbc->for_reclaim) {f2fs_submit_merged_write_cond (sbi, inode,0 , page->index,DATA );
@@ -2573,6 +2576,8 @@ void f2fs_invalidate_page(struct page *page, unsigned int offset, } } +clear_cold_data (page); +/* This is atomic written page, keep Private */ if (IS_ATOMIC_WRITTEN_PAGE (page))return f2fs_drop_inmem_page (inode, page);
@@ -2591,6 +2596,7 @@ int f2fs_release_page(struct page *page, gfp_t wait)if (IS_ATOMIC_WRITTEN_PAGE (page))return 0 ; +clear_cold_data (page);set_page_private (page,0 );ClearPagePrivate (page);return 1 ;
fs/f2fs/dir.c +1 -0
@@ -733,6 +733,7 @@ void f2fs_delete_entry(struct f2fs_dir_entry *dentry, struct page *page,clear_page_dirty_for_io (page);ClearPagePrivate (page);ClearPageUptodate (page); +clear_cold_data (page);inode_dec_dirty_pages (dir);f2fs_remove_dirty_inode (dir); }
fs/f2fs/segment.c +3 -1
@@ -277,8 +277,10 @@ static int __revoke_inmem_pages(struct inode *inode, } next:/* we don't need to invalidate this in the sccessful status */ -if (drop || recover) +if (drop || recover) {ClearPageUptodate (page); +clear_cold_data (page); + }set_page_private (page,0 );ClearPagePrivate (page);f2fs_put_page (page,1 );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 123/306 f2fs: spread f2fs_set_inode_flags()
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
[ Upstream commit 9149a5eb606152df158eb7d7da5a34e84b574189 ]
This patch changes codes as below:
- use f2fs_set_inode_flags() to update i_flags atomically to avoid potential race.
- synchronize F2FS_I(inode)->i_flags to inode->i_flags in f2fs_new_inode().
- use f2fs_set_inode_flags() to simply codes in f2fs_quota_{on,off}.
--- fs/f2fs/f2fs.h | 2 +- fs/f2fs/namei.c | 2 ++ fs/f2fs/super.c | 5 ++--- 3 files changed, 5 insertions(+), 4 deletions(-)
fs/f2fs/f2fs.h +1 -1
@@ -3388,7 +3388,7 @@ static inline void f2fs_set_encrypted_inode(struct inode *inode) {#ifdef CONFIG_F2FS_FS_ENCRYPTION file_set_encrypt (inode); - inode->i_flags |=S_ENCRYPTED ; +f2fs_set_inode_flags (inode);#endif }
fs/f2fs/namei.c +2 -0
@@ -124,6 +124,8 @@ static struct inode *f2fs_new_inode(struct inode *dir, umode_t mode)if (F2FS_I (inode)->i_flags &F2FS_PROJINHERIT_FL )set_inode_flag (inode,FI_PROJ_INHERIT ); +f2fs_set_inode_flags (inode); +trace_f2fs_new_inode (inode,0 );return inode;
fs/f2fs/super.c +2 -3
@@ -1837,8 +1837,7 @@ static int f2fs_quota_on(struct super_block *sb, int type, int format_id,inode_lock (inode);F2FS_I (inode)->i_flags |=F2FS_NOATIME_FL |F2FS_IMMUTABLE_FL ; -inode_set_flags (inode,S_NOATIME |S_IMMUTABLE , -S_NOATIME |S_IMMUTABLE ); +f2fs_set_inode_flags (inode);inode_unlock (inode);f2fs_mark_inode_dirty_sync (inode, false);
@@ -1863,7 +1862,7 @@ static int f2fs_quota_off(struct super_block *sb, int type)inode_lock (inode);F2FS_I (inode)->i_flags &= ~(F2FS_NOATIME_FL |F2FS_IMMUTABLE_FL ); -inode_set_flags (inode,0 ,S_NOATIME |S_IMMUTABLE ); +f2fs_set_inode_flags (inode);inode_unlock (inode);f2fs_mark_inode_dirty_sync (inode, false); out_put:
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 125/306 qlcnic: fix a return in qlcnic_dcb_get_capability()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit c94f026fb742b2d3199422751dbc4f6fc0e753d8 ]
These functions are supposed to return one on failure and zero on success. Returning a zero here could cause uninitialized variable bugs in several of the callers. For example:
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c:1660 get_iscsi_dcb_priority()
error: uninitialized symbol 'caps'.
--- drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c +1 -1
@@ -883,7 +883,7 @@ static u8 qlcnic_dcb_get_capability(struct net_device *netdev, int capid,struct qlcnic_adapter *adapter =netdev_priv (netdev);if (!test_bit (QLCNIC_DCB_STATE , &adapter->dcb->state)) -return 0 ; +return 1 ;switch (capid) {case DCB_CAP_ATTR_PG :
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 99/306 dm raid: avoid bitmap with raid4/5/6 journal device
In reply to Greg Kroah-HartmanFrom: Heinz Mauelshagen <[email protected]>
[ Upstream commit d857ad75edf3c0066fcd920746f9dc75382b3324 ]
With raid4/5/6, journal device and write intent bitmap are mutually exclusive.
--- drivers/md/dm-raid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-raid.c +1 -1
@@ -2475,7 +2475,7 @@ static int super_validate(struct raid_set *rs, struct md_rdev *rdev) }/* Enable bitmap creation for RAID levels != 0 */ - mddev->bitmap_info.offset =rt_is_raid0 (rs->raid_type) ?0 :to_sector (4096 ); + mddev->bitmap_info.offset = (rt_is_raid0 (rs->raid_type) || rs->journal_dev.dev) ?0 :to_sector (4096 ); mddev->bitmap_info.default_offset = mddev->bitmap_info.offset;if (!test_and_clear_bit (FirstUse, &rdev->flags)) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 128/306 mfd: mc13xxx-core: Fix PMIC shutdown when reading ADC values
In reply to Greg Kroah-HartmanFrom: Fabio Estevam <[email protected]>
[ Upstream commit 55143439b7b501882bea9d95a54adfe00ffc79a3 ]
When trying to read any MC13892 ADC channel on a imx51-babbage board:
The MC13892 PMIC shutdowns completely.
After debugging this issue and comparing the MC13892 and MC13783 initializations done in the vendor kernel, it was noticed that the CHRGRAWDIV bit of the ADC0 register was not being set.
This bit is set by default after power on, but the driver was clearing it.
After setting this bit it is possible to read the ADC values correctly.
--- drivers/mfd/mc13xxx-core.c | 3 ++- include/linux/mfd/mc13xxx.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/mfd/mc13xxx-core.c +2 -1
@@ -278,7 +278,8 @@ int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx, unsigned int mode,if (ret) goto out; - adc0 =MC13XXX_ADC0_ADINC1 |MC13XXX_ADC0_ADINC2 ; + adc0 =MC13XXX_ADC0_ADINC1 |MC13XXX_ADC0_ADINC2 | +MC13XXX_ADC0_CHRGRAWDIV ; adc1 =MC13XXX_ADC1_ADEN |MC13XXX_ADC1_ADTRIGIGN |MC13XXX_ADC1_ASC ;/*
include/linux/mfd/mc13xxx.h +1 -0
@@ -249,6 +249,7 @@ struct mc13xxx_platform_data {#define MC13XXX_ADC0_TSMOD0 (1 << 12)#define MC13XXX_ADC0_TSMOD1 (1 << 13)#define MC13XXX_ADC0_TSMOD2 (1 << 14) +#define MC13XXX_ADC0_CHRGRAWDIV (1 << 15)#define MC13XXX_ADC0_ADINC1 (1 << 16)#define MC13XXX_ADC0_ADINC2 (1 << 17)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 129/306 mfd: intel_soc_pmic_bxtwc: Chain power button IRQs as well
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 9f8ddee1dab836ca758ca8fc555ab5a3aaa5d3fd ]
Power button IRQ actually has a second level of interrupts to distinguish between UI and POWER buttons. Moreover, current implementation looks awkward in approach to handle second level IRQs by first level related IRQ chip.
To address above issues, split power button IRQ to be chained as well.
--- drivers/mfd/intel_soc_pmic_bxtwc.c | 41 ++++++++++++++++++++++-------- include/linux/mfd/intel_soc_pmic.h | 1 + 2 files changed, 32 insertions(+), 10 deletions(-)
drivers/mfd/intel_soc_pmic_bxtwc.c +31 -10
@@ -31,8 +31,8 @@/* Interrupt Status Registers */ #define BXTWC_IRQLVL1 0x4E02 -#define BXTWC_PWRBTNIRQ 0x4E03 +#define BXTWC_PWRBTNIRQ 0x4E03#define BXTWC_THRM0IRQ 0x4E04#define BXTWC_THRM1IRQ 0x4E05#define BXTWC_THRM2IRQ 0x4E06
@@ -47,10 +47,9 @@/* Interrupt MASK Registers */ #define BXTWC_MIRQLVL1 0x4E0E -#define BXTWC_MPWRTNIRQ 0x4E0F -#define BXTWC_MIRQLVL1_MCHGR BIT(5) +#define BXTWC_MPWRBTNIRQ 0x4E0F#define BXTWC_MTHRM0IRQ 0x4E12#define BXTWC_MTHRM1IRQ 0x4E13#define BXTWC_MTHRM2IRQ 0x4E14
@@ -66,9 +65,7 @@/* Whiskey Cove PMIC share same ACPI ID between different platforms */ #define BROXTON_PMIC_WC_HRV 4 -/* Manage in two IRQ chips since mask registers are not consecutive */ enum bxtwc_irqs { -/* Level 1 */ BXTWC_PWRBTN_LVL1_IRQ =0 ,BXTWC_TMU_LVL1_IRQ ,BXTWC_THRM_LVL1_IRQ ,
@@ -77,9 +74,11 @@ enum bxtwc_irqs {BXTWC_CHGR_LVL1_IRQ ,BXTWC_GPIO_LVL1_IRQ , BXTWC_CRIT_LVL1_IRQ, +}; -/* Level 2 */ - BXTWC_PWRBTN_IRQ, +enum bxtwc_irqs_pwrbtn { +BXTWC_PWRBTN_IRQ =0 , +BXTWC_UIBTN_IRQ , }; enum bxtwc_irqs_bcu {
@@ -113,7 +112,10 @@ static const struct regmap_irq bxtwc_regmap_irqs[] = {REGMAP_IRQ_REG (BXTWC_CHGR_LVL1_IRQ ,0 ,BIT (5 )),REGMAP_IRQ_REG (BXTWC_GPIO_LVL1_IRQ ,0 ,BIT (6 )), REGMAP_IRQ_REG(BXTWC_CRIT_LVL1_IRQ, 0, BIT(7)), - REGMAP_IRQ_REG(BXTWC_PWRBTN_IRQ, 1, 0x03), +}; + +static const struct regmap_irq bxtwc_regmap_irqs_pwrbtn[] = { +REGMAP_IRQ_REG (BXTWC_PWRBTN_IRQ ,0 ,0x01 ), }; static const struct regmap_irq bxtwc_regmap_irqs_bcu[] = {
@@ -125,7 +127,7 @@ static const struct regmap_irq bxtwc_regmap_irqs_adc[] = { };static const struct regmap_irq bxtwc_regmap_irqs_chgr[] = { -REGMAP_IRQ_REG (BXTWC_USBC_IRQ ,0 ,BIT (5 )), +REGMAP_IRQ_REG (BXTWC_USBC_IRQ ,0 ,0x20 ),REGMAP_IRQ_REG (BXTWC_CHGR0_IRQ ,0 ,0x1f ),REGMAP_IRQ_REG (BXTWC_CHGR1_IRQ ,1 ,0x1f ), };
@@ -144,7 +146,16 @@ static struct regmap_irq_chip bxtwc_regmap_irq_chip = { .mask_base = BXTWC_MIRQLVL1, .irqs = bxtwc_regmap_irqs, .num_irqs = ARRAY_SIZE(bxtwc_regmap_irqs), - .num_regs = 2, + .num_regs = 1, +}; + +static struct regmap_irq_chip bxtwc_regmap_irq_chip_pwrbtn = { + .name ="bxtwc_irq_chip_pwrbtn" , + .status_base =BXTWC_PWRBTNIRQ , + .mask_base =BXTWC_MPWRBTNIRQ , + .irqs = bxtwc_regmap_irqs_pwrbtn, + .num_irqs =ARRAY_SIZE (bxtwc_regmap_irqs_pwrbtn), + .num_regs =1 , };static struct regmap_irq_chip bxtwc_regmap_irq_chip_tmu = {
@@ -472,6 +483,16 @@ static int bxtwc_probe(struct platform_device *pdev)return ret; } + ret =bxtwc_add_chained_irq_chip (pmic, pmic->irq_chip_data, +BXTWC_PWRBTN_LVL1_IRQ , +IRQF_ONESHOT , + &bxtwc_regmap_irq_chip_pwrbtn, + &pmic->irq_chip_data_pwrbtn); +if (ret) { +dev_err (&pdev->dev,"Failed to add PWRBTN IRQ chip\n" ); +return ret; + } + ret = bxtwc_add_chained_irq_chip(pmic, pmic->irq_chip_data, BXTWC_TMU_LVL1_IRQ, IRQF_ONESHOT,
include/linux/mfd/intel_soc_pmic.h +1 -0
@@ -25,6 +25,7 @@ struct intel_soc_pmic {int irq;struct regmap *regmap;struct regmap_irq_chip_data *irq_chip_data; +struct regmap_irq_chip_data *irq_chip_data_pwrbtn;struct regmap_irq_chip_data *irq_chip_data_tmu;struct regmap_irq_chip_data *irq_chip_data_bcu;struct regmap_irq_chip_data *irq_chip_data_adc;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 130/306 mfd: max8997: Enale irq-wakeup unconditionally
In reply to Greg Kroah-HartmanFrom: Marek Szyprowski <[email protected]>
[ Upstream commit efddff27c886e729a7f84a7205bd84d7d4af7336 ]
IRQ wake up support for MAX8997 driver was initially configured by respective property in pdata. However, after the driver conversion to device-tree, setting it was left as 'todo'. Nowadays most of other PMIC MFD drivers initialized from device-tree assume that they can be an irq wakeup source, so enable it also for MAX8997. This fixes support for wakeup from MAX8997 RTC alarm.
--- drivers/mfd/max8997.c | 8 +------- include/linux/mfd/max8997.h | 1 - 2 files changed, 1 insertion(+), 8 deletions(-)
drivers/mfd/max8997.c +1 -7
@@ -153,12 +153,6 @@ static struct max8997_platform_data *max8997_i2c_parse_dt_pdata( pd->ono =irq_of_parse_and_map (dev->of_node,1 ); -/* -* ToDo: the 'wakeup' member in the platform data is more of a linux -* specfic information. Hence, there is no binding for that yet and -* not parsed here. -*/ -return pd; }
@@ -246,7 +240,7 @@ static int max8997_i2c_probe(struct i2c_client *i2c,*/ /* MAX8997 has a power button input. */ -device_init_wakeup (max8997->dev, pdata->wakeup); +device_init_wakeup (max8997->dev, true);return ret;
include/linux/mfd/max8997.h +0 -1
@@ -178,7 +178,6 @@ struct max8997_led_platform_data {struct max8997_platform_data {/* IRQ */ int ono; -int wakeup;/* ---- PMIC ---- */ struct max8997_regulator_data *regulators;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 132/306 fs/cifs: fix uninitialised variable warnings
In reply to Greg Kroah-HartmanFrom: Garry McNulty <[email protected]>
[ Upstream commit ef2298a06d012973bbc592b86fe5ff730d4d0c63 ]
In some error conditions, resp_buftype can be passed uninitialised to free_rsp_buf(), potentially resulting in a spurious debug message. If resp_buftype randomly had the value 1 (CIFS_SMALL_BUFFER) then this would log a debug message.
The rsp pointer is initialised to NULL so there is no other side-effect.
Detected by CoverityScan, CID 1438585 ("Uninitialized scalar variable") Detected by CoverityScan, CID 1438667 ("Uninitialized scalar variable") Detected by CoverityScan, CID 1438764 ("Uninitialized scalar variable")
--- fs/cifs/smb2pdu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/cifs/smb2pdu.c +3 -3
@@ -2283,7 +2283,7 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,struct cifs_ses *ses = tcon->ses;struct kvec iov[SMB2_CREATE_IOV_SIZE ];struct kvec rsp_iov = {NULL ,0 }; -int resp_buftype; +int resp_buftype =CIFS_NO_BUFFER ;int rc =0 ;int flags =0 ;
@@ -2570,7 +2570,7 @@ SMB2_close_flags(const unsigned int xid, struct cifs_tcon *tcon,struct cifs_ses *ses = tcon->ses;struct kvec iov[1 ];struct kvec rsp_iov; -int resp_buftype; +int resp_buftype =CIFS_NO_BUFFER ;int rc =0 ;cifs_dbg (FYI ,"Close\n" );
@@ -2723,7 +2723,7 @@ query_info(const unsigned int xid, struct cifs_tcon *tcon,struct kvec iov[1 ];struct kvec rsp_iov;int rc =0 ; -int resp_buftype; +int resp_buftype =CIFS_NO_BUFFER ;struct cifs_ses *ses = tcon->ses;int flags =0 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 133/306 spi: uniphier: fix incorrect property items
In reply to Greg Kroah-HartmanFrom: Keiji Hayashibara <[email protected]>
[ Upstream commit 3511ba7d4ca6f39e2d060bb94e42a41ad1fee7bf ]
This commit fixes incorrect property because it was different from the actual.
The parameters of '#address-cells' and '#size-cells' were removed, and 'interrupts', 'pinctrl-names' and 'pinctrl-0' were added.
--- .../devicetree/bindings/spi/spi-uniphier.txt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
Documentation/devicetree/bindings/spi/spi-uniphier.txt +8 -6
@@ -5,18 +5,20 @@ UniPhier SoCs have SCSSI which supports SPI single channel. Required properties: - compatible: should be "socionext,uniphier-scssi" - reg: address and length of the spi master registers - - #address-cells: must be <1>, see spi-bus.txt - - #size-cells: must be <0>, see spi-bus.txt - - clocks: A phandle to the clock for the device. - - resets: A phandle to the reset control for the device. + - interrupts: a single interrupt specifier + - pinctrl-names: should be "default" + - pinctrl-0: pin control state for the default mode + - clocks: a phandle to the clock for the device + - resets: a phandle to the reset control for the device Example: spi0: spi@54006000 { compatible = "socionext,uniphier-scssi"; reg = <0x54006000 0x100>; - #address-cells = <1>; - #size-cells = <0>; + interrupts = <0 39 4>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_spi0>; clocks = <&peri_clk 11>; resets = <&peri_rst 11>; };
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 100/306 selftests/bpf: fix file resource leak in load_kallsyms
In reply to Greg Kroah-HartmanFrom: Peng Hao <[email protected]>
[ Upstream commit 1bd70d2eba9d90eb787634361f0f6fa2c86b3f6d ]
FILE pointer variable f is opened but never closed.
--- tools/testing/selftests/bpf/trace_helpers.c | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/bpf/trace_helpers.c +1 -0
@@ -41,6 +41,7 @@ int load_kallsyms(void) syms[i].name =strdup (func); i++; } +fclose (f); sym_cnt = i;qsort (syms, sym_cnt,sizeof (struct ksym ), ksym_cmp);return 0 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 136/306 selftests: watchdog: Fix error message.
In reply to Greg Kroah-HartmanFrom: Jerry Hoemann <[email protected]>
[ Upstream commit 04d5e4bd37516ad60854eb74592c7dbddd75d277 ]
Printf's say errno but print the string version of error. Make consistent.
--- tools/testing/selftests/watchdog/watchdog-test.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tools/testing/selftests/watchdog/watchdog-test.c +4 -4
@@ -109,7 +109,7 @@ int main(int argc, char *argv[])printf ("Last boot is caused by: %s.\n" , (flags !=0 ) ?"Watchdog" :"Power-On-Reset" ); else - printf("WDIOC_GETBOOTSTATUS errno '%s'\n", strerror(errno)); + printf("WDIOC_GETBOOTSTATUS error '%s'\n", strerror(errno));break ;case 'd' : flags =WDIOS_DISABLECARD ;
@@ -117,7 +117,7 @@ int main(int argc, char *argv[])if (!ret)printf ("Watchdog card disabled.\n" );else -printf ("WDIOS_DISABLECARD errno '%s'\n" ,strerror (errno)); +printf ("WDIOS_DISABLECARD error '%s'\n" ,strerror (errno));break ;case 'e' : flags =WDIOS_ENABLECARD ;
@@ -125,7 +125,7 @@ int main(int argc, char *argv[])if (!ret)printf ("Watchdog card enabled.\n" );else -printf ("WDIOS_ENABLECARD errno '%s'\n" ,strerror (errno)); +printf ("WDIOS_ENABLECARD error '%s'\n" ,strerror (errno));break ;case 'p' : ping_rate =strtoul (optarg,NULL ,0 );
@@ -139,7 +139,7 @@ int main(int argc, char *argv[])if (!ret)printf ("Watchdog timeout set to %u seconds.\n" , flags);else -printf ("WDIOC_SETTIMEOUT errno '%s'\n" ,strerror (errno)); +printf ("WDIOC_SETTIMEOUT error '%s'\n" ,strerror (errno));break ;default :usage (argv[0 ]);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 137/306 selftests: kvm: Fix -Wformat warnings
In reply to Greg Kroah-HartmanFrom: Andrea Parri <[email protected]>
[ Upstream commit fb363e2d20351e1d16629df19e7bce1a31b3227a ]
Fixes the following warnings:
dirty_log_test.c: In function ‘help’:
dirty_log_test.c:216:9: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘int’ [-Wformat=]
printf(" -i: specify iteration counts (default: %"PRIu64")\n",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from include/test_util.h:18:0,
from dirty_log_test.c:16:
/usr/include/inttypes.h:105:34: note: format string is defined here
# define PRIu64 __PRI64_PREFIX "u"
dirty_log_test.c:218:9: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘int’ [-Wformat=]
printf(" -I: specify interval in ms (default: %"PRIu64" ms)\n",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from include/test_util.h:18:0,
from dirty_log_test.c:16:
/usr/include/inttypes.h:105:34: note: format string is defined here
# define PRIu64 __PRI64_PREFIX "u"--- tools/testing/selftests/kvm/dirty_log_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/kvm/dirty_log_test.c +2 -2
@@ -31,9 +31,9 @@/* How many pages to dirty for each guest loop */ #define TEST_PAGES_PER_LOOP 1024/* How many host loops to run (one KVM_GET_DIRTY_LOG for each loop) */ -#define TEST_HOST_LOOP_N 32 +#define TEST_HOST_LOOP_N 32UL/* Interval for each host loop (ms) */ -#define TEST_HOST_LOOP_INTERVAL 10 +#define TEST_HOST_LOOP_INTERVAL 10UL/* * Guest variables. We use these variables to share data between host
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 138/306 selftests: fix warning: "_GNU_SOURCE" redefined
In reply to Greg Kroah-HartmanFrom: Peng Hao <[email protected]>
[ Upstream commit 0387662d1b6c5ad2950d8e94d5e380af3f15c05c ]
Makefile contains -D_GNU_SOURCE. remove define "_GNU_SOURCE" in c files.
--- tools/testing/selftests/proc/fd-001-lookup.c | 2 +- tools/testing/selftests/proc/fd-003-kthread.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/proc/fd-001-lookup.c +1 -1
@@ -14,7 +14,7 @@* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ // Test /proc/*/fd lookup. -#define _GNU_SOURCE +#undef NDEBUG#include <assert.h> #include <dirent.h>
tools/testing/selftests/proc/fd-003-kthread.c +1 -1
@@ -14,7 +14,7 @@* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ // Test that /proc/$KERNEL_THREAD/fd/ is empty. -#define _GNU_SOURCE +#undef NDEBUG#include <sys/syscall.h> #include <assert.h>
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 139/306 thermal: rcar_thermal: fix duplicate IRQ request
In reply to Greg Kroah-HartmanFrom: Sergei Shtylyov <[email protected]>
[ Upstream commit df016bbba63743bbef9ff5c6c282561211dd72cc ]
The driver on R8A77995 requests the same IRQ twice since platform_get_resource() is always called for the 1st IRQ resource.
--- drivers/thermal/rcar_thermal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/rcar_thermal.c +1 -1
@@ -493,7 +493,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)pm_runtime_get_sync (dev);for (i =0 ; i < chip->nirqs; i++) { - irq =platform_get_resource (pdev,IORESOURCE_IRQ ,0 ); + irq =platform_get_resource (pdev,IORESOURCE_IRQ , i);if (!irq)continue ;if (!common->base) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 140/306 thermal: rcar_thermal: Prevent hardware access during system suspend
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 3a31386217628ffe2491695be2db933c25dde785 ]
On r8a7791/koelsch, sometimes the following message is printed during system suspend:
rcar_thermal e61f0000.thermal: thermal sensor was broken
This happens if the workqueue runs while the device is already suspended. Fix this by using the freezable system workqueue instead, cfr. commit 51e20d0e3a60cf46 ("thermal: Prevent polling from happening during system suspend").
--- drivers/thermal/rcar_thermal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/thermal/rcar_thermal.c +2 -2
@@ -434,8 +434,8 @@ static irqreturn_t rcar_thermal_irq(int irq, void *data)rcar_thermal_for_each_priv (priv, common) {if (rcar_thermal_had_changed (priv, status)) {rcar_thermal_irq_disable (priv); -schedule_delayed_work (&priv->work, -msecs_to_jiffies (300 )); +queue_delayed_work (system_freezable_wq, &priv->work, +msecs_to_jiffies (300 )); } }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 141/306 net: ethernet: cadence: fix socket buffer corruption problem
In reply to Greg Kroah-HartmanFrom: Tristram Ha <[email protected]>
[ Upstream commit 899ecaedd15599c22553d158f53b127cc1632dc2 ]
Socket buffer is not re-created when headroom is 2 and tailroom is 1.
--- drivers/net/ethernet/cadence/macb_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/cadence/macb_main.c +1 -1
@@ -1721,7 +1721,7 @@ static int macb_pad_and_fcs(struct sk_buff **skb, struct net_device *ndev) padlen =0 ;/* No room for FCS, need to reallocate skb. */ else - padlen =ETH_FCS_LEN - tailroom; + padlen =ETH_FCS_LEN ; }else {/* Add room for FCS. */ padlen +=ETH_FCS_LEN ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 101/306 SUNRPC: Fix a compile warning for cmpxchg64()
In reply to Greg Kroah-HartmanFrom: Trond Myklebust <[email protected]>
[ Upstream commit e732f4485a150492b286f3efc06f9b34dd6b9995 ]
--- net/sunrpc/auth_gss/gss_krb5_seal.c | 1 + 1 file changed, 1 insertion(+)
net/sunrpc/auth_gss/gss_krb5_seal.c +1 -0
@@ -63,6 +63,7 @@#include <linux/sunrpc/gss_krb5.h> #include <linux/random.h> #include <linux/crypto.h> +#include <linux/atomic.h> #if IS_ENABLED (CONFIG_SUNRPC_DEBUG )# define RPCDBG_FACILITY RPCDBG_AUTH
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 102/306 sunrpc: safely reallow resvport min/max inversion
In reply to Greg Kroah-HartmanFrom: J. Bruce Fields <[email protected]>
[ Upstream commit 826799e66e8683e5698e140bb9ef69afc8c0014e ]
Commits ffb6ca33b04b and e08ea3a96fc7 prevent setting xprt_min_resvport greater than xprt_max_resvport, but may also break simple code that sets one parameter then the other, if the new range does not overlap the old.
Also it looks racy to me, unless there's some serialization I'm not seeing. Granted it would probably require malicious privileged processes (unless there's a chance these might eventually be settable in unprivileged containers), but still it seems better not to let userspace panic the kernel.
Simpler seems to be to allow setting the parameters to whatever you want but interpret xprt_min_resvport > xprt_max_resvport as the empty range.
--- net/sunrpc/xprtsock.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-)
net/sunrpc/xprtsock.c +18 -16
@@ -129,7 +129,7 @@ static struct ctl_table xs_tunables_table[] = { .mode = 0644, .proc_handler = proc_dointvec_minmax, .extra1 = &xprt_min_resvport_limit, - .extra2 = &xprt_max_resvport + .extra2 = &xprt_max_resvport_limit }, { .procname = "max_resvport",
@@ -137,7 +137,7 @@ static struct ctl_table xs_tunables_table[] = { .maxlen = sizeof(unsigned int), .mode = 0644, .proc_handler = proc_dointvec_minmax, - .extra1 = &xprt_min_resvport, + .extra1 = &xprt_min_resvport_limit, .extra2 = &xprt_max_resvport_limit }, {
@@ -1776,11 +1776,17 @@ static void xs_udp_timer(struct rpc_xprt *xprt, struct rpc_task *task)spin_unlock_bh (&xprt->transport_lock); } -static unsigned short xs_get_random_port (void ) +static int xs_get_random_port (void ) { -unsigned short range = xprt_max_resvport - xprt_min_resvport +1 ; -unsigned short rand = (unsigned short )prandom_u32 () % range; -return rand + xprt_min_resvport; +unsigned short min = xprt_min_resvport, max = xprt_max_resvport; +unsigned short range; +unsigned short rand; + +if (max < min) +return -EADDRINUSE ; + range = max - min +1 ; + rand = (unsigned short )prandom_u32 () % range; +return rand + min; }/**
@@ -1836,9 +1842,9 @@ static void xs_set_srcport(struct sock_xprt *transport, struct socket *sock) transport->srcport =xs_sock_getport (sock); } -static unsigned short xs_get_srcport (struct sock_xprt *transport) +static int xs_get_srcport (struct sock_xprt *transport) { -unsigned short port = transport->srcport; +int port = transport->srcport;if (port ==0 && transport->xprt.resvport) port =xs_get_random_port ();
@@ -1859,7 +1865,7 @@ static int xs_bind(struct sock_xprt *transport, struct socket *sock) {struct sockaddr_storage myaddr;int err, nloop =0 ; -unsigned short port =xs_get_srcport (transport); +int port =xs_get_srcport (transport);unsigned short last;/*
@@ -1877,8 +1883,8 @@ static int xs_bind(struct sock_xprt *transport, struct socket *sock)* transport->xprt.resvport == 1) xs_get_srcport above will * ensure that port is non-zero and we will bind as needed. */ -if (port ==0 ) -return 0 ; +if (port <=0 ) +return port;memcpy (&myaddr, &transport->srcaddr, transport->xprt.addrlen); do {
@@ -3319,12 +3325,8 @@ static int param_set_uint_minmax(const char *val,static int param_set_portnr (const char *val,const struct kernel_param *kp) { -if (kp->arg == &xprt_min_resvport) -return param_set_uint_minmax (val, kp, -RPC_MIN_RESVPORT , - xprt_max_resvport);return param_set_uint_minmax (val, kp, - xprt_min_resvport, +RPC_MIN_RESVPORT ,RPC_MAX_RESVPORT ); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 103/306 atm: zatm: Fix empty body Clang warnings
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit 64b9d16e2d02ca6e5dc8fcd30cfd52b0ecaaa8f4 ]
Clang warns:
drivers/atm/zatm.c:513:7: error: while loop has empty body [-Werror,-Wempty-body]
zwait;
^drivers/atm/zatm.c:513:7: note: put the semicolon on a separate line to silence this warning
Get rid of this warning by using an empty do-while loop. While we're at it, add parentheses to make it clear that this is a function-like macro.
--- drivers/atm/zatm.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-)
drivers/atm/zatm.c +21 -21
@@ -126,7 +126,7 @@ static unsigned long dummy[2] = {0,0};#define zin_n (r) inl(zatm_dev->base+r*4)#define zin (r) inl(zatm_dev->base+uPD98401_##r*4)#define zout (v,r) outl(v,zatm_dev->base+uPD98401_##r*4) -#define zwait while (zin(CMR) & uPD98401_BUSY) +#define zwait () do {} while (zin(CMR) & uPD98401_BUSY)/* RX0, RX1, TX0, TX1 */ static const int mbx_entries[NR_MBX ] = {1024 ,1024 ,1024 ,1024 };
@@ -140,7 +140,7 @@ static const int mbx_esize[NR_MBX] = { 16,16,4,4 }; /* entry size in bytes */static void zpokel (struct zatm_dev *zatm_dev,u32 value,u32 addr) { - zwait; +zwait ();zout (value,CER );zout (uPD98401_IND_ACC | uPD98401_IA_BALL | (uPD98401_IA_TGT_CM << uPD98401_IA_TGT_SHIFT) | addr,CMR );
@@ -149,10 +149,10 @@ static void zpokel(struct zatm_dev *zatm_dev,u32 value,u32 addr)static u32 zpeekl (struct zatm_dev *zatm_dev,u32 addr) { - zwait; +zwait ();zout (uPD98401_IND_ACC | uPD98401_IA_BALL | uPD98401_IA_RW | (uPD98401_IA_TGT_CM << uPD98401_IA_TGT_SHIFT) | addr,CMR ); - zwait; +zwait ();return zin (CER ); }
@@ -241,7 +241,7 @@ static void refill_pool(struct atm_dev *dev,int pool) }if (first) {spin_lock_irqsave (&zatm_dev->lock, flags); - zwait; +zwait ();zout (virt_to_bus (first),CER );zout (uPD98401_ADD_BAT | (pool << uPD98401_POOL_SHIFT) | count,CMR );
@@ -508,9 +508,9 @@ static int open_rx_first(struct atm_vcc *vcc) }if (zatm_vcc->pool <0 )return -EMSGSIZE ;spin_lock_irqsave (&zatm_dev->lock, flags); - zwait; +zwait ();zout (uPD98401_OPEN_CHAN,CMR ); - zwait; +zwait ();DPRINTK ("0x%x 0x%x\n" ,zin (CMR ),zin (CER )); chan = (zin (CMR ) & uPD98401_CHAN_ADDR) >> uPD98401_CHAN_ADDR_SHIFT;spin_unlock_irqrestore (&zatm_dev->lock, flags);
@@ -571,21 +571,21 @@ static void close_rx(struct atm_vcc *vcc) pos = vcc->vci >>1 ; shift = (1 -(vcc->vci &1 )) <<4 ;zpokel (zatm_dev,zpeekl (zatm_dev,pos) & ~(0xffff << shift),pos); - zwait; +zwait ();zout (uPD98401_NOP,CMR ); - zwait; +zwait ();zout (uPD98401_NOP,CMR );spin_unlock_irqrestore (&zatm_dev->lock, flags); }spin_lock_irqsave (&zatm_dev->lock, flags); - zwait; +zwait ();zout (uPD98401_DEACT_CHAN | uPD98401_CHAN_RT | (zatm_vcc->rx_chan << uPD98401_CHAN_ADDR_SHIFT),CMR ); - zwait; +zwait ();udelay (10 );/* why oh why ... ? */ zout (uPD98401_CLOSE_CHAN | uPD98401_CHAN_RT | (zatm_vcc->rx_chan << uPD98401_CHAN_ADDR_SHIFT),CMR ); - zwait; +zwait ();if (!(zin (CMR ) & uPD98401_CHAN_ADDR)) printk(KERN_CRIT DEV_LABEL "(itf %d): can't close RX channel ""%d\n" ,vcc->dev->number,zatm_vcc->rx_chan);
@@ -699,7 +699,7 @@ printk("NONONONOO!!!!\n");skb_queue_tail (&zatm_vcc->tx_queue,skb);DPRINTK ("QRP=0x%08lx\n" ,zpeekl (zatm_dev,zatm_vcc->tx_chan*VC_SIZE /4 + uPD98401_TXVC_QRP)); - zwait; +zwait ();zout (uPD98401_TX_READY | (zatm_vcc->tx_chan << uPD98401_CHAN_ADDR_SHIFT),CMR );spin_unlock_irqrestore (&zatm_dev->lock, flags);
@@ -891,12 +891,12 @@ static void close_tx(struct atm_vcc *vcc) }spin_lock_irqsave (&zatm_dev->lock, flags);#if 0 - zwait; +zwait ();zout (uPD98401_DEACT_CHAN | (chan << uPD98401_CHAN_ADDR_SHIFT),CMR );#endif - zwait; +zwait ();zout (uPD98401_CLOSE_CHAN | (chan << uPD98401_CHAN_ADDR_SHIFT),CMR ); - zwait; +zwait ();if (!(zin (CMR ) & uPD98401_CHAN_ADDR)) printk(KERN_CRIT DEV_LABEL "(itf %d): can't close TX channel ""%d\n" ,vcc->dev->number,chan);
@@ -926,9 +926,9 @@ static int open_tx_first(struct atm_vcc *vcc) zatm_vcc->tx_chan =0 ;if (vcc->qos.txtp.traffic_class ==ATM_NONE )return 0 ;spin_lock_irqsave (&zatm_dev->lock, flags); - zwait; +zwait ();zout (uPD98401_OPEN_CHAN,CMR ); - zwait; +zwait ();DPRINTK ("0x%x 0x%x\n" ,zin (CMR ),zin (CER )); chan = (zin (CMR ) & uPD98401_CHAN_ADDR) >> uPD98401_CHAN_ADDR_SHIFT;spin_unlock_irqrestore (&zatm_dev->lock, flags);
@@ -1557,7 +1557,7 @@ static void zatm_phy_put(struct atm_dev *dev,unsigned char value,struct zatm_dev *zatm_dev; zatm_dev =ZATM_DEV (dev); - zwait; +zwait ();zout (value,CER );zout (uPD98401_IND_ACC | uPD98401_IA_B0 | (uPD98401_IA_TGT_PHY << uPD98401_IA_TGT_SHIFT) | addr,CMR );
@@ -1569,10 +1569,10 @@ static unsigned char zatm_phy_get(struct atm_dev *dev,unsigned long addr)struct zatm_dev *zatm_dev; zatm_dev =ZATM_DEV (dev); - zwait; +zwait ();zout (uPD98401_IND_ACC | uPD98401_IA_B0 | uPD98401_IA_RW | (uPD98401_IA_TGT_PHY << uPD98401_IA_TGT_SHIFT) | addr,CMR ); - zwait; +zwait ();return zin (CER ) &0xff ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 105/306 swiotlb: do not panic on mapping failures
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
[ Upstream commit 8088546832aa2c0d8f99dd56edf6384f8a9b63b3 ]
All properly written drivers now have error handling in the dma_map_single / dma_map_page callers. As swiotlb_tbl_map_single already prints a useful warning when running out of swiotlb pool space we can also remove swiotlb_full entirely as it serves no purpose now.
--- kernel/dma/swiotlb.c | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-)
kernel/dma/swiotlb.c +1 -32
@@ -761,34 +761,6 @@ static bool swiotlb_free_buffer(struct device *dev, size_t size,return true; } -static void -swiotlb_full (struct device *dev,size_t size,enum dma_data_direction dir, -int do_panic) -{ -if (swiotlb_force ==SWIOTLB_NO_FORCE ) -return ; - -/* -* Ran out of IOMMU space for this operation. This is very bad. -* Unfortunately the drivers cannot handle this operation properly. -* unless they check for dma_mapping_error (most don't) -* When the mapping is small enough return a static buffer to limit -* the damage, or panic when the transfer is too big. -*/ -dev_err_ratelimited (dev,"DMA: Out of SW-IOMMU space for %zu bytes\n" , - size); - -if (size <= io_tlb_overflow || !do_panic) -return ; - -if (dir ==DMA_BIDIRECTIONAL ) -panic ("DMA: Random memory could be DMA accessed\n" ); -if (dir ==DMA_FROM_DEVICE ) -panic ("DMA: Random memory could be DMA written\n" ); -if (dir ==DMA_TO_DEVICE ) -panic ("DMA: Random memory could be DMA read\n" ); -} -/* * Map a single buffer of the indicated size for DMA in streaming mode. The * physical address to use is returned.
@@ -817,10 +789,8 @@ dma_addr_t swiotlb_map_page(struct device *dev, struct page *page,/* Oh well, have to allocate and map a bounce buffer. */ map =map_single (dev, phys, size, dir, attrs); -if (map ==SWIOTLB_MAP_ERROR ) { -swiotlb_full (dev, size, dir,1 ); +if (map ==SWIOTLB_MAP_ERROR )return __phys_to_dma (dev, io_tlb_overflow_buffer); - } dev_addr =__phys_to_dma (dev, map);
@@ -954,7 +924,6 @@ swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, int nelems,if (map ==SWIOTLB_MAP_ERROR ) {/* Don't panic here, we expect map_sg users to do proper error handling. */ -swiotlb_full (hwdev, sg->length, dir,0 ); attrs |=DMA_ATTR_SKIP_CPU_SYNC ;swiotlb_unmap_sg_attrs (hwdev, sgl, i, dir, attrs);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 96/306 USB: misc: appledisplay: fix backlight update_status return code
In reply to Greg Kroah-HartmanFrom: Mattias Jacobsson <[email protected]>
[ Upstream commit 090158555ff8d194a98616034100b16697dd80d0 ]
Upon success the update_status handler returns a positive number corresponding to the number of bytes transferred by usb_control_msg. However the return code of the update_status handler should indicate if an error occurred(negative) or how many bytes of the user's input to sysfs that was consumed. Return code zero indicates all bytes were consumed.
The bug can for example result in the update_status handler being called twice, the second time with only the "unconsumed" part of the user's input to sysfs. Effectively setting an incorrect brightness.
Change the update_status handler to return zero for all successful transactions and forward usb_control_msg's error code upon failure.
--- drivers/usb/misc/appledisplay.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/usb/misc/appledisplay.c +5 -2
@@ -148,8 +148,11 @@ static int appledisplay_bl_update_status(struct backlight_device *bd) pdata->msgdata,2 , ACD_USB_TIMEOUT);mutex_unlock (&pdata->sysfslock); - -return retval; + +if (retval <0 ) +return retval; +else +return 0 ; }static int appledisplay_bl_get_brightness (struct backlight_device *bd)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 143/306 bpf, btf: fix a missing check bug in btf_parse
In reply to Greg Kroah-HartmanFrom: Martin Lau <[email protected]>
[ Upstream commit 4a6998aff82a20a1aece86a186d8e5263f8b2315 ]
Wenwen Wang reported:
In btf_parse(), the header of the user-space btf data 'btf_data' is firstly parsed and verified through btf_parse_hdr(). In btf_parse_hdr(), the header is copied from user-space 'btf_data' to kernel-space 'btf->hdr' and then verified. If no error happens during the verification process, the whole data of 'btf_data', including the header, is then copied to 'data' in btf_parse(). It is obvious that the header is copied twice here. More importantly, no check is enforced after the second copy to make sure the headers obtained in these two copies are same. Given that 'btf_data' resides in the user space, a malicious user can race to modify the header between these two copies. By doing so, the user can inject inconsistent data, which can cause undefined behavior of the kernel and introduce potential security risk.
This issue is similar to the one fixed in commit 8af03d1ae2e1 ("bpf:
btf: Fix a missing check bug"). To fix it, this patch copies the user 'btf_data' *before* parsing / verifying the BTF header.
--- kernel/bpf/btf.c | 55 ++++++++++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 30 deletions(-)
kernel/bpf/btf.c +25 -30
@@ -2067,50 +2067,44 @@ static int btf_check_sec_info(struct btf_verifier_env *env,return 0 ; } -static int btf_parse_hdr (struct btf_verifier_env *env,void __user *btf_data, -u32 btf_data_size) +static int btf_parse_hdr (struct btf_verifier_env *env) { +u32 hdr_len, hdr_copy, btf_data_size;const struct btf_header *hdr; -u32 hdr_len, hdr_copy; -/* -* Minimal part of the "struct btf_header" that -* contains the hdr_len. -*/ -struct btf_min_header { -u16 magic; -u8 version; -u8 flags; -u32 hdr_len; - }__user *min_hdr;struct btf *btf;int err; btf = env->btf; - min_hdr = btf_data; + btf_data_size = btf->data_size; -if (btf_data_size <sizeof (*min_hdr)) { +if (btf_data_size < + offsetof(struct btf_header , hdr_len) +sizeof (hdr->hdr_len)) {btf_verifier_log (env,"hdr_len not found" );return -EINVAL ; } -if (get_user (hdr_len, &min_hdr->hdr_len)) -return -EFAULT ; - + hdr = btf->data; + hdr_len = hdr->hdr_len;if (btf_data_size < hdr_len) {btf_verifier_log (env,"btf_header not found" );return -EINVAL ; } - err =bpf_check_uarg_tail_zero (btf_data,sizeof (btf->hdr), hdr_len); -if (err) { -if (err == -E2BIG ) -btf_verifier_log (env,"Unsupported btf_header" ); -return err; +/* Ensure the unsupported header fields are zero */ +if (hdr_len >sizeof (btf->hdr)) { +u8 *expected_zero = btf->data +sizeof (btf->hdr); +u8 *end = btf->data + hdr_len; + +for (; expected_zero < end; expected_zero++) { +if (*expected_zero) { +btf_verifier_log (env,"Unsupported btf_header" ); +return -E2BIG ; + } + } } hdr_copy =min_t (u32, hdr_len,sizeof (btf->hdr)); -if (copy_from_user (&btf->hdr, btf_data, hdr_copy)) -return -EFAULT ; +memcpy (&btf->hdr, btf->data, hdr_copy); hdr = &btf->hdr;
@@ -2186,10 +2180,6 @@ static struct btf *btf_parse(void __user *btf_data, u32 btf_data_size, } env->btf = btf; - err =btf_parse_hdr (env, btf_data, btf_data_size); -if (err) - goto errout; - data =kvmalloc (btf_data_size,GFP_KERNEL | __GFP_NOWARN);if (!data) { err = -ENOMEM ;
@@ -2198,13 +2188,18 @@ static struct btf *btf_parse(void __user *btf_data, u32 btf_data_size, btf->data = data; btf->data_size = btf_data_size; - btf->nohdr_data = btf->data + btf->hdr.hdr_len;if (copy_from_user (data, btf_data, btf_data_size)) { err = -EFAULT ; goto errout; } + err =btf_parse_hdr (env); +if (err) + goto errout; + + btf->nohdr_data = btf->data + btf->hdr.hdr_len; + err =btf_parse_str_sec (env);if (err) goto errout;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 152/306 macsec: let the administrator set UP state even if lowerdev is down
In reply to Greg Kroah-HartmanFrom: Sabrina Dubroca <[email protected]>
[ Upstream commit 07bddef9839378bd6f95b393cf24c420529b4ef1 ]
Currently, the kernel doesn't let the administrator set a macsec device up unless its lower device is currently up. This is inconsistent, as a macsec device that is up won't automatically go down when its lower device goes down.
Now that linkstate propagation works, there's really no reason for this limitation, so let's remove it.
--- drivers/net/macsec.c | 3 --- 1 file changed, 3 deletions(-)
drivers/net/macsec.c +0 -3
@@ -2813,9 +2813,6 @@ static int macsec_dev_open(struct net_device *dev)struct net_device *real_dev = macsec->real_dev;int err; -if (!(real_dev->flags &IFF_UP )) -return -ENETDOWN ; - err =dev_uc_add (real_dev, dev->dev_addr);if (err <0 )return err;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 153/306 block: fix the DISCARD request merge
In reply to Greg Kroah-HartmanFrom: Jianchao Wang <[email protected]>
[ Upstream commit 69840466086d2248898020a08dda52732686c4e6 ]
There are two cases when handle DISCARD merge.
If max_discard_segments == 1, the bios/requests need to be contiguous to merge. If max_discard_segments > 1, it takes every bio as a range and different range needn't to be contiguous.
But now, attempt_merge screws this up. It always consider contiguity for DISCARD for the case max_discard_segments > 1 and cannot merge contiguous DISCARD for the case max_discard_segments == 1, because rq_attempt_discard_merge always returns false in this case. This patch fixes both of the two cases above.
--- block/blk-merge.c | 46 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 10 deletions(-)
block/blk-merge.c +36 -10
@@ -669,6 +669,31 @@ static void blk_account_io_merge(struct request *req)part_stat_unlock (); } } +/* +* Two cases of handling DISCARD merge: +* If max_discard_segments > 1, the driver takes every bio +* as a range and send them to controller together. The ranges +* needn't to be contiguous. +* Otherwise, the bios/requests will be handled as same as +* others which should be contiguous. +*/ +static inline bool blk_discard_mergable (struct request *req) +{ +if (req_op (req) ==REQ_OP_DISCARD && +queue_max_discard_segments (req->q) >1 ) +return true; +return false; +} + +enum elv_merge blk_try_req_merge (struct request *req,struct request *next) +{ +if (blk_discard_mergable (req)) +return ELEVATOR_DISCARD_MERGE ; +else if (blk_rq_pos (req) +blk_rq_sectors (req) ==blk_rq_pos (next)) +return ELEVATOR_BACK_MERGE ; + +return ELEVATOR_NO_MERGE ; +}/* * For non-mq, this has to be called with the request spinlock acquired.
@@ -686,12 +711,6 @@ static struct request *attempt_merge(struct request_queue *q,if (req_op (req) !=req_op (next))return NULL ; -/* -* not contiguous -*/ -if (blk_rq_pos (req) +blk_rq_sectors (req) !=blk_rq_pos (next)) -return NULL ; -if (rq_data_dir (req) !=rq_data_dir (next) || req->rq_disk != next->rq_disk ||req_no_special_merge (next))
@@ -715,11 +734,19 @@ static struct request *attempt_merge(struct request_queue *q,* counts here. Handle DISCARDs separately, as they * have separate settings. */ -if (req_op (req) ==REQ_OP_DISCARD ) { + +switch (blk_try_req_merge (req, next)) { +case ELEVATOR_DISCARD_MERGE :if (!req_attempt_discard_merge (q, req, next))return NULL ; - }else if (!ll_merge_requests_fn (q, req, next)) +break ; +case ELEVATOR_BACK_MERGE : +if (!ll_merge_requests_fn (q, req, next)) +return NULL ; +break ; +default :return NULL ; + }/* * If failfast settings disagree or any of the two is already
@@ -843,8 +870,7 @@ bool blk_rq_merge_ok(struct request *rq, struct bio *bio)enum elv_merge blk_try_merge (struct request *rq,struct bio *bio) { -if (req_op (rq) ==REQ_OP_DISCARD && -queue_max_discard_segments (rq->q) >1 ) +if (blk_discard_mergable (rq))return ELEVATOR_DISCARD_MERGE ;else if (blk_rq_pos (rq) +blk_rq_sectors (rq) == bio->bi_iter.bi_sector)return ELEVATOR_BACK_MERGE ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 155/306 i2c: uniphier-f: fix occasional timeout error
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
[ Upstream commit 39226aaa85f002d695e3cafade3309e12ffdaecd ]
Currently, a timeout error could happen at a repeated START condition.
For a (non-repeated) START condition, the controller starts sending data when the UNIPHIER_FI2C_CR_STA bit is set. However, for a repeated START condition, the hardware starts running when the slave address is written to the TX FIFO - the write to the UNIPHIER_FI2C_CR register is actually unneeded.
Because the hardware is already running before the IRQ is enabled for a repeated START, the driver may miss the IRQ event. In most cases, this problem does not show up since modern CPUs are much faster than the I2C transfer. However, it is still possible that a context switch happens after the controller starts, but before the IRQ register is set up.
To fix this,
- Do not write UNIPHIER_FI2C_CR for repeated START conditions.
- Enable IRQ *before* writing the slave address to the TX FIFO.
- Disable IRQ for the current CPU while queuing up the TX FIFO; If the CPU is interrupted by some task, the interrupt handler might be invoked due to the empty TX FIFO before completing the setup.
--- drivers/i2c/busses/i2c-uniphier-f.c | 33 ++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 8 deletions(-)
drivers/i2c/busses/i2c-uniphier-f.c +25 -8
@@ -260,6 +260,8 @@ static irqreturn_t uniphier_fi2c_interrupt(int irq, void *dev_id)static void uniphier_fi2c_tx_init (struct uniphier_fi2c_priv *priv,u16 addr) { priv->enabled_irqs |=UNIPHIER_FI2C_INT_TE ; +uniphier_fi2c_set_irqs (priv); +/* do not use TX byte counter */ writel (0 , priv->membase +UNIPHIER_FI2C_TBC );/* set slave address */
@@ -292,6 +294,8 @@ static void uniphier_fi2c_rx_init(struct uniphier_fi2c_priv *priv, u16 addr) priv->enabled_irqs |=UNIPHIER_FI2C_INT_RF ; } +uniphier_fi2c_set_irqs (priv); +/* set slave address with RD bit */ writel (UNIPHIER_FI2C_DTTX_CMD |UNIPHIER_FI2C_DTTX_RD | addr <<1 , priv->membase +UNIPHIER_FI2C_DTTX );
@@ -315,14 +319,16 @@ static void uniphier_fi2c_recover(struct uniphier_fi2c_priv *priv) }static int uniphier_fi2c_master_xfer_one (struct i2c_adapter *adap, -struct i2c_msg *msg,bool stop) +struct i2c_msg *msg,bool repeat, +bool stop) {struct uniphier_fi2c_priv *priv =i2c_get_adapdata (adap);bool is_read = msg->flags &I2C_M_RD ;unsigned long time_left, flags; -dev_dbg (&adap->dev,"%s: addr=0x%02x, len=%d, stop=%d\n" , - is_read ?"receive" :"transmit" , msg->addr, msg->len, stop); +dev_dbg (&adap->dev,"%s: addr=0x%02x, len=%d, repeat=%d, stop=%d\n" , + is_read ?"receive" :"transmit" , msg->addr, msg->len, + repeat, stop); priv->len = msg->len; priv->buf = msg->buf;
@@ -338,16 +344,24 @@ static int uniphier_fi2c_master_xfer_one(struct i2c_adapter *adap,writel (UNIPHIER_FI2C_RST_TBRST |UNIPHIER_FI2C_RST_RBRST , priv->membase +UNIPHIER_FI2C_RST );/* reset TX/RX FIFO */ +spin_lock_irqsave (&priv->lock, flags); +if (is_read)uniphier_fi2c_rx_init (priv, msg->addr);else uniphier_fi2c_tx_init (priv, msg->addr); -uniphier_fi2c_set_irqs (priv); -dev_dbg (&adap->dev,"start condition\n" ); -writel (UNIPHIER_FI2C_CR_MST |UNIPHIER_FI2C_CR_STA , - priv->membase +UNIPHIER_FI2C_CR ); +/* +* For a repeated START condition, writing a slave address to the FIFO +* kicks the controller. So, the UNIPHIER_FI2C_CR register should be +* written only for a non-repeated START condition. +*/ +if (!repeat) +writel (UNIPHIER_FI2C_CR_MST |UNIPHIER_FI2C_CR_STA , + priv->membase +UNIPHIER_FI2C_CR ); + +spin_unlock_irqrestore (&priv->lock, flags); time_left =wait_for_completion_timeout (&priv->comp, adap->timeout);
@@ -408,6 +422,7 @@ static int uniphier_fi2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) {struct i2c_msg *msg, *emsg = msgs + num; +bool repeat = false;int ret; ret =uniphier_fi2c_check_bus_busy (adap);
@@ -418,9 +433,11 @@ static int uniphier_fi2c_master_xfer(struct i2c_adapter *adap,/* Emit STOP if it is the last message or I2C_M_STOP is set. */ bool stop = (msg +1 == emsg) || (msg->flags &I2C_M_STOP ); - ret =uniphier_fi2c_master_xfer_one (adap, msg, stop); + ret =uniphier_fi2c_master_xfer_one (adap, msg, repeat, stop);if (ret)return ret; + + repeat = !stop; }return num;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 154/306 i2c: uniphier-f: make driver robust against concurrency
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
[ Upstream commit f1fdcbbdf45d9609f3d4063b67e9ea941ba3a58f ]
This is unlikely to happen, but it is possible for a CPU to enter the interrupt handler just after wait_for_completion_timeout() has expired. If this happens, the hardware is accessed from multiple contexts concurrently.
Disable the IRQ after wait_for_completion_timeout(), and do nothing from the handler when the IRQ is disabled.
--- drivers/i2c/busses/i2c-uniphier-f.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-uniphier-f.c +16 -1
@@ -98,6 +98,7 @@ struct uniphier_fi2c_priv {unsigned int flags;unsigned int busy_cnt;unsigned int clk_cycle; +spinlock_t lock;/* IRQ synchronization */ }; static void uniphier_fi2c_fill_txfifo(struct uniphier_fi2c_priv *priv,
@@ -162,7 +163,10 @@ static irqreturn_t uniphier_fi2c_interrupt(int irq, void *dev_id)struct uniphier_fi2c_priv *priv = dev_id;u32 irq_status; +spin_lock (&priv->lock); + irq_status =readl (priv->membase +UNIPHIER_FI2C_INT ); + irq_status &= priv->enabled_irqs; dev_dbg(&priv->adap.dev, "interrupt: enabled_irqs=%04x, irq_status=%04x\n",
@@ -230,6 +234,8 @@ static irqreturn_t uniphier_fi2c_interrupt(int irq, void *dev_id) goto handled; } +spin_unlock (&priv->lock); +return IRQ_NONE ; data_done:
@@ -246,6 +252,8 @@ static irqreturn_t uniphier_fi2c_interrupt(int irq, void *dev_id) handled:uniphier_fi2c_clear_irqs (priv); +spin_unlock (&priv->lock); +return IRQ_HANDLED ; }
@@ -311,7 +319,7 @@ static int uniphier_fi2c_master_xfer_one(struct i2c_adapter *adap, {struct uniphier_fi2c_priv *priv =i2c_get_adapdata (adap);bool is_read = msg->flags &I2C_M_RD ; -unsigned long time_left; +unsigned long time_left, flags;dev_dbg (&adap->dev,"%s: addr=0x%02x, len=%d, stop=%d\n" , is_read ?"receive" :"transmit" , msg->addr, msg->len, stop);
@@ -342,6 +350,12 @@ static int uniphier_fi2c_master_xfer_one(struct i2c_adapter *adap, priv->membase + UNIPHIER_FI2C_CR); time_left =wait_for_completion_timeout (&priv->comp, adap->timeout); + +spin_lock_irqsave (&priv->lock, flags); + priv->enabled_irqs =0 ; +uniphier_fi2c_set_irqs (priv); +spin_unlock_irqrestore (&priv->lock, flags); +if (!time_left) {dev_err (&adap->dev,"transaction timeout.\n" );uniphier_fi2c_recover (priv);
@@ -546,6 +560,7 @@ static int uniphier_fi2c_probe(struct platform_device *pdev) priv->clk_cycle = clk_rate / bus_speed;init_completion (&priv->comp); +spin_lock_init (&priv->lock); priv->adap.owner =THIS_MODULE ; priv->adap.algo = &uniphier_fi2c_algo; priv->adap.dev.parent = dev;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 157/306 um: Make line/tty semantics use true write IRQ
In reply to Greg Kroah-HartmanFrom: Anton Ivanov <[email protected]>
[ Upstream commit 917e2fd2c53eb3c4162f5397555cbd394390d4bc ]
This fixes a long standing bug where large amounts of output could freeze the tty (most commonly seen on stdio console). While the bug has always been there it became more pronounced after moving to the new interrupt controller.
The line semantics are now changed to have true IRQ write semantics which should further improve the tty/line subsystem stability and performance
--- arch/um/drivers/line.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/um/drivers/line.c +2 -2
@@ -261,7 +261,7 @@ static irqreturn_t line_write_interrupt(int irq, void *data)if (err ==0 ) {spin_unlock (&line->lock);return IRQ_NONE ; - }else if (err <0 ) { + }else if ((err <0 ) && (err != -EAGAIN )) { line->head = line->buffer; line->tail = line->buffer; }
@@ -284,7 +284,7 @@ int line_setup_irq(int fd, int input, int output, struct line *line, void *data)if (err)return err;if (output) - err =um_request_irq (driver->write_irq, fd,IRQ_NONE , + err =um_request_irq (driver->write_irq, fd,IRQ_WRITE , line_write_interrupt,IRQF_SHARED , driver->write_irq_name, data);return err;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 158/306 vfs: avoid problematic remapping requests into partial EOF block
In reply to Greg Kroah-HartmanFrom: Darrick J. Wong <[email protected]>
[ Upstream commit 07d19dc9fbe9128378b9e226abe886fd8fd473df ]
A deduplication data corruption is exposed in XFS and btrfs. It is caused by extending the block match range to include the partial EOF block, but then allowing unknown data beyond EOF to be considered a "match" to data in the destination file because the comparison is only made to the end of the source file. This corrupts the destination file when the source extent is shared with it.
The VFS remapping prep functions only support whole block dedupe, but we still need to appear to support whole file dedupe correctly. Hence if the dedupe request includes the last block of the souce file, don't include it in the actual dedupe operation. If the rest of the range dedupes successfully, then reject the entire request. A subsequent patch will enable us to shorten dedupe requests correctly.
When reflinking sub-file ranges, a data corruption can occur when the source file range includes a partial EOF block. This shares the unknown data beyond EOF into the second file at a position inside EOF, exposing stale data in the second file.
If the reflink request includes the last block of the souce file, only proceed with the reflink operation if it lands at or past the destination file's current EOF. If it lands within the destination file EOF, reject the entire request with -EINVAL and make the caller go the hard way. A subsequent patch will enable us to shorten reflink requests correctly.
--- fs/read_write.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
fs/read_write.c +33 -0
@@ -1715,6 +1715,34 @@ static int clone_verify_area(struct file *file, loff_t pos, u64 len, bool write)return security_file_permission (file, write ?MAY_WRITE :MAY_READ ); } +/* +* Ensure that we don't remap a partial EOF block in the middle of something +* else. Assume that the offsets have already been checked for block +* alignment. +* +* For deduplication we always scale down to the previous block because we +* can't meaningfully compare post-EOF contents. +* +* For clone we only link a partial EOF block above the destination file's EOF. +*/ +static int generic_remap_check_len (struct inode *inode_in, +struct inode *inode_out, +loff_t pos_out, +u64 *len, +bool is_dedupe) +{ +u64 blkmask =i_blocksize (inode_in) -1 ; + +if ((*len & blkmask) ==0 ) +return 0 ; + +if (is_dedupe) + *len &= ~blkmask; +else if (pos_out + *len <i_size_read (inode_out)) +return -EINVAL ; + +return 0 ; +}/* * Check that the two inodes are eligible for cloning, the ranges make
@@ -1821,6 +1849,11 @@ int vfs_clone_file_prep_inodes(struct inode *inode_in, loff_t pos_in,return -EBADE ; } + ret =generic_remap_check_len (inode_in, inode_out, pos_out, len, + is_dedupe); +if (ret) +return ret; +return 1 ; }EXPORT_SYMBOL (vfs_clone_file_prep_inodes);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 160/306 powerpc/xmon: Relax frame size for clang
In reply to Greg Kroah-HartmanFrom: Joel Stanley <[email protected]>
[ Upstream commit 9c87156cce5a63735d1218f0096a65c50a7a32aa ]
When building with clang (8 trunk, 7.0 release) the frame size limit is hit:
arch/powerpc/xmon/xmon.c:452:12: warning: stack frame size of 2576 bytes in function 'xmon_core' [-Wframe-larger-than=]
Some investigation by Naveen indicates this is due to clang saving the addresses to printf format strings on the stack.
While this issue is investigated, bump up the frame size limit for xmon when building with clang.
--- arch/powerpc/xmon/Makefile | 6 ++++++ 1 file changed, 6 insertions(+)
arch/powerpc/xmon/Makefile +6 -0
@@ -13,6 +13,12 @@ UBSAN_SANITIZE := n ORIG_CFLAGS := $(KBUILD_CFLAGS) KBUILD_CFLAGS = $(subst $(CC_FLAGS_FTRACE),,$(ORIG_CFLAGS)) +ifdef CONFIG_CC_IS_CLANG +# clang stores addresses on the stack causing the frame size to blow +# out. See https://github.com/ClangBuiltLinux/linux/issues/252 +KBUILD_CFLAGS += -Wframe-larger-than=4096 +endif + ccflags-$(CONFIG_PPC64) := $(NO_MINIMAL_TOC) obj-y += xmon.o nonstdio.o spr_access.o
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 144/306 powerpc/process: Fix flush_all_to_thread for SPE
In reply to Greg Kroah-HartmanFrom: Felipe Rechia <[email protected]>
[ Upstream commit e901378578c62202594cba0f6c076f3df365ec91 ]
Fix a bug introduced by the creation of flush_all_to_thread() for processors that have SPE (Signal Processing Engine) and use it to compute floating-point operations.
Quoted 1 line
From userspace perspective, the problem was seen in attempts of
computing floating-point operations which should generate exceptions. For example:
fork(); float x = 0.0 / 0.0; isnan(x); // forked process returns False (should be True)
The operation above also should always cause the SPEFSCR FINV bit to be set. However, the SPE floating-point exceptions were turned off after a fork().
Kernel versions prior to the bug used flush_spe_to_thread(), which first saves SPEFSCR register values in tsk->thread and then calls giveup_spe(tsk).
After commit 579e633e764e, the save_all() function was called first to giveup_spe(), and then the SPEFSCR register values were saved in tsk->thread. This would save the SPEFSCR register values after disabling SPE for that thread, causing the bug described above.
Fixes 579e633e764e ("powerpc: create flush_all_to_thread()")
--- arch/powerpc/kernel/process.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/powerpc/kernel/process.c +1 -2
@@ -575,12 +575,11 @@ void flush_all_to_thread(struct task_struct *tsk)if (tsk->thread.regs) {preempt_disable ();BUG_ON (tsk != current); -save_all (tsk); -#ifdef CONFIG_SPE if (tsk->thread.regs->msr &MSR_SPE ) tsk->thread.spefscr =mfspr (SPRN_SPEFSCR );#endif +save_all (tsk);preempt_enable (); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 162/306 selftests/powerpc/signal: Fix out-of-tree build
In reply to Greg Kroah-HartmanFrom: Joel Stanley <[email protected]>
[ Upstream commit 27825349d7b238533a47e3d98b8bb0efd886b752 ]
We should use TEST_GEN_PROGS, not TEST_PROGS. That tells the selftests makefile (lib.mk) that those tests are generated (built), and so it adds the $(OUTPUT) prefix for us, making the out-of-tree build work correctly.
It also means we don't need our own clean rule, lib.mk does it.
We also have to update the signal_tm rule to use $(OUTPUT).
--- tools/testing/selftests/powerpc/signal/Makefile | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
tools/testing/selftests/powerpc/signal/Makefile +3 -8
@@ -1,15 +1,10 @@ # SPDX-License-Identifier: GPL-2.0 -TEST_PROGS := signal signal_tm - -all: $(TEST_PROGS) - -$(TEST_PROGS): ../harness.c ../utils.c signal.S +TEST_GEN_PROGS := signal signal_tm CFLAGS += -maltivec -signal_tm: CFLAGS += -mhtm +$(OUTPUT)/signal_tm: CFLAGS += -mhtm top_srcdir = ../../../../.. include ../../lib.mk -clean: - rm -f $(TEST_PROGS) *.o +$(TEST_GEN_PROGS): ../harness.c ../utils.c signal.S
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 163/306 selftests/powerpc/switch_endian: Fix out-of-tree build
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
[ Upstream commit 266bac361d5677e61a6815bd29abeb3bdced2b07 ]
For the out-of-tree build to work we need to tell switch_endian_test to look for check-reversed.S in $(OUTPUT).
--- tools/testing/selftests/powerpc/switch_endian/Makefile | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/powerpc/switch_endian/Makefile +1 -0
@@ -8,6 +8,7 @@ EXTRA_CLEAN = $(OUTPUT)/*.o $(OUTPUT)/check-reversed.S top_srcdir = ../../../../.. include ../../lib.mk +$(OUTPUT)/switch_endian_test: ASFLAGS += -I $(OUTPUT) $(OUTPUT)/switch_endian_test: $(OUTPUT)/check-reversed.S $(OUTPUT)/check-reversed.o: $(OUTPUT)/check.o
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 165/306 block: call rq_qos_exit() after queue is frozen
In reply to Greg Kroah-HartmanFrom: Ming Lei <[email protected]>
[ Upstream commit c57cdf7a9e51d97a43e29b8f4a04157875104000 ]
rq_qos_exit() removes the current q->rq_qos, this action has to be done after queue is frozen, otherwise the IO queue path may never be waken up, then IO hang is caused.
So fixes this issue by moving rq_qos_exit() after queue is frozen.
--- block/blk-core.c | 3 +++ block/blk-sysfs.c | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-)
block/blk-core.c +3 -0
@@ -784,6 +784,9 @@ void blk_cleanup_queue(struct request_queue *q)* prevent that q->request_fn() gets invoked after draining finished. */ blk_freeze_queue (q); + +rq_qos_exit (q); +spin_lock_irq (lock);queue_flag_set (QUEUE_FLAG_DEAD , q);spin_unlock_irq (lock);
block/blk-sysfs.c +0 -2
@@ -997,8 +997,6 @@ void blk_unregister_queue(struct gendisk *disk)kobject_del (&q->kobj);blk_trace_remove_sysfs (disk_to_dev (disk)); -rq_qos_exit (q); -mutex_lock (&q->sysfs_lock);if (q->request_fn || (q->mq_ops && q->elevator))elv_unregister_queue (q);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 166/306 mm/gup_benchmark.c: prevent integer overflow in ioctl
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 4b408c74ee5a0b74fc9265c2fe39b0e7dec7c056 ]
The concern here is that "gup->size" is a u64 and "nr_pages" is unsigned long. On 32 bit systems we could trick the kernel into allocating fewer pages than expected.
--- mm/gup_benchmark.c | 3 +++ 1 file changed, 3 insertions(+)
mm/gup_benchmark.c +3 -0
@@ -23,6 +23,9 @@ static int __gup_benchmark_ioctl(unsigned int cmd,int nr;struct page **pages; +if (gup->size >ULONG_MAX ) +return -EINVAL ; + nr_pages = gup->size /PAGE_SIZE ; pages =kvcalloc (nr_pages,sizeof (void *),GFP_KERNEL );if (!pages)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 168/306 linux/bitmap.h: fix type of nbits in bitmap_shift_right()
In reply to Greg Kroah-HartmanFrom: Rasmus Villemoes <[email protected]>
[ Upstream commit d9873969fa8725dc6a5a21ab788c057fd8719751 ]
Most other bitmap API, including the OOL version __bitmap_shift_right, take unsigned nbits. This was accidentally left out from 2fbad29917c98.
--- include/linux/bitmap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/bitmap.h +1 -1
@@ -403,7 +403,7 @@ static __always_inline void bitmap_clear(unsigned long *map, unsigned int start, }static inline void bitmap_shift_right (unsigned long *dst,const unsigned long *src, -unsigned int shift,int nbits) +unsigned int shift,unsigned int nbits) {if (small_const_nbits (nbits)) *dst = (*src &BITMAP_LAST_WORD_MASK (nbits)) >> shift;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 169/306 lib/bitmap.c: fix remaining space computation in bitmap_print_to_pagebuf
In reply to Greg Kroah-HartmanFrom: Rasmus Villemoes <[email protected]>
[ Upstream commit ce1091d471107dbf6f91db66a480a25950c9b9ff ]
For various alignments of buf, the current expression computes
4096 ok
4095 ok
8190
8189
...
4097
i.e., if the caller has already written two bytes into the page buffer, len is 8190 rather than 4094, because PTR_ALIGN aligns up to the next boundary. So if the printed version of the bitmap is huge, scnprintf() ends up writing beyond the page boundary.
I don't think any current callers actually write anything before bitmap_print_to_pagebuf, but the API seems to be designed to allow it.
--- lib/bitmap.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
lib/bitmap.c +6 -4
@@ -13,6 +13,7 @@#include <linux/bitops.h> #include <linux/bug.h> #include <linux/kernel.h> +#include <linux/mm.h> #include <linux/slab.h> #include <linux/string.h> #include <linux/uaccess.h>
@@ -466,14 +467,15 @@ EXPORT_SYMBOL(bitmap_parse_user);* ranges if list is specified or hex digits grouped into comma-separated * sets of 8 digits/set. Returns the number of characters written to buf. * -* It is assumed that @buf is a pointer into a PAGE_SIZE area and that -* sufficient storage remains at @buf to accommodate the -* bitmap_print_to_pagebuf() output. +* It is assumed that @buf is a pointer into a PAGE_SIZE, page-aligned +* area and that sufficient storage remains at @buf to accommodate the +* bitmap_print_to_pagebuf() output. Returns the number of characters +* actually printed to @buf, excluding terminating '\0'. */ int bitmap_print_to_pagebuf (bool list,char *buf,const unsigned long *maskp,int nmaskbits) { -ptrdiff_t len =PTR_ALIGN (buf +PAGE_SIZE -1 ,PAGE_SIZE ) - buf; +ptrdiff_t len =PAGE_SIZE -offset_in_page (buf);int n =0 ;if (len >1 )
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 170/306 hfsplus: fix BUG on bnode parent update
In reply to Greg Kroah-HartmanFrom: Ernesto A. Fernández <[email protected]>
[ Upstream commit 19a9d0f1acf75e8be8cfba19c1a34e941846fa2b ]
Creating, renaming or deleting a file may hit BUG_ON() if the first record of both a leaf node and its parent are changed, and if this forces the parent to be split. This bug is triggered by xfstests generic/027, somewhat rarely; here is a more reliable reproducer:
truncate -s 50M fs.iso
mkfs.hfsplus fs.iso
mount fs.iso /mnt
i=1000
while [ $i -le 2400 ]; do
touch /mnt/$i &>/dev/null
((++i))
done
i=2400
while [ $i -ge 1000 ]; do
mv /mnt/$i /mnt/$(perl -e "print $i x61") &>/dev/null
((--i))
doneThe issue is that a newly created bnode is being put twice. Reset new_node to NULL in hfs_brec_update_parent() before reaching goto again.
--- fs/hfsplus/brec.c | 1 + 1 file changed, 1 insertion(+)
fs/hfsplus/brec.c +1 -0
@@ -449,6 +449,7 @@ static int hfs_brec_update_parent(struct hfs_find_data *fd)/* restore search_key */ hfs_bnode_read_key (node, fd->search_key,14 ); } + new_node =NULL ; }if (!rec && node->parent)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 171/306 hfs: fix BUG on bnode parent update
In reply to Greg Kroah-HartmanFrom: Ernesto A. Fernández <[email protected]>
[ Upstream commit ef75bcc5763d130451a99825f247d301088b790b ]
hfs_brec_update_parent() may hit BUG_ON() if the first record of both a leaf node and its parent are changed, and if this forces the parent to be split. It is not possible for this to happen on a valid hfs filesystem because the index nodes have fixed length keys.
For reasons I ignore, the hfs module does have support for a number of hfsplus features. A corrupt btree header may report variable length keys and trigger this BUG, so it's better to fix it.
--- fs/hfs/brec.c | 1 + 1 file changed, 1 insertion(+)
fs/hfs/brec.c +1 -0
@@ -445,6 +445,7 @@ static int hfs_brec_update_parent(struct hfs_find_data *fd)/* restore search_key */ hfs_bnode_read_key (node, fd->search_key,14 ); } + new_node =NULL ; }if (!rec && node->parent)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 172/306 hfsplus: prevent btree data loss on ENOSPC
In reply to Greg Kroah-HartmanFrom: Ernesto A. Fernández <[email protected]>
[ Upstream commit d92915c35bfaf763d78bf1d5ac7f183420e3bd99 ]
Inserting or deleting a record in a btree may require splitting several of its nodes. If we hit ENOSPC halfway through, the new nodes will be left orphaned and their records will be lost. This could mean lost inodes, extents or xattrs.
Henceforth, check the available disk space before making any changes. This still leaves the potential problem of corruption on ENOMEM.
The patch can be tested with xfstests generic/027.
--- fs/hfsplus/attributes.c | 10 ++++++++++ fs/hfsplus/btree.c | 44 ++++++++++++++++++++++++++--------------- fs/hfsplus/catalog.c | 24 ++++++++++++++++++++++ fs/hfsplus/extents.c | 4 ++++ fs/hfsplus/hfsplus_fs.h | 2 ++ 5 files changed, 68 insertions(+), 16 deletions(-)
fs/hfsplus/attributes.c +10 -0
@@ -217,6 +217,11 @@ int hfsplus_create_attr(struct inode *inode,if (err) goto failed_init_create_attr; +/* Fail early and avoid ENOSPC during the btree operation */ + err =hfs_bmap_reserve (fd.tree, fd.tree->depth +1 ); +if (err) + goto failed_create_attr; +if (name) { err =hfsplus_attr_build_key (sb, fd.search_key, inode->i_ino, name);
@@ -313,6 +318,11 @@ int hfsplus_delete_attr(struct inode *inode, const char *name)if (err)return err; +/* Fail early and avoid ENOSPC during the btree operation */ + err =hfs_bmap_reserve (fd.tree, fd.tree->depth); +if (err) + goto out; +if (name) { err =hfsplus_attr_build_key (sb, fd.search_key, inode->i_ino, name);
fs/hfsplus/btree.c +28 -16
63 lines not on this page · raw message
fs/hfsplus/catalog.c +24 -0
@@ -265,6 +265,14 @@ int hfsplus_create_cat(u32 cnid, struct inode *dir,if (err)return err; +/* +* Fail early and avoid ENOSPC during the btree operations. We may +* have to split the root node at most once. +*/ + err =hfs_bmap_reserve (fd.tree,2 * fd.tree->depth); +if (err) + goto err2; +hfsplus_cat_build_key_with_cnid (sb, fd.search_key, cnid); entry_size = hfsplus_fill_cat_thread(sb, &entry, S_ISDIR(inode->i_mode) ?
@@ -333,6 +341,14 @@ int hfsplus_delete_cat(u32 cnid, struct inode *dir, const struct qstr *str)if (err)return err; +/* +* Fail early and avoid ENOSPC during the btree operations. We may +* have to split the root node at most once. +*/ + err =hfs_bmap_reserve (fd.tree,2 * (int )fd.tree->depth -2 ); +if (err) + goto out; +if (!str) {int len;
@@ -433,6 +449,14 @@ int hfsplus_rename_cat(u32 cnid,return err; dst_fd = src_fd; +/* +* Fail early and avoid ENOSPC during the btree operations. We may +* have to split the root node at most twice. +*/ + err =hfs_bmap_reserve (src_fd.tree,4 * (int )src_fd.tree->depth -1 ); +if (err) + goto out; +/* find the old dir entry and read the data */ err =hfsplus_cat_build_key (sb, src_fd.search_key, src_dir->i_ino, src_name);
fs/hfsplus/extents.c +4 -0
@@ -100,6 +100,10 @@ static int __hfsplus_ext_write_extent(struct inode *inode,if (hip->extent_state &HFSPLUS_EXT_NEW ) {if (res != -ENOENT )return res; +/* Fail early and avoid ENOSPC during the btree operation */ + res =hfs_bmap_reserve (fd->tree, fd->tree->depth +1 ); +if (res) +return res;hfs_brec_insert (fd, hip->cached_extents,sizeof (hfsplus_extent_rec)); hip->extent_state &= ~(HFSPLUS_EXT_DIRTY |HFSPLUS_EXT_NEW );
fs/hfsplus/hfsplus_fs.h +2 -0
@@ -311,6 +311,7 @@ static inline unsigned short hfsplus_min_io_size(struct super_block *sb)#define hfs_btree_open hfsplus_btree_open#define hfs_btree_close hfsplus_btree_close#define hfs_btree_write hfsplus_btree_write +#define hfs_bmap_reserve hfsplus_bmap_reserve#define hfs_bmap_alloc hfsplus_bmap_alloc#define hfs_bmap_free hfsplus_bmap_free#define hfs_bnode_read hfsplus_bnode_read
@@ -395,6 +396,7 @@ u32 hfsplus_calc_btree_clump_size(u32 block_size, u32 node_size, u64 sectors,struct hfs_btree *hfs_btree_open (struct super_block *sb,u32 id);void hfs_btree_close (struct hfs_btree *tree);int hfs_btree_write (struct hfs_btree *tree); +int hfs_bmap_reserve (struct hfs_btree *tree,int rsvd_nodes);struct hfs_bnode *hfs_bmap_alloc (struct hfs_btree *tree);void hfs_bmap_free (struct hfs_bnode *node);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 173/306 hfs: prevent btree data loss on ENOSPC
In reply to Greg Kroah-HartmanFrom: Ernesto A. Fernández <[email protected]>
[ Upstream commit 54640c7502e5ed41fbf4eedd499e85f9acc9698f ]
Inserting a new record in a btree may require splitting several of its nodes. If we hit ENOSPC halfway through, the new nodes will be left orphaned and their records will be lost. This could mean lost inodes or extents.
Henceforth, check the available disk space before making any changes. This still leaves the potential problem of corruption on ENOMEM.
There is no need to reserve space before deleting a catalog record, as we do for hfsplus. This difference is because hfs index nodes have fixed length keys.
--- fs/hfs/btree.c | 41 +++++++++++++++++++++++++---------------- fs/hfs/btree.h | 1 + fs/hfs/catalog.c | 16 ++++++++++++++++ fs/hfs/extent.c | 4 ++++ 4 files changed, 46 insertions(+), 16 deletions(-)
fs/hfs/btree.c +25 -16
@@ -220,25 +220,17 @@ static struct hfs_bnode *hfs_bmap_new_bmap(struct hfs_bnode *prev, u32 idx)return node; } -struct hfs_bnode *hfs_bmap_alloc (struct hfs_btree *tree) +/* Make sure @tree has enough space for the @rsvd_nodes */ +int hfs_bmap_reserve (struct hfs_btree *tree,int rsvd_nodes) { -struct hfs_bnode *node, *next_node; -struct page **pagep; -u32 nidx, idx; -unsigned off; -u16 off16; -u16 len; -u8 *data, byte, m; -int i; - -while (!tree->free_nodes) { -struct inode *inode = tree->inode; -u32 count; -int res; +struct inode *inode = tree->inode; +u32 count; +int res; +while (tree->free_nodes < rsvd_nodes) { res =hfs_extend_file (inode);if (res) -return ERR_PTR (res); +return res;HFS_I (inode)->phys_size = inode->i_size = (loff_t )HFS_I (inode)->alloc_blocks *HFS_SB (tree->sb)->alloc_blksz;
@@ -246,9 +238,26 @@ struct hfs_bnode *hfs_bmap_alloc(struct hfs_btree *tree) tree->sb->s_blocksize_bits;inode_set_bytes (inode, inode->i_size); count = inode->i_size >> tree->node_size_shift; - tree->free_nodes = count - tree->node_count; + tree->free_nodes += count - tree->node_count; tree->node_count = count; } +return 0 ; +} + +struct hfs_bnode *hfs_bmap_alloc (struct hfs_btree *tree) +{ +struct hfs_bnode *node, *next_node; +struct page **pagep; +u32 nidx, idx; +unsigned off; +u16 off16; +u16 len; +u8 *data, byte, m; +int i, res; + + res =hfs_bmap_reserve (tree,1 ); +if (res) +return ERR_PTR (res); nidx =0 ; node =hfs_bnode_find (tree, nidx);
fs/hfs/btree.h +1 -0
@@ -82,6 +82,7 @@ struct hfs_find_data {extern struct hfs_btree *hfs_btree_open (struct super_block *,u32 ,btree_keycmp );extern void hfs_btree_close (struct hfs_btree *);extern void hfs_btree_write (struct hfs_btree *); +extern int hfs_bmap_reserve (struct hfs_btree *,int );extern struct hfs_bnode *hfs_bmap_alloc (struct hfs_btree *);extern void hfs_bmap_free (struct hfs_bnode *node);
fs/hfs/catalog.c +16 -0
@@ -97,6 +97,14 @@ int hfs_cat_create(u32 cnid, struct inode *dir, const struct qstr *str, struct iif (err)return err; +/* +* Fail early and avoid ENOSPC during the btree operations. We may +* have to split the root node at most once. +*/ + err =hfs_bmap_reserve (fd.tree,2 * fd.tree->depth); +if (err) + goto err2; +hfs_cat_build_key (sb, fd.search_key, cnid,NULL ); entry_size = hfs_cat_build_thread(sb, &entry, S_ISDIR(inode->i_mode) ? HFS_CDR_THD : HFS_CDR_FTH,
@@ -295,6 +303,14 @@ int hfs_cat_move(u32 cnid, struct inode *src_dir, const struct qstr *src_name,return err; dst_fd = src_fd; +/* +* Fail early and avoid ENOSPC during the btree operations. We may +* have to split the root node at most once. +*/ + err =hfs_bmap_reserve (src_fd.tree,2 * src_fd.tree->depth); +if (err) + goto out; +/* find the old dir entry and read the data */ hfs_cat_build_key (sb, src_fd.search_key, src_dir->i_ino, src_name); err =hfs_brec_find (&src_fd);
fs/hfs/extent.c +4 -0
@@ -117,6 +117,10 @@ static int __hfs_ext_write_extent(struct inode *inode, struct hfs_find_data *fd)if (HFS_I (inode)->flags &HFS_FLG_EXT_NEW ) {if (res != -ENOENT )return res; +/* Fail early and avoid ENOSPC during the btree operation */ + res =hfs_bmap_reserve (fd->tree, fd->tree->depth +1 ); +if (res) +return res;hfs_brec_insert (fd,HFS_I (inode)->cached_extents,sizeof (hfs_extent_rec));HFS_I (inode)->flags &= ~(HFS_FLG_EXT_DIRTY |HFS_FLG_EXT_NEW ); }else {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 174/306 hfsplus: fix return value of hfsplus_get_block()
In reply to Greg Kroah-HartmanFrom: Ernesto A. Fernández <[email protected]>
[ Upstream commit 839c3a6a5e1fbc8542d581911b35b2cb5cd29304 ]
Direct writes to empty inodes fail with EIO. The generic direct-io code is in part to blame (a patch has been submitted as "direct-io: allow direct writes to empty inodes"), but hfsplus is worse affected than the other filesystems because the fallback to buffered I/O doesn't happen.
The problem is the return value of hfsplus_get_block() when called with !create. Change it to be more consistent with the other modules.
--- fs/hfsplus/extents.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/hfsplus/extents.c +3 -1
@@ -237,7 +237,9 @@ int hfsplus_get_block(struct inode *inode, sector_t iblock, ablock = iblock >> sbi->fs_shift;if (iblock >= hip->fs_blocks) { -if (iblock > hip->fs_blocks || !create) +if (!create) +return 0 ; +if (iblock > hip->fs_blocks)return -EIO ;if (ablock >= hip->alloc_blocks) { res =hfsplus_file_extend (inode, false);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 176/306 hfsplus: update timestamps on truncate()
In reply to Greg Kroah-HartmanFrom: Ernesto A. Fernández <[email protected]>
[ Upstream commit dc8844aada735890a6de109bef327f5df36a982e ]
The vfs takes care of updating ctime and mtime on ftruncate(), but on truncate() it must be done by the module.
This patch can be tested with xfstests generic/313.
--- fs/hfsplus/inode.c | 1 + 1 file changed, 1 insertion(+)
fs/hfsplus/inode.c +1 -0
@@ -261,6 +261,7 @@ static int hfsplus_setattr(struct dentry *dentry, struct iattr *attr) }truncate_setsize (inode, attr->ia_size);hfsplus_file_truncate (inode); + inode->i_mtime = inode->i_ctime =current_time (inode); }setattr_copy (inode, attr);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 178/306 fs/hfs/extent.c: fix array out of bounds read of array extent
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 6c9a3f843a29d6894dfc40df338b91dbd78f0ae3 ]
Currently extent and index i are both being incremented causing an array out of bounds read on extent[i]. Fix this by removing the extraneous increment of extent.
Ernesto said:
: This is only triggered when deleting a file with a resource fork. I : may be wrong because the documentation isn't clear, but I don't think : you can create those under linux. So I guess nobody was testing them. :
: > A disk space leak, perhaps?
:
: That's what it looks like in general. hfs_free_extents() won't do : anything if the block count doesn't add up, and the error will be : ignored. Now, if the block count randomly does add up, we could see : some corruption.
Detected by CoverityScan, CID#711541 ("Out of bounds read")
--- fs/hfs/extent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/hfs/extent.c +1 -1
@@ -304,7 +304,7 @@ int hfs_free_fork(struct super_block *sb, struct hfs_cat_file *file, int type)return 0 ; blocks =0 ; -for (i =0 ; i <3 ; extent++, i++) +for (i =0 ; i <3 ; i++) blocks +=be16_to_cpu (extent[i].count); res =hfs_free_extents (sb, extent, blocks, blocks);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 180/306 mm/memory_hotplug: make add_memory() take the device_hotplug_lock
In reply to Greg Kroah-HartmanFrom: David Hildenbrand <[email protected]>
[ Upstream commit 8df1d0e4a265f25dc1e7e7624ccdbcb4a6630c89 ]
add_memory() currently does not take the device_hotplug_lock, however is aleady called under the lock from
arch/powerpc/platforms/pseries/hotplug-memory.c drivers/acpi/acpi_memhotplug.c
to synchronize against CPU hot-remove and similar.
In general, we should hold the device_hotplug_lock when adding memory to synchronize against online/offline request (e.g. from user space) - which already resulted in lock inversions due to device_lock() and mem_hotplug_lock - see 30467e0b3be ("mm, hotplug: fix concurrent memory hot-add deadlock"). add_memory()/add_memory_resource() will create memory block devices, so this really feels like the right thing to do.
Holding the device_hotplug_lock makes sure that a memory block device can really only be accessed (e.g. via .online/.state) from user space, once the memory has been fully added to the system.
The lock is not held yet in
drivers/xen/balloon.c arch/powerpc/platforms/powernv/memtrace.c drivers/s390/char/sclp_cmd.c drivers/hv/hv_balloon.c
So, let's either use the locked variants or take the lock.
Don't export add_memory_resource(), as it once was exported to be used by XEN, which is never built as a module. If somebody requires it, we also have to export a locked variant (as device_hotplug_lock is never exported).
--- .../platforms/pseries/hotplug-memory.c | 2 +- drivers/acpi/acpi_memhotplug.c | 2 +- drivers/base/memory.c | 9 ++++++-- drivers/xen/balloon.c | 3 +++ include/linux/memory_hotplug.h | 1 + mm/memory_hotplug.c | 22 ++++++++++++++++--- 6 files changed, 32 insertions(+), 7 deletions(-)
arch/powerpc/platforms/pseries/hotplug-memory.c +1 -1
@@ -676,7 +676,7 @@ static int dlpar_add_lmb(struct drmem_lmb *lmb) nid =memory_add_physaddr_to_nid (lmb->base_addr);/* Add the memory */ - rc =add_memory (nid, lmb->base_addr, block_sz); + rc =__add_memory (nid, lmb->base_addr, block_sz);if (rc) {invalidate_lmb_associativity_index (lmb);return rc;
drivers/acpi/acpi_memhotplug.c +1 -1
@@ -228,7 +228,7 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)if (node <0 ) node =memory_add_physaddr_to_nid (info->start_addr); - result =add_memory (node, info->start_addr, info->length); + result =__add_memory (node, info->start_addr, info->length);/* * If the memory block has been used by the kernel, add_memory()
drivers/base/memory.c +7 -2
@@ -519,15 +519,20 @@ memory_probe_store(struct device *dev, struct device_attribute *attr,if (phys_addr & ((pages_per_block <<PAGE_SHIFT ) -1 ))return -EINVAL ; + ret =lock_device_hotplug_sysfs (); +if (ret) + goto out; + nid =memory_add_physaddr_to_nid (phys_addr); - ret =add_memory (nid, phys_addr, -MIN_MEMORY_BLOCK_SIZE * sections_per_block); + ret =__add_memory (nid, phys_addr, +MIN_MEMORY_BLOCK_SIZE * sections_per_block);if (ret) goto out; ret = count; out: +unlock_device_hotplug ();return ret; }
drivers/xen/balloon.c +3 -0
@@ -350,7 +350,10 @@ static enum bp_state reserve_additional_memory(void)* callers drop the mutex before trying again. */ mutex_unlock (&balloon_mutex); +/* add_memory_resource() requires the device_hotplug lock */ +lock_device_hotplug (); rc =add_memory_resource (nid, resource, memhp_auto_online); +unlock_device_hotplug ();mutex_lock (&balloon_mutex);if (rc) {
include/linux/memory_hotplug.h +1 -0
@@ -322,6 +322,7 @@ static inline void remove_memory(int nid, u64 start, u64 size) {}extern void __ref free_area_init_core_hotplug (int nid);extern int walk_memory_range (unsigned long start_pfn,unsigned long end_pfn,void *arg,int (*func)(struct memory_block *,void *)); +extern int __add_memory (int nid,u64 start,u64 size);extern int add_memory (int nid,u64 start,u64 size);extern int add_memory_resource (int nid,struct resource *resource,bool online); extern int arch_add_memory(int nid, u64 start, u64 size,
mm/memory_hotplug.c +19 -3
@@ -1077,7 +1077,12 @@ static int online_memory_block(struct memory_block *mem, void *arg)return device_online (&mem->dev); } -/* we are OK calling __meminit stuff here - we have CONFIG_MEMORY_HOTPLUG */ +/* +* NOTE: The caller must call lock_device_hotplug() to serialize hotplug +* and online/offline operations (triggered e.g. by sysfs). +* +* we are OK calling __meminit stuff here - we have CONFIG_MEMORY_HOTPLUG +*/ int __ref add_memory_resource (int nid,struct resource *res,bool online) {u64 start, size;
@@ -1146,9 +1151,9 @@ int __ref add_memory_resource(int nid, struct resource *res, bool online)mem_hotplug_done ();return ret; } -EXPORT_SYMBOL_GPL (add_memory_resource); -int __ref add_memory (int nid,u64 start,u64 size) +/* requires device_hotplug_lock, see add_memory_resource() */ +int __ref __add_memory (int nid,u64 start,u64 size) {struct resource *res;int ret;
@@ -1162,6 +1167,17 @@ int __ref add_memory(int nid, u64 start, u64 size)release_memory_resource (res);return ret; } + +int add_memory (int nid,u64 start,u64 size) +{ +int rc; + +lock_device_hotplug (); + rc =__add_memory (nid, start, size); +unlock_device_hotplug (); + +return rc; +}EXPORT_SYMBOL_GPL (add_memory);#ifdef CONFIG_MEMORY_HOTREMOVE
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 181/306 mm/memory_hotplug: fix online/offline_pages called w.o. mem_hotplug_lock
In reply to Greg Kroah-HartmanFrom: David Hildenbrand <[email protected]>
[ Upstream commit 381eab4a6ee81266f8dddc62e57376c7e584e5b8 ]
There seem to be some problems as result of 30467e0b3be ("mm, hotplug:
fix concurrent memory hot-add deadlock"), which tried to fix a possible lock inversion reported and discussed in [1] due to the two locks
a) device_lock()
b) mem_hotplug_lock
While add_memory() first takes b), followed by a) during bus_probe_device(), onlining of memory from user space first took a), followed by b), exposing a possible deadlock.
In [1], and it was decided to not make use of device_hotplug_lock, but rather to enforce a locking order.
The problems I spotted related to this:
1. Memory block device attributes: While .state first calls mem_hotplug_begin() and the calls device_online() - which takes device_lock() - .online does no longer call mem_hotplug_begin(), so effectively calls online_pages() without mem_hotplug_lock.
2. device_online() should be called under device_hotplug_lock, however onlining memory during add_memory() does not take care of that.
In addition, I think there is also something wrong about the locking in
3. arch/powerpc/platforms/powernv/memtrace.c calls offline_pages() without locks. This was introduced after 30467e0b3be. And skimming over the code, I assume it could need some more care in regards to locking (e.g. device_online() called without device_hotplug_lock. This will be addressed in the following patches.
Now that we hold the device_hotplug_lock when
- adding memory (e.g. via add_memory()/add_memory_resource())
- removing memory (e.g. via remove_memory())
- device_online()/device_offline()
We can move mem_hotplug_lock usage back into
online_pages()/offline_pages().
Why is mem_hotplug_lock still needed? Essentially to make get_online_mems()/put_online_mems() be very fast (relying on device_hotplug_lock would be very slow), and to serialize against addition of memory that does not create memory block devices (hmm).
[1] http://driverdev.linuxdriverproject.org/pipermail/ driverdev-devel/
2015-February/065324.html
This patch is partly based on a patch by Vitaly Kuznetsov.
--- drivers/base/memory.c | 13 +------------ mm/memory_hotplug.c | 28 ++++++++++++++++++++-------- 2 files changed, 21 insertions(+), 20 deletions(-)
drivers/base/memory.c +1 -12
@@ -228,7 +228,6 @@ static bool pages_correctly_probed(unsigned long start_pfn)/* * MEMORY_HOTPLUG depends on SPARSEMEM in mm/Kconfig, so it is * OK to have direct references to sparsemem variables in here. -* Must already be protected by mem_hotplug_begin(). */ static int memory_block_action (unsigned long phys_index,unsigned long action,int online_type)
@@ -294,7 +293,6 @@ static int memory_subsys_online(struct device *dev)if (mem->online_type <0 ) mem->online_type =MMOP_ONLINE_KEEP ; -/* Already under protection of mem_hotplug_begin() */ ret =memory_block_change_state (mem,MEM_ONLINE ,MEM_OFFLINE );/* clear online_type */
@@ -341,19 +339,11 @@ store_mem_state(struct device *dev, goto err; } -/* -* Memory hotplug needs to hold mem_hotplug_begin() for probe to find -* the correct memory block to online before doing device_online(dev), -* which will take dev->mutex. Take the lock early to prevent an -* inversion, memory_subsys_online() callbacks will be implemented by -* assuming it's already protected. -*/ -mem_hotplug_begin (); -switch (online_type) {case MMOP_ONLINE_KERNEL :case MMOP_ONLINE_MOVABLE :case MMOP_ONLINE_KEEP : +/* mem->online_type is protected by device_hotplug_lock */ mem->online_type = online_type; ret =device_online (&mem->dev);break ;
@@ -364,7 +354,6 @@ store_mem_state(struct device *dev, ret = -EINVAL ;/* should never happen */ } -mem_hotplug_done (); err:unlock_device_hotplug ();
mm/memory_hotplug.c +20 -8
@@ -846,7 +846,6 @@ static struct zone * __meminit move_pfn_range(int online_type, int nid,return zone; } -/* Must be protected by mem_hotplug_begin() or a device_lock */ int __ref online_pages (unsigned long pfn,unsigned long nr_pages,int online_type) {unsigned long flags;
@@ -858,6 +857,8 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages, int online_typstruct memory_notify arg;struct memory_block *mem; +mem_hotplug_begin (); +/* * We can't use pfn_to_nid() because nid might be stored in struct page * which is not yet initialized. Instead, we find nid from memory block.
@@ -923,6 +924,7 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages, int online_typif (onlined_pages)memory_notify (MEM_ONLINE , &arg); +mem_hotplug_done ();return 0 ; failed_addition:
@@ -930,6 +932,7 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages, int online_typ (unsigned long long ) pfn <<PAGE_SHIFT , (((unsigned long long) pfn + nr_pages) << PAGE_SHIFT) - 1);memory_notify (MEM_CANCEL_ONLINE , &arg); +mem_hotplug_done (); return ret; }#endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */
@@ -1134,20 +1137,20 @@ int __ref add_memory_resource(int nid, struct resource *res, bool online)/* create new memmap entry */ firmware_map_add_hotplug (start, start + size,"System RAM" ); +/* device_online() will take the lock when calling online_pages() */ +mem_hotplug_done (); +/* online pages if requested */ if (online)walk_memory_range (PFN_DOWN (start),PFN_UP (start + size -1 ),NULL , online_memory_block); - goto out; - +return ret; error:/* rollback pgdat allocation and others */ if (new_node)rollback_node_hotadd (nid);memblock_remove (start, size); - -out:mem_hotplug_done ();return ret; }
@@ -1614,10 +1617,16 @@ static int __ref __offline_pages(unsigned long start_pfn,return -EINVAL ;if (!IS_ALIGNED (end_pfn, pageblock_nr_pages))return -EINVAL ; + +mem_hotplug_begin (); +/* This makes hotplug much easier...and readable. we assume this for now. .*/ -if (!test_pages_in_a_zone (start_pfn, end_pfn, &valid_start, &valid_end)) +if (!test_pages_in_a_zone (start_pfn, end_pfn, &valid_start, + &valid_end)) { +mem_hotplug_done ();return -EINVAL ; + } zone =page_zone (pfn_to_page (valid_start)); node =zone_to_nid (zone);
@@ -1626,8 +1635,10 @@ static int __ref __offline_pages(unsigned long start_pfn,/* set above range as isolated */ ret =start_isolate_page_range (start_pfn, end_pfn,MIGRATE_MOVABLE , true); -if (ret) +if (ret) { +mem_hotplug_done ();return ret; + } arg.start_pfn = start_pfn; arg.nr_pages = nr_pages;
@@ -1698,6 +1709,7 @@ static int __ref __offline_pages(unsigned long start_pfn,writeback_set_ratelimit ();memory_notify (MEM_OFFLINE , &arg); +mem_hotplug_done ();return 0 ; failed_removal:
@@ -1707,10 +1719,10 @@ static int __ref __offline_pages(unsigned long start_pfn,memory_notify (MEM_CANCEL_OFFLINE , &arg);/* pushback to free area */ undo_isolate_page_range (start_pfn, end_pfn,MIGRATE_MOVABLE ); +mem_hotplug_done ();return ret; } -/* Must be protected by mem_hotplug_begin() or a device_lock */ int offline_pages (unsigned long start_pfn,unsigned long nr_pages) {return __offline_pages (start_pfn, start_pfn + nr_pages);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 146/306 arm64: lib: use C string functions with KASAN enabled
In reply to Greg Kroah-HartmanFrom: Andrey Ryabinin <[email protected]>
[ Upstream commit 19a2ca0fb560fd7be7b5293c6b652c6d6078dcde ]
ARM64 has asm implementation of memchr(), memcmp(), str[r]chr(), str[n]cmp(), str[n]len(). KASAN don't see memory accesses in asm code, thus it can potentially miss many bugs.
Ifdef out __HAVE_ARCH_* defines of these functions when KASAN is enabled, so the generic implementations from lib/string.c will be used.
We can't just remove the asm functions because efistub uses them. And we can't have two non-weak functions either, so declare the asm functions as weak.
--- arch/arm64/include/asm/string.h | 14 ++++++++------ arch/arm64/kernel/arm64ksyms.c | 7 +++++-- arch/arm64/lib/memchr.S | 2 +- arch/arm64/lib/memcmp.S | 2 +- arch/arm64/lib/strchr.S | 2 +- arch/arm64/lib/strcmp.S | 2 +- arch/arm64/lib/strlen.S | 2 +- arch/arm64/lib/strncmp.S | 2 +- arch/arm64/lib/strnlen.S | 2 +- arch/arm64/lib/strrchr.S | 2 +- 10 files changed, 21 insertions(+), 16 deletions(-)
arch/arm64/include/asm/string.h +8 -6
@@ -16,6 +16,7 @@#ifndef __ASM_STRING_H#define __ASM_STRING_H +#ifndef CONFIG_KASAN #define __HAVE_ARCH_STRRCHRextern char *strrchr (const char *,int c);
@@ -34,6 +35,13 @@ extern __kernel_size_t strlen(const char *);#define __HAVE_ARCH_STRNLENextern __kernel_size_t strnlen (const char *,__kernel_size_t ); +#define __HAVE_ARCH_MEMCMP +extern int memcmp (const void *,const void *,size_t ); + +#define __HAVE_ARCH_MEMCHR +extern void *memchr (const void *,int ,__kernel_size_t ); +#endif +#define __HAVE_ARCH_MEMCPYextern void *memcpy (void *,const void *,__kernel_size_t );extern void *__memcpy (void *,const void *,__kernel_size_t );
@@ -42,16 +50,10 @@ extern void *__memcpy(void *, const void *, __kernel_size_t);extern void *memmove (void *,const void *,__kernel_size_t );extern void *__memmove (void *,const void *,__kernel_size_t ); -#define __HAVE_ARCH_MEMCHR -extern void *memchr (const void *,int ,__kernel_size_t ); -#define __HAVE_ARCH_MEMSETextern void *memset (void *,int ,__kernel_size_t );extern void *__memset (void *,int ,__kernel_size_t ); -#define __HAVE_ARCH_MEMCMP -extern int memcmp (const void *,const void *,size_t ); -#ifdef CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE #define __HAVE_ARCH_MEMCPY_FLUSHCACHEvoid memcpy_flushcache (void *dst,const void *src,size_t cnt);
arch/arm64/kernel/arm64ksyms.c +5 -2
@@ -44,20 +44,23 @@ EXPORT_SYMBOL(__arch_copy_in_user);EXPORT_SYMBOL (memstart_addr);/* string / mem functions */ +#ifndef CONFIG_KASAN EXPORT_SYMBOL (strchr);EXPORT_SYMBOL (strrchr);EXPORT_SYMBOL (strcmp);EXPORT_SYMBOL (strncmp);EXPORT_SYMBOL (strlen);EXPORT_SYMBOL (strnlen); +EXPORT_SYMBOL (memcmp); +EXPORT_SYMBOL (memchr); +#endif +EXPORT_SYMBOL (memset);EXPORT_SYMBOL (memcpy);EXPORT_SYMBOL (memmove);EXPORT_SYMBOL (__memset);EXPORT_SYMBOL (__memcpy);EXPORT_SYMBOL (__memmove); -EXPORT_SYMBOL (memchr); -EXPORT_SYMBOL (memcmp);/* atomic bitops */ EXPORT_SYMBOL (set_bit);
arch/arm64/lib/memchr.S +1 -1
@@ -30,7 +30,7 @@ * Returns: * x0 - address of first occurrence of 'c' or 0 */ -ENTRY(memchr) +WEAK(memchr) and w1, w1, #0xff 1: subs x2, x2, #1 b.mi 2f
arch/arm64/lib/memcmp.S +1 -1
@@ -58,7 +58,7 @@ pos .req x11 limit_wd .req x12 mask .req x13 -ENTRY(memcmp) +WEAK(memcmp) cbz limit, .Lret0 eor tmp1, src1, src2 tst tmp1, #7
arch/arm64/lib/strchr.S +1 -1
@@ -29,7 +29,7 @@ * Returns: * x0 - address of first occurrence of 'c' or 0 */ -ENTRY(strchr) +WEAK(strchr) and w1, w1, #0xff 1: ldrb w2, [x0], #1 cmp w2, w1
arch/arm64/lib/strcmp.S +1 -1
@@ -60,7 +60,7 @@ tmp3 .req x9 zeroones .req x10 pos .req x11 -ENTRY(strcmp) +WEAK(strcmp) eor tmp1, src1, src2 mov zeroones, #REP8_01 tst tmp1, #7
arch/arm64/lib/strlen.S +1 -1
@@ -56,7 +56,7 @@ pos .req x12 #define REP8_7f 0x7f7f7f7f7f7f7f7f #define REP8_80 0x8080808080808080 -ENTRY(strlen) +WEAK(strlen) mov zeroones, #REP8_01 bic src, srcin, #15 ands tmp1, srcin, #15
arch/arm64/lib/strncmp.S +1 -1
@@ -64,7 +64,7 @@ limit_wd .req x13 mask .req x14 endloop .req x15 -ENTRY(strncmp) +WEAK(strncmp) cbz limit, .Lret0 eor tmp1, src1, src2 mov zeroones, #REP8_01
arch/arm64/lib/strnlen.S +1 -1
@@ -59,7 +59,7 @@ limit_wd .req x14 #define REP8_7f 0x7f7f7f7f7f7f7f7f #define REP8_80 0x8080808080808080 -ENTRY(strnlen) +WEAK(strnlen) cbz limit, .Lhit_limit mov zeroones, #REP8_01 bic src, srcin, #15
arch/arm64/lib/strrchr.S +1 -1
@@ -29,7 +29,7 @@ * Returns: * x0 - address of last occurrence of 'c' or 0 */ -ENTRY(strrchr) +WEAK(strrchr) mov x3, #0 and w1, w1, #0xff 1: ldrb w2, [x0], #1
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 182/306 powerpc/powernv: hold device_hotplug_lock when calling device_online()
In reply to Greg Kroah-HartmanFrom: David Hildenbrand <[email protected]>
[ Upstream commit cec1680591d6d5b10ecc10f370210089416e98af ]
device_online() should be called with device_hotplug_lock() held.
--- arch/powerpc/platforms/powernv/memtrace.c | 2 ++ 1 file changed, 2 insertions(+)
arch/powerpc/platforms/powernv/memtrace.c +2 -0
@@ -244,9 +244,11 @@ static int memtrace_online(void)* we need to online the memory ourselves. */ if (!memhp_auto_online) { +lock_device_hotplug ();walk_memory_range (PFN_DOWN (ent->start),PFN_UP (ent->start + ent->size -1 ),NULL , online_mem_block); +unlock_device_hotplug (); }/*
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 183/306 igb: shorten maximum PHC timecounter update interval
In reply to Greg Kroah-HartmanFrom: Miroslav Lichvar <[email protected]>
[ Upstream commit 094bf4d0e9657f6ea1ee3d7e07ce3970796949ce ]
The timecounter needs to be updated at least once per ~550 seconds in order to avoid a 40-bit SYSTIM timestamp to be misinterpreted as an old timestamp.
Since commit 500462a9d ("timers: Switch to a non-cascading wheel"), scheduling of delayed work seems to be less accurate and a requested delay of 540 seconds may actually be longer than 550 seconds. Shorten the delay to 480 seconds to be sure the timecounter is updated in time.
This fixes an issue with HW timestamps on 82580/I350/I354 being off by ~1100 seconds for few seconds every ~9 minutes.
--- drivers/net/ethernet/intel/igb/igb_ptp.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/igb/igb_ptp.c +7 -1
@@ -51,9 +51,15 @@* * The 40 bit 82580 SYSTIM overflows every * 2^40 * 10^-9 / 60 = 18.3 minutes. +* +* SYSTIM is converted to real time using a timecounter. As +* timecounter_cyc2time() allows old timestamps, the timecounter +* needs to be updated at least once per half of the SYSTIM interval. +* Scheduling of delayed work is not very accurate, so we aim for 8 +* minutes to be sure the actual interval is shorter than 9.16 minutes. */ -#define IGB_SYSTIM_OVERFLOW_PERIOD (HZ * 60 * 9) +#define IGB_SYSTIM_OVERFLOW_PERIOD (HZ * 60 * 8)#define IGB_PTP_TX_TIMEOUT (HZ * 15)#define INCPERIOD_82576 BIT(E1000_TIMINCA_16NS_SHIFT)#define INCVALUE_82576_MASK GENMASK(E1000_TIMINCA_16NS_SHIFT - 1, 0)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 184/306 fm10k: ensure completer aborts are marked as non-fatal after a resume
In reply to Greg Kroah-HartmanFrom: Jacob Keller <[email protected]>
[ Upstream commit e330af788998b0de4da4f5bd7ddd087507999800 ]
VF drivers can trigger PCIe completer aborts any time they read a queue that they don't own. Even in nominal circumstances, it is not possible to prevent the VF driver from reading queues it doesn't own. VF drivers may attempt to read queues it previously owned, but which it no longer does due to a PF reset.
Normally these completer aborts aren't an issue. However, on some platforms these trigger machine check errors. This is true even if we lower their severity from fatal to non-fatal. Indeed, we already have code for lowering the severity.
We could attempt to mask these errors conditionally around resets, which is the most common time they would occur. However this would essentially be a race between the PF and VF drivers, and we may still occasionally see machine check exceptions on these strictly configured platforms.
Instead, mask the errors entirely any time we resume VFs. By doing so, we prevent the completer aborts from being sent to the parent PCIe device, and thus these strict platforms will not upgrade them into machine check errors.
Additionally, we don't lose any information by masking these errors, because we'll still report VFs which attempt to access queues via the FUM_BAD_VF_QACCESS errors.
Without this change, on platforms where completer aborts cause machine check exceptions, the VF reading queues it doesn't own could crash the host system. Masking the completer abort prevents this, so we should mask it for good, and not just around a PCIe reset. Otherwise malicious or misconfigured VFs could cause the host system to crash.
Because we are masking the error entirely, there is little reason to also keep setting the severity bit, so that code is also removed.
--- drivers/net/ethernet/intel/fm10k/fm10k_iov.c | 48 ++++++++++++-------- 1 file changed, 28 insertions(+), 20 deletions(-)
drivers/net/ethernet/intel/fm10k/fm10k_iov.c +28 -20
@@ -302,6 +302,28 @@ void fm10k_iov_suspend(struct pci_dev *pdev) } } +static void fm10k_mask_aer_comp_abort (struct pci_dev *pdev) +{ +u32 err_mask; +int pos; + + pos =pci_find_ext_capability (pdev,PCI_EXT_CAP_ID_ERR ); +if (!pos) +return ; + +/* Mask the completion abort bit in the ERR_UNCOR_MASK register, +* preventing the device from reporting these errors to the upstream +* PCIe root device. This avoids bringing down platforms which upgrade +* non-fatal completer aborts into machine check exceptions. Completer +* aborts can occur whenever a VF reads a queue it doesn't own. +*/ +pci_read_config_dword (pdev, pos +PCI_ERR_UNCOR_MASK , &err_mask); + err_mask |=PCI_ERR_UNC_COMP_ABORT ; +pci_write_config_dword (pdev, pos +PCI_ERR_UNCOR_MASK , err_mask); + +mmiowb (); +} +int fm10k_iov_resume (struct pci_dev *pdev) {struct fm10k_intfc *interface =pci_get_drvdata (pdev);
@@ -317,6 +339,12 @@ int fm10k_iov_resume(struct pci_dev *pdev)if (!iov_data)return -ENOMEM ; +/* Lower severity of completer abort error reporting as +* the VFs can trigger this any time they read a queue +* that they don't own. +*/ +fm10k_mask_aer_comp_abort (pdev); +/* allocate hardware resources for the VFs */ hw->iov.ops.assign_resources (hw, num_vfs, num_vfs);
@@ -460,20 +488,6 @@ void fm10k_iov_disable(struct pci_dev *pdev)fm10k_iov_free_data (pdev); } -static void fm10k_disable_aer_comp_abort (struct pci_dev *pdev) -{ -u32 err_sev; -int pos; - - pos =pci_find_ext_capability (pdev,PCI_EXT_CAP_ID_ERR ); -if (!pos) -return ; - -pci_read_config_dword (pdev, pos +PCI_ERR_UNCOR_SEVER , &err_sev); - err_sev &= ~PCI_ERR_UNC_COMP_ABORT ; -pci_write_config_dword (pdev, pos +PCI_ERR_UNCOR_SEVER , err_sev); -} -int fm10k_iov_configure (struct pci_dev *pdev,int num_vfs) {int current_vfs =pci_num_vf (pdev);
@@ -495,12 +509,6 @@ int fm10k_iov_configure(struct pci_dev *pdev, int num_vfs)/* allocate VFs if not already allocated */ if (num_vfs && num_vfs != current_vfs) { -/* Disable completer abort error reporting as -* the VFs can trigger this any time they read a queue -* that they don't own. -*/ -fm10k_disable_aer_comp_abort (pdev); - err =pci_enable_sriov (pdev, num_vfs);if (err) { dev_err(&pdev->dev,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 185/306 net: hns3: bugfix for buffer not free problem during resetting
In reply to Greg Kroah-HartmanFrom: Huazhong Tan <[email protected]>
[ Upstream commit 73b907a083b8a8c1c62cb494bc9fbe6ae086c460 ]
When hns3_get_ring_config()/hns3_queue_to_ring()/ hns3_get_vector_ring_chain() failed during resetting, the allocated memory has not been freed before these three functions return. So this patch adds error handler in these functions to fix it.
--- .../net/ethernet/hisilicon/hns3/hns3_enet.c | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +21 -3
@@ -2547,7 +2547,7 @@ static int hns3_get_vector_ring_chain(struct hns3_enet_tqp_vector *tqp_vector, chain =devm_kzalloc (&pdev->dev,sizeof (*chain),GFP_KERNEL );if (!chain) -return -ENOMEM ; + goto err_free_chain; cur_chain->next = chain; chain->tqp_index = tx_ring->tqp->tqp_index;
@@ -2577,7 +2577,7 @@ static int hns3_get_vector_ring_chain(struct hns3_enet_tqp_vector *tqp_vector,while (rx_ring) { chain =devm_kzalloc (&pdev->dev,sizeof (*chain),GFP_KERNEL );if (!chain) -return -ENOMEM ; + goto err_free_chain; cur_chain->next = chain; chain->tqp_index = rx_ring->tqp->tqp_index;
@@ -2592,6 +2592,16 @@ static int hns3_get_vector_ring_chain(struct hns3_enet_tqp_vector *tqp_vector, }return 0 ; + +err_free_chain: + cur_chain = head->next; +while (cur_chain) { + chain = cur_chain->next; +devm_kfree (&pdev->dev, chain); + cur_chain = chain; + } + +return -ENOMEM ; } static void hns3_free_vector_ring_chain(struct hns3_enet_tqp_vector *tqp_vector,
@@ -2836,8 +2846,10 @@ static int hns3_queue_to_ring(struct hnae3_queue *tqp,return ret; ret =hns3_ring_get_cfg (tqp, priv,HNAE3_RING_TYPE_RX ); -if (ret) +if (ret) { +devm_kfree (priv->dev, priv->ring_data[tqp->tqp_index].ring);return ret; + }return 0 ; }
@@ -2864,6 +2876,12 @@ static int hns3_get_ring_config(struct hns3_nic_priv *priv)return 0 ; err: +while (i--) { +devm_kfree (priv->dev, priv->ring_data[i].ring); +devm_kfree (priv->dev, + priv->ring_data[i + h->kinfo.num_tqps].ring); + } +devm_kfree (&pdev->dev, priv->ring_data);return ret; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 186/306 net: hns3: bugfix for reporting unknown vector0 interrupt repeatly problem
In reply to Greg Kroah-HartmanFrom: Huazhong Tan <[email protected]>
[ Upstream commit 0d4411408a7fb9aad0645f23911d9bfdd2ce3177 ]
The current driver supports handling two vector0 interrupts, reset and mailbox. When the hardware reports an interrupt of another type of interrupt source, if the driver does not process the interrupt, but enables the interrupt, the hardware will repeatedly report the unknown interrupt.
Therefore, the driver enables the vector0 interrupt after clearing the known type of interrupt source. Other conditions are not enabled.
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +1 -1
@@ -2574,7 +2574,7 @@ static irqreturn_t hclge_misc_irq_handle(int irq, void *data) }/* clear the source of interrupt if it is not cause by reset */ -if (event_cause !=HCLGE_VECTOR0_EVENT_RST ) { +if (event_cause ==HCLGE_VECTOR0_EVENT_MBX ) {hclge_clear_event_cause (hdev, event_cause, clearval);hclge_enable_vector (&hdev->misc_vector, true); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 147/306 fs/ocfs2/dlm/dlmdebug.c: fix a sleep-in-atomic-context bug in dlm_print_one_mle()
In reply to Greg Kroah-HartmanFrom: Jia-Ju Bai <[email protected]>
[ Upstream commit 999865764f5f128896402572b439269acb471022 ]
The kernel module may sleep with holding a spinlock.
The function call paths (from bottom to top) in Linux-4.16 are:
[FUNC] get_zeroed_page(GFP_NOFS) fs/ocfs2/dlm/dlmdebug.c, 332: get_zeroed_page in dlm_print_one_mle fs/ocfs2/dlm/dlmmaster.c, 240: dlm_print_one_mle in __dlm_put_mle fs/ocfs2/dlm/dlmmaster.c, 255: __dlm_put_mle in dlm_put_mle fs/ocfs2/dlm/dlmmaster.c, 254: spin_lock in dlm_put_ml
[FUNC] get_zeroed_page(GFP_NOFS) fs/ocfs2/dlm/dlmdebug.c, 332: get_zeroed_page in dlm_print_one_mle fs/ocfs2/dlm/dlmmaster.c, 240: dlm_print_one_mle in __dlm_put_mle fs/ocfs2/dlm/dlmmaster.c, 222: __dlm_put_mle in dlm_put_mle_inuse fs/ocfs2/dlm/dlmmaster.c, 219: spin_lock in dlm_put_mle_inuse
To fix this bug, GFP_NOFS is replaced with GFP_ATOMIC.
This bug is found by my static analysis tool DSAC.
--- fs/ocfs2/dlm/dlmdebug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/dlm/dlmdebug.c +1 -1
@@ -329,7 +329,7 @@ void dlm_print_one_mle(struct dlm_master_list_entry *mle) {char *buf; - buf = (char *)get_zeroed_page (GFP_NOFS ); + buf = (char *)get_zeroed_page (GFP_ATOMIC );if (buf) {dump_mle (mle, buf,PAGE_SIZE -1 );free_page ((unsigned long )buf);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 149/306 tools/testing/selftests/vm/gup_benchmark.c: fix write flag usage
In reply to Greg Kroah-HartmanFrom: Keith Busch <[email protected]>
[ Upstream commit 319e0bec1aecb36c5ac6d23812af487ff2c8f47f ]
If the '-w' parameter was provided, the benchmark would exit due to a mssing 'break'.
--- tools/testing/selftests/vm/gup_benchmark.c | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/vm/gup_benchmark.c +1 -0
@@ -51,6 +51,7 @@ int main(int argc, char **argv)break ;case 'w' : write =1 ; +break ;default :return -1 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 150/306 mm: thp: fix MADV_DONTNEED vs migrate_misplaced_transhuge_page race condition
In reply to Greg Kroah-HartmanFrom: Andrea Arcangeli <[email protected]>
[ Upstream commit d7c3393413fe7e7dc54498ea200ea94742d61e18 ]
Patch series "migrate_misplaced_transhuge_page race conditions".
Aaron found a new instance of the THP MADV_DONTNEED race against pmdp_clear_flush* variants, that was apparently left unfixed.
While looking into the race found by Aaron, I may have found two more issues in migrate_misplaced_transhuge_page.
These race conditions would not cause kernel instability, but they'd corrupt userland data or leave data non zero after MADV_DONTNEED.
I did only minor testing, and I don't expect to be able to reproduce this (especially the lack of ->invalidate_range before migrate_page_copy, requires the latest iommu hardware or infiniband to reproduce). The last patch is noop for x86 and it needs further review from maintainers of archs that implement flush_cache_range() (not in CC yet).
To avoid confusion, it's not the first patch that introduces the bug fixed in the second patch, even before removing the pmdp_huge_clear_flush_notify, that _notify suffix was called after migrate_page_copy already run.
This patch (of 3):
This is a corollary of ced108037c2aa ("thp: fix MADV_DONTNEED vs. numa balancing race"), 58ceeb6bec8 ("thp: fix MADV_DONTNEED vs. MADV_FREE race") and 5b7abeae3af8c ("thp: fix MADV_DONTNEED vs clear soft dirty race).
When the above three fixes where posted Dave asked
https://lkml.kernel.org/r/[email protected]
but apparently this was missed.
The pmdp_clear_flush* in migrate_misplaced_transhuge_page() was introduced in a54a407fbf7 ("mm: Close races between THP migration and PMD numa clearing").
The important part of such commit is only the part where the page lock is not released until the first do_huge_pmd_numa_page() finished disarming the pagenuma/protnone.
The addition of pmdp_clear_flush() wasn't beneficial to such commit and there's no commentary about such an addition either.
I guess the pmdp_clear_flush() in such commit was added just in case for safety, but it ended up introducing the MADV_DONTNEED race condition found by Aaron.
At that point in time nobody thought of such kind of MADV_DONTNEED race conditions yet (they were fixed later) so the code may have looked more robust by adding the pmdp_clear_flush().
This specific race condition won't destabilize the kernel, but it can confuse userland because after MADV_DONTNEED the memory won't be zeroed out.
This also optimizes the code and removes a superfluous TLB flush.
--- mm/migrate.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-)
mm/migrate.c +18 -7
@@ -2048,15 +2048,26 @@ int migrate_misplaced_transhuge_page(struct mm_struct *mm, entry =maybe_pmd_mkwrite (pmd_mkdirty (entry), vma);/* -* Clear the old entry under pagetable lock and establish the new PTE. -* Any parallel GUP will either observe the old page blocking on the -* page lock, block on the page table lock or observe the new page. -* The SetPageUptodate on the new page and page_add_new_anon_rmap -* guarantee the copy is visible before the pagetable update. +* Overwrite the old entry under pagetable lock and establish +* the new PTE. Any parallel GUP will either observe the old +* page blocking on the page lock, block on the page table +* lock or observe the new page. The SetPageUptodate on the +* new page and page_add_new_anon_rmap guarantee the copy is +* visible before the pagetable update. */ flush_cache_range (vma, mmun_start, mmun_end);page_add_anon_rmap (new_page, vma, mmun_start, true); -pmdp_huge_clear_flush_notify (vma, mmun_start, pmd); +/* +* At this point the pmd is numa/protnone (i.e. non present) and the TLB +* has already been flushed globally. So no TLB can be currently +* caching this non present pmd mapping. There's no need to clear the +* pmd before doing set_pmd_at(), nor to flush the TLB after +* set_pmd_at(). Clearing the pmd here would introduce a race +* condition against MADV_DONTNEED, because MADV_DONTNEED only holds the +* mmap_sem for reading. If the pmd is set to NULL at any given time, +* MADV_DONTNEED won't wait on the pmd lock and it'll skip clearing this +* pmd. +*/ set_pmd_at (mm, mmun_start, pmd, entry);update_mmu_cache_pmd (vma, address, &entry);
@@ -2070,7 +2081,7 @@ int migrate_misplaced_transhuge_page(struct mm_struct *mm,* No need to double call mmu_notifier->invalidate_range() callback as * the above pmdp_huge_clear_flush_notify() did already call it. */ -mmu_notifier_invalidate_range_only_end (mm, mmun_start, mmun_end); +mmu_notifier_invalidate_range_end (mm, mmun_start, mmun_end);/* Take an "isolate" reference and put new page on the LRU. */ get_page (new_page);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 151/306 macsec: update operstate when lower device changes
In reply to Greg Kroah-HartmanFrom: Sabrina Dubroca <[email protected]>
[ Upstream commit e6ac075882b2afcdf2d5ab328ce4ab42a1eb9593 ]
Like all other virtual devices (macvlan, vlan), the operstate of a macsec device should match the state of its lower device. This is done by calling netif_stacked_transfer_operstate from its netdevice notifier.
We also need to call netif_stacked_transfer_operstate when a new macsec device is created, so that its operstate is set properly. This is only relevant when we try to bring the device up directly when we create it.
Radu Rendec proposed a similar patch, inspired from the 802.1q driver, that included changing the administrative state of the macsec device, instead of just the operstate. This version is similar to what the macvlan driver does, and updates only the operstate.
--- drivers/net/macsec.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/net/macsec.c +17 -0
@@ -3305,6 +3305,9 @@ static int macsec_newlink(struct net *net, struct net_device *dev,if (err <0 ) goto del_dev; +netif_stacked_transfer_operstate (real_dev, dev); +linkwatch_fire_event (dev); + macsec_generation++;return 0 ;
@@ -3489,6 +3492,20 @@ static int macsec_notify(struct notifier_block *this, unsigned long event,return NOTIFY_DONE ;switch (event) { +case NETDEV_DOWN : +case NETDEV_UP : +case NETDEV_CHANGE : { +struct macsec_dev *m, *n; +struct macsec_rxh_data *rxd; + + rxd =macsec_data_rtnl (real_dev); +list_for_each_entry_safe (m, n, &rxd->secys, secys) { +struct net_device *dev = m->secy.netdev; + +netif_stacked_transfer_operstate (real_dev, dev); + } +break ; + }case NETDEV_UNREGISTER : {struct macsec_dev *m, *n;struct macsec_rxh_data *rxd;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 142/306 bpf: devmap: fix wrong interface selection in notifier_call
In reply to Greg Kroah-HartmanFrom: Taehee Yoo <[email protected]>
[ Upstream commit f592f804831f1cf9d1f9966f58c80f150e6829b5 ]
The dev_map_notification() removes interface in devmap if unregistering interface's ifindex is same.
But only checking ifindex is not enough because other netns can have same ifindex. so that wrong interface selection could occurred. Hence netdev pointer comparison code is added.
v2: compare netdev pointer instead of using net_eq() (Daniel Borkmann)
v1: Initial patch
--- kernel/bpf/devmap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/bpf/devmap.c +1 -2
@@ -520,8 +520,7 @@ static int dev_map_notification(struct notifier_block *notifier,struct bpf_dtab_netdev *dev, *odev; dev =READ_ONCE (dtab->netdev_map[i]); -if (!dev || - dev->dev->ifindex != netdev->ifindex) +if (!dev || netdev != dev->dev)continue ; odev =cmpxchg (&dtab->netdev_map[i], dev,NULL );if (dev == odev)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 188/306 net: hns3: bugfix for hclge_mdio_write and hclge_mdio_read
In reply to Greg Kroah-HartmanFrom: Huazhong Tan <[email protected]>
[ Upstream commit 1c12493809924deda6c0834cb2f2c5a6dc786390 ]
When there is a PHY, the driver needs to complete some operations through MDIO during reset reinitialization, so HCLGE_STATE_CMD_DISABLE is more suitable than HCLGE_STATE_RST_HANDLING to prevent the MDIO operation from being sent during the hardware reset.
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c +2 -2
@@ -54,7 +54,7 @@ static int hclge_mdio_write(struct mii_bus *bus, int phyid, int regnum,struct hclge_desc desc;int ret; -if (test_bit (HCLGE_STATE_RST_HANDLING , &hdev->state)) +if (test_bit (HCLGE_STATE_CMD_DISABLE , &hdev->state))return 0 ;hclge_cmd_setup_basic_desc (&desc,HCLGE_OPC_MDIO_CONFIG , false);
@@ -92,7 +92,7 @@ static int hclge_mdio_read(struct mii_bus *bus, int phyid, int regnum)struct hclge_desc desc;int ret; -if (test_bit (HCLGE_STATE_RST_HANDLING , &hdev->state)) +if (test_bit (HCLGE_STATE_CMD_DISABLE , &hdev->state))return 0 ;hclge_cmd_setup_basic_desc (&desc,HCLGE_OPC_MDIO_CONFIG , true);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 197/306 ocfs2: dont use iocb when EIOCBQUEUED returns
In reply to Greg Kroah-HartmanFrom: Changwei Ge <[email protected]>
[ Upstream commit 9e985787750db8aae87f02b67e908f28ac4d6b83 ]
When -EIOCBQUEUED returns, it means that aio_complete() will be called from dio_complete(), which is an asynchronous progress against write_iter. Generally, IO is a very slow progress than executing instruction, but we still can't take the risk to access a freed iocb.
And we do face a BUG crash issue. Using the crash tool, iocb is obviously freed already.
crash> struct -x kiocb ffff881a350f5900
struct kiocb {
ki_filp = 0xffff881a350f5a80,
ki_pos = 0x0,
ki_complete = 0x0,
private = 0x0,
ki_flags = 0x0
}And the backtrace shows:
ocfs2_file_write_iter+0xcaa/0xd00 [ocfs2] aio_run_iocb+0x229/0x2f0 do_io_submit+0x291/0x540 SyS_io_submit+0x10/0x20 system_call_fastpath+0x16/0x75
--- fs/ocfs2/file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ocfs2/file.c +2 -2
@@ -2389,7 +2389,7 @@ static ssize_t ocfs2_file_write_iter(struct kiocb *iocb, written =__generic_file_write_iter (iocb, from);/* buffered aio wouldn't have proper lock coverage today */ -BUG_ON (written == -EIOCBQUEUED && !(iocb->ki_flags &IOCB_DIRECT )); +BUG_ON (written == -EIOCBQUEUED && !direct_io);/* * deep in g_f_a_w_n()->ocfs2_direct_IO we pass in a ocfs2_dio_end_io
@@ -2509,7 +2509,7 @@ static ssize_t ocfs2_file_read_iter(struct kiocb *iocb,trace_generic_file_read_iter_ret (ret);/* buffered aio wouldn't have proper lock coverage today */ -BUG_ON (ret == -EIOCBQUEUED && !(iocb->ki_flags &IOCB_DIRECT )); +BUG_ON (ret == -EIOCBQUEUED && !direct_io);/* see ocfs2_file_write_iter */ if (ret == -EIOCBQUEUED || !ocfs2_iocb_is_rw_locked (iocb)) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 199/306 ocfs2: fix clusters leak in ocfs2_defrag_extent()
In reply to Greg Kroah-HartmanFrom: Larry Chen <[email protected]>
[ Upstream commit 6194ae4242dec0c9d604bc05df83aa9260a899e4 ]
ocfs2_defrag_extent() might leak allocated clusters. When the file system has insufficient space, the number of claimed clusters might be less than the caller wants. If that happens, the original code might directly commit the transaction without returning clusters.
This patch is based on code in ocfs2_add_clusters_in_btree().
--- fs/ocfs2/move_extents.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
fs/ocfs2/move_extents.c +17 -0
@@ -25,6 +25,7 @@#include "ocfs2_ioctl.h" #include "alloc.h" +#include "localalloc.h" #include "aops.h" #include "dlmglue.h" #include "extent_map.h"
@@ -222,6 +223,7 @@ static int ocfs2_defrag_extent(struct ocfs2_move_extents_context *context,struct ocfs2_refcount_tree *ref_tree =NULL ;u32 new_phys_cpos, new_len;u64 phys_blkno =ocfs2_clusters_to_blocks (inode->i_sb, phys_cpos); +int need_free =0 ;if ((ext_flags &OCFS2_EXT_REFCOUNTED ) && *len) {BUG_ON (!ocfs2_is_refcount_inode (inode));
@@ -312,6 +314,7 @@ static int ocfs2_defrag_extent(struct ocfs2_move_extents_context *context,if (!partial) { context->range->me_flags &= ~OCFS2_MOVE_EXT_FL_COMPLETE ; ret = -ENOSPC ; + need_free =1 ; goto out_commit; } }
@@ -336,6 +339,20 @@ static int ocfs2_defrag_extent(struct ocfs2_move_extents_context *context,mlog_errno (ret); out_commit: +if (need_free && context->data_ac) { +struct ocfs2_alloc_context *data_ac = context->data_ac; + +if (context->data_ac->ac_which ==OCFS2_AC_USE_LOCAL ) +ocfs2_free_local_alloc_bits (osb, handle, data_ac, + new_phys_cpos, new_len); +else +ocfs2_free_clusters (handle, + data_ac->ac_inode, + data_ac->ac_bh, +ocfs2_clusters_to_blocks (osb->sb, new_phys_cpos), + new_len); + } +ocfs2_commit_trans (osb, handle); out_unlock_mutex:
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 201/306 sched/topology: Fix off by one bug
In reply to Greg Kroah-HartmanFrom: Peter Zijlstra <[email protected]>
[ Upstream commit 993f0b0510dad98b4e6e39506834dab0d13fd539 ]
With the addition of the NUMA identity level, we increased @level by one and will run off the end of the array in the distance sort loop.
Fixed: 051f3ca02e46 ("sched/topology: Introduce NUMA identity node sched domain")
--- kernel/sched/topology.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/topology.c +1 -1
@@ -1329,7 +1329,7 @@ void sched_init_numa(void)int level =0 ;int i, j, k; - sched_domains_numa_distance =kzalloc (sizeof (int ) * nr_node_ids,GFP_KERNEL ); + sched_domains_numa_distance =kzalloc (sizeof (int ) * (nr_node_ids +1 ),GFP_KERNEL );if (!sched_domains_numa_distance)return ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 202/306 sched/fair: Dont increase sd->balance_interval on newidle balance
In reply to Greg Kroah-HartmanFrom: Valentin Schneider <[email protected]>
[ Upstream commit 3f130a37c442d5c4d66531b240ebe9abfef426b5 ]
When load_balance() fails to move some load because of task affinity, we end up increasing sd->balance_interval to delay the next periodic balance in the hopes that next time we look, that annoying pinned task(s) will be gone.
However, idle_balance() pays no attention to sd->balance_interval, yet it will still lead to an increase in balance_interval in case of pinned tasks.
If we're going through several newidle balances (e.g. we have a periodic task), this can lead to a huge increase of the balance_interval in a very small amount of time.
To prevent that, don't increase the balance interval when going through a newidle balance.
This is a similar approach to what is done in commit 58b26c4c0257 ("sched: Increment cache_nice_tries only on periodic lb"), where we disregard newidle balance and rely on periodic balance for more stable results.
--- kernel/sched/fair.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
kernel/sched/fair.c +11 -2
@@ -8819,13 +8819,22 @@ static int load_balance(int this_cpu, struct rq *this_rq, sd->nr_balance_failed =0 ; out_one_pinned: + ld_moved =0 ; + +/* +* idle_balance() disregards balance intervals, so we could repeatedly +* reach this code, which would lead to balance_interval skyrocketting +* in a short amount of time. Skip the balance_interval increase logic +* to avoid that. +*/ +if (env.idle ==CPU_NEWLY_IDLE ) + goto out; +/* tune up the balancing interval */ if (((env.flags &LBF_ALL_PINNED ) && sd->balance_interval <MAX_PINNED_INTERVAL ) || (sd->balance_interval < sd->max_interval)) sd->balance_interval *=2 ; - - ld_moved =0 ; out:return ld_moved; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 203/306 openvswitch: fix linking without CONFIG_NF_CONNTRACK_LABELS
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit a277d516de5f498c91d91189717ef7e01102ad27 ]
When CONFIG_CC_OPTIMIZE_FOR_DEBUGGING is enabled, the compiler fails to optimize out a dead code path, which leads to a link failure:
net/openvswitch/conntrack.o: In function `ovs_ct_set_labels':
conntrack.c:(.text+0x2e60): undefined reference to `nf_connlabels_replace'
In this configuration, we can take a shortcut, and completely remove the contrack label code. This may also help the regular optimization.
--- net/openvswitch/conntrack.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/openvswitch/conntrack.c +2 -1
@@ -1199,7 +1199,8 @@ static int ovs_ct_commit(struct net *net, struct sw_flow_key *key, &info->labels.mask);if (err)return err; - }else if (labels_nonzero (&info->labels.mask)) { + }else if (IS_ENABLED (CONFIG_NF_CONNTRACK_LABELS ) && +labels_nonzero (&info->labels.mask)) { err =ovs_ct_set_labels (ct, key, &info->labels.value, &info->labels.mask);if (err)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 205/306 clk: sunxi-ng: enable so-said LDOs for A64 SoCs pll-mipi clock
In reply to Greg Kroah-HartmanFrom: Icenowy Zheng <[email protected]>
[ Upstream commit 859783d1390035e29ba850963bded2b4ffdf43b5 ]
In the user manual of A64 SoC, the bit 22 and 23 of pll-mipi control register is called "LDO{1,2}_EN", and according to the BSP source code from Allwinner , the LDOs are enabled during the clock's enabling process.
The clock failed to generate output if the two LDOs are not enabled.
Add the two bits to the clock's gate bits, so that the LDOs are enabled when the PLL is enabled.
--- drivers/clk/sunxi-ng/ccu-sun50i-a64.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/clk/sunxi-ng/ccu-sun50i-a64.c +6 -1
@@ -158,7 +158,12 @@ static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_gpu_clk, "pll-gpu",#define SUN50I_A64_PLL_MIPI_REG 0x040static struct ccu_nkm pll_mipi_clk = { - .enable =BIT (31 ), +/* +* The bit 23 and 22 are called "LDO{1,2}_EN" on the SoC's +* user manual, and by experiments the PLL doesn't work without +* these bits toggled. +*/ + .enable =BIT (31 ) |BIT (23 ) |BIT (22 ), .lock =BIT (28 ), .n =_SUNXI_CCU_MULT (8 ,4 ), .k =_SUNXI_CCU_MULT_MIN (4 ,2 ,2 ),
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 189/306 ntb_netdev: fix sleep time mismatch
In reply to Greg Kroah-HartmanFrom: Jon Mason <[email protected]>
[ Upstream commit a861594b1b7ffd630f335b351c4e9f938feadb8e ]
The tx_time should be in usecs (according to the comment above the variable), but the setting of the timer during the rearming is done in msecs. Change it to match the expected units.
--- drivers/net/ntb_netdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ntb_netdev.c +1 -1
@@ -236,7 +236,7 @@ static void ntb_netdev_tx_timer(struct timer_list *t)struct net_device *ndev = dev->ndev;if (ntb_transport_tx_free_entry (dev->qp) < tx_stop) { -mod_timer (&dev->tx_timer, jiffies +msecs_to_jiffies (tx_time)); +mod_timer (&dev->tx_timer, jiffies +usecs_to_jiffies (tx_time)); }else {/* Make sure anybody stopping the queue after this sees the new * value of ntb_transport_tx_free_entry()
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 207/306 audit: print empty EXECVE args
In reply to Greg Kroah-HartmanFrom: Richard Guy Briggs <[email protected]>
[ Upstream commit ea956d8be91edc702a98b7fe1f9463e7ca8c42ab ]
Empty executable arguments were being skipped when printing out the list of arguments in an EXECVE record, making it appear they were somehow lost. Include empty arguments as an itemized empty string.
Reproducer:
autrace /bin/ls "" "/etc" ausearch --start recent -m execve -i | grep EXECVE type=EXECVE msg=audit(10/03/2018 13:04:03.208:1391) : argc=3 a0=/bin/ls a2=/etc
With fix:
type=EXECVE msg=audit(10/03/2018 21:51:38.290:194) : argc=3 a0=/bin/ls a1= a2=/etc type=EXECVE msg=audit(1538617898.290:194): argc=3 a0="/bin/ls" a1="" a2="/etc"
Passes audit-testsuite. GH issue tracker at
https://github.com/linux-audit/audit-kernel/issues/99
--- kernel/auditsc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/auditsc.c +1 -1
@@ -1107,7 +1107,7 @@ static void audit_log_execve_info(struct audit_context *context, }/* write as much as we can to the audit log */ -if (len_buf >0 ) { +if (len_buf >=0 ) {/* NOTE: some magic numbers here - basically if we * can't fit a reasonable amount of data into the * existing audit buffer, flush it and start with
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 210/306 nds32: Fix bug in bitfield.h
In reply to Greg Kroah-HartmanFrom: Nickhu <[email protected]>
[ Upstream commit 9aaafac8cffa1c1edb66e19a63841b7c86be07ca ]
There two bitfield bug for perfomance counter
in bitfield.h:
PFM_CTL_offSEL1 21 --> 16 PFM_CTL_offSEL2 27 --> 22
This commit fix it.
--- arch/nds32/include/asm/bitfield.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/nds32/include/asm/bitfield.h +2 -2
@@ -692,8 +692,8 @@#define PFM_CTL_offKU1 13/* Enable user mode event counting for PFMC1 */ #define PFM_CTL_offKU2 14/* Enable user mode event counting for PFMC2 */ #define PFM_CTL_offSEL0 15/* The event selection for PFMC0 */ -#define PFM_CTL_offSEL1 21/* The event selection for PFMC1 */ -#define PFM_CTL_offSEL2 27/* The event selection for PFMC2 */ +#define PFM_CTL_offSEL1 16/* The event selection for PFMC1 */ +#define PFM_CTL_offSEL2 22/* The event selection for PFMC2 */ /* bit 28:31 reserved */ #define PFM_CTL_mskEN0 ( 0x01 << PFM_CTL_offEN0 )
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 209/306 net: bpfilter: fix iptables failure if bpfilter_umh is disabled
In reply to Greg Kroah-HartmanFrom: Taehee Yoo <[email protected]>
[ Upstream commit 97adaddaa6db7a8af81b9b11e30cbe3628cd6700 ]
When iptables command is executed, ip_{set/get}sockopt() try to upload bpfilter.ko if bpfilter is enabled. if it couldn't find bpfilter.ko, command is failed.
bpfilter.ko is generated if CONFIG_BPFILTER_UMH is enabled. ip_{set/get}sockopt() only checks CONFIG_BPFILTER.
So that if CONFIG_BPFILTER is enabled and CONFIG_BPFILTER_UMH is disabled, iptables command is always failed.
test config:
CONFIG_BPFILTER=y
# CONFIG_BPFILTER_UMH is not set
test command:
%iptables -L
iptables: No chain/target/match by that name.
--- net/ipv4/ip_sockglue.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/ipv4/ip_sockglue.c +3 -3
@@ -1244,7 +1244,7 @@ int ip_setsockopt(struct sock *sk, int level,return -ENOPROTOOPT ; err =do_ip_setsockopt (sk, level, optname, optval, optlen); -#ifdef CONFIG_BPFILTER +#if IS_ENABLED (CONFIG_BPFILTER_UMH )if (optname >=BPFILTER_IPT_SO_SET_REPLACE && optname <BPFILTER_IPT_SET_MAX ) err =bpfilter_ip_set_sockopt (sk, optname, optval, optlen);
@@ -1557,7 +1557,7 @@ int ip_getsockopt(struct sock *sk, int level,int err; err =do_ip_getsockopt (sk, level, optname, optval, optlen,0 ); -#ifdef CONFIG_BPFILTER +#if IS_ENABLED (CONFIG_BPFILTER_UMH )if (optname >=BPFILTER_IPT_SO_GET_INFO && optname <BPFILTER_IPT_GET_MAX ) err =bpfilter_ip_get_sockopt (sk, optname, optval, optlen);
@@ -1594,7 +1594,7 @@ int compat_ip_getsockopt(struct sock *sk, int level, int optname, err =do_ip_getsockopt (sk, level, optname, optval, optlen,MSG_CMSG_COMPAT ); -#ifdef CONFIG_BPFILTER +#if IS_ENABLED (CONFIG_BPFILTER_UMH )if (optname >=BPFILTER_IPT_SO_GET_INFO && optname <BPFILTER_IPT_GET_MAX ) err =bpfilter_ip_get_sockopt (sk, optname, optval, optlen);
Signature · 1 line
2.20.1