iwlwifi: mvm: check for short GI only for OFDM
Subsystems (4)
Sasha Levin
maintainerPATCH 1/46 iwlwifi: mvm: check for short GI only for OFDM
From: Sara Sharon <[email protected]>
[ Upstream commit 4c59ff5a9a9c54cc26c807dc2fa6933f7e9fa4ef ]
This bit will be used in CCK to indicate short preamble.
--- drivers/net/wireless/intel/iwlwifi/mvm/rx.c | 3 ++- drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/rx.c +2 -1
@@ -439,7 +439,8 @@ void iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct napi_struct *napi, rx_status->bw =RATE_INFO_BW_160 ;break ; } -if (rate_n_flags &RATE_MCS_SGI_MSK ) +if (!(rate_n_flags &RATE_MCS_CCK_MSK ) && + rate_n_flags &RATE_MCS_SGI_MSK ) rx_status->enc_flags |=RX_ENC_FLAG_SHORT_GI ;if (rate_n_flags &RATE_HT_MCS_GF_MSK ) rx_status->enc_flags |=RX_ENC_FLAG_HT_GF ;
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c +3 -1
@@ -981,7 +981,9 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi, rx_status->bw =RATE_INFO_BW_160 ;break ; } -if (rate_n_flags &RATE_MCS_SGI_MSK ) + +if (!(rate_n_flags &RATE_MCS_CCK_MSK ) && + rate_n_flags &RATE_MCS_SGI_MSK ) rx_status->enc_flags |=RX_ENC_FLAG_SHORT_GI ;if (rate_n_flags &RATE_HT_MCS_GF_MSK ) rx_status->enc_flags |=RX_ENC_FLAG_HT_GF ;
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 2/46 iwlwifi: dbg: allow wrt collection before ALIVE
From: Liad Kaufman <[email protected]>
[ Upstream commit dfd4b08cf44f27587e2053e006e43a1603328006 ]
Even if no ALIVE was received, the WRT data can still be collected. Add this.
--- drivers/net/wireless/intel/iwlwifi/fw/dbg.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/fw/dbg.c +14 -1
@@ -950,7 +950,20 @@ int iwl_fw_dbg_collect_desc(struct iwl_fw_runtime *fwrt,if (trigger) delay =msecs_to_jiffies (le32_to_cpu (trigger->stop_delay)); -if (WARN (fwrt->trans->state ==IWL_TRANS_NO_FW , +/* +* If the loading of the FW completed successfully, the next step is to +* get the SMEM config data. Thus, if fwrt->smem_cfg.num_lmacs is non +* zero, the FW was already loaded successully. If the state is "NO_FW" +* in such a case - WARN and exit, since FW may be dead. Otherwise, we +* can try to collect the data, since FW might just not be fully +* loaded (no "ALIVE" yet), and the debug data is accessible. +* +* Corner case: got the FW alive but crashed before getting the SMEM +* config. In such a case, due to HW access problems, we might +* collect garbage. +*/ +if (WARN ((fwrt->trans->state ==IWL_TRANS_NO_FW ) && + fwrt->smem_cfg.num_lmacs,"Can't collect dbg data when FW isn't alive\n" ))return -EIO ;
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 3/46 iwlwifi: fix the ALIVE notification layout
In reply to Sasha LevinFrom: Emmanuel Grumbach <[email protected]>
[ Upstream commit 5cd2d8fc6c6bca979ac5dd8ad0e41153f1f982f9 ]
The ucode_major and ucode_minor were swapped. This has no practical consequences since those fields are not used. Same goes for umac_major and umac_minor which were only printed under certain debug flags.
--- drivers/net/wireless/intel/iwlwifi/fw/api/alive.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/api/alive.h +2 -2
@@ -95,8 +95,8 @@ enum {#define IWL_ALIVE_FLG_RFKILL BIT(0)struct iwl_lmac_alive { -__le32 ucode_minor;__le32 ucode_major; +__le32 ucode_minor;u8 ver_subtype;u8 ver_type;u8 mac;
@@ -113,8 +113,8 @@ struct iwl_lmac_alive { } __packed;/* UCODE_ALIVE_NTFY_API_S_VER_3 */ struct iwl_umac_alive { -__le32 umac_minor;/* UMAC version: minor */ __le32 umac_major;/* UMAC version: major */ +__le32 umac_minor;/* UMAC version: minor */ __le32 error_info_addr;/* SRAM address for UMAC error log */ __le32 dbg_print_buff_addr; } __packed;/* UMAC_ALIVE_DATA_API_S_VER_2 */
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 4/46 x86/power: Fix some ordering bugs in __restore_processor_context()
In reply to Sasha LevinFrom: Andy Lutomirski <[email protected]>
[ Upstream commit 5b06bbcfc2c621da3009da8decb7511500c293ed ]
__restore_processor_context() had a couple of ordering bugs. It restored GSBASE after calling load_gs_index(), and the latter can call into tracing code. It also tried to restore segment registers before restoring the LDT, which is straight-up wrong.
Reorder the code so that we restore GSBASE, then the descriptor tables, then the segments.
This fixes two bugs. First, it fixes a regression that broke resume under certain configurations due to irqflag tracing in native_load_gs_index(). Second, it fixes resume when the userspace process that initiated suspect had funny segments. The latter can be reproduced by compiling this:
// SPDX-License-Identifier: GPL-2.0
/*
* ldt_echo.c - Echo argv[1] while using an LDT segment */
int main(int argc, char **argv)
{
int ret;
size_t len;
char *buf;
const struct user_desc desc = {
.entry_number = 0,
.base_addr = 0,
.limit = 0xfffff,
.seg_32bit = 1,
.contents = 0, /* Data, grow-up */
.read_exec_only = 0,
.limit_in_pages = 1,
.seg_not_present = 0,
.useable = 0
};
if (argc != 2)
errx(1, "Usage: %s STRING", argv[0]);
len = asprintf(&buf, "%s\n", argv[1]);
if (len < 0)
errx(1, "Out of memory");
ret = syscall(SYS_modify_ldt, 1, &desc, sizeof(desc));
if (ret < -1)
errno = -ret;
if (ret)
err(1, "modify_ldt");
asm volatile ("movw %0, %%es" :: "rm" ((unsigned short)7));
write(1, buf, len);
return 0;
}and running ldt_echo >/sys/power/mem
Without the fix, the latter causes a triple fault on resume.
--- arch/x86/power/cpu.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
arch/x86/power/cpu.c +17 -4
@@ -228,8 +228,20 @@ static void notrace __restore_processor_state(struct saved_context *ctxt)load_idt ((const struct desc_ptr *)&ctxt->idt_limit);#endif +#ifdef CONFIG_X86_64 /* -* segment registers +* We need GSBASE restored before percpu access can work. +* percpu access can happen in exception handlers or in complicated +* helpers like load_gs_index(). +*/ +wrmsrl (MSR_GS_BASE , ctxt->gs_base); +#endif + +fix_processor_context (); + +/* +* Restore segment registers. This happens after restoring the GDT +* and LDT, which happen in fix_processor_context(). */ #ifdef CONFIG_X86_32 loadsegment (es, ctxt->es);
@@ -250,13 +262,14 @@ static void notrace __restore_processor_state(struct saved_context *ctxt)load_gs_index (ctxt->gs); asmvolatile ("movw %0, %%ss" ::"r" (ctxt->ss)); +/* +* Restore FSBASE and user GSBASE after reloading the respective +* segment selectors. +*/ wrmsrl (MSR_FS_BASE , ctxt->fs_base); -wrmsrl (MSR_GS_BASE , ctxt->gs_base);wrmsrl (MSR_KERNEL_GS_BASE , ctxt->gs_kernel_base);#endif -fix_processor_context (); -do_fpu_end ();tsc_verify_tsc_adjust (true); x86_platform.restore_sched_clock_state ();
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 5/46 tools/testing/nvdimm: unit test clear-error commands
In reply to Sasha LevinFrom: Dan Williams <[email protected]>
[ Upstream commit fb2a1748355161e050e9f49f1ea9a0ae707a148b ]
Validate command parsing in acpi_nfit_ctl for the clear error command. This tests for a crash condition introduced by commit 4b27db7e26cd "acpi, nfit: add support for the _LSI, _LSR, and _LSW label methods".
--- tools/testing/nvdimm/test/nfit.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
tools/testing/nvdimm/test/nfit.c +18 -0
@@ -1589,6 +1589,7 @@ static int nfit_ctl_test(struct device *dev)unsigned long mask, cmd_size, offset;union {struct nd_cmd_get_config_size cfg_size; +struct nd_cmd_clear_error clear_err;struct nd_cmd_ars_status ars_stat;struct nd_cmd_ars_cap ars_cap; char buf[sizeof(struct nd_cmd_ars_status)
@@ -1767,6 +1768,23 @@ static int nfit_ctl_test(struct device *dev)return -EIO ; } +/* test clear error */ + cmd_size =sizeof (cmds.clear_err); + cmds.clear_err = (struct nd_cmd_clear_error ) { + .length =512 , + .cleared =512 , + }; + rc =setup_result (cmds.buf, cmd_size); +if (rc) +return rc; + rc =acpi_nfit_ctl (&acpi_desc->nd_desc,NULL ,ND_CMD_CLEAR_ERROR , + cmds.buf, cmd_size, &cmd_rc); +if (rc <0 || cmd_rc) { +dev_dbg (dev,"%s: failed at: %d rc: %d cmd_rc: %d\n" , + __func__, __LINE__, rc, cmd_rc); +return -EIO ; + } +return 0 ; }
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 6/46 usbip: vhci_hcd: update 'status' file header and format
In reply to Sasha LevinFrom: Shuah Khan <[email protected]>
[ Upstream commit 5468099c747240ed97dbb34340fece8ca87be34f ]
Commit 2f2d0088eb93
("usbip: prevent vhci_hcd driver from leaking a socket pointer address") in the /sys/devices/platform/vhci_hcd/status.
Fix the header and field alignment to reflect the changes and make it easier to read.
--- drivers/usb/usbip/vhci_sysfs.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/usb/usbip/vhci_sysfs.c +6 -6
@@ -34,10 +34,10 @@/* * output example: -* hub port sta spd dev sockfd local_busid -* hs 0000 004 000 00000000 3 1-2.3 +* hub port sta spd dev sockfd local_busid +* hs 0000 004 000 00000000 000003 1-2.3 * ................................................ -* ss 0008 004 000 00000000 4 2-3.4 +* ss 0008 004 000 00000000 000004 2-3.4 * ................................................ * * Output includes socket fd instead of socket pointer address to avoid
@@ -61,13 +61,13 @@ static void port_show_vhci(char **out, int hub, int port, struct vhci_device *vdif (vdev->ud.status ==VDEV_ST_USED ) { *out +=sprintf (*out,"%03u %08x " , vdev->speed, vdev->devid); - *out +=sprintf (*out,"%u %s" , + *out +=sprintf (*out,"%06u %s" , vdev->ud.sockfd,dev_name (&vdev->udev->dev)); }else { *out +=sprintf (*out,"000 00000000 " ); - *out +=sprintf (*out,"0000000000000000 0-0" ); + *out +=sprintf (*out,"000000 0-0" ); } *out +=sprintf (*out,"\n" );
@@ -165,7 +165,7 @@ static ssize_t status_show(struct device *dev,int pdev_nr; out +=sprintf (out, -"hub port sta spd dev socket local_busid\n" ); +"hub port sta spd dev sockfd local_busid\n" ); pdev_nr =status_name_to_id (attr->attr.name);if (pdev_nr <0 )
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 7/46 scsi: aacraid: address UBSAN warning regression
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit d18539754d97876503275efc7d00a1901bb0cfad ]
As reported by Meelis Roos, my previous patch causes an incorrect calculation of the timeout, through an undefined signed integer overflow:
[ 12.228155] UBSAN: Undefined behaviour in drivers/scsi/aacraid/commsup.c:2514:49 [ 12.228229] signed integer overflow: [ 12.228283] 964297611 * 250 cannot be represented in type 'long int'
The problem is that doing a multiplication with HZ first and then dividing by USEC_PER_SEC worked correctly for 32-bit microseconds, but not for 32-bit nanoseconds, which would require up to 41 bits.
This reworks the calculation to first convert the nanoseconds into jiffies, which should give us the same result as before and not overflow.
Unfortunately I did not understand the exact intention of the algorithm, in particular the part where we add half a second, so it's possible that there is still a preexisting problem in this function. I added a comment that this would be handled more nicely using usleep_range(), which generally works better for waking up at a particular time than the current schedule_timeout() based implementation. I did not feel comfortable trying to implement that without being sure what the intent is here though.
--- drivers/scsi/aacraid/commsup.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/scsi/aacraid/commsup.c +6 -2
@@ -2506,8 +2506,8 @@ int aac_command_thread(void *data)/* Synchronize our watches */ if (((NSEC_PER_SEC - (NSEC_PER_SEC /HZ )) > now.tv_nsec) && (now.tv_nsec > (NSEC_PER_SEC /HZ ))) - difference = (((NSEC_PER_SEC - now.tv_nsec) *HZ ) - +NSEC_PER_SEC /2 ) /NSEC_PER_SEC ; + difference =HZ +HZ /2 - + now.tv_nsec / (NSEC_PER_SEC /HZ );else {if (now.tv_nsec >NSEC_PER_SEC /2 ) ++now.tv_sec;
@@ -2531,6 +2531,10 @@ int aac_command_thread(void *data)if (kthread_should_stop ())break ; +/* +* we probably want usleep_range() here instead of the +* jiffies computation +*/ schedule_timeout (difference);if (kthread_should_stop ())
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 8/46 IB/ipoib: Fix lockdep issue found on ipoib_ib_dev_heavy_flush
In reply to Sasha LevinFrom: Alex Vesker <[email protected]>
[ Upstream commit 1f80bd6a6cc8358b81194e1f5fc16449947396ec ]
The locking order of vlan_rwsem (LOCK A) and then rtnl (LOCK B), contradicts other flows such as ipoib_open possibly causing a deadlock. To prevent this deadlock heavy flush is called with RTNL locked and only then tries to acquire vlan_rwsem.
This deadlock is possible only when there are child interfaces.
[ 140.941758] ======================================================
[ 140.946276] WARNING: possible circular locking dependency detected
[ 140.950950] 4.15.0-rc1+ #9 Tainted: G O
[ 140.954797] ------------------------------------------------------
[ 140.959424] kworker/u32:1/146 is trying to acquire lock:
[ 140.963450] (rtnl_mutex){+.+.}, at: [<ffffffffc083516a>] __ipoib_ib_dev_flush+0x2da/0x4e0 [ib_ipoib]
[ 140.970006]
but task is already holding lock:
[ 140.975141] (&priv->vlan_rwsem){++++}, at: [<ffffffffc0834ee1>] __ipoib_ib_dev_flush+0x51/0x4e0 [ib_ipoib]
[ 140.982105]
which lock already depends on the new lock.
[ 140.990023]
the existing dependency chain (in reverse order) is:
[ 140.998650]
-> #1 (&priv->vlan_rwsem){++++}:
[ 141.005276] down_read+0x4d/0xb0
[ 141.009560] ipoib_open+0xad/0x120 [ib_ipoib]
[ 141.014400] __dev_open+0xcb/0x140
[ 141.017919] __dev_change_flags+0x1a4/0x1e0
[ 141.022133] dev_change_flags+0x23/0x60
[ 141.025695] devinet_ioctl+0x704/0x7d0
[ 141.029156] sock_do_ioctl+0x20/0x50
[ 141.032526] sock_ioctl+0x221/0x300
[ 141.036079] do_vfs_ioctl+0xa6/0x6d0
[ 141.039656] SyS_ioctl+0x74/0x80
[ 141.042811] entry_SYSCALL_64_fastpath+0x1f/0x96
[ 141.046891]
-> #0 (rtnl_mutex){+.+.}:
[ 141.051701] lock_acquire+0xd4/0x220
[ 141.055212] __mutex_lock+0x88/0x970
[ 141.058631] __ipoib_ib_dev_flush+0x2da/0x4e0 [ib_ipoib]
[ 141.063160] __ipoib_ib_dev_flush+0x71/0x4e0 [ib_ipoib]
[ 141.067648] process_one_work+0x1f5/0x610
[ 141.071429] worker_thread+0x4a/0x3f0
[ 141.074890] kthread+0x141/0x180
[ 141.078085] ret_from_fork+0x24/0x30
[ 141.081559]other info that might help us debug this:
[ 141.088967] Possible unsafe locking scenario: [ 141.094280] CPU0 CPU1 [ 141.097953] ---- ---- [ 141.101640] lock(&priv->vlan_rwsem); [ 141.104771] lock(rtnl_mutex); [ 141.109207] lock(&priv->vlan_rwsem); [ 141.114032] lock(rtnl_mutex); [ 141.116800] *** DEADLOCK ***
--- drivers/infiniband/ulp/ipoib/ipoib_ib.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/infiniband/ulp/ipoib/ipoib_ib.c +3 -4
@@ -1203,13 +1203,10 @@ static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv,ipoib_ib_dev_down (dev);if (level ==IPOIB_FLUSH_HEAVY ) { -rtnl_lock ();if (test_bit (IPOIB_FLAG_INITIALIZED , &priv->flags))ipoib_ib_dev_stop (dev); - result =ipoib_ib_dev_open (dev); -rtnl_unlock (); -if (result) +if (ipoib_ib_dev_open (dev))return ;if (netif_queue_stopped (dev))
@@ -1249,7 +1246,9 @@ void ipoib_ib_dev_flush_heavy(struct work_struct *work)struct ipoib_dev_priv *priv = container_of(work, struct ipoib_dev_priv, flush_heavy); +rtnl_lock ();__ipoib_ib_dev_flush (priv,IPOIB_FLUSH_HEAVY ,0 ); +rtnl_unlock (); }void ipoib_ib_dev_cleanup (struct net_device *dev)
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 9/46 IB/rxe: put the pool on allocation failure
In reply to Sasha LevinFrom: Doug Ledford <[email protected]>
[ Upstream commit 6b9f8970cd30929cb6b372fa44fa66da9e59c650 ]
If the allocation of elem fails, it is not sufficient to simply check for NULL and return. We need to also put our reference on the pool or else we will leave the pool with a permanent ref count and we will never be able to free it.
--- drivers/infiniband/sw/rxe/rxe_pool.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/infiniband/sw/rxe/rxe_pool.c +9 -7
@@ -394,23 +394,25 @@ void *rxe_alloc(struct rxe_pool *pool)kref_get (&pool->rxe->ref_cnt); -if (atomic_inc_return (&pool->num_elem) > pool->max_elem) { -atomic_dec (&pool->num_elem); -rxe_dev_put (pool->rxe); -rxe_pool_put (pool); -return NULL ; - } +if (atomic_inc_return (&pool->num_elem) > pool->max_elem) + goto out_put_pool; elem =kmem_cache_zalloc (pool_cache (pool), (pool->flags &RXE_POOL_ATOMIC ) ?GFP_ATOMIC :GFP_KERNEL );if (!elem) -return NULL ; + goto out_put_pool; elem->pool = pool;kref_init (&elem->ref_cnt);return elem; + +out_put_pool: +atomic_dec (&pool->num_elem); +rxe_dev_put (pool->rxe); +rxe_pool_put (pool); +return NULL ; }void rxe_elem_release (struct kref *kref)
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 10/46 s390/qeth: fix error handling in adapter command callbacks
In reply to Sasha LevinFrom: Julian Wiedmann <[email protected]>
[ Upstream commit 686c97ee29c886ee07d17987d0059874c5c3b5af ]
Make sure to check both return code fields before(!) processing the command response. Otherwise we risk operating on invalid data.
This matches an earlier fix for SETASSPARMS commands, see
commit ad3cbf613329 ("s390/qeth: fix error handling in checksum cmd callback").
--- drivers/s390/net/qeth_core_main.c | 85 ++++++++++++++----------------- 1 file changed, 37 insertions(+), 48 deletions(-)
drivers/s390/net/qeth_core_main.c +37 -48
@@ -3001,28 +3001,23 @@ static int qeth_send_startlan(struct qeth_card *card)return rc; } -static int qeth_default_setadapterparms_cb (struct qeth_card *card, -struct qeth_reply *reply,unsigned long data) +static int qeth_setadpparms_inspect_rc (struct qeth_ipa_cmd *cmd) { -struct qeth_ipa_cmd *cmd; - -QETH_CARD_TEXT (card,4 ,"defadpcb" ); - - cmd = (struct qeth_ipa_cmd *) data; -if (cmd->hdr.return_code ==0 ) +if (!cmd->hdr.return_code) cmd->hdr.return_code = cmd->data.setadapterparms.hdr.return_code; -return 0 ; +return cmd->hdr.return_code; }static int qeth_query_setadapterparms_cb (struct qeth_card *card,struct qeth_reply *reply,unsigned long data) { -struct qeth_ipa_cmd *cmd; +struct qeth_ipa_cmd *cmd = (struct qeth_ipa_cmd *) data;QETH_CARD_TEXT (card,3 ,"quyadpcb" ); +if (qeth_setadpparms_inspect_rc (cmd)) +return 0 ; - cmd = (struct qeth_ipa_cmd *) data;if (cmd->data.setadapterparms.data.query_cmds_supp.lan_type &0x7f ) { card->info.link_type = cmd->data.setadapterparms.data.query_cmds_supp.lan_type;
@@ -3030,7 +3025,7 @@ static int qeth_query_setadapterparms_cb(struct qeth_card *card, } card->options.adp.supported_funcs = cmd->data.setadapterparms.data.query_cmds_supp.supported_cmds; -return qeth_default_setadapterparms_cb (card, reply, (unsigned long )cmd); +return 0 ; } static struct qeth_cmd_buffer *qeth_get_adapter_cmd(struct qeth_card *card,
@@ -3122,22 +3117,20 @@ EXPORT_SYMBOL_GPL(qeth_query_ipassists);static int qeth_query_switch_attributes_cb (struct qeth_card *card,struct qeth_reply *reply,unsigned long data) { -struct qeth_ipa_cmd *cmd; -struct qeth_switch_info *sw_info; +struct qeth_ipa_cmd *cmd = (struct qeth_ipa_cmd *) data;struct qeth_query_switch_attributes *attrs; +struct qeth_switch_info *sw_info;QETH_CARD_TEXT (card,2 ,"qswiatcb" ); - cmd = (struct qeth_ipa_cmd *) data; - sw_info = (struct qeth_switch_info *)reply->param; -if (cmd->data.setadapterparms.hdr.return_code ==0 ) { - attrs = &cmd->data.setadapterparms.data.query_switch_attributes; - sw_info->capabilities = attrs->capabilities; - sw_info->settings = attrs->settings; -QETH_CARD_TEXT_ (card,2 ,"%04x%04x" , sw_info->capabilities, - sw_info->settings); - } -qeth_default_setadapterparms_cb (card, reply, (unsigned long ) cmd); +if (qeth_setadpparms_inspect_rc (cmd)) +return 0 ; + sw_info = (struct qeth_switch_info *)reply->param; + attrs = &cmd->data.setadapterparms.data.query_switch_attributes; + sw_info->capabilities = attrs->capabilities; + sw_info->settings = attrs->settings; +QETH_CARD_TEXT_ (card,2 ,"%04x%04x" , sw_info->capabilities, + sw_info->settings);return 0 ; }
@@ -4188,16 +4181,13 @@ EXPORT_SYMBOL_GPL(qeth_do_send_packet);static int qeth_setadp_promisc_mode_cb (struct qeth_card *card,struct qeth_reply *reply,unsigned long data) { -struct qeth_ipa_cmd *cmd; +struct qeth_ipa_cmd *cmd = (struct qeth_ipa_cmd *) data;struct qeth_ipacmd_setadpparms *setparms;QETH_CARD_TEXT (card,4 ,"prmadpcb" ); - cmd = (struct qeth_ipa_cmd *) data; setparms = &(cmd->data.setadapterparms); - -qeth_default_setadapterparms_cb (card, reply, (unsigned long )cmd); -if (cmd->hdr.return_code) { +if (qeth_setadpparms_inspect_rc (cmd)) {QETH_CARD_TEXT_ (card,4 ,"prmrc%x" , cmd->hdr.return_code); setparms->data.mode =SET_PROMISC_MODE_OFF ; }
@@ -4267,11 +4257,12 @@ EXPORT_SYMBOL_GPL(qeth_get_stats);static int qeth_setadpparms_change_macaddr_cb (struct qeth_card *card,struct qeth_reply *reply,unsigned long data) { -struct qeth_ipa_cmd *cmd; +struct qeth_ipa_cmd *cmd = (struct qeth_ipa_cmd *) data;QETH_CARD_TEXT (card,4 ,"chgmaccb" ); +if (qeth_setadpparms_inspect_rc (cmd)) +return 0 ; - cmd = (struct qeth_ipa_cmd *) data;if (!card->options.layer2 || !(card->info.mac_bits &QETH_LAYER2_MAC_READ )) { memcpy(card->dev->dev_addr,
@@ -4279,7 +4270,6 @@ static int qeth_setadpparms_change_macaddr_cb(struct qeth_card *card, OSA_ADDR_LEN); card->info.mac_bits |=QETH_LAYER2_MAC_READ ; } -qeth_default_setadapterparms_cb (card, reply, (unsigned long ) cmd);return 0 ; }
@@ -4310,13 +4300,15 @@ EXPORT_SYMBOL_GPL(qeth_setadpparms_change_macaddr);static int qeth_setadpparms_set_access_ctrl_cb (struct qeth_card *card,struct qeth_reply *reply,unsigned long data) { -struct qeth_ipa_cmd *cmd; +struct qeth_ipa_cmd *cmd = (struct qeth_ipa_cmd *) data;struct qeth_set_access_ctrl *access_ctrl_req;int fallback = *(int *)reply->param;QETH_CARD_TEXT (card,4 ,"setaccb" ); +if (cmd->hdr.return_code) +return 0 ; +qeth_setadpparms_inspect_rc (cmd); - cmd = (struct qeth_ipa_cmd *) data; access_ctrl_req = &cmd->data.setadapterparms.data.set_access_ctrl;QETH_DBF_TEXT_ (SETUP ,2 ,"setaccb" );QETH_DBF_TEXT_ (SETUP ,2 ,"%s" , card->gdev->dev.kobj.name);
@@ -4389,7 +4381,6 @@ static int qeth_setadpparms_set_access_ctrl_cb(struct qeth_card *card, card->options.isolation = card->options.prev_isolation;break ; } -qeth_default_setadapterparms_cb (card, reply, (unsigned long ) cmd);return 0 ; }
@@ -4677,14 +4668,15 @@ static int qeth_snmp_command(struct qeth_card *card, char __user *udata)static int qeth_setadpparms_query_oat_cb (struct qeth_card *card,struct qeth_reply *reply,unsigned long data) { -struct qeth_ipa_cmd *cmd; +struct qeth_ipa_cmd *cmd = (struct qeth_ipa_cmd *)data;struct qeth_qoat_priv *priv;char *resdata;int resdatalen;QETH_CARD_TEXT (card,3 ,"qoatcb" ); +if (qeth_setadpparms_inspect_rc (cmd)) +return 0 ; - cmd = (struct qeth_ipa_cmd *)data; priv = (struct qeth_qoat_priv *)reply->param; resdatalen = cmd->data.setadapterparms.hdr.cmdlength; resdata = (char *)data +28 ;
@@ -4778,21 +4770,18 @@ static int qeth_query_oat_command(struct qeth_card *card, char __user *udata)static int qeth_query_card_info_cb (struct qeth_card *card,struct qeth_reply *reply,unsigned long data) { -struct qeth_ipa_cmd *cmd; +struct carrier_info *carrier_info = (struct carrier_info *)reply->param; +struct qeth_ipa_cmd *cmd = (struct qeth_ipa_cmd *)data;struct qeth_query_card_info *card_info; -struct carrier_info *carrier_info;QETH_CARD_TEXT (card,2 ,"qcrdincb" ); - carrier_info = (struct carrier_info *)reply->param; - cmd = (struct qeth_ipa_cmd *)data; - card_info = &cmd->data.setadapterparms.data.card_info; -if (cmd->data.setadapterparms.hdr.return_code ==0 ) { - carrier_info->card_type = card_info->card_type; - carrier_info->port_mode = card_info->port_mode; - carrier_info->port_speed = card_info->port_speed; - } +if (qeth_setadpparms_inspect_rc (cmd)) +return 0 ; -qeth_default_setadapterparms_cb (card, reply, (unsigned long ) cmd); + card_info = &cmd->data.setadapterparms.data.card_info; + carrier_info->card_type = card_info->card_type; + carrier_info->port_mode = card_info->port_mode; + carrier_info->port_speed = card_info->port_speed;return 0 ; }
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 11/46 net/mlx5: Fix mlx5_get_vector_affinity function
In reply to Sasha LevinFrom: Israel Rukshin <[email protected]>
[ Upstream commit 6082d9c9c94a408d7409b5f2e4e42ac9e8b16d0d ]
Adding the vector offset when calling to mlx5_vector2eqn() is wrong. This is because mlx5_vector2eqn() checks if EQ index is equal to vector number and the fact that the internal completion vectors that mlx5 allocates don't get an EQ index.
The second problem here is that using effective_affinity_mask gives the same CPU for different vectors.
This leads to unmapped queues when calling it from blk_mq_rdma_map_queues(). This doesn't happen when using affinity_hint mask.
--- drivers/infiniband/hw/mlx5/main.c | 2 +- include/linux/mlx5/driver.h | 12 +++--------- 2 files changed, 4 insertions(+), 10 deletions(-)
drivers/infiniband/hw/mlx5/main.c +1 -1
@@ -3911,7 +3911,7 @@ mlx5_ib_get_vector_affinity(struct ib_device *ibdev, int comp_vector) {struct mlx5_ib_dev *dev =to_mdev (ibdev); -return mlx5_get_vector_affinity (dev->mdev, comp_vector); +return mlx5_get_vector_affinity_hint (dev->mdev, comp_vector); }static void *mlx5_ib_add (struct mlx5_core_dev *mdev)
include/linux/mlx5/driver.h +3 -9
@@ -1193,25 +1193,19 @@ enum { };static inline const struct cpumask * -mlx5_get_vector_affinity (struct mlx5_core_dev *dev,int vector) +mlx5_get_vector_affinity_hint (struct mlx5_core_dev *dev,int vector) { -const struct cpumask *mask;struct irq_desc *desc;unsigned int irq;int eqn;int err; - err =mlx5_vector2eqn (dev,MLX5_EQ_VEC_COMP_BASE + vector, &eqn, &irq); + err =mlx5_vector2eqn (dev, vector, &eqn, &irq);if (err)return NULL ; desc =irq_to_desc (irq); -#ifdef CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK - mask =irq_data_get_effective_affinity_mask (&desc->irq_data); -#else - mask = desc->irq_common_data.affinity; -#endif -return mask; +return desc->affinity_hint; }#endif /* MLX5_DRIVER_H */
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 12/46 powerpc/pseries: Add empty update_numa_cpu_lookup_table() for NUMA=n
In reply to Sasha LevinFrom: Corentin Labbe <[email protected]>
[ Upstream commit c1e150ceb61e4a585bad156da15c33bfe89f5858 ]
When CONFIG_NUMA is not set, the build fails with:
arch/powerpc/platforms/pseries/hotplug-cpu.c:335:4:
error: déclaration implicite de la fonction « update_numa_cpu_lookup_table »
So we have to add update_numa_cpu_lookup_table() as an empty function when CONFIG_NUMA is not set.
--- arch/powerpc/include/asm/topology.h | 3 +++ 1 file changed, 3 insertions(+)
arch/powerpc/include/asm/topology.h +3 -0
@@ -81,6 +81,9 @@ static inline int numa_update_cpu_topology(bool cpus_locked) {return 0 ; } + +static inline void update_numa_cpu_lookup_table (unsigned int cpu,int node) {} +#endif /* CONFIG_NUMA */ #if defined(CONFIG_NUMA ) && defined(CONFIG_PPC_SPLPAR )
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 13/46 dm integrity: fail early if required HMAC key is not available
In reply to Sasha LevinFrom: Milan Broz <[email protected]>
[ Upstream commit e16b4f99f0f79682a7efe191a8ce694d87ca9fc8 ]
Since crypto API commit 9fa68f62004 ("crypto: hash - prevent using keyed hashes without setting key") dm-integrity cannot use keyed algorithms without the key being set.
The dm-integrity recognizes this too late (during use of HMAC), so it allows creation and formatting of superblock, but the device is in fact unusable.
Fix it by detecting the key requirement in integrity table constructor.
--- drivers/md/dm-integrity.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/md/dm-integrity.c +3 -0
@@ -2547,6 +2547,9 @@ static int get_mac(struct crypto_shash **hash, struct alg_spec *a, char **error, *error = error_key;return r; } + }else if (crypto_shash_get_flags (*hash) &CRYPTO_TFM_NEED_KEY ) { + *error = error_key; +return -ENOKEY ; } }
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 14/46 net: phy: realtek: Use the dummy stubs for MMD register access for rtl8211b
In reply to Sasha LevinFrom: Kevin Hao <[email protected]>
[ Upstream commit 0231b1a074c672f8c00da00a57144072890d816b ]
The Ethernet on mpc8315erdb is broken since commit b6b5e8a69118 ("gianfar: Disable EEE autoneg by default"). The reason is that even though the rtl8211b doesn't support the MMD extended registers access, it does return some random values if we trying to access the MMD register via indirect method. This makes it seem that the EEE is supported by this phy device. And the subsequent writing to the MMD registers does cause the phy malfunction. So use the dummy stubs for the MMD register access to fix this issue.
--- drivers/net/phy/realtek.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/phy/realtek.c +2 -0
@@ -138,6 +138,8 @@ static struct phy_driver realtek_drvs[] = { .read_status = &genphy_read_status, .ack_interrupt = &rtl821x_ack_interrupt, .config_intr = &rtl8211b_config_intr, + .read_mmd = &genphy_read_mmd_unsupported, + .write_mmd = &genphy_write_mmd_unsupported, }, { .phy_id = 0x001cc914, .name = "RTL8211DN Gigabit Ethernet",
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 15/46 net: phy: Add general dummy stubs for MMD register access
In reply to Sasha LevinFrom: Kevin Hao <[email protected]>
[ Upstream commit 5df7af85ecd88e8b5f1f31d6456c3cf38a8bbdda ]
For some phy devices, even though they don't support the MMD extended register access, it does have some side effect if we are trying to read/write the MMD registers via indirect method. So introduce general dummy stubs for MMD register access which these devices can use to avoid such side effect.
--- drivers/net/phy/phy_device.c | 17 +++++++++++++++++ include/linux/phy.h | 4 ++++ 2 files changed, 21 insertions(+)
drivers/net/phy/phy_device.c +17 -0
@@ -1641,6 +1641,23 @@ int genphy_config_init(struct phy_device *phydev) }EXPORT_SYMBOL (genphy_config_init); +/* This is used for the phy device which doesn't support the MMD extended +* register access, but it does have side effect when we are trying to access +* the MMD register via indirect method. +*/ +int genphy_read_mmd_unsupported (struct phy_device *phdev,int devad,u16 regnum) +{ +return -EOPNOTSUPP ; +} +EXPORT_SYMBOL (genphy_read_mmd_unsupported); + +int genphy_write_mmd_unsupported (struct phy_device *phdev,int devnum, +u16 regnum,u16 val) +{ +return -EOPNOTSUPP ; +} +EXPORT_SYMBOL (genphy_write_mmd_unsupported); +int genphy_suspend (struct phy_device *phydev) {int value;
include/linux/phy.h +4 -0
@@ -879,6 +879,10 @@ static inline int genphy_no_soft_reset(struct phy_device *phydev) {return 0 ; } +int genphy_read_mmd_unsupported (struct phy_device *phdev,int devad, +u16 regnum); +int genphy_write_mmd_unsupported (struct phy_device *phdev,int devnum, +u16 regnum,u16 val);/* Clause 45 PHY */ int genphy_c45_restart_aneg (struct phy_device *phydev);
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 16/46 net/mlx5e: Refine ets validation function
In reply to Sasha LevinFrom: Shay Agroskin <[email protected]>
[ Upstream commit e279d634f3d57452eb106a0c0e99a6add3fba1a6 ]
Removed an error message received when configuring ETS total bandwidth to be zero.
Our hardware doesn't support such configuration, so we shall reject it in the driver. Nevertheless, we removed the error message in order to eliminate error messages caused by old userspace tools who try to pass such configuration.
--- .../net/ethernet/mellanox/mlx5/core/en_dcbnl.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c +8 -9
@@ -257,7 +257,8 @@ int mlx5e_dcbnl_ieee_setets_core(struct mlx5e_priv *priv, struct ieee_ets *ets) }static int mlx5e_dbcnl_validate_ets (struct net_device *netdev, -struct ieee_ets *ets) +struct ieee_ets *ets, +bool zero_sum_allowed) {bool have_ets_tc = false;int bw_sum =0 ;
@@ -282,8 +283,9 @@ static int mlx5e_dbcnl_validate_ets(struct net_device *netdev, }if (have_ets_tc && bw_sum !=100 ) { -netdev_err (netdev, -"Failed to validate ETS: BW sum is illegal\n" ); +if (bw_sum || (!bw_sum && !zero_sum_allowed)) +netdev_err (netdev, +"Failed to validate ETS: BW sum is illegal\n" );return -EINVAL ; }return 0 ;
@@ -298,7 +300,7 @@ static int mlx5e_dcbnl_ieee_setets(struct net_device *netdev,if (!MLX5_CAP_GEN (priv->mdev, ets))return -EOPNOTSUPP ; - err =mlx5e_dbcnl_validate_ets (netdev, ets); + err =mlx5e_dbcnl_validate_ets (netdev, ets, false);if (err)return err;
@@ -477,12 +479,9 @@ static u8 mlx5e_dcbnl_setall(struct net_device *netdev) ets.prio_tc[i] = cee_cfg->prio_to_pg_map[i]; } - err =mlx5e_dbcnl_validate_ets (netdev, &ets); -if (err) { -netdev_err (netdev, -"%s, Failed to validate ETS: %d\n" , __func__, err); + err =mlx5e_dbcnl_validate_ets (netdev, &ets, true); +if (err) goto out; - } err =mlx5e_dcbnl_ieee_setets_core (priv, &ets);if (err) {
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 17/46 scsi: qla2xxx: Avoid double completion of abort command
In reply to Sasha LevinFrom: Ben Hutchings <[email protected]>
[ Upstream commit 3a9910d7b686546dcc9986e790af17e148f1c888 ]
qla2x00_tmf_sp_done() now deletes the timer that will run qla2x00_tmf_iocb_timeout(), but doesn't check whether the timer already expired. Check the return value from del_timer() to avoid calling complete() a second time.
--- drivers/scsi/qla2xxx/qla_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_init.c +2 -2
@@ -1365,8 +1365,8 @@ qla24xx_abort_sp_done(void *ptr, int res)srb_t *sp = ptr;struct srb_iocb *abt = &sp->u.iocb_cmd; -del_timer (&sp->u.iocb_cmd.timer); -complete (&abt->u.abt.comp); +if (del_timer (&sp->u.iocb_cmd.timer)) +complete (&abt->u.abt.comp); }int
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 18/46 kbuild: set no-integrated-as before incl. arch Makefile
In reply to Sasha LevinFrom: Stefan Agner <[email protected]>
[ Upstream commit 0f0e8de334c54c38818a4a5390a39aa09deff5bf ]
In order to make sure compiler flag detection for ARM works correctly the no-integrated-as flags need to be set before including the arch specific Makefile.
--- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
@@ -487,6 +487,8 @@ CLANG_GCC_TC := --gcc-toolchain=$(GCC_TOOLCHAIN) endif KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) +KBUILD_CFLAGS += $(call cc-option, -no-integrated-as) +KBUILD_AFLAGS += $(call cc-option, -no-integrated-as) endif RETPOLINE_CFLAGS_GCC := -mindirect-branch=thunk-extern -mindirect-branch-register
@@ -721,8 +723,6 @@ KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare) # See modpost pattern 2 KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,) KBUILD_CFLAGS += $(call cc-option, -fcatch-undefined-behavior) -KBUILD_CFLAGS += $(call cc-option, -no-integrated-as) -KBUILD_AFLAGS += $(call cc-option, -no-integrated-as) else # These warnings generated too much noise in a regular build.
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 19/46 IB/mlx5: Avoid passing an invalid QP type to firmware
In reply to Sasha LevinFrom: Noa Osherovich <[email protected]>
[ Upstream commit e7b169f34403becd3c9fd3b6e46614ab788f2187 ]
During QP creation, the mlx5 driver translates the QP type to an internal value which is passed on to FW. There was no check to make sure that the translated value is valid, and -EINVAL was coerced into the mailbox command.
Current firmware refuses this as an invalid QP type, but future/past firmware may do something else.
--- drivers/infiniband/hw/mlx5/qp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/qp.c +6 -1
@@ -1527,6 +1527,7 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd,u32 uidx =MLX5_IB_DEFAULT_UIDX ;struct mlx5_ib_create_qp ucmd;struct mlx5_ib_qp_base *base; +int mlx5_st;void *qpc;u32 *in;int err;
@@ -1535,6 +1536,10 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd,spin_lock_init (&qp->sq.lock);spin_lock_init (&qp->rq.lock); + mlx5_st =to_mlx5_st (init_attr->qp_type); +if (mlx5_st <0 ) +return -EINVAL ; +if (init_attr->rwq_ind_tbl) {if (!udata)return -ENOSYS ;
@@ -1688,7 +1693,7 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd, qpc =MLX5_ADDR_OF (create_qp_in, in, qpc); -MLX5_SET (qpc, qpc, st,to_mlx5_st (init_attr->qp_type)); +MLX5_SET (qpc, qpc, st, mlx5_st);MLX5_SET (qpc, qpc, pm_state,MLX5_QP_PM_MIGRATED );if (init_attr->qp_type !=MLX5_IB_QPT_REG_UMR )
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 20/46 ARM: tegra: Fix ULPI regression on Tegra20
In reply to Sasha LevinFrom: Marcel Ziswiler <[email protected]>
[ Upstream commit 4c9a27a6c66d4427f3cba4019d4ba738fe99fa87 ]
Since commit f8f8f1d04494 ("clk: Don't touch hardware when reparenting during registration") ULPI has been broken on Tegra20 leading to the following error message during boot:
[ 1.974698] ulpi_phy_power_on: ulpi write failed [ 1.979384] tegra-ehci c5004000.usb: Failed to power on the phy [ 1.985434] tegra-ehci: probe of c5004000.usb failed with error -110
Debugging through the changes and finally also consulting the TRM revealed that rather than the CDEV2 clock off OSC requiring such pin muxing actually the PLL_P_OUT4 clock is in use. It looks like so far it just worked by chance of that one having been enabled which Stephen's commit now changed when reparenting sclk away from pll_p_out4 leaving that one disabled. Fix this by properly assigning the PLL_P_OUT4 clock as the ULPI PHY clock.
--- arch/arm/boot/dts/tegra20.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/tegra20.dtsi +1 -1
@@ -706,7 +706,7 @@ phy_type = "ulpi"; clocks = <&tegra_car TEGRA20_CLK_USB2>, <&tegra_car TEGRA20_CLK_PLL_U>, - <&tegra_car TEGRA20_CLK_CDEV2>; + <&tegra_car TEGRA20_CLK_PLL_P_OUT4>; clock-names = "reg", "pll_u", "ulpi-link"; resets = <&tegra_car 58>, <&tegra_car 22>; reset-names = "usb", "utmi-pads";
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 21/46 l2tp: remove configurable payload offset
In reply to Sasha LevinFrom: James Chapman <[email protected]>
[ Upstream commit 900631ee6a2651dc4fbaecb8ef9fa5f1e3378853 ]
If L2TP_ATTR_OFFSET is set to a non-zero value in L2TPv3 tunnels, it results in L2TPv3 packets being transmitted which might not be compliant with the L2TPv3 RFC. This patch has l2tp ignore the offset setting and send all packets with no offset.
In more detail:
L2TPv2 supports a variable offset from the L2TPv2 header to the payload. The offset value is indicated by an optional field in the L2TP header. Our L2TP implementation already detects the presence of the optional offset and skips that many bytes when handling data received packets. All transmitted packets are always transmitted with no offset.
L2TPv3 has no optional offset field in the L2TPv3 packet header. Instead, L2TPv3 defines optional fields in a "Layer-2 Specific Sublayer". At the time when the original L2TP code was written, there was talk at IETF of offset being implemented in a new Layer-2 Specific Sublayer. A L2TP_ATTR_OFFSET netlink attribute was added so that this offset could be configured and the intention was to allow it to be also used to set the tx offset for L2TPv2. However, no L2TPv3 offset was ever specified and the L2TP_ATTR_OFFSET parameter was forgotten about.
Setting L2TP_ATTR_OFFSET results in L2TPv3 packets being transmitted with the specified number of bytes padding between L2TPv3 header and payload. This is not compliant with L2TPv3 RFC3931. This change removes the configurable offset altogether while retaining L2TP_ATTR_OFFSET for backwards compatibility. Any L2TP_ATTR_OFFSET value is ignored.
--- net/l2tp/l2tp_core.c | 14 ++++---------- net/l2tp/l2tp_core.h | 3 --- net/l2tp/l2tp_debugfs.c | 4 ++-- net/l2tp/l2tp_netlink.c | 3 --- 4 files changed, 6 insertions(+), 18 deletions(-)
net/l2tp/l2tp_core.c +4 -10
@@ -808,10 +808,8 @@ void l2tp_recv_common(struct l2tp_session *session, struct sk_buff *skb, } } -/* Session data offset is handled differently for L2TPv2 and -* L2TPv3. For L2TPv2, there is an optional 16-bit value in -* the header. For L2TPv3, the offset is negotiated using AVPs -* in the session setup control protocol. +/* Session data offset is defined only for L2TPv2 and is +* indicated by an optional 16-bit value in the header. */ if (tunnel->version ==L2TP_HDR_VER_2 ) {/* If offset bit set, skip it. */
@@ -819,8 +817,7 @@ void l2tp_recv_common(struct l2tp_session *session, struct sk_buff *skb, offset =ntohs (*(__be16 *)ptr); ptr +=2 + offset; } - }else - ptr += session->offset; + } offset = ptr - optr;if (!pskb_may_pull (skb, offset))
@@ -1104,8 +1101,6 @@ static int l2tp_build_l2tpv3_header(struct l2tp_session *session, void *buf) } bufp += session->l2specific_len; } -if (session->offset) - bufp += session->offset;return bufp - optr; }
@@ -1779,7 +1774,7 @@ void l2tp_session_set_header_len(struct l2tp_session *session, int version)if (session->send_seq) session->hdr_len +=4 ; }else { - session->hdr_len =4 + session->cookie_len + session->l2specific_len + session->offset; + session->hdr_len =4 + session->cookie_len + session->l2specific_len;if (session->tunnel->encap ==L2TP_ENCAPTYPE_UDP ) session->hdr_len +=4 ; }
@@ -1830,7 +1825,6 @@ struct l2tp_session *l2tp_session_create(int priv_size, struct l2tp_tunnel *tunn session->recv_seq = cfg->recv_seq; session->lns_mode = cfg->lns_mode; session->reorder_timeout = cfg->reorder_timeout; - session->offset = cfg->offset; session->l2specific_type = cfg->l2specific_type; session->l2specific_len = cfg->l2specific_len; session->cookie_len = cfg->cookie_len;
net/l2tp/l2tp_core.h +0 -3
@@ -59,7 +59,6 @@ struct l2tp_session_cfg {int debug;/* bitmask of debug message * categories */ u16 vlan_id;/* VLAN pseudowire only */ -u16 offset;/* offset to payload */ u16 l2specific_len;/* Layer 2 specific length */ u16 l2specific_type;/* Layer 2 specific type */ u8 cookie[8 ];/* optional cookie */
@@ -86,8 +85,6 @@ struct l2tp_session {int cookie_len;u8 peer_cookie[8 ];int peer_cookie_len; -u16 offset;/* offset from end of L2TP header -to beginning of data */ u16 l2specific_len;u16 l2specific_type;u16 hdr_len;
net/l2tp/l2tp_debugfs.c +2 -2
@@ -180,8 +180,8 @@ static void l2tp_dfs_seq_session_show(struct seq_file *m, void *v) session->lns_mode ?"LNS" :"LAC" , session->debug, jiffies_to_msecs(session->reorder_timeout)); -seq_printf (m," offset %hu l2specific %hu/%hu\n" , - session->offset, session->l2specific_type, session->l2specific_len); +seq_printf (m," offset 0 l2specific %hu/%hu\n" , + session->l2specific_type, session->l2specific_len);if (session->cookie_len) { seq_printf(m, " cookie %02x%02x%02x%02x", session->cookie[0], session->cookie[1],
net/l2tp/l2tp_netlink.c +0 -3
@@ -549,9 +549,6 @@ static int l2tp_nl_cmd_session_create(struct sk_buff *skb, struct genl_info *inf }if (tunnel->version >2 ) { -if (info->attrs[L2TP_ATTR_OFFSET ]) - cfg.offset =nla_get_u16 (info->attrs[L2TP_ATTR_OFFSET ]); -if (info->attrs[L2TP_ATTR_DATA_SEQ ]) cfg.data_seq =nla_get_u8 (info->attrs[L2TP_ATTR_DATA_SEQ ]);
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 22/46 cifs: Use ULL suffix for 64-bit constant
In reply to Sasha LevinFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 3995bbf53bd2047f2720c6fdd4bf38f6d942a0c0 ]
On 32-bit (e.g. with m68k-linux-gnu-gcc-4.1):
fs/cifs/inode.c: In function ‘simple_hashstr’:
fs/cifs/inode.c:713: warning: integer constant is too large for ‘long’ type
--- fs/cifs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/inode.c +1 -1
@@ -712,7 +712,7 @@ cifs_get_file_info(struct file *filp)/* Simple function to return a 64 bit hash of string. Rarely called */ static __u64 simple_hashstr (const char *str) { -const __u64 hash_mult =1125899906842597L ;/* a big enough prime */ +const __u64 hash_mult =1125899906842597ULL ;/* a big enough prime */ __u64 hash =0 ;while (*str)
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 23/46 test_bpf: Fix testing with CONFIG_BPF_JIT_ALWAYS_ON=y on other arches
In reply to Sasha LevinFrom: Thadeu Lima de Souza Cascardo <[email protected]>
[ Upstream commit 52fda36d63bfc8c8e8ae5eda8eb5ac6f52cd67ed ]
Function bpf_fill_maxinsns11 is designed to not be able to be JITed on x86_64. So, it fails when CONFIG_BPF_JIT_ALWAYS_ON=y, and commit 09584b406742 ("bpf: fix selftests/bpf test_kmod.sh failure when CONFIG_BPF_JIT_ALWAYS_ON=y") makes sure that failure is detected on that case.
However, it does not fail on other architectures, which have a different JIT compiler design. So, test_bpf has started to fail to load on those.
After this fix, test_bpf loads fine on both x86_64 and ppc64el.
--- lib/test_bpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/test_bpf.c +1 -1
@@ -5427,7 +5427,7 @@ static struct bpf_test tests[] = { { "BPF_MAXINSNS: Jump, gap, jump, ...", { }, -#ifdef CONFIG_BPF_JIT_ALWAYS_ON +#if defined(CONFIG_BPF_JIT_ALWAYS_ON ) && defined(CONFIG_X86 )CLASSIC |FLAG_NO_DATA |FLAG_EXPECTED_FAIL , #else CLASSIC | FLAG_NO_DATA,
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 24/46 KVM: x86: Update the exit_qualification access bits while walking an address
In reply to Sasha LevinFrom: KarimAllah Ahmed <[email protected]>
[ Upstream commit ddd6f0e94d3153951580d5b88b9d97c7e26a0e00 ]
... to avoid having a stale value when handling an EPT misconfig for MMIO regions.
MMIO regions that are not passed-through to the guest are handled through EPT misconfigs. The first time a certain MMIO page is touched it causes an EPT violation, then KVM marks the EPT entry to cause an EPT misconfig instead. Any subsequent accesses to the entry will generate an EPT misconfig.
Things gets slightly complicated with nested guest handling for MMIO regions that are not passed through from L0 (i.e. emulated by L0 user-space).
An EPT violation for one of these MMIO regions from L2, exits to L0 hypervisor. L0 would then look at the EPT12 mapping for L1 hypervisor and realize it is not present (or not sufficient to serve the request). Then L0 injects an EPT violation to L1. L1 would then update its EPT mappings. The EXIT_QUALIFICATION value for L1 would come from exit_qualification variable in "struct vcpu". The problem is that this variable is only updated on EPT violation and not on EPT misconfig. So if an EPT violation because of a read happened first, then an EPT misconfig because of a write happened afterwards. The L0 hypervisor will still contain exit_qualification value from the previous read instead of the write and end up injecting an EPT violation to the L1 hypervisor with an out of date EXIT_QUALIFICATION.
The EPT violation that is injected from L0 to L1 needs to have the correct EXIT_QUALIFICATION specially for the access bits because the individual access bits for MMIO EPTs are updated only on actual access of this specific type. So for the example above, the L1 hypervisor will keep updating only the read bit in the EPT then resume the L2 guest. The L2 guest would end up causing another exit where the L0 *again* will inject another EPT violation to L1 hypervisor with *again* an out of date exit_qualification which indicates a read and not a write. Then this ping-pong just keeps happening without making any forward progress.
The behavior of mapping MMIO regions changed in:
commit a340b3e229b24 ("kvm: Map PFN-type memory regions as writable (if possible)")
... where an EPT violation for a read would also fixup the write bits to avoid another EPT violation which by acciddent would fix the bug mentioned above.
This commit fixes this situation and ensures that the access bits for the exit_qualifcation is up to date. That ensures that even L1 hypervisor running with a KVM version before the commit mentioned above would still work.
( The description above assumes EPT to be available and used by L1
hypervisor + the L1 hypervisor is passing through the MMIO region to the L2 guest while this MMIO region is emulated by the L0 user-space ).
--- arch/x86/kvm/paging_tmpl.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
arch/x86/kvm/paging_tmpl.h +9 -2
@@ -452,14 +452,21 @@ static int FNAME(walk_addr_generic)(struct guest_walker *walker,* done by is_rsvd_bits_set() above. * * We set up the value of exit_qualification to inject: -* [2:0] - Derive from [2:0] of real exit_qualification at EPT violation +* [2:0] - Derive from the access bits. The exit_qualification might be +* out of date if it is serving an EPT misconfiguration. * [5:3] - Calculated by the page walk of the guest EPT page tables * [7:8] - Derived from [7:8] of real exit_qualification * * The other bits are set to 0. */ if (!(errcode &PFERR_RSVD_MASK )) { - vcpu->arch.exit_qualification &=0x187 ; + vcpu->arch.exit_qualification &=0x180 ; +if (write_fault) + vcpu->arch.exit_qualification |=EPT_VIOLATION_ACC_WRITE ; +if (user_fault) + vcpu->arch.exit_qualification |=EPT_VIOLATION_ACC_READ ; +if (fetch_fault) + vcpu->arch.exit_qualification |=EPT_VIOLATION_ACC_INSTR ; vcpu->arch.exit_qualification |= (pte_access &0x7 ) <<3 ; }#endif
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 25/46 sparc64: Fix regression in pmdp_invalidate().
In reply to Sasha LevinFrom: "David S. Miller" <[email protected]>
[ Upstream commit cfb61b5e3e09f8b49bc4d685429df75f45127adc ]
pmdp_invalidate() was changed to update the pmd atomically (to not lose dirty/access bits) and return the original pmd value.
However, in doing so, we lost a lot of the essential work that set_pmd_at() does, namely to update hugepage mapping counts and queuing up the batched TLB flush entry.
Thus we were not flushing entries out of the TLB when making such PMD changes.
Fix this by abstracting the accounting work of set_pmd_at() out into a separate function, and call it from pmdp_establish().
--- arch/sparc/mm/tlb.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
arch/sparc/mm/tlb.c +13 -6
@@ -163,13 +163,10 @@ static void tlb_batch_pmd_scan(struct mm_struct *mm, unsigned long vaddr,pte_unmap (pte); } -void set_pmd_at (struct mm_struct *mm,unsigned long addr, -pmd_t *pmdp,pmd_t pmd) -{ -pmd_t orig = *pmdp; - - *pmdp = pmd; +static void __set_pmd_acct (struct mm_struct *mm,unsigned long addr, +pmd_t orig,pmd_t pmd) +{if (mm == &init_mm)return ;
@@ -219,6 +216,15 @@ void set_pmd_at(struct mm_struct *mm, unsigned long addr, } } +void set_pmd_at (struct mm_struct *mm,unsigned long addr, +pmd_t *pmdp,pmd_t pmd) +{ +pmd_t orig = *pmdp; + + *pmdp = pmd; +__set_pmd_acct (mm, addr, orig, pmd); +} +static inline pmd_t pmdp_establish (struct vm_area_struct *vma,unsigned long address,pmd_t *pmdp,pmd_t pmd) {
@@ -227,6 +233,7 @@ static inline pmd_t pmdp_establish(struct vm_area_struct *vma,do { old = *pmdp; }while (cmpxchg64 (&pmdp->pmd, old.pmd, pmd.pmd) != old.pmd); +__set_pmd_acct (vma->vm_mm, address, old, pmd);return old; }
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 26/46 tpm: move the delay_msec increment after sleep in tpm_transmit()
In reply to Sasha LevinFrom: Nayna Jain <[email protected]>
[ Upstream commit 92980756979a9c51be0275f395f4e89c42cf199a ]
Commit e2fb992d82c6 ("tpm: add retry logic") introduced a new loop to handle the TPM2_RC_RETRY error. The loop retries the command after sleeping for the specified time, which is incremented exponentially in every iteration.
Unfortunately, the loop doubles the time before sleeping, causing the initial sleep to be doubled. This patch fixes the initial sleep time.
--- drivers/char/tpm/tpm-interface.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/char/tpm/tpm-interface.c +2 -1
@@ -611,12 +611,13 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space, rc =be32_to_cpu (header->return_code);if (rc !=TPM2_RC_RETRY )break ; - delay_msec *=2 ; +if (delay_msec >TPM2_DURATION_LONG ) {dev_err (&chip->dev,"TPM is in retry loop\n" );break ; }tpm_msleep (delay_msec); + delay_msec *=2 ;memcpy (buf, save, save_size); }return ret;
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 27/46 bpf: sockmap, map_release does not hold refcnt for pinned maps
In reply to Sasha LevinFrom: John Fastabend <[email protected]>
[ Upstream commit ba6b8de423f8d0dee48d6030288ed81c03ddf9f0 ]
Relying on map_release hook to decrement the reference counts when a map is removed only works if the map is not being pinned. In the pinned case the ref is decremented immediately and the BPF programs released. After this BPF programs may not be in-use which is not what the user would expect.
This patch moves the release logic into bpf_map_put_uref() and brings sockmap in-line with how a similar case is handled in prog array maps.
--- include/linux/bpf.h | 2 +- kernel/bpf/arraymap.c | 3 ++- kernel/bpf/sockmap.c | 4 ++-- kernel/bpf/syscall.c | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-)
include/linux/bpf.h +1 -1
@@ -27,6 +27,7 @@ struct bpf_map_ops {void (*map_release)(struct bpf_map *map,struct file *map_file);void (*map_free)(struct bpf_map *map);int (*map_get_next_key)(struct bpf_map *map,void *key,void *next_key); +void (*map_release_uref)(struct bpf_map *map);/* funcs callable from userspace and from eBPF programs */ void *(*map_lookup_elem)(struct bpf_map *map,void *key);
@@ -300,7 +301,6 @@ int bpf_stackmap_copy(struct bpf_map *map, void *key, void *value);int bpf_fd_array_map_update_elem (struct bpf_map *map,struct file *map_file,void *key,void *value,u64 map_flags);int bpf_fd_array_map_lookup_elem (struct bpf_map *map,void *key,u32 *value); -void bpf_fd_array_map_clear (struct bpf_map *map);int bpf_fd_htab_map_update_elem (struct bpf_map *map,struct file *map_file,void *key,void *value,u64 map_flags);int bpf_fd_htab_map_lookup_elem (struct bpf_map *map,void *key,u32 *value);
kernel/bpf/arraymap.c +2 -1
@@ -467,7 +467,7 @@ static u32 prog_fd_array_sys_lookup_elem(void *ptr) }/* decrement refcnt of all bpf_progs that are stored in this map */ -void bpf_fd_array_map_clear (struct bpf_map *map) +static void bpf_fd_array_map_clear (struct bpf_map *map) { struct bpf_array *array = container_of(map, struct bpf_array, map);int i;
@@ -485,6 +485,7 @@ const struct bpf_map_ops prog_array_map_ops = { .map_fd_get_ptr = prog_fd_array_get_ptr, .map_fd_put_ptr = prog_fd_array_put_ptr, .map_fd_sys_lookup_elem = prog_fd_array_sys_lookup_elem, + .map_release_uref = bpf_fd_array_map_clear, }; static struct bpf_event_entry *bpf_event_entry_gen(struct file *perf_file,
kernel/bpf/sockmap.c +2 -2
@@ -875,7 +875,7 @@ static int sock_map_update_elem(struct bpf_map *map,return err; } -static void sock_map_release (struct bpf_map *map,struct file *map_file) +static void sock_map_release (struct bpf_map *map) { struct bpf_stab *stab = container_of(map, struct bpf_stab, map);struct bpf_prog *orig;
@@ -895,7 +895,7 @@ const struct bpf_map_ops sock_map_ops = { .map_get_next_key = sock_map_get_next_key, .map_update_elem = sock_map_update_elem, .map_delete_elem = sock_map_delete_elem, - .map_release = sock_map_release, + .map_release_uref = sock_map_release, }; BPF_CALL_4(bpf_sock_map_update, struct bpf_sock_ops_kern *, bpf_sock,
kernel/bpf/syscall.c +2 -2
@@ -214,8 +214,8 @@ static void bpf_map_free_deferred(struct work_struct *work)static void bpf_map_put_uref (struct bpf_map *map) {if (atomic_dec_and_test (&map->usercnt)) { -if (map->map_type ==BPF_MAP_TYPE_PROG_ARRAY ) -bpf_fd_array_map_clear (map); +if (map->ops->map_release_uref) + map->ops->map_release_uref (map); } }
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 28/46 tpm: tpm_crb: relinquish locality on error path.
In reply to Sasha LevinFrom: "Winkler, Tomas" <[email protected]>
[ Upstream commit 1fbad3028664e114d210dc65d768947a3a553eaa ]
In crb_map_io() function, __crb_request_locality() is called prior to crb_cmd_ready(), but if one of the consecutive function fails the flow bails out instead of trying to relinquish locality. This patch adds goto jump to __crb_relinquish_locality() on the error path.
--- drivers/char/tpm/tpm_crb.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/char/tpm/tpm_crb.c +7 -3
@@ -520,8 +520,10 @@ static int crb_map_io(struct acpi_device *device, struct crb_priv *priv, priv->regs_t =crb_map_res (dev, priv, &io_res, buf->control_address,sizeof (struct crb_regs_tail )); -if (IS_ERR (priv->regs_t)) -return PTR_ERR (priv->regs_t); +if (IS_ERR (priv->regs_t)) { + ret =PTR_ERR (priv->regs_t); + goto out_relinquish_locality; + }/* * PTT HW bug w/a: wake up the device to access
@@ -529,7 +531,7 @@ static int crb_map_io(struct acpi_device *device, struct crb_priv *priv,*/ ret =__crb_cmd_ready (dev, priv);if (ret) -return ret; + goto out_relinquish_locality; pa_high =ioread32 (&priv->regs_t->ctrl_cmd_pa_high); pa_low =ioread32 (&priv->regs_t->ctrl_cmd_pa_low);
@@ -574,6 +576,8 @@ static int crb_map_io(struct acpi_device *device, struct crb_priv *priv,__crb_go_idle (dev, priv); +out_relinquish_locality: +__crb_relinquish_locality (dev, priv,0 );return ret;
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 29/46 xen-netfront: Update features after registering netdev
In reply to Sasha LevinFrom: Ross Lagerwall <[email protected]>
[ Upstream commit 45c8184c1bed1ca8a7f02918552063a00b909bf5 ]
Update the features after calling register_netdev() otherwise the device features are not set up correctly and it not possible to change the MTU of the device. After this change, the features reported by ethtool match the device's features before the commit which introduced the issue and it is possible to change the device's MTU.
--- drivers/net/xen-netfront.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/xen-netfront.c +4 -4
@@ -1964,10 +1964,6 @@ static int xennet_connect(struct net_device *dev)/* talk_to_netback() sets the correct number of queues */ num_queues = dev->real_num_tx_queues; -rtnl_lock (); -netdev_update_features (dev); -rtnl_unlock (); -if (dev->reg_state ==NETREG_UNINITIALIZED ) { err =register_netdev (dev);if (err) {
@@ -1977,6 +1973,10 @@ static int xennet_connect(struct net_device *dev) } } +rtnl_lock (); +netdev_update_features (dev); +rtnl_unlock (); +/* * All public and private state should now be sane. Get * ready to start sending and receiving packets and give the driver
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 30/46 xen-netfront: Fix mismatched rtnl_unlock
In reply to Sasha LevinFrom: Ross Lagerwall <[email protected]>
[ Upstream commit cb257783c2927b73614b20f915a91ff78aa6f3e8 ]
--- drivers/net/xen-netfront.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/xen-netfront.c +2 -1
@@ -1824,7 +1824,7 @@ static int talk_to_netback(struct xenbus_device *dev, err =xen_net_read_mac (dev, info->netdev->dev_addr);if (err) {xenbus_dev_fatal (dev, err,"parsing %s/mac" , dev->nodename); - goto out; + goto out_unlocked; }rtnl_lock ();
@@ -1939,6 +1939,7 @@ static int talk_to_netback(struct xenbus_device *dev,xennet_destroy_queues (info); out:rtnl_unlock (); +out_unlocked:device_unregister (&dev->dev);return err; }
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 31/46 IB/usnic: Update with bug fixes from core code
In reply to Sasha LevinFrom: Jason Gunthorpe <[email protected]>
[ Upstream commit 43cbd64b1fdc1da89abdad88a022d9e87a98e9c6 ]
usnic has a modified version of the core codes' ib_umem_get() and related, and the copy misses many of the bug fixes done over the years:
Commit bc3e53f682d9 ("mm: distinguish between mlocked and pinned pages") Commit 87773dd56d54 ("IB: ib_umem_release() should decrement mm->pinned_vm
from ib_umem_get")
Commit 8494057ab5e4 ("IB/uverbs: Prevent integer overflow in ib_umem_get
address arithmetic")
Commit 8abaae62f3fd ("IB/core: disallow registering 0-sized memory region") Commit 66578b0b2f69 ("IB/core: don't disallow registering region starting
at 0x0")
Commit 53376fedb9da ("RDMA/core: not to set page dirty bit if it's already
set.")Commit 8e907ed48827 ("IB/umem: Use the correct mm during ib_umem_release")
--- drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 2 +- drivers/infiniband/hw/usnic/usnic_uiom.c | 40 ++++++++++++++------ drivers/infiniband/hw/usnic/usnic_uiom.h | 5 ++- 3 files changed, 33 insertions(+), 14 deletions(-)
drivers/infiniband/hw/usnic/usnic_ib_verbs.c +1 -1
@@ -642,7 +642,7 @@ int usnic_ib_dereg_mr(struct ib_mr *ibmr)usnic_dbg ("va 0x%lx length 0x%zx\n" , mr->umem->va, mr->umem->length); -usnic_uiom_reg_release (mr->umem, ibmr->pd->uobject->context->closing); +usnic_uiom_reg_release (mr->umem, ibmr->uobject->context);kfree (mr);return 0 ; }
drivers/infiniband/hw/usnic/usnic_uiom.c +28 -12
@@ -41,6 +41,7 @@#include <linux/workqueue.h> #include <linux/list.h> #include <linux/pci.h> +#include <rdma/ib_verbs.h> #include "usnic_log.h" #include "usnic_uiom.h"
@@ -88,7 +89,7 @@ static void usnic_uiom_put_pages(struct list_head *chunk_list, int dirty)for_each_sg (chunk->page_list, sg, chunk->nents, i) { page =sg_page (sg); pa =sg_phys (sg); -if (dirty) +if (!PageDirty (page) && dirty)set_page_dirty_lock (page);put_page (page);usnic_dbg ("pa: %pa\n" , &pa);
@@ -114,6 +115,16 @@ static int usnic_uiom_get_pages(unsigned long addr, size_t size, int writable,dma_addr_t pa;unsigned int gup_flags; +/* +* If the combination of the addr and size requested for this memory +* region causes an integer overflow, return error. +*/ +if (((addr + size) < addr) ||PAGE_ALIGN (addr + size) < (addr + size)) +return -EINVAL ; + +if (!size) +return -EINVAL ; +if (!can_do_mlock ())return -EPERM ;
@@ -127,7 +138,7 @@ static int usnic_uiom_get_pages(unsigned long addr, size_t size, int writable,down_write (¤t->mm->mmap_sem); - locked = npages + current->mm->locked_vm; + locked = npages + current->mm->pinned_vm; lock_limit =rlimit (RLIMIT_MEMLOCK ) >>PAGE_SHIFT ;if ((locked > lock_limit) && !capable (CAP_IPC_LOCK )) {
@@ -143,7 +154,7 @@ static int usnic_uiom_get_pages(unsigned long addr, size_t size, int writable, ret =0 ;while (npages) { - ret =get_user_pages (cur_base, + ret =get_user_pages_longterm (cur_base, min_t(unsigned long, npages,PAGE_SIZE /sizeof (struct page *)), gup_flags, page_list,NULL );
@@ -186,7 +197,7 @@ static int usnic_uiom_get_pages(unsigned long addr, size_t size, int writable,if (ret <0 )usnic_uiom_put_pages (chunk_list,0 );else - current->mm->locked_vm = locked; + current->mm->pinned_vm = locked;up_write (¤t->mm->mmap_sem);free_page ((unsigned long ) page_list);
@@ -420,18 +431,22 @@ struct usnic_uiom_reg *usnic_uiom_reg_get(struct usnic_uiom_pd *pd,return ERR_PTR (err); } -void usnic_uiom_reg_release (struct usnic_uiom_reg *uiomr,int closing) +void usnic_uiom_reg_release (struct usnic_uiom_reg *uiomr, +struct ib_ucontext *ucontext) { +struct task_struct *task;struct mm_struct *mm;unsigned long diff;__usnic_uiom_reg_release (uiomr->pd, uiomr,1 ); - mm =get_task_mm (current); -if (!mm) { -kfree (uiomr); -return ; - } + task =get_pid_task (ucontext->tgid,PIDTYPE_PID ); +if (!task) + goto out; + mm =get_task_mm (task); +put_task_struct (task); +if (!mm) + goto out; diff =PAGE_ALIGN (uiomr->length + uiomr->offset) >>PAGE_SHIFT ;
@@ -443,7 +458,7 @@ void usnic_uiom_reg_release(struct usnic_uiom_reg *uiomr, int closing)* up here and not be able to take the mmap_sem. In that case * we defer the vm_locked accounting to the system workqueue. */ -if (closing) { +if (ucontext->closing) {if (!down_write_trylock (&mm->mmap_sem)) {INIT_WORK (&uiomr->work, usnic_uiom_reg_account); uiomr->mm = mm;
@@ -455,9 +470,10 @@ void usnic_uiom_reg_release(struct usnic_uiom_reg *uiomr, int closing) }else down_write (&mm->mmap_sem); - current->mm->locked_vm -= diff; + mm->pinned_vm -= diff;up_write (&mm->mmap_sem);mmput (mm); +out:kfree (uiomr); }
drivers/infiniband/hw/usnic/usnic_uiom.h +4 -1
@@ -39,6 +39,8 @@#include "usnic_uiom_interval_tree.h" +struct ib_ucontext ; +#define USNIC_UIOM_READ (1)#define USNIC_UIOM_WRITE (2)
@@ -89,7 +91,8 @@ void usnic_uiom_free_dev_list(struct device **devs);struct usnic_uiom_reg *usnic_uiom_reg_get (struct usnic_uiom_pd *pd,unsigned long addr,size_t size,int access,int dmasync); -void usnic_uiom_reg_release (struct usnic_uiom_reg *uiomr,int closing); +void usnic_uiom_reg_release (struct usnic_uiom_reg *uiomr, +struct ib_ucontext *ucontext);int usnic_uiom_init (char *drv_name);void usnic_uiom_fini (void );#endif /* USNIC_UIOM_H_ */
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 32/46 mmc: dw_mmc-rockchip: correct property names in debug
In reply to Sasha LevinFrom: John Keeping <[email protected]>
[ Upstream commit e988867fd774d00aeaf5d3c332032bf5b97a4147 ]
Following up the device tree fixed in commits e78c637127ee ("ARM: dts:
rockchip: Fix DWMMC clocks") and ca9eee95a2de ("arm64: dts: rockchip:
Fix DWMMC clocks", 2018-02-15), avoid confusion by using the correct property name in the debug output if clocks are not found.
--- drivers/mmc/host/dw_mmc-rockchip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/host/dw_mmc-rockchip.c +2 -2
@@ -282,11 +282,11 @@ static int dw_mci_rk3288_parse_dt(struct dw_mci *host) priv->drv_clk =devm_clk_get (host->dev,"ciu-drive" );if (IS_ERR (priv->drv_clk)) -dev_dbg (host->dev,"ciu_drv not available\n" ); +dev_dbg (host->dev,"ciu-drive not available\n" ); priv->sample_clk =devm_clk_get (host->dev,"ciu-sample" );if (IS_ERR (priv->sample_clk)) -dev_dbg (host->dev,"ciu_sample not available\n" ); +dev_dbg (host->dev,"ciu-sample not available\n" ); host->priv = priv;
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 33/46 MIPS: Workaround GCC __builtin_unreachable reordering bug
In reply to Sasha LevinFrom: Paul Burton <[email protected]>
[ Upstream commit 906d441febc0de974b2a6ef848a8f058f3bfada3 ]
Some versions of GCC for the MIPS architecture suffer from a bug which can lead to instructions from beyond an unreachable statement being incorrectly reordered into earlier branch delay slots if the unreachable statement is the only content of a case in a switch statement. This can lead to seemingly random behaviour, such as invalid memory accesses from incorrectly reordered loads or stores, and link failures on microMIPS builds.
See this potential GCC fix for details:
https://gcc.gnu.org/ml/gcc-patches/2015-09/msg00360.html
Runtime problems resulting from this bug were initially observed using a maltasmvp_defconfig v4.4 kernel built using GCC 4.9.2 (from a Codescape SDK 2015.06-05 toolchain), with the result being an address exception taken after log messages about the L1 caches (during probe of the L2 cache):
Initmem setup node 0 [mem 0x0000000080000000-0x000000009fffffff] VPE topology {2,2} total 4
Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes. Primary data cache 64kB, 4-way, PIPT, no aliases, linesize 32 bytes <AdEL exception here>
This is early enough that the kernel exception vectors are not in use, so any further output depends upon the bootloader. This is reproducible in QEMU where no further output occurs - ie. the system hangs here. Given the nature of the bug it may potentially be hit with differing symptoms. The bug is known to affect GCC versions as recent as 7.3, and it is unclear whether GCC 8 fixed it or just happens not to encounter the bug in the testcase found at the link above due to differing optimizations.
This bug can be worked around by placing a volatile asm statement, which GCC is prevented from reordering past, prior to the __builtin_unreachable call.
That was actually done already for other reasons by commit 173a3efd3edb ("bug.h: work around GCC PR82365 in BUG()"), but creates problems for microMIPS builds due to the lack of a .insn directive. The microMIPS ISA allows for interlinking with regular MIPS32 code by repurposing bit 0 of the program counter as an ISA mode bit. To switch modes one changes the value of this bit in the PC. However typical branch instructions encode their offsets as multiples of 2-byte instruction halfwords, which means they cannot change ISA mode - this must be done using either an indirect branch (a jump-register in MIPS terminology) or a dedicated jalx instruction. In order to ensure that regular branches don't attempt to target code in a different ISA which they can't actually switch to, the linker will check that branch targets are code in the same ISA as the branch.
Unfortunately our empty asm volatile statements don't qualify as code, and the link for microMIPS builds fails with errors such as:
arch/mips/mm/dma-default.s:3265: Error: branch to a symbol in another ISA mode arch/mips/mm/dma-default.s:5027: Error: branch to a symbol in another ISA mode
Resolve this by adding a .insn directive within the asm statement which declares that what comes next is code. This may or may not be true, since we don't really know what comes next, but as this code is in an unreachable path anyway that doesn't matter since we won't execute it.
We do this in asm/compiler.h & select CONFIG_HAVE_ARCH_COMPILER_H in order to have this included by linux/compiler_types.h after linux/compiler-gcc.h. This will result in asm/compiler.h being included in all C compilations via the -include linux/compiler_types.h argument in c_flags, which should be harmless.
Patchwork: https://patchwork.linux-mips.org/patch/20270/
--- arch/mips/Kconfig | 1 + arch/mips/include/asm/compiler.h | 35 ++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+)
arch/mips/Kconfig +1 -0
@@ -29,6 +29,7 @@ config MIPS select GENERIC_SMP_IDLE_THREAD select GENERIC_TIME_VSYSCALL select HANDLE_DOMAIN_IRQ + select HAVE_ARCH_COMPILER_H select HAVE_ARCH_JUMP_LABEL select HAVE_ARCH_KGDB select HAVE_ARCH_MMAP_RND_BITS if MMU
arch/mips/include/asm/compiler.h +35 -0
@@ -8,6 +8,41 @@#ifndef _ASM_COMPILER_H#define _ASM_COMPILER_H +/* +* With GCC 4.5 onwards we can use __builtin_unreachable to indicate to the +* compiler that a particular code path will never be hit. This allows it to be +* optimised out of the generated binary. +* +* Unfortunately at least GCC 4.6.3 through 7.3.0 inclusive suffer from a bug +* that can lead to instructions from beyond an unreachable statement being +* incorrectly reordered into earlier delay slots if the unreachable statement +* is the only content of a case in a switch statement. This can lead to +* seemingly random behaviour, such as invalid memory accesses from incorrectly +* reordered loads or stores. See this potential GCC fix for details: +* +* https://gcc.gnu.org/ml/gcc-patches/2015-09/msg00360.html +* +* It is unclear whether GCC 8 onwards suffer from the same issue - nothing +* relevant is mentioned in GCC 8 release notes and nothing obviously relevant +* stands out in GCC commit logs, but these newer GCC versions generate very +* different code for the testcase which doesn't exhibit the bug. +* +* GCC also handles stack allocation suboptimally when calling noreturn +* functions or calling __builtin_unreachable(): +* +* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82365 +* +* We work around both of these issues by placing a volatile asm statement, +* which GCC is prevented from reordering past, prior to __builtin_unreachable +* calls. +* +* The .insn statement is required to ensure that any branches to the +* statement, which sadly must be kept due to the asm statement, are known to +* be branches to code and satisfy linker requirements for microMIPS kernels. +*/ +#undef barrier_before_unreachable +#define barrier_before_unreachable () asm volatile(".insn") +#if __GNUC__ >3 || (__GNUC__ ==3 && __GNUC_MINOR__ >=4 )#define GCC_IMM_ASM () "n"#define GCC_REG_ACCUM "$0"
Signature · 1 line
2.17.1
Re: [PATCH AUTOSEL 4.14 33/46] MIPS: Workaround GCC __builtin_unreachable reordering bug
Hi Sasha,
Quoted 80 lines · Sasha Levin
From: Paul Burton <[email protected]>
[ Upstream commit
906d441febc0de974b2a6ef848a8f058f3bfada3]Some versions of GCC for the MIPS architecture suffer from a bug which can lead to instructions from beyond an unreachable statement being incorrectly reordered into earlier branch delay slots if the unreachable statement is the only content of a case in a switch statement. This can lead to seemingly random behaviour, such as invalid memory accesses from incorrectly reordered loads or stores, and link failures on microMIPS builds.
See this potential GCC fix for details:
https://gcc.gnu.org/ml/gcc-patches/2015-09/msg00360.htmlRuntime problems resulting from this bug were initially observed using a
maltasmvp_defconfigv4.4 kernel built using GCC 4.9.2 (from a Codescape SDK 2015.06-05 toolchain), with the result being an address exception taken after log messages about the L1 caches (during probe of the L2 cache):Initmem setup node 0 [mem 0x0000000080000000-0x000000009fffffff] VPE topology {2,2} total 4
Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes. Primary data cache 64kB, 4-way, PIPT, no aliases, linesize 32 bytes <AdEL exception here>This is early enough that the kernel exception vectors are not in use, so any further output depends upon the bootloader. This is reproducible in QEMU where no further output occurs - ie. the system hangs here. Given the nature of the bug it may potentially be hit with differing symptoms. The bug is known to affect GCC versions as recent as 7.3, and it is unclear whether GCC 8 fixed it or just happens not to encounter the bug in the testcase found at the link above due to differing optimizations.
This bug can be worked around by placing a volatile asm statement, which GCC is prevented from reordering past, prior to the
__builtin_unreachablecall.That was actually done already for other reasons by commit
173a3efd3edb("bug.h: work around GCC PR82365 inBUG()"), but creates problems for microMIPS builds due to the lack of a .insn directive. The microMIPS ISA allows for interlinking with regular MIPS32 code by repurposing bit 0 of the program counter as an ISA mode bit. To switch modes one changes the value of this bit in the PC. However typical branch instructions encode their offsets as multiples of 2-byte instruction halfwords, which means they cannot change ISA mode - this must be done using either an indirect branch (a jump-register in MIPS terminology) or a dedicated jalx instruction. In order to ensure that regular branches don't attempt to target code in a different ISA which they can't actually switch to, the linker will check that branch targets are code in the same ISA as the branch.Unfortunately our empty asm volatile statements don't qualify as code, and the link for microMIPS builds fails with errors such as:
arch/mips/mm/dma-default.s:3265: Error: branch to a symbol in another ISA modearch/mips/mm/dma-default.s:5027: Error: branch to a symbol in another ISA modeResolve this by adding a .insn directive within the asm statement which declares that what comes next is code. This may or may not be true, since we don't really know what comes next, but as this code is in an unreachable path anyway that doesn't matter since we won't execute it.
We do this in
asm/compiler.h& selectCONFIG_HAVE_ARCH_COMPILER_Hin order to have this included bylinux/compiler_types.hafterlinux/compiler-gcc.h. This will result inasm/compiler.hbeing included in all C compilations via the -includelinux/compiler_types.hargument inc_flags, which should be harmless.Signed-off-by Paul Burton <[email protected]>Fixes 173a3efd3edb ("bug.h: work around GCC PR82365 in BUG()")Patchwork: https://patchwork.linux-mips.org/patch/20270/
Cc James Hogan <[email protected]>Cc Ralf Baechle <[email protected]>Cc Arnd Bergmann <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Quoted 4 lines
--- arch/mips/Kconfig | 1 + arch/mips/include/asm/compiler.h | 35 ++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+)
In principle I'm fine with backporting this - it does fix broken builds.
It's only going to be of any use though if you also backport commit 04f264d3a8b0 ("compiler.h: Allow arch-specific asm/compiler.h"). I'd recommend backporting both or neither.
In practice I think it's unlikely anyone will need a microMIPS kernel & be tied to the particular versions affected by the bug this patch fixed, so I don't think it's a problem to backport neither.
Thanks,
Paul
Re: [PATCH AUTOSEL 4.14 33/46] MIPS: Workaround GCC __builtin_unreachable reordering bug
Quoted 9 lines · Paul Burton
Quoted 5 lines · Sasha Levin
From: Paul Burton <[email protected]>
--- arch/mips/Kconfig | 1 + arch/mips/include/asm/compiler.h | 35 ++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+)In principle I'm fine with backporting this - it does fix broken builds.
Quoted 7 lines
It's only going to be of any use though if you also backport commit
04f264d3a8b0("compiler.h: Allow arch-specificasm/compiler.h"). I'd recommend backporting both or neither.In practice I think it's unlikely anyone will need a microMIPS kernel & be tied to the particular versions affected by the bug this patch fixed, so I don't think it's a problem to backport neither.
I think the current practice of the stable kernel these days is to take both patches in this case: They fix an actual bug in the mainline kernel, and it seems unlikely enough that they cause a regression if backported, so putting them into 4.14 has more advantages than disadvantages.
Arnd
Sasha Levin
maintainerRe: [PATCH AUTOSEL 4.14 33/46] MIPS: Workaround GCC __builtin_unreachable reordering bug
Quoted 14 lines · Arnd Bergmann
Quoted 13 lines · Paul Burton
Quoted 5 lines · Sasha Levin
From: Paul Burton <[email protected]>
--- arch/mips/Kconfig | 1 + arch/mips/include/asm/compiler.h | 35 ++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+)In principle I'm fine with backporting this - it does fix broken builds.
It's only going to be of any use though if you also backport commit
04f264d3a8b0("compiler.h: Allow arch-specificasm/compiler.h"). I'd recommend backporting both or neither.
Quoted 8 lines
Quoted 3 lines
In practice I think it's unlikely anyone will need a microMIPS kernel & be tied to the particular versions affected by the bug this patch fixed, so I don't think it's a problem to backport neither.
I think the current practice of the stable kernel these days is to take both patches in this case: They fix an actual bug in the mainline kernel, and it seems unlikely enough that they cause a regression if backported, so putting them into 4.14 has more advantages than disadvantages.
I'll take both, thank you!
--
Thanks,
Sasha
Sasha Levin
maintainerPATCH 34/46 lan78xx: Don't reset the interface on open
In reply to Sasha LevinFrom: Phil Elwell <[email protected]>
[ Upstream commit 47b998653fea4ef69e3e89574956386f262bccca ]
Commit 92571a1aae40 ("lan78xx: Connect phy early") moves the PHY initialisation into lan78xx_probe, but lan78xx_open subsequently calls lan78xx_reset. As well as forcing a second round of link negotiation, this reset frequently prevents the phy interrupt from being generated (even though the link is up), rendering the interface unusable.
Fix this issue by removing the lan78xx_reset call from lan78xx_open.
--- drivers/net/usb/lan78xx.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/net/usb/lan78xx.c +0 -4
@@ -2517,10 +2517,6 @@ static int lan78xx_open(struct net_device *net)if (ret <0 ) goto out; - ret =lan78xx_reset (dev); -if (ret <0 ) - goto done; -phy_start (net->phydev);netif_dbg (dev, ifup, dev->net,"phy initialised successfully" );
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 35/46 enic: do not overwrite error code
In reply to Sasha LevinFrom: Govindarajulu Varadarajan <[email protected]>
[ Upstream commit 56f772279a762984f6e9ebbf24a7c829faba5712 ]
In failure path, we overwrite err to what vnic_rq_disable() returns. In case it returns 0, enic_open() returns success in case of error.
--- drivers/net/ethernet/cisco/enic/enic_main.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/net/ethernet/cisco/enic/enic_main.c +4 -5
@@ -1879,7 +1879,7 @@ static int enic_open(struct net_device *netdev) {struct enic *enic =netdev_priv (netdev);unsigned int i; -int err; +int err, ret; err =enic_request_intr (enic);if (err) {
@@ -1936,10 +1936,9 @@ static int enic_open(struct net_device *netdev) err_out_free_rq:for (i =0 ; i < enic->rq_count; i++) { - err =vnic_rq_disable (&enic->rq[i]); -if (err) -return err; -vnic_rq_clean (&enic->rq[i], enic_free_rq_buf); + ret =vnic_rq_disable (&enic->rq[i]); +if (!ret) +vnic_rq_clean (&enic->rq[i], enic_free_rq_buf); }enic_dev_notify_unset (enic); err_out_free_intr:
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 36/46 iio: buffer: fix the function signature to match implementation
In reply to Sasha LevinFrom: Phil Reid <[email protected]>
[ Upstream commit 92397a6c38d139d50fabbe9e2dc09b61d53b2377 ]
linux/iio/buffer-dma.h was not updated to when length was changed to unsigned int.
--- include/linux/iio/buffer-dma.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/iio/buffer-dma.h +1 -1
@@ -141,7 +141,7 @@ int iio_dma_buffer_read(struct iio_buffer *buffer, size_t n, char __user *user_buffer);size_t iio_dma_buffer_data_available (struct iio_buffer *buffer);int iio_dma_buffer_set_bytes_per_datum (struct iio_buffer *buffer,size_t bpd); -int iio_dma_buffer_set_length (struct iio_buffer *buffer,int length); +int iio_dma_buffer_set_length (struct iio_buffer *buffer,unsigned int length);int iio_dma_buffer_request_update (struct iio_buffer *buffer); int iio_dma_buffer_init(struct iio_dma_buffer_queue *queue,
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 37/46 selftests/powerpc: Add ptrace hw breakpoint test
In reply to Sasha LevinFrom: Michael Neuling <[email protected]>
[ Upstream commit 9c2ddfe55c42bf4b9bc336a0650ab78f9222a159 ]
This test the ptrace hw breakpoints via PTRACE_SET_DEBUGREG and PPC_PTRACE_SETHWDEBUG. This test was use to find the bugs fixed by these recent commits:
4f7c06e26e powerpc/ptrace: Fix setting 512B aligned breakpoints with PTRACE_SET_DEBUGREG cd6ef7eebf powerpc/ptrace: Fix enforcement of DAWR constraints
--- .../selftests/powerpc/ptrace/.gitignore | 1 + .../testing/selftests/powerpc/ptrace/Makefile | 2 +- .../selftests/powerpc/ptrace/ptrace-hwbreak.c | 342 ++++++++++++++++++ 3 files changed, 344 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-hwbreak.c
tools/testing/selftests/powerpc/ptrace/.gitignore +1 -0
@@ -8,3 +8,4 @@ ptrace-vsx ptrace-tm-vsx ptrace-tm-spd-vsx ptrace-tm-spr +ptrace-hwbreak
tools/testing/selftests/powerpc/ptrace/Makefile +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 TEST_PROGS := ptrace-gpr ptrace-tm-gpr ptrace-tm-spd-gpr \ ptrace-tar ptrace-tm-tar ptrace-tm-spd-tar ptrace-vsx ptrace-tm-vsx \ - ptrace-tm-spd-vsx ptrace-tm-spr + ptrace-tm-spd-vsx ptrace-tm-spr ptrace-hwbreak include ../../lib.mk
tools/testing/selftests/powerpc/ptrace/ptrace-hwbreak.c new file +342 -0
342 lines not on this page · raw message
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 38/46 scsi: ibmvfc: Avoid unnecessary port relogin
In reply to Sasha LevinFrom: Brian King <[email protected]>
[ Upstream commit 09dd15e0d9547ca424de4043bcd429bab6f285c8 ]
Following an RSCN, ibmvfc will issue an ADISC to determine if the underlying target has changed, comparing the SCSI ID, WWPN, and WWNN to determine how to handle the rport in discovery. However, the comparison of the WWPN and WWNN was performing a memcmp between a big endian field against a CPU endian field, which resulted in the wrong answer on LE systems. This was observed as unexpected errors getting logged at boot time as targets were getting relogins when not needed.
--- drivers/scsi/ibmvscsi/ibmvfc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/scsi/ibmvscsi/ibmvfc.c +2 -4
@@ -3580,11 +3580,9 @@ static void ibmvfc_tgt_implicit_logout(struct ibmvfc_target *tgt)static int ibmvfc_adisc_needs_plogi (struct ibmvfc_passthru_mad *mad,struct ibmvfc_target *tgt) { -if (memcmp (&mad->fc_iu.response[2 ], &tgt->ids.port_name, -sizeof (tgt->ids.port_name))) +if (wwn_to_u64 ((u8 *)&mad->fc_iu.response[2 ]) != tgt->ids.port_name)return 1 ; -if (memcmp (&mad->fc_iu.response[4 ], &tgt->ids.node_name, -sizeof (tgt->ids.node_name))) +if (wwn_to_u64 ((u8 *)&mad->fc_iu.response[4 ]) != tgt->ids.node_name)return 1 ;if (be32_to_cpu (mad->fc_iu.response[6 ]) != tgt->scsi_id)return 1 ;
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 39/46 scsi: sd: Remember that READ CAPACITY(16) succeeded
In reply to Sasha LevinFrom: "Martin K. Petersen" <[email protected]>
[ Upstream commit 597d74005ba85e87c256cd732128ebf7faf54247 ]
The USB storage glue sets the try_rc_10_first flag in an attempt to avoid wedging poorly implemented legacy USB devices.
If the device capacity is too large to be expressed in the provided response buffer field of READ CAPACITY(10), a well-behaved device will set the reported capacity to 0xFFFFFFFF. We will then attempt to issue a READ CAPACITY(16) to obtain the real capacity.
Since this part of the discovery logic is not covered by the first_scan flag, a warning will be printed a couple of times times per revalidate attempt if we upgrade from READ CAPACITY(10) to READ CAPACITY(16).
Remember that we have successfully issued READ CAPACITY(16) so we can take the fast path on subsequent revalidate attempts.
--- drivers/scsi/sd.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/scsi/sd.c +2 -0
@@ -2497,6 +2497,8 @@ sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer) sector_size = old_sector_size; goto got_data; } +/* Remember that READ CAPACITY(16) succeeded */ + sdp->try_rc_10_first =0 ; } }
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 40/46 btrfs: quota: Set rescan progress to (u64)-1 if we hit last leaf
In reply to Sasha LevinFrom: Qu Wenruo <[email protected]>
[ Upstream commit 6f7de19ed3d4d3526ca5eca428009f97cf969c2f ]
Commit ff3d27a048d9 ("btrfs: qgroup: Finish rescan when hit the last leaf of extent tree") added a new exit for rescan finish.
However after finishing quota rescan, we set fs_info->qgroup_rescan_progress to (u64)-1 before we exit through the original exit path.
While we missed that assignment of (u64)-1 in the new exit path.
The end result is, the quota status item doesn't have the same value. (-1 vs the last bytenr + 1)
Although it doesn't affect quota accounting, it's still better to keep the original behavior.
--- fs/btrfs/qgroup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/btrfs/qgroup.c +3 -1
@@ -2603,8 +2603,10 @@ qgroup_rescan_leaf(struct btrfs_fs_info *fs_info, struct btrfs_path *path, }btrfs_put_tree_mod_seq (fs_info, &tree_mod_seq_elem); -if (done && !ret) +if (done && !ret) { ret =1 ; + fs_info->qgroup_rescan_progress.objectid = (u64)-1 ; + }return ret; }
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 41/46 net: phy: phylink: Don't release NULL GPIO
In reply to Sasha LevinFrom: Florian Fainelli <[email protected]>
[ Upstream commit 3bcd47726c3b744fd08781795cca905cc59a1382 ]
If CONFIG_GPIOLIB is disabled, gpiod_put() becomes a stub that produces a warning, this helped identify that we could be attempting to release a NULL pl->link_gpio GPIO descriptor, so guard against that.
--- drivers/net/phy/phylink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/phylink.c +1 -1
@@ -561,7 +561,7 @@ void phylink_destroy(struct phylink *pl) {if (pl->sfp_bus)sfp_unregister_upstream (pl->sfp_bus); -if (!IS_ERR (pl->link_gpio)) +if (!IS_ERR_OR_NULL (pl->link_gpio))gpiod_put (pl->link_gpio);cancel_work_sync (&pl->resolve);
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 42/46 x86/paravirt: Fix some warning messages
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit 571d0563c8881595f4ab027aef9ed1c55e3e7b7c ]
The first argument to WARN_ONCE() is a condition.
--- arch/x86/kernel/paravirt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/paravirt.c +2 -2
@@ -90,7 +90,7 @@ unsigned paravirt_patch_call(void *insnbuf,if (len <5 ) {#ifdef CONFIG_RETPOLINE -WARN_ONCE ("Failing to patch indirect CALL in %ps\n" , (void *)addr); +WARN_ONCE (1 ,"Failing to patch indirect CALL in %ps\n" , (void *)addr);#endif return len;/* call too long for patch site */ }
@@ -110,7 +110,7 @@ unsigned paravirt_patch_jmp(void *insnbuf, const void *target,if (len <5 ) {#ifdef CONFIG_RETPOLINE -WARN_ONCE ("Failing to patch indirect JMP in %ps\n" , (void *)addr); +WARN_ONCE (1 ,"Failing to patch indirect JMP in %ps\n" , (void *)addr);#endif return len;/* call too long for patch site */ }
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 43/46 net: stmmac: mark PM functions as __maybe_unused
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 81a8b0799632627b587af31ecd06112397e4ec36 ]
The newly added suspend/resume functions cause a build warning when CONFIG_PM is disabled:
drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c:324:12: error: 'stmmac_pci_resume' defined but not used [-Werror=unused-function] drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c:306:12: error: 'stmmac_pci_suspend' defined but not used [-Werror=unused-function]
Mark them as __maybe_unused so gcc can drop them silently.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c +2 -2
@@ -303,7 +303,7 @@ static void stmmac_pci_remove(struct pci_dev *pdev)pci_disable_device (pdev); } -static int stmmac_pci_suspend (struct device *dev) +static int __maybe_unused stmmac_pci_suspend (struct device *dev) {struct pci_dev *pdev =to_pci_dev (dev);int ret;
@@ -321,7 +321,7 @@ static int stmmac_pci_suspend(struct device *dev)return 0 ; } -static int stmmac_pci_resume (struct device *dev) +static int __maybe_unused stmmac_pci_resume (struct device *dev) {struct pci_dev *pdev =to_pci_dev (dev);int ret;
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 44/46 kconfig: fix the rule of mainmenu_stmt symbol
In reply to Sasha LevinFrom: Masahiro Yamada <[email protected]>
[ Upstream commit 56869d45e364244a721de34ce9c5dc9ed022779e ]
The rule of mainmenu_stmt does not have debug print of zconf_lineno(), but if it had, it would print a wrong line number for the same reason as commit b2d00d7c61c8 ("kconfig: fix line numbers for if-entries in menu tree").
The mainmenu_stmt does not need to eat following empty lines because they are reduced to common_stmt.
--- scripts/kconfig/zconf.y | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/kconfig/zconf.y +2 -2
@@ -31,7 +31,7 @@ struct symbol *symbol_hash[SYMBOL_HASHSIZE]; static struct menu *current_menu, *current_entry; %} -%expect 31 +%expect 30 %union {
@@ -112,7 +112,7 @@ start: mainmenu_stmt stmt_list | no_mainmenu_stmt stmt_list; /* mainmenu entry */ -mainmenu_stmt: T_MAINMENU prompt nl +mainmenu_stmt: T_MAINMENU prompt T_EOL { menu_add_prompt(P_MENU, $2, NULL); };
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 45/46 libertas: call into generic suspend code before turning off power
In reply to Sasha LevinFrom: Daniel Mack <[email protected]>
[ Upstream commit 4f666675cdff0b986195413215eb062b7da6586f ]
When powering down a SDIO connected card during suspend, make sure to call into the generic lbs_suspend() function before pulling the plug. This will make sure the card is successfully deregistered from the system to avoid communication to the card starving out.
--- drivers/net/wireless/marvell/libertas/if_sdio.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/marvell/libertas/if_sdio.c +4 -0
@@ -1317,6 +1317,10 @@ static int if_sdio_suspend(struct device *dev)if (priv->wol_criteria ==EHS_REMOVE_WAKEUP ) {dev_info (dev,"Suspend without wake params -- powering down card\n" );if (priv->fw_ready) { + ret =lbs_suspend (priv); +if (ret) +return ret; + priv->power_up_on_resume = true;if_sdio_power_off (card); }
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 46/46 perf tests: Fix indexing when invoking subtests
In reply to Sasha LevinFrom: Sandipan Das <[email protected]>
[ Upstream commit aa90f9f9554616d5738f7bedb4a8f0e5e14d1bc6 ]
Recently, the subtest numbering was changed to start from 1. While it is fine for displaying results, this should not be the case when the subtests are actually invoked.
Typically, the subtests are stored in zero-indexed arrays and invoked based on the index passed to the main test function. Since the index now starts from 1, the second subtest in the array (index 1) gets invoked instead of the first (index 0). This applies to all of the following subtests but for the last one, the subtest always fails because it does not meet the boundary condition of the subtest index being lesser than the number of subtests.
This can be observed on powerpc64 and x86_64 systems running Fedora 28 as shown below.
Before:
# perf test "builtin clang support" 55: builtin clang support : 55.1: builtin clang compile C source to IR : Ok 55.2: builtin clang compile C source to ELF object : FAILED!
# perf test "LLVM search and compile" 38: LLVM search and compile : 38.1: Basic BPF llvm compile : Ok 38.2: kbuild searching : Ok 38.3: Compile source for BPF prologue generation : Ok 38.4: Compile source for BPF relocation : FAILED!
# perf test "BPF filter" 40: BPF filter : 40.1: Basic BPF filtering : Ok 40.2: BPF pinning : Ok 40.3: BPF prologue generation : Ok 40.4: BPF relocation checker : FAILED!
After:
# perf test "builtin clang support" 55: builtin clang support : 55.1: builtin clang compile C source to IR : Ok 55.2: builtin clang compile C source to ELF object : Ok
# perf test "LLVM search and compile" 38: LLVM search and compile : 38.1: Basic BPF llvm compile : Ok 38.2: kbuild searching : Ok 38.3: Compile source for BPF prologue generation : Ok 38.4: Compile source for BPF relocation : Ok
# perf test "BPF filter" 40: BPF filter : 40.1: Basic BPF filtering : Ok 40.2: BPF pinning : Ok 40.3: BPF prologue generation : Ok 40.4: BPF relocation checker : Ok
--- tools/perf/tests/builtin-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/tests/builtin-test.c +2 -2
@@ -375,7 +375,7 @@ static int test_and_print(struct test *t, bool force_skip, int subtest)if (!t->subtest.get_nr)pr_debug ("%s:" , t->desc);else -pr_debug ("%s subtest %d:" , t->desc, subtest); +pr_debug ("%s subtest %d:" , t->desc, subtest +1 );switch (err) {case TEST_OK :
@@ -589,7 +589,7 @@ static int __cmd_test(int argc, const char *argv[], struct intlist *skiplist)for (subi =0 ; subi < subn; subi++) {pr_info ("%2d.%1d: %-*s:" , i, subi +1 , subw, t->subtest.get_desc (subi)); - err =test_and_print (t, skip, subi +1 ); + err =test_and_print (t, skip, subi);if (err !=TEST_OK && t->subtest.skip_if_fail) skip = true; }
Signature · 1 line
2.17.1