usb: hso: Fix debug compile warning on sparc32
Subsystems (5)
Sasha Levin
maintainerPATCH 1/10 usb: hso: Fix debug compile warning on sparc32
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit e0484010ec05191a8edf980413fc92f28050c1cc ]
On sparc32, tcflag_t is "unsigned long", unlike on all other architectures, where it is "unsigned int":
drivers/net/usb/hso.c: In function ‘hso_serial_set_termios’:
include/linux/kern_levels.h:5:18: warning: format ‘%d’ expects argument of type ‘unsigned int’, but argument 4 has type ‘tcflag_t {aka long unsigned int}’ [-Wformat=] drivers/net/usb/hso.c:1393:3: note: in expansion of macro ‘hso_dbg’
hso_dbg(0x16, "Termios called with: cflags new[%d] - old[%d]\n",
^~~~~~~
include/linux/kern_levels.h:5:18: warning: format ‘%d’ expects argument of type ‘unsigned int’, but argument 5 has type ‘tcflag_t {aka long unsigned int}’ [-Wformat=] drivers/net/usb/hso.c:1393:3: note: in expansion of macro ‘hso_dbg’
hso_dbg(0x16, "Termios called with: cflags new[%d] - old[%d]\n",
^~~~~~~
As "unsigned long" is 32-bit on sparc32, fix this by casting all tcflag_t parameters to "unsigned int".
While at it, use "%u" to format unsigned numbers.
--- drivers/net/usb/hso.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/usb/hso.c +3 -2
@@ -1402,8 +1402,9 @@ static void hso_serial_set_termios(struct tty_struct *tty, struct ktermios *old)unsigned long flags;if (old) -hso_dbg (0x16 ,"Termios called with: cflags new[%d] - old[%d]\n" , - tty->termios.c_cflag, old->c_cflag); +hso_dbg (0x16 ,"Termios called with: cflags new[%u] - old[%u]\n" , + (unsigned int )tty->termios.c_cflag, + (unsigned int )old->c_cflag);/* the actual setup */ spin_lock_irqsave (&serial->serial_lock, flags);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 2/10 qed: Disable "MFW indication via attention" SPAM every 5 minutes
From: Laurence Oberman <[email protected]>
[ Upstream commit 1d61e21852d3161f234b9656797669fe185c251b ]
This is likely firmware causing this but its starting to annoy customers. Change the message level to verbose to prevent the spam.
Note that this seems to only show up with ISCSI enabled on the HBA via the qedi driver.
--- drivers/net/ethernet/qlogic/qed/qed_int.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/qlogic/qed/qed_int.c +2 -1
@@ -1015,7 +1015,8 @@ static int qed_int_attentions(struct qed_hwfn *p_hwfn) index, attn_bits, attn_acks, asserted_bits, deasserted_bits, p_sb_attn_sw->known_attn); }else if (asserted_bits ==0x100 ) { -DP_INFO (p_hwfn,"MFW indication via attention\n" ); +DP_VERBOSE (p_hwfn,NETIF_MSG_INTR , +"MFW indication via attention\n" ); }else {DP_VERBOSE (p_hwfn,NETIF_MSG_INTR ,"MFW indication [deassertion]\n" );
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 4/10 parisc: add support for cmpxchg on u8 pointers
In reply to Sasha LevinFrom: Liam Beguin <[email protected]>
[ Upstream commit b344d6a83d01c52fddbefa6b3b4764da5b1022a0 ]
The kernel test bot reported[1] that using set_mask_bits on a u8 causes the following issue on parisc:
hppa-linux-ld: drivers/phy/ti/phy-tusb1210.o: in function `tusb1210_probe': >> (.text+0x2f4): undefined reference to `__cmpxchg_called_with_bad_pointer' >> hppa-linux-ld: (.text+0x324): undefined reference to `__cmpxchg_called_with_bad_pointer' hppa-linux-ld: (.text+0x354): undefined reference to `__cmpxchg_called_with_bad_pointer'
Add support for cmpxchg on u8 pointers.
[1] https://lore.kernel.org/patchwork/patch/1272617/#1468946
--- arch/parisc/include/asm/cmpxchg.h | 2 ++ arch/parisc/lib/bitops.c | 12 ++++++++++++ 2 files changed, 14 insertions(+)
arch/parisc/include/asm/cmpxchg.h +2 -0
@@ -60,6 +60,7 @@ extern void __cmpxchg_called_with_bad_pointer(void);extern unsigned long __cmpxchg_u32 (volatile unsigned int *m,unsigned int old,unsigned int new_);extern u64 __cmpxchg_u64 (volatile u64 *ptr,u64 old,u64 new_); +extern u8 __cmpxchg_u8 (volatile u8 *ptr,u8 old,u8 new_);/* don't worry...optimizer will get rid of most of this */ static inline unsigned long
@@ -71,6 +72,7 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size)#endif case 4 :return __cmpxchg_u32 ((unsigned int *)ptr, (unsigned int )old, (unsigned int )new_); +case 1 :return __cmpxchg_u8 ((u8 *)ptr, (u8 )old, (u8 )new_); }__cmpxchg_called_with_bad_pointer ();return old;
arch/parisc/lib/bitops.c +12 -0
@@ -79,3 +79,15 @@ unsigned long __cmpxchg_u32(volatile unsigned int *ptr, unsigned int old, unsign_atomic_spin_unlock_irqrestore (ptr, flags);return (unsigned long )prev; } + +u8 __cmpxchg_u8 (volatile u8 *ptr,u8 old,u8 new) +{ +unsigned long flags; +u8 prev; + +_atomic_spin_lock_irqsave (ptr, flags); +if ((prev = *ptr) == old) + *ptr = new; +_atomic_spin_unlock_irqrestore (ptr, flags); +return prev; +}
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 8/10 x86/unwind/orc: Fix ORC for newly forked tasks
In reply to Sasha LevinFrom: Josh Poimboeuf <[email protected]>
[ Upstream commit 372a8eaa05998cd45b3417d0e0ffd3a70978211a ]
The ORC unwinder fails to unwind newly forked tasks which haven't yet run on the CPU. It correctly reads the 'ret_from_fork' instruction pointer from the stack, but it incorrectly interprets that value as a call stack address rather than a "signal" one, so the address gets incorrectly decremented in the call to orc_find(), resulting in bad ORC data.
Fix it by forcing 'ret_from_fork' frames to be signal frames.
--- arch/x86/kernel/unwind_orc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
arch/x86/kernel/unwind_orc.c +6 -2
@@ -346,8 +346,11 @@ bool unwind_next_frame(struct unwind_state *state)/* * Find the orc_entry associated with the text address. * -* Decrement call return addresses by one so they work for sibling -* calls and calls to noreturn functions. +* For a call frame (as opposed to a signal frame), state->ip points to +* the instruction after the call. That instruction's stack layout +* could be different from the call instruction's layout, for example +* if the call was to a noreturn function. So get the ORC data for the +* call instruction itself. */ orc =orc_find (state->signal ? state->ip : state->ip -1 );if (!orc || orc->sp_reg ==ORC_REG_UNDEFINED )
@@ -550,6 +553,7 @@ void __unwind_start(struct unwind_state *state, struct task_struct *task, state->sp = task->thread.sp; state->bp =READ_ONCE_NOCHECK (frame->bp); state->ip =READ_ONCE_NOCHECK (frame->ret_addr); + state->signal = (void *)state->ip == ret_from_fork; } if (get_stack_info((unsigned long *)state->sp, state->task,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 7/10 Revert "i2c: cadence: Fix the hold bit setting"
In reply to Sasha LevinFrom: Raviteja Narayanam <[email protected]>
[ Upstream commit 0db9254d6b896b587759e2c844c277fb1a6da5b9 ]
This reverts commit d358def706880defa4c9e87381c5bf086a97d5f9.
There are two issues with "i2c: cadence: Fix the hold bit setting" commit.
1. In case of combined message request from user space, when the HOLD bit is cleared in cdns_i2c_mrecv function, a STOP condition is sent on the bus even before the last message is started. This is because when the HOLD bit is cleared, the FIFOS are empty and there is no pending transfer. The STOP condition should occur only after the last message is completed.
2. The code added by the commit is redundant. Driver is handling the setting/clearing of HOLD bit in right way before the commit.
The setting of HOLD bit based on 'bus_hold_flag' is taken care in cdns_i2c_master_xfer function even before cdns_i2c_msend/cdns_i2c_recv functions.
The clearing of HOLD bit is taken care at the end of cdns_i2c_msend and cdns_i2c_recv functions based on bus_hold_flag and byte count. Since clearing of HOLD bit is done after the slave address is written to the register (writing to address register triggers the message transfer), it is ensured that STOP condition occurs at the right time after completion of the pending transfer (last message).
--- drivers/i2c/busses/i2c-cadence.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/i2c/busses/i2c-cadence.c +2 -7
@@ -382,10 +382,8 @@ static void cdns_i2c_mrecv(struct cdns_i2c *id)* Check for the message size against FIFO depth and set the * 'hold bus' bit if it is greater than FIFO depth. */ -if ((id->recv_count >CDNS_I2C_FIFO_DEPTH ) || id->bus_hold_flag) +if (id->recv_count >CDNS_I2C_FIFO_DEPTH ) ctrl_reg |=CDNS_I2C_CR_HOLD ; -else - ctrl_reg = ctrl_reg & ~CDNS_I2C_CR_HOLD ;cdns_i2c_writereg (ctrl_reg,CDNS_I2C_CR_OFFSET );
@@ -442,11 +440,8 @@ static void cdns_i2c_msend(struct cdns_i2c *id)* Check for the message size against FIFO depth and set the * 'hold bus' bit if it is greater than FIFO depth. */ -if ((id->send_count >CDNS_I2C_FIFO_DEPTH ) || id->bus_hold_flag) +if (id->send_count >CDNS_I2C_FIFO_DEPTH ) ctrl_reg |=CDNS_I2C_CR_HOLD ; -else - ctrl_reg = ctrl_reg & ~CDNS_I2C_CR_HOLD ; -cdns_i2c_writereg (ctrl_reg,CDNS_I2C_CR_OFFSET );/* Clear the interrupts in interrupt status register. */
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 9/10 cxgb4: add missing release on skb in uld_send()
In reply to Sasha LevinFrom: Navid Emamdoost <[email protected]>
[ Upstream commit e6827d1abdc9b061a57d7b7d3019c4e99fabea2f ]
In the implementation of uld_send(), the skb is consumed on all execution paths except one. Release skb when returning NET_XMIT_DROP.
--- drivers/net/ethernet/chelsio/cxgb4/sge.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/chelsio/cxgb4/sge.c +1 -0
@@ -1812,6 +1812,7 @@ static inline int uld_send(struct adapter *adap, struct sk_buff *skb, txq_info = adap->sge.uld_txq_info[tx_uld_type];if (unlikely (!txq_info)) {WARN_ON (true); +kfree_skb (skb);return NET_XMIT_DROP ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 10/10 xen-netfront: fix potential deadlock in xennet_remove()
In reply to Sasha LevinFrom: Andrea Righi <[email protected]>
[ Upstream commit c2c633106453611be07821f53dff9e93a9d1c3f0 ]
There's a potential race in xennet_remove(); this is what the driver is doing upon unregistering a network device:
1. state = read bus state
2. if state is not "Closed":
3. request to set state to "Closing" 4. wait for state to be set to "Closing" 5. request to set state to "Closed" 6. wait for state to be set to "Closed"
If the state changes to "Closed" immediately after step 1 we are stuck forever in step 4, because the state will never go back from "Closed" to "Closing".
Make sure to check also for state == "Closed" in step 4 to prevent the deadlock.
Also add a 5 sec timeout any time we wait for the bus state to change, to avoid getting stuck forever in wait_event().
--- drivers/net/xen-netfront.c | 64 +++++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 22 deletions(-)
drivers/net/xen-netfront.c +42 -22
@@ -63,6 +63,8 @@ module_param_named(max_queues, xennet_max_queues, uint, 0644);MODULE_PARM_DESC (max_queues,"Maximum number of queues per virtual interface" ); +#define XENNET_TIMEOUT (5 * HZ) +static const struct ethtool_ops xennet_ethtool_ops;struct netfront_cb {
@@ -1336,12 +1338,15 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)netif_carrier_off (netdev); -xenbus_switch_state (dev, XenbusStateInitialising); -wait_event (module_wq, -xenbus_read_driver_state (dev->otherend) != - XenbusStateClosed && -xenbus_read_driver_state (dev->otherend) != - XenbusStateUnknown); +do { +xenbus_switch_state (dev, XenbusStateInitialising); + err =wait_event_timeout (module_wq, +xenbus_read_driver_state (dev->otherend) != + XenbusStateClosed && +xenbus_read_driver_state (dev->otherend) != + XenbusStateUnknown,XENNET_TIMEOUT ); + }while (!err); +return netdev; exit:
@@ -2142,28 +2147,43 @@ static const struct attribute_group xennet_dev_group = { };#endif /* CONFIG_SYSFS */ -static int xennet_remove (struct xenbus_device *dev) +static void xennet_bus_close (struct xenbus_device *dev) { -struct netfront_info *info =dev_get_drvdata (&dev->dev); - -dev_dbg (&dev->dev,"%s\n" , dev->nodename); +int ret; -if (xenbus_read_driver_state (dev->otherend) != XenbusStateClosed) { +if (xenbus_read_driver_state (dev->otherend) == XenbusStateClosed) +return ; +do {xenbus_switch_state (dev, XenbusStateClosing); -wait_event (module_wq, -xenbus_read_driver_state (dev->otherend) == - XenbusStateClosing || -xenbus_read_driver_state (dev->otherend) == - XenbusStateUnknown); + ret =wait_event_timeout (module_wq, +xenbus_read_driver_state (dev->otherend) == + XenbusStateClosing || +xenbus_read_driver_state (dev->otherend) == + XenbusStateClosed || +xenbus_read_driver_state (dev->otherend) == + XenbusStateUnknown, +XENNET_TIMEOUT ); + }while (!ret); + +if (xenbus_read_driver_state (dev->otherend) == XenbusStateClosed) +return ; +do {xenbus_switch_state (dev, XenbusStateClosed); -wait_event (module_wq, -xenbus_read_driver_state (dev->otherend) == - XenbusStateClosed || -xenbus_read_driver_state (dev->otherend) == - XenbusStateUnknown); - } + ret =wait_event_timeout (module_wq, +xenbus_read_driver_state (dev->otherend) == + XenbusStateClosed || +xenbus_read_driver_state (dev->otherend) == + XenbusStateUnknown, +XENNET_TIMEOUT ); + }while (!ret); +} + +static int xennet_remove (struct xenbus_device *dev) +{ +struct netfront_info *info =dev_get_drvdata (&dev->dev); +xennet_bus_close (dev);xennet_disconnect_backend (info);if (info->netdev->reg_state ==NETREG_REGISTERED )
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 6/10 drivers/net/wan/x25_asy: Fix to make it work
In reply to Sasha LevinFrom: Xie He <[email protected]>
[ Upstream commit 8fdcabeac39824fe67480fd9508d80161c541854 ]
This driver is not working because of problems of its receiving code. This patch fixes it to make it work.
When the driver receives an LAPB frame, it should first pass the frame to the LAPB module to process. After processing, the LAPB module passes the data (the packet) back to the driver, the driver should then add a one-byte pseudo header and pass the data to upper layers.
The changes to the "x25_asy_bump" function and the "x25_asy_data_indication" function are to correctly implement this procedure.
Also, the "x25_asy_unesc" function ignores any frame that is shorter than 3 bytes. However the shortest frames are 2-byte long. So we need to change it to allow 2-byte frames to pass.
--- drivers/net/wan/x25_asy.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/net/wan/x25_asy.c +14 -7
@@ -183,7 +183,7 @@ static inline void x25_asy_unlock(struct x25_asy *sl)netif_wake_queue (sl->dev); } -/* Send one completely decapsulated IP datagram to the IP layer. */ +/* Send an LAPB frame to the LAPB module to process. */ static void x25_asy_bump (struct x25_asy *sl) {
@@ -195,13 +195,12 @@ static void x25_asy_bump(struct x25_asy *sl) count = sl->rcount; dev->stats.rx_bytes += count; - skb =dev_alloc_skb (count+1 ); + skb =dev_alloc_skb (count);if (skb ==NULL ) {netdev_warn (sl->dev,"memory squeeze, dropping packet\n" ); dev->stats.rx_dropped++;return ; } -skb_push (skb,1 );/* LAPB internal control */ skb_put_data (skb, sl->rbuff, count); skb->protocol =x25_type_trans (skb, sl->dev); err =lapb_data_received (skb->dev, skb);
@@ -209,7 +208,6 @@ static void x25_asy_bump(struct x25_asy *sl)kfree_skb (skb);printk (KERN_DEBUG "x25_asy: data received err - %d\n" , err); }else { -netif_rx (skb); dev->stats.rx_packets++; } }
@@ -355,12 +353,21 @@ static netdev_tx_t x25_asy_xmit(struct sk_buff *skb,*/ /* -* Called when I frame data arrives. We did the work above - throw it -* at the net layer. +* Called when I frame data arrive. We add a pseudo header for upper +* layers and pass it to upper layers. */ static int x25_asy_data_indication (struct net_device *dev,struct sk_buff *skb) { +if (skb_cow (skb,1 )) { +kfree_skb (skb); +return NET_RX_DROP ; + } +skb_push (skb,1 ); + skb->data[0 ] =X25_IFACE_DATA ; + + skb->protocol =x25_type_trans (skb, dev); +return netif_rx (skb); }
@@ -656,7 +663,7 @@ static void x25_asy_unesc(struct x25_asy *sl, unsigned char s)switch (s) {case X25_END :if (!test_and_clear_bit (SLF_ERROR , &sl->flags) && - sl->rcount >2 ) + sl->rcount >=2 )x25_asy_bump (sl);clear_bit (SLF_ESCAPE , &sl->flags); sl->rcount =0 ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 5/10 net: ethernet: ravb: exit if re-initialization fails in tx timeout
In reply to Sasha LevinFrom: Yoshihiro Shimoda <[email protected]>
[ Upstream commit 015c5d5e6aa3523c758a70eb87b291cece2dbbb4 ]
According to the report of [1], this driver is possible to cause the following error in ravb_tx_timeout_work().
ravb e6800000.ethernet ethernet: failed to switch device to config mode
This error means that the hardware could not change the state from "Operation" to "Configuration" while some tx and/or rx queue are operating. After that, ravb_config() in ravb_dmac_init() will fail, and then any descriptors will be not allocaled anymore so that NULL pointer dereference happens after that on ravb_start_xmit().
To fix the issue, the ravb_tx_timeout_work() should check the return values of ravb_stop_dma() and ravb_dmac_init(). If ravb_stop_dma() fails, ravb_tx_timeout_work() re-enables TX and RX and just exits. If ravb_dmac_init() fails, just exits.
[1]
https://lore.kernel.org/linux-renesas-soc/[email protected]/
--- drivers/net/ethernet/renesas/ravb_main.c | 26 ++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)
drivers/net/ethernet/renesas/ravb_main.c +24 -2
@@ -1482,6 +1482,7 @@ static void ravb_tx_timeout_work(struct work_struct *work) struct ravb_private *priv = container_of(work, struct ravb_private, work);struct net_device *ndev = priv->ndev; +int error;netif_tx_stop_all_queues (ndev);
@@ -1490,15 +1491,36 @@ static void ravb_tx_timeout_work(struct work_struct *work)ravb_ptp_stop (ndev);/* Wait for DMA stopping */ -ravb_stop_dma (ndev); +if (ravb_stop_dma (ndev)) { +/* If ravb_stop_dma() fails, the hardware is still operating +* for TX and/or RX. So, this should not call the following +* functions because ravb_dmac_init() is possible to fail too. +* Also, this should not retry ravb_stop_dma() again and again +* here because it's possible to wait forever. So, this just +* re-enables the TX and RX and skip the following +* re-initialization procedure. +*/ +ravb_rcv_snd_enable (ndev); + goto out; + }ravb_ring_free (ndev,RAVB_BE );ravb_ring_free (ndev,RAVB_NC );/* Device init */ -ravb_dmac_init (ndev); + error =ravb_dmac_init (ndev); +if (error) { +/* If ravb_dmac_init() fails, descriptors are freed. So, this +* should return here to avoid re-enabling the TX and RX in +* ravb_emac_init(). +*/ +netdev_err (ndev,"%s: ravb_dmac_init() failed, error %d\n" , + __func__, error); +return ; + }ravb_emac_init (ndev); +out:/* Initialise PTP Clock driver */ if (priv->chip_id ==RCAR_GEN2 )ravb_ptp_init (ndev, priv->pdev);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 3/10 nfc: s3fwrn5: add missing release on skb in s3fwrn5_recv_frame
In reply to Sasha LevinFrom: Navid Emamdoost <[email protected]>
[ Upstream commit 1e8fd3a97f2d83a7197876ceb4f37b4c2b00a0f3 ]
The implementation of s3fwrn5_recv_frame() is supposed to consume skb on all execution paths. Release skb before returning -ENODEV.
--- drivers/nfc/s3fwrn5/core.c | 1 + 1 file changed, 1 insertion(+)
drivers/nfc/s3fwrn5/core.c +1 -0
@@ -209,6 +209,7 @@ int s3fwrn5_recv_frame(struct nci_dev *ndev, struct sk_buff *skb,case S3FWRN5_MODE_FW :return s3fwrn5_fw_recv_frame (ndev, skb);default : +kfree_skb (skb);return -ENODEV ; } }
Signature · 1 line
2.25.1