Input: mms114 - fix handling of mms345l
Subsystems (9)
Sasha Levin
maintainerPATCH 1/17 Input: mms114 - fix handling of mms345l
From: Stephan Gerhold <[email protected]>
[ Upstream commit 3f8f770575d911c989043d8f0fb8dec96360c41c ]
MMS345L is another first generation touch screen from Melfas, which uses the same registers as MMS152.
However, using I2C_M_NOSTART for it causes errors when reading:
i2c i2c-0: sendbytes: NAK bailout. mms114 0-0048: __mms114_read_reg: i2c transfer failed (-5)
The driver works fine as soon as I2C_M_NOSTART is removed.
[dtor: removed separate mms345l handling, made everyone use standard transfer mode, propagated the 10bit addressing flag to the read part of the transfer as well.]
--- drivers/input/touchscreen/mms114.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/input/touchscreen/mms114.c +5 -7
@@ -91,15 +91,15 @@ static int __mms114_read_reg(struct mms114_data *data, unsigned int reg,if (reg <=MMS114_MODE_CONTROL && reg + len >MMS114_MODE_CONTROL )BUG (); -/* Write register: use repeated start */ +/* Write register */ xfer[0 ].addr = client->addr; - xfer[0 ].flags =I2C_M_TEN |I2C_M_NOSTART ; + xfer[0 ].flags = client->flags &I2C_M_TEN ; xfer[0 ].len =1 ; xfer[0 ].buf = &buf;/* Read data */ xfer[1 ].addr = client->addr; - xfer[1 ].flags =I2C_M_RD ; + xfer[1 ].flags = (client->flags &I2C_M_TEN ) |I2C_M_RD ; xfer[1 ].len = len; xfer[1 ].buf = val;
@@ -428,10 +428,8 @@ static int mms114_probe(struct i2c_client *client,const void *match_data;int error; -if (!i2c_check_functionality (client->adapter, -I2C_FUNC_PROTOCOL_MANGLING )) { -dev_err (&client->dev, -"Need i2c bus that supports protocol mangling\n" ); +if (!i2c_check_functionality (client->adapter,I2C_FUNC_I2C )) { +dev_err (&client->dev,"Not supported I2C adapter\n" );return -ENODEV ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 2/17 Input: axp20x-pek - always register interrupt handlers
From: Hans de Goede <[email protected]>
[ Upstream commit 9747070c11d6ae021ed7a8e96e2950ed46cd53a9 ]
On some X86 devices we do not register an input-device, because the power-button is also handled by the soc_button_array (GPIO) input driver, and we want to avoid reporting power-button presses to userspace twice.
Sofar when we did this we also did not register our interrupt handlers, since those were only necessary to report input events.
But on at least 2 device models the Medion Akoya E1239T and the GPD win, the GPIO pin used by the soc_button_array driver for the power-button cannot wakeup the system from suspend. Why this does not work is not clear, I've tried comparing the value of all relevant registers on the Cherry Trail SoC, with those from models where this does work. I've checked:
PMC registers: FUNC_DIS, FUNC_DIS2, SOIX_WAKE_EN, D3_STS_0, D3_STS_1, D3_STDBY_STS_0, D3_STDBY_STS_1; PMC ACPI I/O regs: PM1_STS_EN, GPE0a_EN and they all have identical contents in the working and non working cases. I suspect that the firmware either sets some unknown register to a value causing this, or that it turns off a power-plane which is necessary for GPIO wakeups to work during suspend.
What does work on the Medion Akoya E1239T is letting the AXP288 wakeup the system on a power-button press (the GPD win has a different PMIC).
Move the registering of the power-button press/release interrupt-handler from axp20x_pek_probe_input_device() to axp20x_pek_probe() so that the PMIC will wakeup the system on a power-button press, even if we do not register an input device.
--- drivers/input/misc/axp20x-pek.c | 72 +++++++++++++++++---------------- 1 file changed, 37 insertions(+), 35 deletions(-)
drivers/input/misc/axp20x-pek.c +37 -35
@@ -205,8 +205,11 @@ ATTRIBUTE_GROUPS(axp20x);static irqreturn_t axp20x_pek_irq (int irq,void *pwr) { -struct input_dev *idev = pwr; -struct axp20x_pek *axp20x_pek =input_get_drvdata (idev); +struct axp20x_pek *axp20x_pek = pwr; +struct input_dev *idev = axp20x_pek->input; + +if (!idev) +return IRQ_HANDLED ;/* * The power-button is connected to ground so a falling edge (dbf)
@@ -225,22 +228,9 @@ static irqreturn_t axp20x_pek_irq(int irq, void *pwr)static int axp20x_pek_probe_input_device (struct axp20x_pek *axp20x_pek,struct platform_device *pdev) { -struct axp20x_dev *axp20x = axp20x_pek->axp20x;struct input_dev *idev;int error; - axp20x_pek->irq_dbr =platform_get_irq_byname (pdev,"PEK_DBR" ); -if (axp20x_pek->irq_dbr <0 ) -return axp20x_pek->irq_dbr; - axp20x_pek->irq_dbr =regmap_irq_get_virq (axp20x->regmap_irqc, - axp20x_pek->irq_dbr); - - axp20x_pek->irq_dbf =platform_get_irq_byname (pdev,"PEK_DBF" ); -if (axp20x_pek->irq_dbf <0 ) -return axp20x_pek->irq_dbf; - axp20x_pek->irq_dbf =regmap_irq_get_virq (axp20x->regmap_irqc, - axp20x_pek->irq_dbf); - axp20x_pek->input =devm_input_allocate_device (&pdev->dev);if (!axp20x_pek->input)return -ENOMEM ;
@@ -255,24 +245,6 @@ static int axp20x_pek_probe_input_device(struct axp20x_pek *axp20x_pek,input_set_drvdata (idev, axp20x_pek); - error =devm_request_any_context_irq (&pdev->dev, axp20x_pek->irq_dbr, - axp20x_pek_irq,0 , -"axp20x-pek-dbr" , idev); -if (error <0 ) { -dev_err (&pdev->dev,"Failed to request dbr IRQ#%d: %d\n" , - axp20x_pek->irq_dbr, error); -return error; - } - - error =devm_request_any_context_irq (&pdev->dev, axp20x_pek->irq_dbf, - axp20x_pek_irq,0 , -"axp20x-pek-dbf" , idev); -if (error <0 ) { -dev_err (&pdev->dev,"Failed to request dbf IRQ#%d: %d\n" , - axp20x_pek->irq_dbf, error); -return error; - } - error =input_register_device (idev);if (error) { dev_err(&pdev->dev, "Can't register input device: %d\n",
@@ -280,8 +252,6 @@ static int axp20x_pek_probe_input_device(struct axp20x_pek *axp20x_pek,return error; } -device_init_wakeup (&pdev->dev, true); -return 0 ; }
@@ -339,6 +309,18 @@ static int axp20x_pek_probe(struct platform_device *pdev) axp20x_pek->axp20x =dev_get_drvdata (pdev->dev.parent); + axp20x_pek->irq_dbr =platform_get_irq_byname (pdev,"PEK_DBR" ); +if (axp20x_pek->irq_dbr <0 ) +return axp20x_pek->irq_dbr; + axp20x_pek->irq_dbr =regmap_irq_get_virq ( + axp20x_pek->axp20x->regmap_irqc, axp20x_pek->irq_dbr); + + axp20x_pek->irq_dbf =platform_get_irq_byname (pdev,"PEK_DBF" ); +if (axp20x_pek->irq_dbf <0 ) +return axp20x_pek->irq_dbf; + axp20x_pek->irq_dbf =regmap_irq_get_virq ( + axp20x_pek->axp20x->regmap_irqc, axp20x_pek->irq_dbf); +if (axp20x_pek_should_register_input (axp20x_pek, pdev)) { error =axp20x_pek_probe_input_device (axp20x_pek, pdev);if (error)
@@ -347,6 +329,26 @@ static int axp20x_pek_probe(struct platform_device *pdev) axp20x_pek->info = (struct axp20x_info *)match->driver_data; + error =devm_request_any_context_irq (&pdev->dev, axp20x_pek->irq_dbr, + axp20x_pek_irq,0 , +"axp20x-pek-dbr" , axp20x_pek); +if (error <0 ) { +dev_err (&pdev->dev,"Failed to request dbr IRQ#%d: %d\n" , + axp20x_pek->irq_dbr, error); +return error; + } + + error =devm_request_any_context_irq (&pdev->dev, axp20x_pek->irq_dbf, + axp20x_pek_irq,0 , +"axp20x-pek-dbf" , axp20x_pek); +if (error <0 ) { +dev_err (&pdev->dev,"Failed to request dbf IRQ#%d: %d\n" , + axp20x_pek->irq_dbf, error); +return error; + } + +device_init_wakeup (&pdev->dev, true); +platform_set_drvdata (pdev, axp20x_pek);return 0 ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 3/17 ARM: 8977/1: ptrace: Fix mask for thumb breakpoint hook
In reply to Sasha LevinFrom: Fredrik Strupe <[email protected]>
[ Upstream commit 3866f217aaa81bf7165c7f27362eee5d7919c496 ]
call_undef_hook() in traps.c applies the same instr_mask for both 16-bit and 32-bit thumb instructions. If instr_mask then is only 16 bits wide (0xffff as opposed to 0xffffffff), the first half-word of 32-bit thumb instructions will be masked out. This makes the function match 32-bit thumb instructions where the second half-word is equal to instr_val, regardless of the first half-word.
The result in this case is that all undefined 32-bit thumb instructions with the second half-word equal to 0xde01 (udf #1) work as breakpoints and will raise a SIGTRAP instead of a SIGILL, instead of just the one intended 16-bit instruction. An example of such an instruction is 0xeaa0de01, which is unallocated according to Arm ARM and should raise a SIGILL, but instead raises a SIGTRAP.
This patch fixes the issue by setting all the bits in instr_mask, which will still match the intended 16-bit thumb instruction (where the upper half is always 0), but not any 32-bit thumb instructions.
--- arch/arm/kernel/ptrace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/kernel/ptrace.c +2 -2
@@ -219,8 +219,8 @@ static struct undef_hook arm_break_hook = { };static struct undef_hook thumb_break_hook = { - .instr_mask =0xffff , - .instr_val =0xde01 , + .instr_mask =0xffffffff , + .instr_val =0x0000de01 , .cpsr_mask =PSR_T_BIT , .cpsr_val =PSR_T_BIT , .fn = break_trap,
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 4/17 sched/fair: Don't NUMA balance for kthreads
In reply to Sasha LevinFrom: Jens Axboe <[email protected]>
[ Upstream commit 18f855e574d9799a0e7489f8ae6fd8447d0dd74a ]
Stefano reported a crash with using SQPOLL with io_uring:
BUG: kernel NULL pointer dereference, address: 00000000000003b0 CPU: 2 PID: 1307 Comm: io_uring-sq Not tainted 5.7.0-rc7 #11 RIP: 0010:task_numa_work+0x4f/0x2c0 Call Trace: task_work_run+0x68/0xa0 io_sq_thread+0x252/0x3d0 kthread+0xf9/0x130 ret_from_fork+0x35/0x40
which is task_numa_work() oopsing on current->mm being NULL.
The task work is queued by task_tick_numa(), which checks if current->mm is NULL at the time of the call. But this state isn't necessarily persistent, if the kthread is using use_mm() to temporarily adopt the mm of a task.
Change the task_tick_numa() check to exclude kernel threads in general, as it doesn't make sense to attempt ot balance for kthreads anyway.
--- kernel/sched/fair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/fair.c +1 -1
@@ -2682,7 +2682,7 @@ static void task_tick_numa(struct rq *rq, struct task_struct *curr)/* * We don't care about NUMA placement if we don't have memory. */ -if (!curr->mm || (curr->flags &PF_EXITING ) || work->next != work) +if ((curr->flags & (PF_EXITING |PF_KTHREAD )) || work->next != work)return ;/*
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 5/17 net: stmmac: enable timestamp snapshot for required PTP packets in dwmac v5.10a
In reply to Sasha LevinFrom: Fugang Duan <[email protected]>
[ Upstream commit f2fb6b6275eba9d312957ca44c487bd780da6169 ]
For rx filter 'HWTSTAMP_FILTER_PTP_V2_EVENT', it should be PTP v2/802.AS1, any layer, any kind of event packet, but HW only take timestamp snapshot for below PTP message: sync, Pdelay_req, Pdelay_resp.
Then it causes below issue when test E2E case:
ptp4l[2479.534]: port 1: received DELAY_REQ without timestamp ptp4l[2481.423]: port 1: received DELAY_REQ without timestamp ptp4l[2481.758]: port 1: received DELAY_REQ without timestamp ptp4l[2483.524]: port 1: received DELAY_REQ without timestamp ptp4l[2484.233]: port 1: received DELAY_REQ without timestamp ptp4l[2485.750]: port 1: received DELAY_REQ without timestamp ptp4l[2486.888]: port 1: received DELAY_REQ without timestamp ptp4l[2487.265]: port 1: received DELAY_REQ without timestamp ptp4l[2487.316]: port 1: received DELAY_REQ without timestamp
Timestamp snapshot dependency on register bits in received path:
SNAPTYPSEL TSMSTRENA TSEVNTENA PTP_Messages
01 x 0 SYNC, Follow_Up, Delay_Req,
Delay_Resp, Pdelay_Req, Pdelay_Resp, Pdelay_Resp_Follow_Up
01 0 1 SYNC, Pdelay_Req, Pdelay_Resp
For dwmac v5.10a, enabling all events by setting register DWC_EQOS_TIME_STAMPING[SNAPTYPSEL] to 2’b01, clearing bit [TSEVNTENA] to 0’b0, which can support all required events.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +2 -1
@@ -630,7 +630,8 @@ static int stmmac_hwtstamp_set(struct net_device *dev, struct ifreq *ifr) config.rx_filter =HWTSTAMP_FILTER_PTP_V2_EVENT ; ptp_v2 =PTP_TCR_TSVER2ENA ; snap_type_sel =PTP_TCR_SNAPTYPSEL_1 ; - ts_event_en =PTP_TCR_TSEVNTENA ; +if (priv->synopsys_id !=DWMAC_CORE_5_10 ) + ts_event_en =PTP_TCR_TSEVNTENA ; ptp_over_ipv4_udp =PTP_TCR_TSIPV4ENA ; ptp_over_ipv6_udp =PTP_TCR_TSIPV6ENA ; ptp_over_ethernet =PTP_TCR_TSIPENA ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 6/17 net: check untrusted gso_size at kernel entry
In reply to Sasha LevinFrom: Willem de Bruijn <[email protected]>
[ Upstream commit 6dd912f82680761d8fb6b1bb274a69d4c7010988 ]
Syzkaller again found a path to a kernel crash through bad gso input:
a packet with gso size exceeding len.
These packets are dropped in tcp_gso_segment and udp[46]_ufo_fragment. But they may affect gso size calculations earlier in the path.
Now that we have thlen as of commit 9274124f023b ("net: stricter validation of untrusted gso packets"), check gso_size at entry too.
--- include/linux/virtio_net.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
include/linux/virtio_net.h +12 -2
@@ -31,6 +31,7 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb, {unsigned int gso_type =0 ;unsigned int thlen =0 ; +unsigned int p_off =0 ;unsigned int ip_proto;if (hdr->gso_type !=VIRTIO_NET_HDR_GSO_NONE ) {
@@ -68,7 +69,8 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb,if (!skb_partial_csum_set (skb, start, off))return -EINVAL ; -if (skb_transport_offset (skb) + thlen >skb_headlen (skb)) + p_off =skb_transport_offset (skb) + thlen; +if (p_off >skb_headlen (skb))return -EINVAL ; }else {/* gso packets without NEEDS_CSUM do not set transport_offset.
@@ -92,17 +94,25 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb,return -EINVAL ; } -if (keys.control.thoff + thlen >skb_headlen (skb) || + p_off = keys.control.thoff + thlen; +if (p_off >skb_headlen (skb) || keys.basic.ip_proto != ip_proto)return -EINVAL ;skb_set_transport_header (skb, keys.control.thoff); + }else if (gso_type) { + p_off = thlen; +if (p_off >skb_headlen (skb)) +return -EINVAL ; } }if (hdr->gso_type !=VIRTIO_NET_HDR_GSO_NONE ) {u16 gso_size =__virtio16_to_cpu (little_endian, hdr->gso_size); +if (skb->len - p_off <= gso_size) +return -EINVAL ; +skb_shinfo (skb)->gso_size = gso_size;skb_shinfo (skb)->gso_type = gso_type;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 7/17 net: usb: qmi_wwan: add Telit LE910C1-EUX composition
In reply to Sasha LevinFrom: Daniele Palmas <[email protected]>
[ Upstream commit 591612aa578cd7148b7b9d74869ef40118978389 ]
Add support for Telit LE910C1-EUX composition
0x1031: tty, tty, tty, rmnet
--- drivers/net/usb/qmi_wwan.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/usb/qmi_wwan.c +1 -0
@@ -1324,6 +1324,7 @@ static const struct usb_device_id products[] = { {QMI_FIXED_INTF(0x1bbb, 0x0203, 2)}, /* Alcatel L800MA */ {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */ {QMI_FIXED_INTF(0x2357, 0x9000, 4)}, /* TP-LINK MA260 */ + {QMI_QUIRK_SET_DTR(0x1bc7, 0x1031, 3)}, /* Telit LE910C1-EUX */ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1040, 2)}, /* Telit LE922A */ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1050, 2)}, /* Telit FN980 */ {QMI_FIXED_INTF(0x1bc7, 0x1100, 3)}, /* Telit ME910 */
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 8/17 Input: synaptics - add a second working PNP_ID for Lenovo T470s
In reply to Sasha LevinFrom: Dennis Kadioglu <[email protected]>
[ Upstream commit 642aa86eaf8f1e6fe894f20fd7f12f0db52ee03c ]
The Lenovo Thinkpad T470s I own has a different touchpad with "LEN007a" instead of the already included PNP ID "LEN006c". However, my touchpad seems to work well without any problems using RMI. So this patch adds the other PNP ID.
--- drivers/input/mouse/synaptics.c | 1 + 1 file changed, 1 insertion(+)
drivers/input/mouse/synaptics.c +1 -0
@@ -170,6 +170,7 @@ static const char * const smbus_pnp_ids[] = {"LEN005b" ,/* P50 */ "LEN005e" ,/* T560 */ "LEN006c" ,/* T470s */ +"LEN007a" ,/* T470s */ "LEN0071" ,/* T480 */ "LEN0072" ,/* X1 Carbon Gen 5 (2017) - Elan/ALPS trackpoint */ "LEN0073", /* X1 Carbon G5 (Elantech) */
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 9/17 nfp: flower: fix used time of merge flow statistics
In reply to Sasha LevinFrom: Heinrich Kuhn <[email protected]>
[ Upstream commit 5b186cd60f033110960a3db424ffbd6de4cee528 ]
Prior to this change the correct value for the used counter is calculated but not stored nor, therefore, propagated to user-space. In use-cases such as OVS use-case at least this results in active flows being removed from the hardware datapath. Which results in both unnecessary flow tear-down and setup, and packet processing on the host.
This patch addresses the problem by saving the calculated used value which allows the value to propagate to user-space.
Found by inspection.
--- drivers/net/ethernet/netronome/nfp/flower/offload.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/netronome/nfp/flower/offload.c +2 -1
@@ -1440,7 +1440,8 @@ __nfp_flower_update_merge_stats(struct nfp_app *app, ctx_id =be32_to_cpu (sub_flow->meta.host_ctx_id); priv->stats[ctx_id].pkts += pkts; priv->stats[ctx_id].bytes += bytes; -max_t (u64, priv->stats[ctx_id].used, used); + priv->stats[ctx_id].used =max_t (u64, used, + priv->stats[ctx_id].used); } }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 10/17 net: dsa: felix: send VLANs on CPU port as egress-tagged
In reply to Sasha LevinFrom: Vladimir Oltean <[email protected]>
[ Upstream commit 183be6f967fe37c3154bfac39e913c3bafe89d1b ]
As explained in other commits before (b9cd75e66895 and 87b0f983f66f), ocelot switches have a single egress-untagged VLAN per port, and the driver would deny adding a second one while an egress-untagged VLAN already exists.
But on the CPU port (where the VLAN configuration is implicit, because there is no net device for the bridge to control), the DSA core attempts to add a VLAN using the same flags as were used for the front-panel port. This would make adding any untagged VLAN fail due to the CPU port rejecting the configuration:
bridge vlan add dev swp0 vid 100 pvid untagged
[ 1865.854253] mscc_felix 0000:00:00.5: Port already has a native VLAN: 1 [ 1865.860824] mscc_felix 0000:00:00.5: Failed to add VLAN 100 to port 5: -16
(note that port 5 is the CPU port and not the front-panel swp0).
So this hardware will send all VLANs as tagged towards the CPU.
--- drivers/net/dsa/ocelot/felix.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/dsa/ocelot/felix.c +6 -2
@@ -100,13 +100,17 @@ static void felix_vlan_add(struct dsa_switch *ds, int port, const struct switchdev_obj_port_vlan *vlan) {struct ocelot *ocelot = ds->priv; +u16 flags = vlan->flags;u16 vid;int err; +if (dsa_is_cpu_port (ds, port)) + flags &= ~BRIDGE_VLAN_INFO_UNTAGGED ; +for (vid = vlan->vid_begin; vid <= vlan->vid_end; vid++) { err =ocelot_vlan_add (ocelot, port, vid, - vlan->flags &BRIDGE_VLAN_INFO_PVID , - vlan->flags &BRIDGE_VLAN_INFO_UNTAGGED ); + flags &BRIDGE_VLAN_INFO_PVID , + flags &BRIDGE_VLAN_INFO_UNTAGGED );if (err) {dev_err (ds->dev,"Failed to add VLAN %d to port %d: %d\n" , vid, port, err);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 11/17 csky: Fixup abiv2 syscall_trace break a4 & a5
In reply to Sasha LevinFrom: Guo Ren <[email protected]>
[ Upstream commit e0bbb53843b5fdfe464b099217e3b9d97e8a75d7 ]
Current implementation could destory a4 & a5 when strace, so we need to get them from pt_regs by SAVE_ALL.
--- arch/csky/abiv2/inc/abi/entry.h | 2 ++ arch/csky/kernel/entry.S | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-)
arch/csky/abiv2/inc/abi/entry.h +2 -0
@@ -13,6 +13,8 @@#define LSAVE_A1 28#define LSAVE_A2 32#define LSAVE_A3 36 +#define LSAVE_A4 40 +#define LSAVE_A5 44#define KSPTOUSP #define USPTOKSP
arch/csky/kernel/entry.S +4 -2
@@ -170,8 +170,10 @@ csky_syscall_trace: ldw a3, (sp, LSAVE_A3) #if defined(__CSKYABIV2__) subi sp, 8 - stw r5, (sp, 0x4) - stw r4, (sp, 0x0) + ldw r9, (sp, LSAVE_A4) + stw r9, (sp, 0x0) + ldw r9, (sp, LSAVE_A5) + stw r9, (sp, 0x4) #else ldw r6, (sp, LSAVE_A4) ldw r7, (sp, LSAVE_A5)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 12/17 gfs2: Even more gfs2_find_jhead fixes
In reply to Sasha LevinFrom: Andreas Gruenbacher <[email protected]>
[ Upstream commit 20be493b787cd581c9fffad7fcd6bfbe6af1050c ]
Fix several issues in the previous gfs2_find_jhead fix:
* When updating @blocks_submitted, @block refers to the first block block not submitted yet, not the last block submitted, so fix an off-by-one error.
* We want to ensure that @blocks_submitted is far enough ahead of @blocks_read to guarantee that there is in-flight I/O. Otherwise, we'll eventually end up waiting for pages that haven't been submitted, yet.
* It's much easier to compare the number of blocks added with the number of blocks submitted to limit the maximum bio size.
* Even with bio chaining, we can keep adding blocks until we reach the maximum bio size, as long as we stop at a page boundary. This simplifies the logic.
--- fs/gfs2/lops.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)
fs/gfs2/lops.c +5 -10
@@ -505,12 +505,12 @@ int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head,unsigned int bsize = sdp->sd_sb.sb_bsize, off;unsigned int bsize_shift = sdp->sd_sb.sb_bsize_shift;unsigned int shift =PAGE_SHIFT - bsize_shift; -unsigned int max_bio_size =2 *1024 *1024 ; +unsigned int max_blocks =2 *1024 *1024 >> bsize_shift;struct gfs2_journal_extent *je;int sz, ret =0 ;struct bio *bio =NULL ;struct page *page =NULL ; -bool bio_chained = false, done = false; +bool done = false;errseq_t since;memset (head,0 ,sizeof (*head));
@@ -533,10 +533,7 @@ int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head, off =0 ; } -if (!bio || (bio_chained && !off) || - bio->bi_iter.bi_size >= max_bio_size) { -/* start new bio */ - }else { +if (bio && (off || block < blocks_submitted + max_blocks)) {sector_t sector = dblock << sdp->sd_fsb2bb_shift;if (bio_end_sector (bio) == sector) {
@@ -549,19 +546,17 @@ int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head, (PAGE_SIZE - off) >> bsize_shift; bio =gfs2_chain_bio (bio, blocks); - bio_chained = true; goto add_block_to_new_bio; } }if (bio) { - blocks_submitted = block +1 ; + blocks_submitted = block;submit_bio (bio); } bio =gfs2_log_alloc_bio (sdp, dblock, gfs2_end_log_read); bio->bi_opf =REQ_OP_READ ; - bio_chained = false; add_block_to_new_bio: sz =bio_add_page (bio, page, bsize, off);BUG_ON (sz != bsize);
@@ -569,7 +564,7 @@ int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head, off += bsize;if (off ==PAGE_SIZE ) page =NULL ; -if (blocks_submitted <2 * max_bio_size >> bsize_shift) { +if (blocks_submitted <= blocks_read + max_blocks) {/* Keep@least one bio in flight */ continue ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 13/17 net/mlx5: Fix crash upon suspend/resume
In reply to Sasha LevinFrom: Mark Bloch <[email protected]>
[ Upstream commit 8fc3e29be9248048f449793502c15af329f35c6e ]
Currently a Linux system with the mlx5 NIC always crashes upon hibernation - suspend/resume.
Add basic callbacks so the NIC could be suspended and resumed.
--- drivers/net/ethernet/mellanox/mlx5/core/main.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/main.c +18 -0
@@ -1552,6 +1552,22 @@ static void shutdown(struct pci_dev *pdev)mlx5_pci_disable_device (dev); } +static int mlx5_suspend (struct pci_dev *pdev,pm_message_t state) +{ +struct mlx5_core_dev *dev =pci_get_drvdata (pdev); + +mlx5_unload_one (dev, false); + +return 0 ; +} + +static int mlx5_resume (struct pci_dev *pdev) +{ +struct mlx5_core_dev *dev =pci_get_drvdata (pdev); + +return mlx5_load_one (dev, false); +} +static const struct pci_device_id mlx5_core_pci_table[] = { {PCI_VDEVICE (MELLANOX ,PCI_DEVICE_ID_MELLANOX_CONNECTIB ) }, {PCI_VDEVICE (MELLANOX ,0x1012 ),MLX5_PCI_DEV_IS_VF },/* Connect-IB VF */
@@ -1595,6 +1611,8 @@ static struct pci_driver mlx5_core_driver = { .id_table = mlx5_core_pci_table, .probe = init_one, .remove = remove_one, + .suspend = mlx5_suspend, + .resume = mlx5_resume, .shutdown = shutdown, .err_handler = &mlx5_err_handler, .sriov_configure = mlx5_core_sriov_configure,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 14/17 net/mlx5e: replace EINVAL in mlx5e_flower_parse_meta()
In reply to Sasha LevinFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit a683012a8e77675a1947cc8f11f97cdc1d5bb769 ]
The drivers reports EINVAL to userspace through netlink on invalid meta match. This is confusing since EINVAL is usually reserved for malformed netlink messages. Replace it by more meaningful codes.
--- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +3 -3
@@ -1824,7 +1824,7 @@ static int mlx5e_flower_parse_meta(struct net_device *filter_dev,flow_rule_match_meta (rule, &match);if (match.mask->ingress_ifindex !=0xFFFFFFFF ) {NL_SET_ERR_MSG_MOD (extack,"Unsupported ingress ifindex mask" ); -return -EINVAL ; +return -EOPNOTSUPP ; } ingress_dev = __dev_get_by_index(dev_net(filter_dev),
@@ -1832,13 +1832,13 @@ static int mlx5e_flower_parse_meta(struct net_device *filter_dev,if (!ingress_dev) {NL_SET_ERR_MSG_MOD (extack,"Can't find the ingress port to match on" ); -return -EINVAL ; +return -ENOENT ; }if (ingress_dev != filter_dev) {NL_SET_ERR_MSG_MOD (extack,"Can't match on the ingress filter port" ); -return -EINVAL ; +return -EOPNOTSUPP ; }return 0 ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 15/17 NFC: st21nfca: add missed kfree_skb() in an error path
In reply to Sasha LevinFrom: Chuhong Yuan <[email protected]>
[ Upstream commit 3decabdc714ca56c944f4669b4cdec5c2c1cea23 ]
st21nfca_tm_send_atr_res() misses to call kfree_skb() in an error path. Add the missed function call to fix it.
--- drivers/nfc/st21nfca/dep.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/nfc/st21nfca/dep.c +3 -1
@@ -173,8 +173,10 @@ static int st21nfca_tm_send_atr_res(struct nfc_hci_dev *hdev,memcpy (atr_res->gbi, atr_req->gbi, gb_len); r =nfc_set_remote_general_bytes (hdev->ndev, atr_res->gbi, gb_len); -if (r <0 ) +if (r <0 ) { +kfree_skb (skb);return r; + } } info->dep_info.curr_nfc_dep_pni =0 ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 16/17 drivers/net/ibmvnic: Update VNIC protocol version reporting
In reply to Sasha LevinFrom: Thomas Falcon <[email protected]>
[ Upstream commit 784688993ebac34dffe44a9f2fabbe126ebfd4db ]
VNIC protocol version is reported in big-endian format, but it is not byteswapped before logging. Fix that, and remove version comparison as only one protocol version exists at this time.
--- drivers/net/ethernet/ibm/ibmvnic.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/net/ethernet/ibm/ibmvnic.c +3 -5
@@ -4678,12 +4678,10 @@ static void ibmvnic_handle_crq(union ibmvnic_crq *crq,dev_err (dev,"Error %ld in VERSION_EXCHG_RSP\n" , rc);break ; } -dev_info (dev,"Partner protocol version is %d\n" , - crq->version_exchange_rsp.version); -if (be16_to_cpu (crq->version_exchange_rsp.version) < - ibmvnic_version) - ibmvnic_version = + ibmvnic_version =be16_to_cpu (crq->version_exchange_rsp.version); +dev_info (dev,"Partner protocol version is %d\n" , + ibmvnic_version);send_cap_queries (adapter);break ;case QUERY_CAPABILITY_RSP :
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 17/17 l2tp: do not use inet_hash()/inet_unhash()
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit 02c71b144c811bcdd865e0a1226d0407d11357e8 ]
syzbot recently found a way to crash the kernel [1]
Issue here is that inet_hash() & inet_unhash() are currently only meant to be used by TCP & DCCP, since only these protocols provide the needed hashinfo pointer.
L2TP uses a single list (instead of a hash table)
This old bug became an issue after commit 610236587600 ("bpf: Add new cgroup attach type to enable sock modifications") since after this commit, sk_common_release() can be called while the L2TP socket is still considered 'hashed'.
general protection fault, probably for non-canonical address 0xdffffc0000000001: 0000 [#1] PREEMPT SMP KASAN KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f] CPU: 0 PID: 7063 Comm: syz-executor654 Not tainted 5.7.0-rc6-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:inet_unhash+0x11f/0x770 net/ipv4/inet_hashtables.c:600 Code: 03 0f b6 04 02 84 c0 74 08 3c 03 0f 8e dd 04 00 00 48 8d 7d 08 44 8b 73 08 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 55 05 00 00 48 8d 7d 14 4c 8b 6d 08 48 b8 00 00 RSP: 0018:ffffc90001777d30 EFLAGS: 00010202 RAX: dffffc0000000000 RBX: ffff88809a6df940 RCX: ffffffff8697c242 RDX: 0000000000000001 RSI: ffffffff8697c251 RDI: 0000000000000008 RBP: 0000000000000000 R08: ffff88809f3ae1c0 R09: fffffbfff1514cc1 R10: ffffffff8a8a6607 R11: fffffbfff1514cc0 R12: ffff88809a6df9b0 R13: 0000000000000007 R14: 0000000000000000 R15: ffffffff873a4d00 FS: 0000000001d2b880(0000) GS:ffff8880ae600000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00000000006cd090 CR3: 000000009403a000 CR4: 00000000001406f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: sk_common_release+0xba/0x370 net/core/sock.c:3210 inet_create net/ipv4/af_inet.c:390 [inline] inet_create+0x966/0xe00 net/ipv4/af_inet.c:248 __sock_create+0x3cb/0x730 net/socket.c:1428 sock_create net/socket.c:1479 [inline] __sys_socket+0xef/0x200 net/socket.c:1521 __do_sys_socket net/socket.c:1530 [inline] __se_sys_socket net/socket.c:1528 [inline] __x64_sys_socket+0x6f/0xb0 net/socket.c:1528 do_syscall_64+0xf6/0x7d0 arch/x86/entry/common.c:295 entry_SYSCALL_64_after_hwframe+0x49/0xb3 RIP: 0033:0x441e29 Code: e8 fc b3 02 00 48 83 c4 18 c3 0f 1f 80 00 00 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 eb 08 fc ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007ffdce184148 EFLAGS: 00000246 ORIG_RAX: 0000000000000029 RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000441e29 RDX: 0000000000000073 RSI: 0000000000000002 RDI: 0000000000000002 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000402c30 R14: 0000000000000000 R15: 0000000000000000 Modules linked in: ---[ end trace 23b6578228ce553e ]--- RIP: 0010:inet_unhash+0x11f/0x770 net/ipv4/inet_hashtables.c:600 Code: 03 0f b6 04 02 84 c0 74 08 3c 03 0f 8e dd 04 00 00 48 8d 7d 08 44 8b 73 08 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 55 05 00 00 48 8d 7d 14 4c 8b 6d 08 48 b8 00 00 RSP: 0018:ffffc90001777d30 EFLAGS: 00010202 RAX: dffffc0000000000 RBX: ffff88809a6df940 RCX: ffffffff8697c242 RDX: 0000000000000001 RSI: ffffffff8697c251 RDI: 0000000000000008 RBP: 0000000000000000 R08: ffff88809f3ae1c0 R09: fffffbfff1514cc1 R10: ffffffff8a8a6607 R11: fffffbfff1514cc0 R12: ffff88809a6df9b0 R13: 0000000000000007 R14: 0000000000000000 R15: ffffffff873a4d00 FS: 0000000001d2b880(0000) GS:ffff8880ae600000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00000000006cd090 CR3: 000000009403a000 CR4: 00000000001406f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
--- net/l2tp/l2tp_ip.c | 29 ++++++++++++++++++++++------- net/l2tp/l2tp_ip6.c | 30 ++++++++++++++++++++++-------- 2 files changed, 44 insertions(+), 15 deletions(-)
net/l2tp/l2tp_ip.c +22 -7
@@ -20,7 +20,6 @@#include <net/icmp.h> #include <net/udp.h> #include <net/inet_common.h> -#include <net/inet_hashtables.h> #include <net/tcp_states.h> #include <net/protocol.h> #include <net/xfrm.h>
@@ -209,15 +208,31 @@ static int l2tp_ip_recv(struct sk_buff *skb)return 0 ; } -static int l2tp_ip_open (struct sock *sk) +static int l2tp_ip_hash (struct sock *sk) { -/* Prevent autobind. We don't have ports. */ -inet_sk (sk)->inet_num =IPPROTO_L2TP ; +if (sk_unhashed (sk)) { +write_lock_bh (&l2tp_ip_lock); +sk_add_node (sk, &l2tp_ip_table); +write_unlock_bh (&l2tp_ip_lock); + } +return 0 ; +} +static void l2tp_ip_unhash (struct sock *sk) +{ +if (sk_unhashed (sk)) +return ;write_lock_bh (&l2tp_ip_lock); -sk_add_node (sk, &l2tp_ip_table); +sk_del_node_init (sk);write_unlock_bh (&l2tp_ip_lock); +} + +static int l2tp_ip_open (struct sock *sk) +{ +/* Prevent autobind. We don't have ports. */ +inet_sk (sk)->inet_num =IPPROTO_L2TP ; +l2tp_ip_hash (sk);return 0 ; }
@@ -594,8 +609,8 @@ static struct proto l2tp_ip_prot = { .sendmsg = l2tp_ip_sendmsg, .recvmsg = l2tp_ip_recvmsg, .backlog_rcv = l2tp_ip_backlog_recv, - .hash = inet_hash, - .unhash = inet_unhash, + .hash = l2tp_ip_hash, + .unhash = l2tp_ip_unhash, .obj_size =sizeof (struct l2tp_ip_sock ), #ifdef CONFIG_COMPAT .compat_setsockopt = compat_ip_setsockopt,
net/l2tp/l2tp_ip6.c +22 -8
@@ -20,8 +20,6 @@#include <net/icmp.h> #include <net/udp.h> #include <net/inet_common.h> -#include <net/inet_hashtables.h> -#include <net/inet6_hashtables.h> #include <net/tcp_states.h> #include <net/protocol.h> #include <net/xfrm.h>
@@ -222,15 +220,31 @@ static int l2tp_ip6_recv(struct sk_buff *skb)return 0 ; } -static int l2tp_ip6_open (struct sock *sk) +static int l2tp_ip6_hash (struct sock *sk) { -/* Prevent autobind. We don't have ports. */ -inet_sk (sk)->inet_num =IPPROTO_L2TP ; +if (sk_unhashed (sk)) { +write_lock_bh (&l2tp_ip6_lock); +sk_add_node (sk, &l2tp_ip6_table); +write_unlock_bh (&l2tp_ip6_lock); + } +return 0 ; +} +static void l2tp_ip6_unhash (struct sock *sk) +{ +if (sk_unhashed (sk)) +return ;write_lock_bh (&l2tp_ip6_lock); -sk_add_node (sk, &l2tp_ip6_table); +sk_del_node_init (sk);write_unlock_bh (&l2tp_ip6_lock); +} + +static int l2tp_ip6_open (struct sock *sk) +{ +/* Prevent autobind. We don't have ports. */ +inet_sk (sk)->inet_num =IPPROTO_L2TP ; +l2tp_ip6_hash (sk);return 0 ; }
@@ -728,8 +742,8 @@ static struct proto l2tp_ip6_prot = { .sendmsg = l2tp_ip6_sendmsg, .recvmsg = l2tp_ip6_recvmsg, .backlog_rcv = l2tp_ip6_backlog_recv, - .hash = inet6_hash, - .unhash = inet_unhash, + .hash = l2tp_ip6_hash, + .unhash = l2tp_ip6_unhash, .obj_size =sizeof (struct l2tp_ip6_sock ), #ifdef CONFIG_COMPAT .compat_setsockopt = compat_ipv6_setsockopt,
Signature · 1 line
2.25.1