5.10.130-rc1 review
Subsystems (2)
Greg Kroah-Hartman
maintainercover 5.10.130-rc1 review
This is the start of the stable review cycle for the 5.10.130 release. There are 55 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 13 Jul 2022 09:05:28 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.130-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.10.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 5.10.130-rc1
Miaoqian Lin <[email protected]>
dmaengine: ti: Add missing put_device in ti_dra7_xbar_route_allocate
Miaoqian Lin <[email protected]>
dmaengine: ti: Fix refcount leak in ti_dra7_xbar_route_allocate
Michael Walle <[email protected]>
dmaengine: at_xdma: handle errors of at_xdmac_alloc_desc() correctly
Dmitry Osipenko <[email protected]>
dmaengine: pl330: Fix lockdep warning about non-static key
Linus Torvalds <[email protected]>
ida: don't use BUG_ON() for debugging
Samuel Holland <[email protected]>
dt-bindings: dma: allwinner,sun50i-a64-dma: Fix min/max typo
Shuah Khan <[email protected]>
misc: rtsx_usb: set return value in rsp_buf alloc err path
Shuah Khan <[email protected]>
misc: rtsx_usb: use separate command and response buffers
Shuah Khan <[email protected]>
misc: rtsx_usb: fix use of dma mapped buffer for usb bulk transfer
Peter Robinson <[email protected]>
dmaengine: imx-sdma: Allow imx8m for imx7 FW revs
Satish Nagireddy <[email protected]>
i2c: cadence: Unregister the clk notifier in error path
Heiner Kallweit <[email protected]>
r8169: fix accessing unset transport header
Vladimir Oltean <[email protected]>
selftests: forwarding: fix error message in learning_test
Vladimir Oltean <[email protected]>
selftests: forwarding: fix learning_test when h1 supports IFF_UNICAST_FLT
Vladimir Oltean <[email protected]>
selftests: forwarding: fix flood_unicast_test when h2 supports IFF_UNICAST_FLT
Rick Lindsley <[email protected]>
ibmvnic: Properly dispose of all skbs during a failover.
Lukasz Cieplicki <[email protected]>
i40e: Fix dropped jumbo frames statistics
Ivan Malov <[email protected]>
xsk: Clear page contiguity bit when unmapping pool
Eugen Hristev <[email protected]>
ARM: dts: at91: sama5d2_icp: fix eeprom compatibles
Eugen Hristev <[email protected]>
ARM: dts: at91: sam9x60ek: fix eeprom compatible and size
Claudiu Beznea <[email protected]>
ARM: at91: pm: use proper compatibles for sam9x60's rtc and rtt
Claudiu Beznea <[email protected]>
ARM: at91: pm: use proper compatible for sama5d2's rtc
Stephan Gerhold <[email protected]>
arm64: dts: qcom: msm8992-*: Fix vdd_lvs1_2-supply typo
Andrei Lalaev <[email protected]>
pinctrl: sunxi: sunxi_pconf_set: use correct offset
Peng Fan <[email protected]>
arm64: dts: imx8mp-evk: correct I2C3 pad settings
Peng Fan <[email protected]>
arm64: dts: imx8mp-evk: correct gpio-led pad settings
Sherry Sun <[email protected]>
arm64: dts: imx8mp-evk: correct the uart2 pinctl value
Peng Fan <[email protected]>
arm64: dts: imx8mp-evk: correct mmc pad settings
Konrad Dybcio <[email protected]>
arm64: dts: qcom: msm8994: Fix CPU6/7 reg values
Samuel Holland <[email protected]>
pinctrl: sunxi: a83t: Fix NAND function name for some pins
Miaoqian Lin <[email protected]>
ARM: meson: Fix refcount leak in meson_smp_prepare_cpus
Eric Sandeen <[email protected]>
xfs: remove incorrect ASSERT in xfs_rename
Jimmy Assarsson <[email protected]>
can: kvaser_usb: kvaser_usb_leaf: fix bittiming limits
Jimmy Assarsson <[email protected]>
can: kvaser_usb: kvaser_usb_leaf: fix CAN clock frequency regression
Jimmy Assarsson <[email protected]>
can: kvaser_usb: replace run-time checks with struct kvaser_usb_driver_info
Jason A. Donenfeld <[email protected]>
powerpc/powernv: delay rng platform device creation until later in boot
Hsin-Yi Wang <[email protected]>
video: of_display_timing.h: include errno.h
Dan Williams <[email protected]>
memregion: Fix memregion_free() fallback definition
Rafael J. Wysocki <[email protected]>
PM: runtime: Redefine pm_runtime_release_supplier()
Helge Deller <[email protected]>
fbcon: Prevent that screen size is smaller than font size
Helge Deller <[email protected]>
fbcon: Disallow setting font bigger than screen size
Helge Deller <[email protected]>
fbmem: Check virtual screen sizes in fb_set_var()
Guiling Deng <[email protected]>
fbdev: fbmem: Fix logo center image dx issue
Yian Chen <[email protected]>
iommu/vt-d: Fix PCI bus rescan device hot add
Pablo Neira Ayuso <[email protected]>
netfilter: nf_tables: stricter validation of element data
Pablo Neira Ayuso <[email protected]>
netfilter: nft_set_pipapo: release elements in clone from abort path
Duoming Zhou <[email protected]>
net: rose: fix UAF bug caused by rose_t0timer_expiry
Oliver Neukum <[email protected]>
usbnet: fix memory leak in error case
Daniel Borkmann <[email protected]>
bpf: Fix insufficient bounds propagation from adjust_scalar_min_max_vals
Daniel Borkmann <[email protected]>
bpf: Fix incorrect verifier simulation around jmp32's jeq/jne
Rhett Aultman <[email protected]>
can: gs_usb: gs_usb_open/close(): fix memory leak
Liang He <[email protected]>
can: grcan: grcan_probe(): remove extra of_node_get()
Oliver Hartkopp <[email protected]>
can: bcm: use call_rcu() instead of costly synchronize_rcu()
Tim Crawford <[email protected]>
ALSA: hda/realtek: Add quirk for Clevo L140PU
Jann Horn <[email protected]>
mm/slub: add missing TID updates on slab deactivation
-------------
Diffstat:
.../bindings/dma/allwinner,sun50i-a64-dma.yaml | 2 +- Makefile | 4 +- arch/arm/boot/dts/at91-sam9x60ek.dts | 3 +- arch/arm/boot/dts/at91-sama5d2_icp.dts | 6 +- arch/arm/mach-at91/pm.c | 6 +- arch/arm/mach-meson/platsmp.c | 2 + arch/arm64/boot/dts/freescale/imx8mp-evk.dts | 18 +- .../boot/dts/qcom/msm8992-bullhead-rev-101.dts | 2 +- arch/arm64/boot/dts/qcom/msm8992-xiaomi-libra.dts | 2 +- arch/arm64/boot/dts/qcom/msm8994.dtsi | 4 +- arch/powerpc/platforms/powernv/rng.c | 16 +- drivers/base/core.c | 3 +- drivers/base/power/runtime.c | 20 +- drivers/dma/at_xdmac.c | 5 + drivers/dma/imx-sdma.c | 2 +- drivers/dma/pl330.c | 2 +- drivers/dma/ti/dma-crossbar.c | 5 + drivers/i2c/busses/i2c-cadence.c | 1 + drivers/iommu/intel/dmar.c | 2 +- drivers/misc/cardreader/rtsx_usb.c | 27 ++- drivers/net/can/grcan.c | 1 - drivers/net/can/usb/gs_usb.c | 23 +- drivers/net/can/usb/kvaser_usb/kvaser_usb.h | 25 +- drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c | 255 ++++++++++++--------- drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c | 4 +- drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c | 119 +++++----- drivers/net/ethernet/ibm/ibmvnic.c | 9 + drivers/net/ethernet/intel/i40e/i40e.h | 16 ++ drivers/net/ethernet/intel/i40e/i40e_main.c | 73 ++++++ drivers/net/ethernet/intel/i40e/i40e_register.h | 13 ++ drivers/net/ethernet/intel/i40e/i40e_type.h | 1 + drivers/net/ethernet/realtek/r8169_main.c | 10 +- drivers/net/usb/usbnet.c | 17 +- drivers/pinctrl/sunxi/pinctrl-sun8i-a83t.c | 10 +- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 2 + drivers/video/fbdev/core/fbcon.c | 33 +++ drivers/video/fbdev/core/fbmem.c | 16 +- fs/xfs/xfs_inode.c | 1 - include/linux/fbcon.h | 4 + include/linux/memregion.h | 2 +- include/linux/pm_runtime.h | 5 +- include/linux/rtsx_usb.h | 2 - include/video/of_display_timing.h | 2 + kernel/bpf/verifier.c | 113 ++++----- lib/idr.c | 3 +- mm/slub.c | 4 +- net/can/bcm.c | 18 +- net/netfilter/nf_tables_api.c | 9 +- net/netfilter/nft_set_pipapo.c | 48 ++-- net/rose/rose_route.c | 4 +- net/xdp/xsk_buff_pool.c | 1 + sound/pci/hda/patch_realtek.c | 1 + tools/testing/selftests/net/forwarding/lib.sh | 6 +- 53 files changed, 632 insertions(+), 350 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/55 mm/slub: add missing TID updates on slab deactivation
From: Jann Horn <[email protected]>
commit eeaa345e128515135ccb864c04482180c08e3259 upstream.
The fastpath in slab_alloc_node() assumes that c->slab is stable as long as the TID stays the same. However, two places in __slab_alloc() currently don't update the TID when deactivating the CPU slab.
If multiple operations race the right way, this could lead to an object getting lost; or, in an even more unlikely situation, it could even lead to an object being freed onto the wrong slab's freelist, messing up the inuse counter and eventually causing a page to be freed to the page allocator while it still contains slab objects.
(I haven't actually tested these cases though, this is just based on looking at the code. Writing testcases for this stuff seems like it'd be a pain...)
The race leading to state inconsistency is (all operations on the same CPU and kmem_cache):
- task A: begin do_slab_free():
- read TID
- read pcpu freelist (==NULL)
- check slab == c->slab (true)
- [PREEMPT A->B]
- task B: begin slab_alloc_node():
- fastpath fails (c->freelist is NULL)
- enter __slab_alloc()
- slub_get_cpu_ptr() (disables preemption)
- enter ___slab_alloc()
- take local_lock_irqsave()
- read c->freelist as NULL
- get_freelist() returns NULL
- write c->slab = NULL
- drop local_unlock_irqrestore()
- goto new_slab
- slub_percpu_partial() is NULL
- get_partial() returns NULL
- slub_put_cpu_ptr() (enables preemption)
- [PREEMPT B->A]
- task A: finish do_slab_free():
- this_cpu_cmpxchg_double() succeeds()
- [CORRUPT STATE: c->slab==NULL, c->freelist!=NULL]
Quoted 1 line
From there, the object on
c->freelistwill get lost if task B is allowed to
continue from here: It will proceed to the retry_load_slab label, set c->slab, then jump to load_freelist, which clobbers c->freelist.
But if we instead continue as follows, we get worse corruption:
- task A: run __slab_free() on object from other struct slab:
- CPU_PARTIAL_FREE case (slab was on no list, is now on pcpu partial)
- task A: run slab_alloc_node() with NUMA node constraint:
- fastpath fails (c->slab is NULL)
- call __slab_alloc()
- slub_get_cpu_ptr() (disables preemption)
- enter ___slab_alloc()
- c->slab is NULL: goto new_slab
- slub_percpu_partial() is non-NULL
- set c->slab to slub_percpu_partial(c)
- [CORRUPT STATE: c->slab points to slab-1, c->freelist has objects from slab-2]
- goto redo
- node_match() fails
- goto deactivate_slab
- existing c->freelist is passed into deactivate_slab()
- inuse count of slab-1 is decremented to account for object from slab-2
At this point, the inuse count of slab-1 is 1 lower than it should be. This means that if we free all allocated objects in slab-1 except for one, SLUB will think that slab-1 is completely unused, and may free its page, leading to use-after-free.
--- mm/slub.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
mm/slub.c +2 -2
@@ -2297,6 +2297,7 @@ redo: c->page =NULL ; c->freelist =NULL ; + c->tid =next_tid (c->tid); }/*
@@ -2430,8 +2431,6 @@ static inline void flush_slab(struct kme {stat (s,CPUSLAB_FLUSH );deactivate_slab (s, c->page, c->freelist, c); - - c->tid =next_tid (c->tid); }/*
@@ -2717,6 +2716,7 @@ redo:if (!freelist) { c->page =NULL ; + c->tid =next_tid (c->tid);stat (s,DEACTIVATE_BYPASS ); goto new_slab; }
Greg Kroah-Hartman
maintainerPATCH 2/55 ALSA: hda/realtek: Add quirk for Clevo L140PU
In reply to Greg Kroah-HartmanFrom: Tim Crawford <[email protected]>
commit 11bea26929a1a3a9dd1a287b60c2f471701bf706 upstream.
Fixes headset detection on Clevo L140PU.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -8934,6 +8934,7 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x1558 ,0x70f4 ,"Clevo NH77EPY" ,ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1558 ,0x70f6 ,"Clevo NH77DPQ-Y" ,ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1558 ,0x7716 ,"Clevo NS50PU" ,ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE ), +SND_PCI_QUIRK (0x1558 ,0x7718 ,"Clevo L140PU" ,ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1558 ,0x8228 ,"Clevo NR40BU" ,ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1558 ,0x8520 ,"Clevo NH50D[CD]" ,ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE ), SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Greg Kroah-Hartman
maintainerPATCH 3/55 can: bcm: use call_rcu() instead of costly synchronize_rcu()
In reply to Greg Kroah-HartmanFrom: Oliver Hartkopp <[email protected]>
commit f1b4e32aca0811aa011c76e5d6cf2fa19224b386 upstream.
In commit d5f9023fa61e ("can: bcm: delay release of struct bcm_op after synchronize_rcu()") Thadeu Lima de Souza Cascardo introduced two synchronize_rcu() calls in bcm_release() (only once at socket close) and in bcm_delete_rx_op() (called on removal of each single bcm_op).
Unfortunately this slow removal of the bcm_op's affects user space applications like cansniffer where the modification of a filter removes 2048 bcm_op's which blocks the cansniffer application for 40(!) seconds.
In commit 181d4447905d ("can: gw: use call_rcu() instead of costly synchronize_rcu()") Eric Dumazet replaced the synchronize_rcu() calls with several call_rcu()'s to safely remove the data structures after the removal of CAN ID subscriptions with can_rx_unregister() calls.
This patch adopts Erics approach for the can-bcm which should be applicable since the removal of tasklet_kill() in bcm_remove_op() and the introduction of the HRTIMER_MODE_SOFT timer handling in Linux 5.4.
--- net/can/bcm.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
net/can/bcm.c +14 -4
@@ -100,6 +100,7 @@ static inline u64 get_u64(const struct cstruct bcm_op {struct list_head list; +struct rcu_head rcu;int ifindex;canid_t can_id;u32 flags;
@@ -718,10 +719,9 @@ static struct bcm_op *bcm_find_op(structreturn NULL ; } -static void bcm_remove_op (struct bcm_op *op) +static void bcm_free_op_rcu (struct rcu_head *rcu_head) { -hrtimer_cancel (&op->timer); -hrtimer_cancel (&op->thrtimer); + struct bcm_op *op = container_of(rcu_head, struct bcm_op, rcu);if ((op->frames) && (op->frames != &op->sframe))kfree (op->frames);
@@ -732,6 +732,14 @@ static void bcm_remove_op(struct bcm_opkfree (op); } +static void bcm_remove_op (struct bcm_op *op) +{ +hrtimer_cancel (&op->timer); +hrtimer_cancel (&op->thrtimer); + +call_rcu (&op->rcu, bcm_free_op_rcu); +} +static void bcm_rx_unreg (struct net_device *dev,struct bcm_op *op) {if (op->rx_reg_dev == dev) {
@@ -757,6 +765,9 @@ static int bcm_delete_rx_op(struct list_if ((op->can_id == mh->can_id) && (op->ifindex == ifindex) && (op->flags &CAN_FD_FRAME ) == (mh->flags &CAN_FD_FRAME )) { +/* disable automatic timer on frame reception */ + op->flags |=RX_NO_AUTOTIMER ; +/* * Don't care if we're bound or not (due to netdev * problems) can_rx_unregister() is always a save
@@ -785,7 +796,6 @@ static int bcm_delete_rx_op(struct list_ bcm_rx_handler, op);list_del (&op->list); -synchronize_rcu ();bcm_remove_op (op);return 1 ;/* done */ }
Greg Kroah-Hartman
maintainerPATCH 4/55 can: grcan: grcan_probe(): remove extra of_node_get()
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
commit 562fed945ea482833667f85496eeda766d511386 upstream.
In grcan_probe(), of_find_node_by_path() has already increased the refcount. There is no need to call of_node_get() again, so remove it.
--- drivers/net/can/grcan.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/can/grcan.c +0 -1
@@ -1659,7 +1659,6 @@ static int grcan_probe(struct platform_d*/ sysid_parent =of_find_node_by_path ("/ambapp0" );if (sysid_parent) { -of_node_get (sysid_parent); err =of_property_read_u32 (sysid_parent,"systemid" , &sysid);if (!err && ((sysid &GRLIB_VERSION_MASK ) >=GRCAN_TXBUG_SAFE_GRLIB_VERSION ))
Greg Kroah-Hartman
maintainerPATCH 5/55 can: gs_usb: gs_usb_open/close(): fix memory leak
In reply to Greg Kroah-HartmanFrom: Rhett Aultman <[email protected]>
commit 2bda24ef95c0311ab93bda00db40486acf30bd0a upstream.
The gs_usb driver appears to suffer from a malady common to many USB CAN adapter drivers in that it performs usb_alloc_coherent() to allocate a number of USB request blocks (URBs) for RX, and then later relies on usb_kill_anchored_urbs() to free them, but this doesn't actually free them. As a result, this may be leaking DMA memory that's been used by the driver.
This commit is an adaptation of the techniques found in the esd_usb2 driver where a similar design pattern led to a memory leak. It explicitly frees the RX URBs and their DMA memory via a call to usb_free_coherent(). Since the RX URBs were allocated in the gs_can_open(), we remove them in gs_can_close() rather than in the disconnect function as was done in esd_usb2.
For more information, see the 928150fad41b ("can: esd_usb2: fix memory leak").
--- drivers/net/can/usb/gs_usb.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-)
drivers/net/can/usb/gs_usb.c +21 -2
@@ -184,6 +184,8 @@ struct gs_can {struct usb_anchor tx_submitted;atomic_t active_tx_urbs; +void *rxbuf[GS_MAX_RX_URBS ]; +dma_addr_t rxbuf_dma[GS_MAX_RX_URBS ]; };/* usb interface struct */
@@ -592,6 +594,7 @@ static int gs_can_open(struct net_devicefor (i =0 ; i <GS_MAX_RX_URBS ; i++) {struct urb *urb;u8 *buf; +dma_addr_t buf_dma;/* alloc rx urb */ urb =usb_alloc_urb (0 ,GFP_KERNEL );
@@ -602,7 +605,7 @@ static int gs_can_open(struct net_device buf =usb_alloc_coherent (dev->udev,sizeof (struct gs_host_frame ),GFP_KERNEL , - &urb->transfer_dma); + &buf_dma);if (!buf) {netdev_err (netdev,"No memory left for USB buffer\n" );
@@ -610,6 +613,8 @@ static int gs_can_open(struct net_devicereturn -ENOMEM ; } + urb->transfer_dma = buf_dma; +/* fill, anchor, and submit rx urb */ usb_fill_bulk_urb(urb, dev->udev,
@@ -633,10 +638,17 @@ static int gs_can_open(struct net_device rc);usb_unanchor_urb (urb); +usb_free_coherent (dev->udev, +sizeof (struct gs_host_frame ), + buf, + buf_dma);usb_free_urb (urb);break ; } + dev->rxbuf[i] = buf; + dev->rxbuf_dma[i] = buf_dma; +/* Drop reference, * USB core will take care of freeing it */
@@ -701,13 +713,20 @@ static int gs_can_close(struct net_devicint rc;struct gs_can *dev =netdev_priv (netdev);struct gs_usb *parent = dev->parent; +unsigned int i;netif_stop_queue (netdev);/* Stop polling */ parent->active_channels--; -if (!parent->active_channels) +if (!parent->active_channels) {usb_kill_anchored_urbs (&parent->rx_submitted); +for (i =0 ; i <GS_MAX_RX_URBS ; i++) +usb_free_coherent (dev->udev, +sizeof (struct gs_host_frame ), + dev->rxbuf[i], + dev->rxbuf_dma[i]); + }/* Stop sending URBs */ usb_kill_anchored_urbs (&dev->tx_submitted);
Greg Kroah-Hartman
maintainerPATCH 6/55 bpf: Fix incorrect verifier simulation around jmp32s jeq/jne
In reply to Greg Kroah-HartmanFrom: Daniel Borkmann <[email protected]>
commit a12ca6277eca6aeeccf66e840c23a2b520e24c8f upstream.
Kuee reported a quirk in the jmp32's jeq/jne simulation, namely that the register value does not match expectations for the fall-through path. For example:
Before fix:
0: R1=ctx(off=0,imm=0) R10=fp0
0: (b7) r2 = 0 ; R2_w=P0 1: (b7) r6 = 563 ; R6_w=P563 2: (87) r2 = -r2 ; R2_w=Pscalar() 3: (87) r2 = -r2 ; R2_w=Pscalar() 4: (4c) w2 |= w6 ; R2_w=Pscalar(umin=563,umax=4294967295,var_off=(0x233; 0xfffffdcc),s32_min=-2147483085) R6_w=P563 5: (56) if w2 != 0x8 goto pc+1 ; R2_w=P571 <--- [*]
6: (95) exit
R0 !read_ok
After fix:
0: R1=ctx(off=0,imm=0) R10=fp0
0: (b7) r2 = 0 ; R2_w=P0 1: (b7) r6 = 563 ; R6_w=P563 2: (87) r2 = -r2 ; R2_w=Pscalar() 3: (87) r2 = -r2 ; R2_w=Pscalar() 4: (4c) w2 |= w6 ; R2_w=Pscalar(umin=563,umax=4294967295,var_off=(0x233; 0xfffffdcc),s32_min=-2147483085) R6_w=P563 5: (56) if w2 != 0x8 goto pc+1 ; R2_w=P8 <--- [*]
6: (95) exit
R0 !read_ok
As can be seen on line 5 for the branch fall-through path in R2 [*] is that given condition w2 != 0x8 is false, verifier should conclude that r2 = 8 as upper 32 bit are known to be zero. However, verifier incorrectly concludes that r2 = 571 which is far off.
The problem is it only marks false{true}_reg as known in the switch for JE/NE case, but at the end of the function, it uses {false,true}_{64,32}off to update {false,true}_reg->var_off and they still hold the prior value of {false,true}_reg->var_off before it got marked as known. The subsequent __reg_combine_32_into_64() then propagates this old var_off and derives new bounds. The information between min/max bounds on {false,true}_reg from setting the register to known const combined with the {false,true}_reg->var_off based on the old information then derives wrong register data.
Fix it by detangling the BPF_JEQ/BPF_JNE cases and updating relevant {false,true}_{64,32}off tnums along with the register marking to known constant.
--- kernel/bpf/verifier.c | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-)
kernel/bpf/verifier.c +24 -17
@@ -7512,26 +7512,33 @@ static void reg_set_min_max(struct bpf_rreturn ;switch (opcode) { +/* JEQ/JNE comparison doesn't change the register equivalence. +* +* r1 = r2; +* if (r1 == 42) goto label; +* ... +* label: // here both r1 and r2 are known to be 42. +* +* Hence when marking register as known preserve it's ID. +*/ case BPF_JEQ : +if (is_jmp32) { +__mark_reg32_known (true_reg, val32); + true_32off =tnum_subreg (true_reg->var_off); + }else { +___mark_reg_known (true_reg, val); + true_64off = true_reg->var_off; + } +break ;case BPF_JNE : - { -struct bpf_reg_state *reg = - opcode ==BPF_JEQ ? true_reg : false_reg; - -/* JEQ/JNE comparison doesn't change the register equivalence. -* r1 = r2; -* if (r1 == 42) goto label; -* ... -* label: // here both r1 and r2 are known to be 42. -* -* Hence when marking register as known preserve it's ID. -*/ -if (is_jmp32) -__mark_reg32_known (reg, val32); -else -___mark_reg_known (reg, val); +if (is_jmp32) { +__mark_reg32_known (false_reg, val32); + false_32off =tnum_subreg (false_reg->var_off); + }else { +___mark_reg_known (false_reg, val); + false_64off = false_reg->var_off; + }break ; - }case BPF_JSET :if (is_jmp32) { false_32off =tnum_and (false_32off,tnum_const (~val32));
Greg Kroah-Hartman
maintainerPATCH 7/55 bpf: Fix insufficient bounds propagation from adjust_scalar_min_max_vals
In reply to Greg Kroah-HartmanFrom: Daniel Borkmann <[email protected]>
commit 3844d153a41adea718202c10ae91dc96b37453b5 upstream.
Kuee reported a corner case where the tnum becomes constant after the call to __reg_bound_offset(), but the register's bounds are not, that is, its min bounds are still not equal to the register's max bounds.
This in turn allows to leak pointers through turning a pointer register as is into an unknown scalar via adjust_ptr_min_max_vals().
Before:
func#0 @0
0: R1=ctx(off=0,imm=0,umax=0,var_off=(0x0; 0x0)) R10=fp(off=0,imm=0,umax=0,var_off=(0x0; 0x0))
0: (b7) r0 = 1 ; R0_w=scalar(imm=1,umin=1,umax=1,var_off=(0x1; 0x0)) 1: (b7) r3 = 0 ; R3_w=scalar(imm=0,umax=0,var_off=(0x0; 0x0)) 2: (87) r3 = -r3 ; R3_w=scalar() 3: (87) r3 = -r3 ; R3_w=scalar() 4: (47) r3 |= 32767 ; R3_w=scalar(smin=-9223372036854743041,umin=32767,var_off=(0x7fff; 0xffffffffffff8000),s32_min=-2147450881) 5: (75) if r3 s>= 0x0 goto pc+1 ; R3_w=scalar(umin=9223372036854808575,var_off=(0x8000000000007fff; 0x7fffffffffff8000),s32_min=-2147450881,u32_min=32767)
6: (95) exit
from 5 to 7: R0=scalar(imm=1,umin=1,umax=1,var_off=(0x1; 0x0)) R1=ctx(off=0,imm=0,umax=0,var_off=(0x0; 0x0)) R3=scalar(umin=32767,umax=9223372036854775807,var_off=(0x7fff; 0x7fffffffffff8000),s32_min=-2147450881) R10=fp(off=0,imm=0,umax=0,var_off=(0x0; 0x0))
7: (d5) if r3 s<= 0x8000 goto pc+1 ; R3=scalar(umin=32769,umax=9223372036854775807,var_off=(0x7fff; 0x7fffffffffff8000),s32_min=-2147450881,u32_min=32767)
8: (95) exit
from 7 to 9: R0=scalar(imm=1,umin=1,umax=1,var_off=(0x1; 0x0)) R1=ctx(off=0,imm=0,umax=0,var_off=(0x0; 0x0)) R3=scalar(umin=32767,umax=32768,var_off=(0x7fff; 0x8000)) R10=fp(off=0,imm=0,umax=0,var_off=(0x0; 0x0))
9: (07) r3 += -32767 ; R3_w=scalar(imm=0,umax=1,var_off=(0x0; 0x0)) <--- [*]
10: (95) exit
What can be seen here is that R3=scalar(umin=32767,umax=32768,var_off=(0x7fff; 0x8000)) after the operation R3 += -32767 results in a 'malformed' constant, that is, R3_w=scalar(imm=0,umax=1,var_off=(0x0; 0x0)). Intersecting with var_off has not been done at that point via __update_reg_bounds(), which would have improved the umax to be equal to umin.
Refactor the tnum <> min/max bounds information flow into a reg_bounds_sync() helper and use it consistently everywhere. After the fix, bounds have been corrected to R3_w=scalar(imm=0,umax=0,var_off=(0x0; 0x0)) and thus the register is regarded as a 'proper' constant scalar of 0.
After:
func#0 @0
0: R1=ctx(off=0,imm=0,umax=0,var_off=(0x0; 0x0)) R10=fp(off=0,imm=0,umax=0,var_off=(0x0; 0x0))
0: (b7) r0 = 1 ; R0_w=scalar(imm=1,umin=1,umax=1,var_off=(0x1; 0x0)) 1: (b7) r3 = 0 ; R3_w=scalar(imm=0,umax=0,var_off=(0x0; 0x0)) 2: (87) r3 = -r3 ; R3_w=scalar() 3: (87) r3 = -r3 ; R3_w=scalar() 4: (47) r3 |= 32767 ; R3_w=scalar(smin=-9223372036854743041,umin=32767,var_off=(0x7fff; 0xffffffffffff8000),s32_min=-2147450881) 5: (75) if r3 s>= 0x0 goto pc+1 ; R3_w=scalar(umin=9223372036854808575,var_off=(0x8000000000007fff; 0x7fffffffffff8000),s32_min=-2147450881,u32_min=32767)
6: (95) exit
from 5 to 7: R0=scalar(imm=1,umin=1,umax=1,var_off=(0x1; 0x0)) R1=ctx(off=0,imm=0,umax=0,var_off=(0x0; 0x0)) R3=scalar(umin=32767,umax=9223372036854775807,var_off=(0x7fff; 0x7fffffffffff8000),s32_min=-2147450881) R10=fp(off=0,imm=0,umax=0,var_off=(0x0; 0x0))
7: (d5) if r3 s<= 0x8000 goto pc+1 ; R3=scalar(umin=32769,umax=9223372036854775807,var_off=(0x7fff; 0x7fffffffffff8000),s32_min=-2147450881,u32_min=32767)
8: (95) exit
from 7 to 9: R0=scalar(imm=1,umin=1,umax=1,var_off=(0x1; 0x0)) R1=ctx(off=0,imm=0,umax=0,var_off=(0x0; 0x0)) R3=scalar(umin=32767,umax=32768,var_off=(0x7fff; 0x8000)) R10=fp(off=0,imm=0,umax=0,var_off=(0x0; 0x0))
9: (07) r3 += -32767 ; R3_w=scalar(imm=0,umax=0,var_off=(0x0; 0x0)) <--- [*]
10: (95) exit
--- kernel/bpf/verifier.c | 72 +++++++++++++++----------------------------------- 1 file changed, 23 insertions(+), 49 deletions(-)
kernel/bpf/verifier.c +23 -49
@@ -1249,6 +1249,21 @@ static void __reg_bound_offset(struct bp reg->var_off =tnum_or (tnum_clear_subreg (var64_off), var32_off); } +static void reg_bounds_sync (struct bpf_reg_state *reg) +{ +/* We might have learned new bounds from the var_off. */ +__update_reg_bounds (reg); +/* We might have learned something about the sign bit. */ +__reg_deduce_bounds (reg); +/* We might have learned some bits from the bounds. */ +__reg_bound_offset (reg); +/* Intersecting with the old var_off might have improved our bounds +* slightly, e.g. if umax was 0x7f...f and var_off was (0; 0xf...fc), +* then new var_off is (0; 0x7f...fc) which improves our umax. +*/ +__update_reg_bounds (reg); +} +static bool __reg32_bound_s64 (s32 a) {return a >=0 && a <=S32_MAX ;
@@ -1290,16 +1305,8 @@ static void __reg_combine_32_into_64(str* so they do not impact tnum bounds calculation. */ __mark_reg64_unbounded (reg); -__update_reg_bounds (reg); } - -/* Intersecting with the old var_off might have improved our bounds -* slightly. e.g. if umax was 0x7f...f and var_off was (0; 0xf...fc), -* then new var_off is (0; 0x7f...fc) which improves our umax. -*/ -__reg_deduce_bounds (reg); -__reg_bound_offset (reg); -__update_reg_bounds (reg); +reg_bounds_sync (reg); }static bool __reg64_bound_s32 (s64 a)
@@ -1315,7 +1322,6 @@ static bool __reg64_bound_u32(u64 a)static void __reg_combine_64_into_32 (struct bpf_reg_state *reg) {__mark_reg32_unbounded (reg); -if (__reg64_bound_s32 (reg->smin_value) &&__reg64_bound_s32 (reg->smax_value)) { reg->s32_min_value = (s32 )reg->smin_value; reg->s32_max_value = (s32 )reg->smax_value;
@@ -1324,14 +1330,7 @@ static void __reg_combine_64_into_32(str reg->u32_min_value = (u32 )reg->umin_value; reg->u32_max_value = (u32 )reg->umax_value; } - -/* Intersecting with the old var_off might have improved our bounds -* slightly. e.g. if umax was 0x7f...f and var_off was (0; 0xf...fc), -* then new var_off is (0; 0x7f...fc) which improves our umax. -*/ -__reg_deduce_bounds (reg); -__reg_bound_offset (reg); -__update_reg_bounds (reg); +reg_bounds_sync (reg); }/* Mark a register as having a completely unknown (scalar) value. */
@@ -5230,9 +5229,7 @@ static void do_refine_retval_range(struc ret_reg->s32_max_value = meta->msize_max_value; ret_reg->smin_value = -MAX_ERRNO ; ret_reg->s32_min_value = -MAX_ERRNO ; -__reg_deduce_bounds (ret_reg); -__reg_bound_offset (ret_reg); -__update_reg_bounds (ret_reg); +reg_bounds_sync (ret_reg); } static int
@@ -6197,11 +6194,7 @@ reject:if (!check_reg_sane_offset (env, dst_reg, ptr_reg->type))return -EINVAL ; - -__update_reg_bounds (dst_reg); -__reg_deduce_bounds (dst_reg); -__reg_bound_offset (dst_reg); - +reg_bounds_sync (dst_reg);if (sanitize_check_bounds (env, insn, dst_reg) <0 )return -EACCES ;if (sanitize_needed (opcode)) {
@@ -6939,10 +6932,7 @@ static int adjust_scalar_min_max_vals(st/* ALU32 ops are zero extended into 64bit register */ if (alu32)zext_32_to_64 (dst_reg); - -__update_reg_bounds (dst_reg); -__reg_deduce_bounds (dst_reg); -__reg_bound_offset (dst_reg); +reg_bounds_sync (dst_reg);return 0 ; }
@@ -7131,10 +7121,7 @@ static int check_alu_op(struct bpf_verif insn->dst_reg); }zext_32_to_64 (dst_reg); - -__update_reg_bounds (dst_reg); -__reg_deduce_bounds (dst_reg); -__reg_bound_offset (dst_reg); +reg_bounds_sync (dst_reg); } }else {/* case: R = imm
@@ -7693,21 +7680,8 @@ static void __reg_combine_min_max(struct dst_reg->smax_value); src_reg->var_off = dst_reg->var_off =tnum_intersect (src_reg->var_off, dst_reg->var_off); -/* We might have learned new bounds from the var_off. */ -__update_reg_bounds (src_reg); -__update_reg_bounds (dst_reg); -/* We might have learned something about the sign bit. */ -__reg_deduce_bounds (src_reg); -__reg_deduce_bounds (dst_reg); -/* We might have learned some bits from the bounds. */ -__reg_bound_offset (src_reg); -__reg_bound_offset (dst_reg); -/* Intersecting with the old var_off might have improved our bounds -* slightly. e.g. if umax was 0x7f...f and var_off was (0; 0xf...fc), -* then new var_off is (0; 0x7f...fc) which improves our umax. -*/ -__update_reg_bounds (src_reg); -__update_reg_bounds (dst_reg); +reg_bounds_sync (src_reg); +reg_bounds_sync (dst_reg); } static void reg_combine_min_max(struct bpf_reg_state *true_src,
Greg Kroah-Hartman
maintainerPATCH 8/55 usbnet: fix memory leak in error case
In reply to Greg Kroah-HartmanFrom: Oliver Neukum <[email protected]>
commit b55a21b764c1e182014630fa5486d717484ac58f upstream.
usbnet_write_cmd_async() mixed up which buffers
need to be freed in which error case.
v2: add Fixes tag
v3: fix uninitialized buf pointer
--- drivers/net/usb/usbnet.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/net/usb/usbnet.c +12 -5
@@ -2102,7 +2102,7 @@ static void usbnet_async_cmd_cb(struct uint usbnet_write_cmd_async (struct usbnet *dev,u8 cmd,u8 reqtype,u16 value,u16 index,const void *data,u16 size) { -struct usb_ctrlrequest *req =NULL ; +struct usb_ctrlrequest *req;struct urb *urb;int err = -ENOMEM ;void *buf =NULL ;
@@ -2120,7 +2120,7 @@ int usbnet_write_cmd_async(struct usbnetif (!buf) {netdev_err (dev->net,"Error allocating buffer" " in %s!\n" , __func__); - goto fail_free; + goto fail_free_urb; } }
@@ -2144,14 +2144,21 @@ int usbnet_write_cmd_async(struct usbnetif (err <0 ) {netdev_err (dev->net,"Error submitting the control" " message: status=%d\n" , err); - goto fail_free; + goto fail_free_all; }return 0 ; +fail_free_all: +kfree (req); fail_free_buf:kfree (buf); -fail_free: -kfree (req); +/* +* avoid a double free +* needed because the flag can be set only +* after filling the URB +*/ + urb->transfer_flags =0 ; +fail_free_urb:usb_free_urb (urb); fail:return err;
Greg Kroah-Hartman
maintainerPATCH 9/55 net: rose: fix UAF bug caused by rose_t0timer_expiry
In reply to Greg Kroah-HartmanFrom: Duoming Zhou <[email protected]>
commit 148ca04518070910739dfc4eeda765057856403d upstream.
There are UAF bugs caused by rose_t0timer_expiry(). The root cause is that del_timer() could not stop the timer handler that is running and there is no synchronization. One of the race conditions is shown below:
(thread 1) | (thread 2)
| rose_device_event
| rose_rt_device_down
| rose_remove_neigh
rose_t0timer_expiry | rose_stop_t0timer(rose_neigh)
... | del_timer(&neigh->t0timer)
| kfree(rose_neigh) //[1]FREE
neigh->dce_mode //[2]USE |The rose_neigh is deallocated in position [1] and use in position [2].
The crash trace triggered by POC is like below:
BUG: KASAN: use-after-free in expire_timers+0x144/0x320 Write of size 8 at addr ffff888009b19658 by task swapper/0/0 ... Call Trace: <IRQ> dump_stack_lvl+0xbf/0xee print_address_description+0x7b/0x440 print_report+0x101/0x230 ? expire_timers+0x144/0x320 kasan_report+0xed/0x120 ? expire_timers+0x144/0x320 expire_timers+0x144/0x320 __run_timers+0x3ff/0x4d0 run_timer_softirq+0x41/0x80 __do_softirq+0x233/0x544 ...
This patch changes rose_stop_ftimer() and rose_stop_t0timer() in rose_remove_neigh() to del_timer_sync() in order that the timer handler could be finished before the resources such as rose_neigh and so on are deallocated. As a result, the UAF bugs could be mitigated.
--- net/rose/rose_route.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/rose/rose_route.c +2 -2
@@ -227,8 +227,8 @@ static void rose_remove_neigh(struct ros {struct rose_neigh *s; -rose_stop_ftimer (rose_neigh); -rose_stop_t0timer (rose_neigh); +del_timer_sync (&rose_neigh->ftimer); +del_timer_sync (&rose_neigh->t0timer);skb_queue_purge (&rose_neigh->queue);
Greg Kroah-Hartman
maintainerPATCH 10/55 netfilter: nft_set_pipapo: release elements in clone from abort path
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
commit 9827a0e6e23bf43003cd3d5b7fb11baf59a35e1e upstream.
New elements that reside in the clone are not released in case that the transaction is aborted.
[16302.231754] ------------[ cut here ]------------ [16302.231756] WARNING: CPU: 0 PID: 100509 at net/netfilter/nf_tables_api.c:1864 nf_tables_chain_destroy+0x26/0x127 [nf_tables] [...] [16302.231882] CPU: 0 PID: 100509 Comm: nft Tainted: G W 5.19.0-rc3+ #155 [...] [16302.231887] RIP: 0010:nf_tables_chain_destroy+0x26/0x127 [nf_tables] [16302.231899] Code: f3 fe ff ff 41 55 41 54 55 53 48 8b 6f 10 48 89 fb 48 c7 c7 82 96 d9 a0 8b 55 50 48 8b 75 58 e8 de f5 92 e0 83 7d 50 00 74 09 <0f> 0b 5b 5d 41 5c 41 5d c3 4c 8b 65 00 48 8b 7d 08 49 39 fc 74 05 [...] [16302.231917] Call Trace: [16302.231919] <TASK> [16302.231921] __nf_tables_abort.cold+0x23/0x28 [nf_tables] [16302.231934] nf_tables_abort+0x30/0x50 [nf_tables] [16302.231946] nfnetlink_rcv_batch+0x41a/0x840 [nfnetlink] [16302.231952] ? __nla_validate_parse+0x48/0x190 [16302.231959] nfnetlink_rcv+0x110/0x129 [nfnetlink] [16302.231963] netlink_unicast+0x211/0x340 [16302.231969] netlink_sendmsg+0x21e/0x460
Add nft_set_pipapo_match_destroy() helper function to release the elements in the lookup tables.
Stefano Brivio says: "We additionally look for elements pointers in the cloned matching data if priv->dirty is set, because that means that cloned data might point to additional elements we did not commit to the working copy yet (such as the abort path case, but perhaps not limited to it)."
--- net/netfilter/nft_set_pipapo.c | 48 ++++++++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 15 deletions(-)
net/netfilter/nft_set_pipapo.c +33 -15
@@ -2121,6 +2121,32 @@ out_scratch: }/** +* nft_set_pipapo_match_destroy() - Destroy elements from key mapping array +* @set: nftables API set representation +* @m: matching data pointing to key mapping array +*/ +static void nft_set_pipapo_match_destroy (const struct nft_set *set, +struct nft_pipapo_match *m) +{ +struct nft_pipapo_field *f; +int i, r; + +for (i =0 , f = m->f; i < m->field_count -1 ; i++, f++) + ; + +for (r =0 ; r < f->rules; r++) { +struct nft_pipapo_elem *e; + +if (r < f->rules -1 && f->mt[r +1 ].e == f->mt[r].e) +continue ; + + e = f->mt[r].e; + +nft_set_elem_destroy (set, e, true); + } +} + +/** * nft_pipapo_destroy() - Free private data for set and all committed elements * @set: nftables API set representation */
@@ -2128,26 +2154,13 @@ static void nft_pipapo_destroy(const str {struct nft_pipapo *priv =nft_set_priv (set);struct nft_pipapo_match *m; -struct nft_pipapo_field *f; -int i, r, cpu; +int cpu; m =rcu_dereference_protected (priv->match, true);if (m) {rcu_barrier (); -for (i =0 , f = m->f; i < m->field_count -1 ; i++, f++) - ; - -for (r =0 ; r < f->rules; r++) { -struct nft_pipapo_elem *e; - -if (r < f->rules -1 && f->mt[r +1 ].e == f->mt[r].e) -continue ; - - e = f->mt[r].e; - -nft_set_elem_destroy (set, e, true); - } +nft_set_pipapo_match_destroy (set, m);#ifdef NFT_PIPAPO_ALIGN free_percpu (m->scratch_aligned);
@@ -2161,6 +2174,11 @@ static void nft_pipapo_destroy(const str }if (priv->clone) { + m = priv->clone; + +if (priv->dirty) +nft_set_pipapo_match_destroy (set, m); +#ifdef NFT_PIPAPO_ALIGN free_percpu (priv->clone->scratch_aligned);#endif
Greg Kroah-Hartman
maintainerPATCH 11/55 netfilter: nf_tables: stricter validation of element data
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
commit 7e6bc1f6cabcd30aba0b11219d8e01b952eacbb6 upstream.
Make sure element data type and length do not mismatch the one specified by the set declaration.
--- net/netfilter/nf_tables_api.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
net/netfilter/nf_tables_api.c +8 -1
@@ -4886,13 +4886,20 @@ static int nft_setelem_parse_data(structstruct nft_data *data, struct nlattr *attr) { + u32 dtype;int err; err =nft_data_init (ctx, data,NFT_DATA_VALUE_MAXLEN , desc, attr);if (err <0 )return err; -if (desc->type !=NFT_DATA_VERDICT && desc->len != set->dlen) { +if (set->dtype ==NFT_DATA_VERDICT ) + dtype =NFT_DATA_VERDICT ; +else + dtype =NFT_DATA_VALUE ; + +if (dtype != desc->type || + set->dlen != desc->len) {nft_data_release (data, desc->type);return -EINVAL ; }
Greg Kroah-Hartman
maintainerPATCH 12/55 iommu/vt-d: Fix PCI bus rescan device hot add
In reply to Greg Kroah-HartmanFrom: Yian Chen <[email protected]>
commit 316f92a705a4c2bf4712135180d56f3cca09243a upstream.
Notifier calling chain uses priority to determine the execution order of the notifiers or listeners registered to the chain. PCI bus device hot add utilizes the notification mechanism.
The current code sets low priority (INT_MIN) to Intel dmar_pci_bus_notifier and postpones DMAR decoding after adding new device into IOMMU. The result is that struct device pointer cannot be found in DRHD search for the new device's DMAR/IOMMU. Subsequently, the device is put under the "catch-all" IOMMU instead of the correct one. This could cause system hang when device TLB invalidation is sent to the wrong IOMMU. Invalidation timeout error and hard lockup have been observed and data inconsistency/crush may occur as well.
This patch fixes the issue by setting a positive priority(1) for dmar_pci_bus_notifier while the priority of IOMMU bus notifier uses the default value(0), therefore DMAR decoding will be in advance of DRHD search for a new device to find the correct IOMMU.
Following is a 2-step example that triggers the bug by simulating PCI device hot add behavior in Intel Sapphire Rapids server.
echo 1 > /sys/bus/pci/devices/0000:6a:01.0/remove
echo 1 > /sys/bus/pci/rescan
--- drivers/iommu/intel/dmar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/intel/dmar.c +1 -1
@@ -385,7 +385,7 @@ static int dmar_pci_bus_notifier(structstatic struct notifier_block dmar_pci_bus_nb = { .notifier_call = dmar_pci_bus_notifier, - .priority =INT_MIN , + .priority =1 , }; static struct dmar_drhd_unit *
Greg Kroah-Hartman
maintainerPATCH 13/55 fbdev: fbmem: Fix logo center image dx issue
In reply to Greg Kroah-HartmanFrom: Guiling Deng <[email protected]>
commit 955f04766d4e6eb94bf3baa539e096808c74ebfb upstream.
Image.dx gets wrong value because of missing '()'.
If xres == logo->width and n == 1, image.dx = -16.
--- drivers/video/fbdev/core/fbmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/core/fbmem.c +1 -1
@@ -513,7 +513,7 @@ static int fb_show_logo_line(struct fb_iwhile (n && (n * (logo->width +8 ) -8 > xres)) --n; - image.dx = (xres - n * (logo->width +8 ) -8 ) /2 ; + image.dx = (xres - (n * (logo->width +8 ) -8 )) /2 ; image.dy = y ?: (yres - logo->height) /2 ; }else { image.dx =0 ;
Greg Kroah-Hartman
maintainerPATCH 14/55 fbmem: Check virtual screen sizes in fb_set_var()
In reply to Greg Kroah-HartmanFrom: Helge Deller <[email protected]>
commit 6c11df58fd1ac0aefcb3b227f72769272b939e56 upstream.
Verify that the fbdev or drm driver correctly adjusted the virtual screen sizes. On failure report the failing driver and reject the screen size change.
--- drivers/video/fbdev/core/fbmem.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/video/fbdev/core/fbmem.c +10 -0
@@ -1019,6 +1019,16 @@ fb_set_var(struct fb_info *info, structif (ret)return ret; +/* verify that virtual resolution >= physical resolution */ +if (var->xres_virtual < var->xres || + var->yres_virtual < var->yres) { +pr_warn ("WARNING: fbcon: Driver '%s' missed to adjust virtual screen size (%ux%u vs. %ux%u)\n" , + info->fix.id, + var->xres_virtual, var->yres_virtual, + var->xres, var->yres); +return -EINVAL ; + } +if ((var->activate &FB_ACTIVATE_MASK ) !=FB_ACTIVATE_NOW )return 0 ;
Greg Kroah-Hartman
maintainerPATCH 15/55 fbcon: Disallow setting font bigger than screen size
In reply to Greg Kroah-HartmanFrom: Helge Deller <[email protected]>
commit 65a01e601dbba8b7a51a2677811f70f783766682 upstream.
Prevent that users set a font size which is bigger than the physical screen. It's unlikely this may happen (because screens are usually much larger than the fonts and each font char is limited to 32x32 pixels), but it may happen on smaller screens/LCD displays.
--- drivers/video/fbdev/core/fbcon.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/video/fbdev/core/fbcon.c +5 -0
@@ -2510,6 +2510,11 @@ static int fbcon_set_font(struct vc_dataif (charcount !=256 && charcount !=512 )return -EINVAL ; +/* font bigger than screen resolution ? */ +if (w >FBCON_SWAP (info->var.rotate, info->var.xres, info->var.yres) || + h >FBCON_SWAP (info->var.rotate, info->var.yres, info->var.xres)) +return -EINVAL ; +/* Make sure drawing engine can handle the font */ if (!(info->pixmap.blit_x & (1 << (font->width -1 ))) || !(info->pixmap.blit_y & (1 << (font->height -1 ))))
Greg Kroah-Hartman
maintainerPATCH 16/55 fbcon: Prevent that screen size is smaller than font size
In reply to Greg Kroah-HartmanFrom: Helge Deller <[email protected]>
commit e64242caef18b4a5840b0e7a9bff37abd4f4f933 upstream.
We need to prevent that users configure a screen size which is smaller than the currently selected font size. Otherwise rendering chars on the screen will access memory outside the graphics memory region.
This patch adds a new function fbcon_modechange_possible() which implements this check and which later may be extended with other checks if necessary. The new function is called from the FBIOPUT_VSCREENINFO ioctl handler in fbmem.c, which will return -EINVAL if userspace asked for a too small screen size.
--- drivers/video/fbdev/core/fbcon.c | 28 ++++++++++++++++++++++++++++ drivers/video/fbdev/core/fbmem.c | 4 +++- include/linux/fbcon.h | 4 ++++ 3 files changed, 35 insertions(+), 1 deletion(-)
drivers/video/fbdev/core/fbcon.c +28 -0
@@ -2776,6 +2776,34 @@ void fbcon_update_vcs(struct fb_info *in }EXPORT_SYMBOL (fbcon_update_vcs); +/* let fbcon check if it supports a new screen resolution */ +int fbcon_modechange_possible (struct fb_info *info,struct fb_var_screeninfo *var) +{ +struct fbcon_ops *ops = info->fbcon_par; +struct vc_data *vc; +unsigned int i; + +WARN_CONSOLE_UNLOCKED (); + +if (!ops) +return 0 ; + +/* prevent setting a screen size which is smaller than font size */ +for (i = first_fb_vc; i <= last_fb_vc; i++) { + vc = vc_cons[i].d; +if (!vc || vc->vc_mode !=KD_TEXT || + registered_fb[con2fb_map[i]] != info) +continue ; + +if (vc->vc_font.width >FBCON_SWAP (var->rotate, var->xres, var->yres) || + vc->vc_font.height >FBCON_SWAP (var->rotate, var->yres, var->xres)) +return -EINVAL ; + } + +return 0 ; +} +EXPORT_SYMBOL_GPL (fbcon_modechange_possible); +int fbcon_mode_deleted (struct fb_info *info,struct fb_videomode *mode) {
drivers/video/fbdev/core/fbmem.c +3 -1
@@ -1119,7 +1119,9 @@ static long do_fb_ioctl(struct fb_info *return -EFAULT ;console_lock ();lock_fb_info (info); - ret =fb_set_var (info, &var); + ret =fbcon_modechange_possible (info, &var); +if (!ret) + ret =fb_set_var (info, &var);if (!ret)fbcon_update_vcs (info, var.activate &FB_ACTIVATE_ALL );unlock_fb_info (info);
include/linux/fbcon.h +4 -0
@@ -15,6 +15,8 @@ void fbcon_new_modelist(struct fb_info *void fbcon_get_requirement (struct fb_info *info,struct fb_blit_caps *caps);void fbcon_fb_blanked (struct fb_info *info,int blank); +int fbcon_modechange_possible (struct fb_info *info, +struct fb_var_screeninfo *var);void fbcon_update_vcs (struct fb_info *info,bool all);void fbcon_remap_all (struct fb_info *info);int fbcon_set_con2fb_map_ioctl (void __user *argp);
@@ -33,6 +35,8 @@ static inline void fbcon_new_modelist(ststatic inline void fbcon_get_requirement (struct fb_info *info,struct fb_blit_caps *caps) {}static inline void fbcon_fb_blanked (struct fb_info *info,int blank) {} +static inline int fbcon_modechange_possible (struct fb_info *info, +struct fb_var_screeninfo *var) {return 0 ; }static inline void fbcon_update_vcs (struct fb_info *info,bool all) {}static inline void fbcon_remap_all (struct fb_info *info) {}static inline int fbcon_set_con2fb_map_ioctl (void __user *argp) {return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 17/55 PM: runtime: Redefine pm_runtime_release_supplier()
In reply to Greg Kroah-HartmanFrom: Rafael J. Wysocki <[email protected]>
commit 07358194badf73e267289b40b761f5dc56928eab upstream.
Instead of passing an extra bool argument to pm_runtime_release_supplier(), make its callers take care of triggering a runtime-suspend of the supplier device as needed.
No expected functional impact.
--- drivers/base/core.c | 3 ++- drivers/base/power/runtime.c | 20 +++++++++----------- include/linux/pm_runtime.h | 5 ++--- 3 files changed, 13 insertions(+), 15 deletions(-)
drivers/base/core.c +2 -1
@@ -348,7 +348,8 @@ static void device_link_release_fn(struc/* Ensure that all references to the link object have been dropped. */ device_link_synchronize_removal (); -pm_runtime_release_supplier (link, true); +pm_runtime_release_supplier (link); +pm_request_idle (link->supplier);put_device (link->consumer);put_device (link->supplier);
drivers/base/power/runtime.c +9 -11
@@ -308,13 +308,10 @@ static int rpm_get_suppliers(struct devi/** * pm_runtime_release_supplier - Drop references to device link's supplier. * @link: Target device link. -* @check_idle: Whether or not to check if the supplier device is idle. * -* Drop all runtime PM references associated with @link to its supplier device -* and if @check_idle is set, check if that device is idle (and so it can be -* suspended). +* Drop all runtime PM references associated with @link to its supplier device. */ -void pm_runtime_release_supplier (struct device_link *link,bool check_idle) +void pm_runtime_release_supplier (struct device_link *link) {struct device *supplier = link->supplier;
@@ -327,9 +324,6 @@ void pm_runtime_release_supplier(structwhile (refcount_dec_not_one (&link->rpm_active) &&atomic_read (&supplier->power.usage_count) >0 )pm_runtime_put_noidle (supplier); - -if (check_idle) -pm_request_idle (supplier); }static void __rpm_put_suppliers (struct device *dev,bool try_to_suspend)
@@ -337,8 +331,11 @@ static void __rpm_put_suppliers(struct dstruct device_link *link;list_for_each_entry_rcu (link, &dev->links.suppliers, c_node, -device_links_read_lock_held ()) -pm_runtime_release_supplier (link, try_to_suspend); +device_links_read_lock_held ()) { +pm_runtime_release_supplier (link); +if (try_to_suspend) +pm_request_idle (link->supplier); + } }static void rpm_put_suppliers (struct device *dev)
@@ -1776,7 +1773,8 @@ void pm_runtime_drop_link(struct device_return ;pm_runtime_drop_link_count (link->consumer); -pm_runtime_release_supplier (link, true); +pm_runtime_release_supplier (link); +pm_request_idle (link->supplier); }static bool pm_runtime_need_not_resume (struct device *dev)
include/linux/pm_runtime.h +2 -3
@@ -58,7 +58,7 @@ extern void pm_runtime_get_suppliers(strextern void pm_runtime_put_suppliers (struct device *dev);extern void pm_runtime_new_link (struct device *dev);extern void pm_runtime_drop_link (struct device_link *link); -extern void pm_runtime_release_supplier (struct device_link *link,bool check_idle); +extern void pm_runtime_release_supplier (struct device_link *link);/** * pm_runtime_get_if_in_use - Conditionally bump up runtime PM usage counter.
@@ -280,8 +280,7 @@ static inline void pm_runtime_get_supplistatic inline void pm_runtime_put_suppliers (struct device *dev) {}static inline void pm_runtime_new_link (struct device *dev) {}static inline void pm_runtime_drop_link (struct device_link *link) {} -static inline void pm_runtime_release_supplier (struct device_link *link, -bool check_idle) {} +static inline void pm_runtime_release_supplier (struct device_link *link) {}#endif /* !CONFIG_PM */
Greg Kroah-Hartman
maintainerPATCH 18/55 memregion: Fix memregion_free() fallback definition
In reply to Greg Kroah-HartmanFrom: Dan Williams <[email protected]>
commit f50974eee5c4a5de1e4f1a3d873099f170df25f8 upstream.
In the CONFIG_MEMREGION=n case, memregion_free() is meant to be a static inline. 0day reports:
In file included from drivers/cxl/core/port.c:4:
include/linux/memregion.h:19:6: warning: no previous prototype for function 'memregion_free' [-Wmissing-prototypes]
Mark memregion_free() static.
--- include/linux/memregion.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/memregion.h +1 -1
@@ -16,7 +16,7 @@ static inline int memregion_alloc(gfp_t {return -ENOMEM ; } -void memregion_free (int id) +static inline void memregion_free (int id) { }#endif
Greg Kroah-Hartman
maintainerPATCH 19/55 video: of_display_timing.h: include errno.h
In reply to Greg Kroah-HartmanFrom: Hsin-Yi Wang <[email protected]>
commit 3663a2fb325b8782524f3edb0ae32d6faa615109 upstream.
If CONFIG_OF is not enabled, default of_get_display_timing() returns an errno, so include the header.
--- include/video/of_display_timing.h | 2 ++ 1 file changed, 2 insertions(+)
include/video/of_display_timing.h +2 -0
@@ -8,6 +8,8 @@#ifndef __LINUX_OF_DISPLAY_TIMING_H#define __LINUX_OF_DISPLAY_TIMING_H +#include <linux/errno.h> +struct device_node ;struct display_timing ;struct display_timings ;
Greg Kroah-Hartman
maintainerPATCH 20/55 powerpc/powernv: delay rng platform device creation until later in boot
In reply to Greg Kroah-HartmanFrom: Jason A. Donenfeld <[email protected]>
commit 887502826549caa7e4215fd9e628f48f14c0825a upstream.
The platform device for the rng must be created much later in boot. Otherwise it tries to connect to a parent that doesn't yet exist, resulting in this splat:
[ 0.000478] kobject: '(null)' ((____ptrval____)): is not initialized, yet kobject_get() is being called. [ 0.002925] [c000000002a0fb30] [c00000000073b0bc] kobject_get+0x8c/0x100 (unreliable) [ 0.003071] [c000000002a0fba0] [c00000000087e464] device_add+0xf4/0xb00 [ 0.003194] [c000000002a0fc80] [c000000000a7f6e4] of_device_add+0x64/0x80 [ 0.003321] [c000000002a0fcb0] [c000000000a800d0] of_platform_device_create_pdata+0xd0/0x1b0 [ 0.003476] [c000000002a0fd00] [c00000000201fa44] pnv_get_random_long_early+0x240/0x2e4 [ 0.003623] [c000000002a0fe20] [c000000002060c38] random_init+0xc0/0x214
This patch fixes the issue by doing the platform device creation inside of machine_subsys_initcall.
--- arch/powerpc/platforms/powernv/rng.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
arch/powerpc/platforms/powernv/rng.c +10 -6
@@ -176,12 +176,8 @@ static int __init pnv_get_random_long_ea NULL) != pnv_get_random_long_early)return 0 ; -for_each_compatible_node (dn,NULL ,"ibm,power-rng" ) { -if (rng_create (dn)) -continue ; -/* Create devices for hwrng driver */ -of_platform_device_create (dn,NULL ,NULL ); - } +for_each_compatible_node (dn,NULL ,"ibm,power-rng" ) +rng_create (dn);if (!ppc_md.get_random_seed)return 0 ;
@@ -205,10 +201,18 @@ void __init pnv_rng_init(void)static int __init pnv_rng_late_init (void ) { +struct device_node *dn;unsigned long v; +/* In case it wasn't called during init for some other reason. */ if (ppc_md.get_random_seed == pnv_get_random_long_early)pnv_get_random_long_early (&v); + +if (ppc_md.get_random_seed == powernv_get_random_long) { +for_each_compatible_node (dn,NULL ,"ibm,power-rng" ) +of_platform_device_create (dn,NULL ,NULL ); + } +return 0 ; }machine_subsys_initcall (powernv, pnv_rng_late_init);
Greg Kroah-Hartman
maintainerPATCH 21/55 can: kvaser_usb: replace run-time checks with struct kvaser_usb_driver_info
In reply to Greg Kroah-HartmanFrom: Jimmy Assarsson <[email protected]>
commit 49f274c72357d2d74cba70b172cf369768909707 upstream.
Unify and move compile-time known information into new struct kvaser_usb_driver_info, in favor of run-time checks.
All Kvaser USBcanII supports listen-only mode and error counter reporting.
--- drivers/net/can/usb/kvaser_usb/kvaser_usb.h | 22 +- drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c | 244 ++++++++++++----------- drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c | 24 +- 3 files changed, 155 insertions(+), 135 deletions(-)
drivers/net/can/usb/kvaser_usb/kvaser_usb.h +12 -10
@@ -35,9 +35,9 @@#define KVASER_USB_RX_BUFFER_SIZE 3072#define KVASER_USB_MAX_NET_DEVICES 5 -/* USB devices features */ -#define KVASER_USB_HAS_SILENT_MODE BIT(0) -#define KVASER_USB_HAS_TXRX_ERRORS BIT(1) +/* Kvaser USB device quirks */ +#define KVASER_USB_QUIRK_HAS_SILENT_MODE BIT(0) +#define KVASER_USB_QUIRK_HAS_TXRX_ERRORS BIT(1)/* Device capabilities */ #define KVASER_USB_CAP_BERR_CAP 0x01
@@ -65,12 +65,7 @@ struct kvaser_usb_dev_card_data_hydra {struct kvaser_usb_dev_card_data {u32 ctrlmode_supported;u32 capabilities; -union { -struct { -enum kvaser_usb_leaf_family family; - } leaf; -struct kvaser_usb_dev_card_data_hydra hydra; - }; +struct kvaser_usb_dev_card_data_hydra hydra; };/* Context for an outstanding, not yet ACKed, transmission */
@@ -84,7 +79,7 @@ struct kvaser_usb {struct usb_device *udev;struct usb_interface *intf;struct kvaser_usb_net_priv *nets[KVASER_USB_MAX_NET_DEVICES ]; -const struct kvaser_usb_dev_ops *ops; +const struct kvaser_usb_driver_info *driver_info;const struct kvaser_usb_dev_cfg *cfg;struct usb_endpoint_descriptor *bulk_in, *bulk_out;
@@ -166,6 +161,12 @@ struct kvaser_usb_dev_ops { int *cmd_len, u16 transid); }; +struct kvaser_usb_driver_info { +u32 quirks; +enum kvaser_usb_leaf_family family; +const struct kvaser_usb_dev_ops *ops; +}; +struct kvaser_usb_dev_cfg {const struct can_clock clock;const unsigned int timestamp_freq;
@@ -185,4 +186,5 @@ int kvaser_usb_send_cmd_async(struct kva int len);int kvaser_usb_can_rx_over_error (struct net_device *netdev); +#endif /* KVASER_USB_H */
drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c +131 -113
409 lines not on this page · raw message
drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +12 -12
@@ -405,7 +405,7 @@ kvaser_usb_leaf_frame_to_cmd(const strucsizeof (struct kvaser_cmd_tx_can ); cmd->u.tx_can.channel = priv->channel; -switch (dev->card_data.leaf.family) { +switch (dev->driver_info->family) {case KVASER_LEAF : cmd_tx_can_flags = &cmd->u.tx_can.leaf.flags;break ;
@@ -551,7 +551,7 @@ static int kvaser_usb_leaf_get_software_if (err)return err; -switch (dev->card_data.leaf.family) { +switch (dev->driver_info->family) {case KVASER_LEAF :kvaser_usb_leaf_get_software_info_leaf (dev, &cmd.u.leaf.softinfo);break ;
@@ -598,7 +598,7 @@ static int kvaser_usb_leaf_get_card_info dev->nchannels = cmd.u.cardinfo.nchannels;if (dev->nchannels >KVASER_USB_MAX_NET_DEVICES || - (dev->card_data.leaf.family ==KVASER_USBCAN && + (dev->driver_info->family ==KVASER_USBCAN && dev->nchannels >MAX_USBCAN_NET_DEVICES ))return -EINVAL ;
@@ -734,7 +734,7 @@ kvaser_usb_leaf_rx_error_update_can_stat new_state < CAN_STATE_BUS_OFF) priv->can.can_stats.restarts++; -switch (dev->card_data.leaf.family) { +switch (dev->driver_info->family) {case KVASER_LEAF :if (es->leaf.error_factor) { priv->can.can_stats.bus_error++;
@@ -813,7 +813,7 @@ static void kvaser_usb_leaf_rx_error(con } } -switch (dev->card_data.leaf.family) { +switch (dev->driver_info->family) {case KVASER_LEAF :if (es->leaf.error_factor) { cf->can_id |=CAN_ERR_BUSERROR |CAN_ERR_PROT ;
@@ -1005,7 +1005,7 @@ static void kvaser_usb_leaf_rx_can_msg(c stats = &priv->netdev->stats;if ((cmd->u.rx_can_header.flag &MSG_FLAG_ERROR_FRAME ) && - (dev->card_data.leaf.family ==KVASER_LEAF && + (dev->driver_info->family ==KVASER_LEAF && cmd->id ==CMD_LEAF_LOG_MESSAGE )) {kvaser_usb_leaf_leaf_rx_error (dev, cmd);return ;
@@ -1021,7 +1021,7 @@ static void kvaser_usb_leaf_rx_can_msg(creturn ; } -switch (dev->card_data.leaf.family) { +switch (dev->driver_info->family) {case KVASER_LEAF : rx_data = cmd->u.leaf.rx_can.data;break ;
@@ -1036,7 +1036,7 @@ static void kvaser_usb_leaf_rx_can_msg(creturn ; } -if (dev->card_data.leaf.family ==KVASER_LEAF && cmd->id == +if (dev->driver_info->family ==KVASER_LEAF && cmd->id ==CMD_LEAF_LOG_MESSAGE ) { cf->can_id =le32_to_cpu (cmd->u.leaf.log_message.id);if (cf->can_id &KVASER_EXTENDED_FRAME )
@@ -1133,14 +1133,14 @@ static void kvaser_usb_leaf_handle_commabreak ;case CMD_LEAF_LOG_MESSAGE : -if (dev->card_data.leaf.family !=KVASER_LEAF ) +if (dev->driver_info->family !=KVASER_LEAF ) goto warn;kvaser_usb_leaf_rx_can_msg (dev, cmd);break ;case CMD_CHIP_STATE_EVENT :case CMD_CAN_ERROR_EVENT : -if (dev->card_data.leaf.family ==KVASER_LEAF ) +if (dev->driver_info->family ==KVASER_LEAF )kvaser_usb_leaf_leaf_rx_error (dev, cmd);else kvaser_usb_leaf_usbcan_rx_error (dev, cmd);
@@ -1152,12 +1152,12 @@ static void kvaser_usb_leaf_handle_comma/* Ignored commands */ case CMD_USBCAN_CLOCK_OVERFLOW_EVENT : -if (dev->card_data.leaf.family !=KVASER_USBCAN ) +if (dev->driver_info->family !=KVASER_USBCAN ) goto warn;break ;case CMD_FLUSH_QUEUE_REPLY : -if (dev->card_data.leaf.family !=KVASER_LEAF ) +if (dev->driver_info->family !=KVASER_LEAF ) goto warn;break ;
Greg Kroah-Hartman
maintainerPATCH 22/55 can: kvaser_usb: kvaser_usb_leaf: fix CAN clock frequency regression
In reply to Greg Kroah-HartmanFrom: Jimmy Assarsson <[email protected]>
commit e6c80e601053ffdac5709f11ff3ec1e19ed05f7b upstream.
The firmware of M32C based Leaf devices expects bittiming parameters calculated for 16MHz clock. Since we use the actual clock frequency of the device, the device may end up with wrong bittiming parameters, depending on user requested parameters.
This regression affects M32C based Leaf devices with non-16MHz clock.
--- drivers/net/can/usb/kvaser_usb/kvaser_usb.h | 1 drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c | 29 +++++++++++++++-------- drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c | 25 ++++++++++++------- 3 files changed, 36 insertions(+), 19 deletions(-)
drivers/net/can/usb/kvaser_usb/kvaser_usb.h +1 -0
@@ -38,6 +38,7 @@/* Kvaser USB device quirks */ #define KVASER_USB_QUIRK_HAS_SILENT_MODE BIT(0)#define KVASER_USB_QUIRK_HAS_TXRX_ERRORS BIT(1) +#define KVASER_USB_QUIRK_IGNORE_CLK_FREQ BIT(2)/* Device capabilities */ #define KVASER_USB_CAP_BERR_CAP 0x01
drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c +19 -10
@@ -92,26 +92,33 @@ static const struct kvaser_usb_driver_in };static const struct kvaser_usb_driver_info kvaser_usb_driver_info_leaf = { - .quirks =0 , + .quirks =KVASER_USB_QUIRK_IGNORE_CLK_FREQ , .family =KVASER_LEAF , .ops = &kvaser_usb_leaf_dev_ops, };static const struct kvaser_usb_driver_info kvaser_usb_driver_info_leaf_err = { - .quirks =KVASER_USB_QUIRK_HAS_TXRX_ERRORS , + .quirks =KVASER_USB_QUIRK_HAS_TXRX_ERRORS | +KVASER_USB_QUIRK_IGNORE_CLK_FREQ , .family =KVASER_LEAF , .ops = &kvaser_usb_leaf_dev_ops, };static const struct kvaser_usb_driver_info kvaser_usb_driver_info_leaf_err_listen = { .quirks =KVASER_USB_QUIRK_HAS_TXRX_ERRORS | -KVASER_USB_QUIRK_HAS_SILENT_MODE , +KVASER_USB_QUIRK_HAS_SILENT_MODE | +KVASER_USB_QUIRK_IGNORE_CLK_FREQ , .family =KVASER_LEAF , .ops = &kvaser_usb_leaf_dev_ops, }; +static const struct kvaser_usb_driver_info kvaser_usb_driver_info_leafimx = { + .quirks =0 , + .ops = &kvaser_usb_leaf_dev_ops, +}; +static const struct usb_device_id kvaser_usb_table[] = { -/* Leaf USB product IDs */ +/* Leaf M32C USB product IDs */ {USB_DEVICE (KVASER_VENDOR_ID ,USB_LEAF_DEVEL_PRODUCT_ID ), .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leaf }, {USB_DEVICE (KVASER_VENDOR_ID ,USB_LEAF_LITE_PRODUCT_ID ),
@@ -152,16 +159,18 @@ static const struct usb_device_id kvaser .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err }, { USB_DEVICE(KVASER_VENDOR_ID, USB_CAN_R_PRODUCT_ID), .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err }, + +/* Leaf i.MX28 USB product IDs */ { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LITE_V2_PRODUCT_ID), - .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leaf }, + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leafimx }, { USB_DEVICE(KVASER_VENDOR_ID, USB_MINI_PCIE_HS_PRODUCT_ID), - .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leaf }, + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leafimx }, { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LIGHT_HS_V2_OEM_PRODUCT_ID), - .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leaf }, + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leafimx }, { USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN_LIGHT_2HS_PRODUCT_ID), - .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leaf }, + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leafimx }, { USB_DEVICE(KVASER_VENDOR_ID, USB_MINI_PCIE_2HS_PRODUCT_ID), - .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leaf }, + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leafimx },/* USBCANII USB product IDs */ { USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN2_PRODUCT_ID),
@@ -190,7 +199,7 @@ static const struct usb_device_id kvaser .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_hydra }, { USB_DEVICE(KVASER_VENDOR_ID, USB_MEMO_PRO_2HS_V2_PRODUCT_ID), .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_hydra }, - { USB_DEVICE(KVASER_VENDOR_ID, USB_HYBRID_2CANLIN_PRODUCT_ID), + { USB_DEVICE(KVASER_VENDOR_ID, USB_HYBRID_CANLIN_PRODUCT_ID), .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_hydra }, { USB_DEVICE(KVASER_VENDOR_ID, USB_ATI_USBCAN_PRO_2HS_V2_PRODUCT_ID), .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_hydra },
drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +16 -9
@@ -525,16 +525,23 @@ static void kvaser_usb_leaf_get_software dev->fw_version =le32_to_cpu (softinfo->fw_version); dev->max_tx_urbs =le16_to_cpu (softinfo->max_outstanding_tx); -switch (sw_options &KVASER_USB_LEAF_SWOPTION_FREQ_MASK ) { -case KVASER_USB_LEAF_SWOPTION_FREQ_16_MHZ_CLK : +if (dev->driver_info->quirks &KVASER_USB_QUIRK_IGNORE_CLK_FREQ ) { +/* Firmware expects bittiming parameters calculated for 16MHz +* clock, regardless of the actual clock +*/ dev->cfg = &kvaser_usb_leaf_dev_cfg_16mhz; -break ; -case KVASER_USB_LEAF_SWOPTION_FREQ_24_MHZ_CLK : - dev->cfg = &kvaser_usb_leaf_dev_cfg_24mhz; -break ; -case KVASER_USB_LEAF_SWOPTION_FREQ_32_MHZ_CLK : - dev->cfg = &kvaser_usb_leaf_dev_cfg_32mhz; -break ; + }else { +switch (sw_options &KVASER_USB_LEAF_SWOPTION_FREQ_MASK ) { +case KVASER_USB_LEAF_SWOPTION_FREQ_16_MHZ_CLK : + dev->cfg = &kvaser_usb_leaf_dev_cfg_16mhz; +break ; +case KVASER_USB_LEAF_SWOPTION_FREQ_24_MHZ_CLK : + dev->cfg = &kvaser_usb_leaf_dev_cfg_24mhz; +break ; +case KVASER_USB_LEAF_SWOPTION_FREQ_32_MHZ_CLK : + dev->cfg = &kvaser_usb_leaf_dev_cfg_32mhz; +break ; + } } }
Greg Kroah-Hartman
maintainerPATCH 23/55 can: kvaser_usb: kvaser_usb_leaf: fix bittiming limits
In reply to Greg Kroah-HartmanFrom: Jimmy Assarsson <[email protected]>
commit b3b6df2c56d80b8c6740433cff5f016668b8de70 upstream.
Use correct bittiming limits depending on device. For devices based on USBcanII, Leaf M32C or Leaf i.MX28.
--- drivers/net/can/usb/kvaser_usb/kvaser_usb.h | 2 drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c | 4 - drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c | 76 ++++++++++++---------- 3 files changed, 47 insertions(+), 35 deletions(-)
drivers/net/can/usb/kvaser_usb/kvaser_usb.h +2 -0
@@ -188,4 +188,6 @@ int kvaser_usb_send_cmd_async(struct kvaint kvaser_usb_can_rx_over_error (struct net_device *netdev); +extern const struct can_bittiming_const kvaser_usb_flexc_bittiming_const; +#endif /* KVASER_USB_H */
drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c +2 -2
@@ -371,7 +371,7 @@ static const struct can_bittiming_const .brp_inc = 1, }; -static const struct can_bittiming_const kvaser_usb_hydra_flexc_bittiming_c = { +const struct can_bittiming_const kvaser_usb_flexc_bittiming_const = { .name ="kvaser_usb_flex" , .tseg1_min =4 , .tseg1_max =16 ,
@@ -2024,5 +2024,5 @@ static const struct kvaser_usb_dev_cfg k .freq = 24000000, }, .timestamp_freq = 1, - .bittiming_const = &kvaser_usb_hydra_flexc_bittiming_c, + .bittiming_const = &kvaser_usb_flexc_bittiming_const, };
drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +43 -33
131 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 24/55 xfs: remove incorrect ASSERT in xfs_rename
In reply to Greg Kroah-HartmanFrom: Eric Sandeen <[email protected]>
commit e445976537ad139162980bee015b7364e5b64fff upstream.
This ASSERT in xfs_rename is a) incorrect, because (RENAME_WHITEOUT|RENAME_NOREPLACE) is a valid combination, and
b) unnecessary, because actual invalid flag combinations are already handled at the vfs level in do_renameat2() before we get called. So, remove it.
--- fs/xfs/xfs_inode.c | 1 - 1 file changed, 1 deletion(-)
fs/xfs/xfs_inode.c +0 -1
@@ -3170,7 +3170,6 @@ xfs_rename(* appropriately. */ if (flags &RENAME_WHITEOUT ) { -ASSERT (!(flags & (RENAME_NOREPLACE |RENAME_EXCHANGE ))); error =xfs_rename_alloc_whiteout (target_dp, &wip);if (error)return error;
Greg Kroah-Hartman
maintainerPATCH 25/55 ARM: meson: Fix refcount leak in meson_smp_prepare_cpus
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 34d2cd3fccced12b958b8848e3eff0ee4296764c ]
of_find_compatible_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when done. Add missing of_node_put() to avoid refcount leak.
--- arch/arm/mach-meson/platsmp.c | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/mach-meson/platsmp.c +2 -0
@@ -71,6 +71,7 @@ static void __init meson_smp_prepare_cpus(const char *scu_compatible, } sram_base =of_iomap (node,0 ); +of_node_put (node);if (!sram_base) {pr_err ("Couldn't map SRAM registers\n" );return ;
@@ -91,6 +92,7 @@ static void __init meson_smp_prepare_cpus(const char *scu_compatible, } scu_base =of_iomap (node,0 ); +of_node_put (node);if (!scu_base) {pr_err ("Couldn't map SCU registers\n" );return ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 26/55 pinctrl: sunxi: a83t: Fix NAND function name for some pins
In reply to Greg Kroah-HartmanFrom: Samuel Holland <[email protected]>
[ Upstream commit aaefa29270d9551b604165a08406543efa9d16f5 ]
The other NAND pins on Port C use the "nand0" function name. "nand0" also matches all of the other Allwinner SoCs.
--- drivers/pinctrl/sunxi/pinctrl-sun8i-a83t.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/pinctrl/sunxi/pinctrl-sun8i-a83t.c +5 -5
@@ -158,26 +158,26 @@ static const struct sunxi_desc_pin sun8i_a83t_pins[] = {SUNXI_PIN (SUNXI_PINCTRL_PIN (C ,14 ),SUNXI_FUNCTION (0x0 ,"gpio_in" ),SUNXI_FUNCTION (0x1 ,"gpio_out" ), -SUNXI_FUNCTION (0x2 ,"nand" ),/* DQ6 */ +SUNXI_FUNCTION (0x2 ,"nand0" ),/* DQ6 */ SUNXI_FUNCTION (0x3 ,"mmc2" )),/* D6 */ SUNXI_PIN (SUNXI_PINCTRL_PIN (C ,15 ),SUNXI_FUNCTION (0x0 ,"gpio_in" ),SUNXI_FUNCTION (0x1 ,"gpio_out" ), -SUNXI_FUNCTION (0x2 ,"nand" ),/* DQ7 */ +SUNXI_FUNCTION (0x2 ,"nand0" ),/* DQ7 */ SUNXI_FUNCTION (0x3 ,"mmc2" )),/* D7 */ SUNXI_PIN (SUNXI_PINCTRL_PIN (C ,16 ),SUNXI_FUNCTION (0x0 ,"gpio_in" ),SUNXI_FUNCTION (0x1 ,"gpio_out" ), -SUNXI_FUNCTION (0x2 ,"nand" ),/* DQS */ +SUNXI_FUNCTION (0x2 ,"nand0" ),/* DQS */ SUNXI_FUNCTION (0x3 ,"mmc2" )),/* RST */ SUNXI_PIN (SUNXI_PINCTRL_PIN (C ,17 ),SUNXI_FUNCTION (0x0 ,"gpio_in" ),SUNXI_FUNCTION (0x1 ,"gpio_out" ), -SUNXI_FUNCTION (0x2 ,"nand" )),/* CE2 */ +SUNXI_FUNCTION (0x2 ,"nand0" )),/* CE2 */ SUNXI_PIN (SUNXI_PINCTRL_PIN (C ,18 ),SUNXI_FUNCTION (0x0 ,"gpio_in" ),SUNXI_FUNCTION (0x1 ,"gpio_out" ), -SUNXI_FUNCTION (0x2 ,"nand" )),/* CE3 */ +SUNXI_FUNCTION (0x2 ,"nand0" )),/* CE3 */ /* Hole */ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 2), SUNXI_FUNCTION(0x0, "gpio_in"),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 27/55 arm64: dts: qcom: msm8994: Fix CPU6/7 reg values
In reply to Greg Kroah-HartmanFrom: Konrad Dybcio <[email protected]>
[ Upstream commit 47bf59c4755930f616dd90c8c6a85f40a6d347ea ]
CPU6 and CPU7 were mistakengly pointing to CPU5 reg. Fix it.
--- arch/arm64/boot/dts/qcom/msm8994.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/msm8994.dtsi +2 -2
@@ -92,7 +92,7 @@ CPU6: cpu@102 { device_type = "cpu"; compatible = "arm,cortex-a57"; - reg = <0x0 0x101>; + reg = <0x0 0x102>; enable-method = "psci"; next-level-cache = <&L2_1>; };
@@ -100,7 +100,7 @@ CPU7: cpu@103 { device_type = "cpu"; compatible = "arm,cortex-a57"; - reg = <0x0 0x101>; + reg = <0x0 0x103>; enable-method = "psci"; next-level-cache = <&L2_1>; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 28/55 arm64: dts: imx8mp-evk: correct mmc pad settings
In reply to Greg Kroah-HartmanFrom: Peng Fan <[email protected]>
[ Upstream commit 01785f1f156511c4f285786b4192245d4f476bf1 ]
According to RM bit layout, BIT3 and BIT0 are reserved.
8 7 6 5 4 3 2 1 0 PE HYS PUE ODE FSEL X DSE X
Not set reserved bit.
--- arch/arm64/boot/dts/freescale/imx8mp-evk.dts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/freescale/imx8mp-evk.dts +4 -4
@@ -161,7 +161,7 @@ pinctrl_reg_usdhc2_vmmc: regusdhc2vmmcgrp { fsl,pins = < - MX8MP_IOMUXC_SD2_RESET_B__GPIO2_IO19 0x41 + MX8MP_IOMUXC_SD2_RESET_B__GPIO2_IO19 0x40 >; };
@@ -180,7 +180,7 @@ MX8MP_IOMUXC_SD2_DATA1__USDHC2_DATA1 0x1d0 MX8MP_IOMUXC_SD2_DATA2__USDHC2_DATA2 0x1d0 MX8MP_IOMUXC_SD2_DATA3__USDHC2_DATA3 0x1d0 - MX8MP_IOMUXC_GPIO1_IO04__USDHC2_VSELECT 0xc1 + MX8MP_IOMUXC_GPIO1_IO04__USDHC2_VSELECT 0xc0 >; };
@@ -192,7 +192,7 @@ MX8MP_IOMUXC_SD2_DATA1__USDHC2_DATA1 0x1d4 MX8MP_IOMUXC_SD2_DATA2__USDHC2_DATA2 0x1d4 MX8MP_IOMUXC_SD2_DATA3__USDHC2_DATA3 0x1d4 - MX8MP_IOMUXC_GPIO1_IO04__USDHC2_VSELECT 0xc1 + MX8MP_IOMUXC_GPIO1_IO04__USDHC2_VSELECT 0xc0 >; };
@@ -204,7 +204,7 @@ MX8MP_IOMUXC_SD2_DATA1__USDHC2_DATA1 0x1d6 MX8MP_IOMUXC_SD2_DATA2__USDHC2_DATA2 0x1d6 MX8MP_IOMUXC_SD2_DATA3__USDHC2_DATA3 0x1d6 - MX8MP_IOMUXC_GPIO1_IO04__USDHC2_VSELECT 0xc1 + MX8MP_IOMUXC_GPIO1_IO04__USDHC2_VSELECT 0xc0 >; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 29/55 arm64: dts: imx8mp-evk: correct the uart2 pinctl value
In reply to Greg Kroah-HartmanFrom: Sherry Sun <[email protected]>
[ Upstream commit 2d4fb72b681205eed4553d8802632bd3270be3ba ]
According to the IOMUXC_SW_PAD_CTL_PAD_UART2_RXD/TXD register define in imx8mp RM, bit0 and bit3 are reserved, and the uart2 rx/tx pin should enable the pull up, so need to set bit8 to 1. The original pinctl value 0x49 is incorrect and needs to be changed to 0x140, same as uart1 and uart3.
--- arch/arm64/boot/dts/freescale/imx8mp-evk.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/freescale/imx8mp-evk.dts +2 -2
@@ -167,8 +167,8 @@ pinctrl_uart2: uart2grp { fsl,pins = < - MX8MP_IOMUXC_UART2_RXD__UART2_DCE_RX 0x49 - MX8MP_IOMUXC_UART2_TXD__UART2_DCE_TX 0x49 + MX8MP_IOMUXC_UART2_RXD__UART2_DCE_RX 0x140 + MX8MP_IOMUXC_UART2_TXD__UART2_DCE_TX 0x140 >; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 30/55 arm64: dts: imx8mp-evk: correct gpio-led pad settings
In reply to Greg Kroah-HartmanFrom: Peng Fan <[email protected]>
[ Upstream commit b838582ab8d5fb11b2c0275056a9f34e1d94fece ]
0x19 is not a valid setting. According to RM bit layout, BIT3 and BIT0 are reserved.
8 7 6 5 4 3 2 1 0 PE HYS PUE ODE FSEL X DSE X
Correct setting with PE PUE set, DSE set to 0.
--- arch/arm64/boot/dts/freescale/imx8mp-evk.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8mp-evk.dts +1 -1
@@ -148,7 +148,7 @@ pinctrl_gpio_led: gpioledgrp { fsl,pins = < - MX8MP_IOMUXC_NAND_READY_B__GPIO3_IO16 0x19 + MX8MP_IOMUXC_NAND_READY_B__GPIO3_IO16 0x140 >; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 31/55 arm64: dts: imx8mp-evk: correct I2C3 pad settings
In reply to Greg Kroah-HartmanFrom: Peng Fan <[email protected]>
[ Upstream commit 0836de513ebaae5f03014641eac996290d67493d ]
According to RM bit layout, BIT3 and BIT0 are reserved.
8 7 6 5 4 3 2 1 0 PE HYS PUE ODE FSEL X DSE X
Although function is not broken, we should not set reserved bit.
--- arch/arm64/boot/dts/freescale/imx8mp-evk.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/freescale/imx8mp-evk.dts +2 -2
@@ -154,8 +154,8 @@ pinctrl_i2c3: i2c3grp { fsl,pins = < - MX8MP_IOMUXC_I2C3_SCL__I2C3_SCL 0x400001c3 - MX8MP_IOMUXC_I2C3_SDA__I2C3_SDA 0x400001c3 + MX8MP_IOMUXC_I2C3_SCL__I2C3_SCL 0x400001c2 + MX8MP_IOMUXC_I2C3_SDA__I2C3_SDA 0x400001c2 >; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 32/55 pinctrl: sunxi: sunxi_pconf_set: use correct offset
In reply to Greg Kroah-HartmanFrom: Andrei Lalaev <[email protected]>
[ Upstream commit cd4c1e65a32afd003b08ad4aafe1e4d3e4e8e61b ]
Some Allwinner SoCs have 2 pinctrls (PIO and R_PIO). Previous implementation used absolute pin numbering and it was incorrect for R_PIO pinctrl.
It's necessary to take into account the base pin number.
--- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pinctrl/sunxi/pinctrl-sunxi.c +2 -0
@@ -544,6 +544,8 @@ static int sunxi_pconf_set(struct pinctrl_dev *pctldev, unsigned pin,struct sunxi_pinctrl *pctl =pinctrl_dev_get_drvdata (pctldev);int i; + pin -= pctl->desc->pin_base; +for (i =0 ; i < num_configs; i++) {enum pin_config_param param;unsigned long flags;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 33/55 arm64: dts: qcom: msm8992-*: Fix vdd_lvs1_2-supply typo
In reply to Greg Kroah-HartmanFrom: Stephan Gerhold <[email protected]>
[ Upstream commit 5fb779558f1c97e2bf2794cb59553e569c38e2f9 ]
"make dtbs_check" complains about the missing "-supply" suffix for vdd_lvs1_2 which is clearly a typo, originally introduced in the msm8994-smd-rpm.dtsi file and apparently later copied to msm8992-xiaomi-libra.dts:
msm8992-lg-bullhead-rev-10/101.dtb: pm8994-regulators: 'vdd_lvs1_2' does not match any of the regexes:
'.*-supply$', '^((s|l|lvs|5vs)[0-9]*)|(boost-bypass)|(bob)$', 'pinctrl-[0-9]+'
Quoted 1 line
From schema:
regulator/qcom,smd-rpm-regulator.yaml
msm8992-xiaomi-libra.dtb: pm8994-regulators: 'vdd_lvs1_2'
does not match any of the regexes:
'.*-supply$', '^((s|l|lvs|5vs)[0-9]*)|(boost-bypass)|(bob)$', 'pinctrl-[0-9]+'
Quoted 1 line
From schema:
regulator/qcom,smd-rpm-regulator.yaml
--- arch/arm64/boot/dts/qcom/msm8992-bullhead-rev-101.dts | 2 +- arch/arm64/boot/dts/qcom/msm8992-xiaomi-libra.dts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/msm8992-bullhead-rev-101.dts +1 -1
@@ -64,7 +64,7 @@ vdd_l17_29-supply = <&vreg_vph_pwr>; vdd_l20_21-supply = <&vreg_vph_pwr>; vdd_l25-supply = <&pm8994_s5>; - vdd_lvs1_2 = <&pm8994_s4>; + vdd_lvs1_2-supply = <&pm8994_s4>; pm8994_s1: s1 { regulator-min-microvolt = <800000>;
arch/arm64/boot/dts/qcom/msm8992-xiaomi-libra.dts +1 -1
@@ -151,7 +151,7 @@ vdd_l17_29-supply = <&vreg_vph_pwr>; vdd_l20_21-supply = <&vreg_vph_pwr>; vdd_l25-supply = <&pm8994_s5>; - vdd_lvs1_2 = <&pm8994_s4>; + vdd_lvs1_2-supply = <&pm8994_s4>; pm8994_s1: s1 { /* unused */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 34/55 ARM: at91: pm: use proper compatible for sama5d2s rtc
In reply to Greg Kroah-HartmanFrom: Claudiu Beznea <[email protected]>
[ Upstream commit ddc980da8043779119acaca106c6d9b445c9b65b ]
Use proper compatible strings for SAMA5D2's RTC IPs. This is necessary for configuring wakeup sources for ULP1 PM mode.
--- arch/arm/mach-at91/pm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-at91/pm.c +1 -1
@@ -104,7 +104,7 @@ static const struct wakeup_source_info ws_info[] = {static const struct of_device_id sama5d2_ws_ids[] = { { .compatible ="atmel,sama5d2-gem" , .data = &ws_info[0 ] }, - { .compatible ="atmel,at91rm9200-rtc" , .data = &ws_info[1 ] }, + { .compatible ="atmel,sama5d2-rtc" , .data = &ws_info[1 ] }, { .compatible ="atmel,sama5d3-udc" , .data = &ws_info[2 ] }, { .compatible ="atmel,at91rm9200-ohci" , .data = &ws_info[2 ] }, { .compatible ="usb-ohci" , .data = &ws_info[2 ] },
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 35/55 ARM: at91: pm: use proper compatibles for sam9x60s rtc and rtt
In reply to Greg Kroah-HartmanFrom: Claudiu Beznea <[email protected]>
[ Upstream commit 641522665dbb25ce117c78746df1aad8b58c80e5 ]
Use proper compatible strings for SAM9X60's RTC and RTT IPs. These are necessary for configuring wakeup sources for ULP1 PM mode.
--- arch/arm/mach-at91/pm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-at91/pm.c +2 -2
@@ -115,12 +115,12 @@ static const struct of_device_id sama5d2_ws_ids[] = { };static const struct of_device_id sam9x60_ws_ids[] = { - { .compatible ="atmel,at91sam9x5-rtc" , .data = &ws_info[1 ] }, + { .compatible ="microchip,sam9x60-rtc" , .data = &ws_info[1 ] }, { .compatible ="atmel,at91rm9200-ohci" , .data = &ws_info[2 ] }, { .compatible ="usb-ohci" , .data = &ws_info[2 ] }, { .compatible ="atmel,at91sam9g45-ehci" , .data = &ws_info[2 ] }, { .compatible ="usb-ehci" , .data = &ws_info[2 ] }, - { .compatible ="atmel,at91sam9260-rtt" , .data = &ws_info[4 ] }, + { .compatible ="microchip,sam9x60-rtt" , .data = &ws_info[4 ] }, { .compatible ="cdns,sam9x60-macb" , .data = &ws_info[5 ] }, {/* sentinel */ } };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 36/55 ARM: dts: at91: sam9x60ek: fix eeprom compatible and size
In reply to Greg Kroah-HartmanFrom: Eugen Hristev <[email protected]>
[ Upstream commit f2cbbc3f926316ccf8ef9363d8a60c1110afc1c7 ]
The board has a microchip 24aa025e48 eeprom, which is a 2 Kbits memory, so it's compatible with at24c02 not at24c32.
Also the size property is wrong, it's not 128 bytes, but 256 bytes. Thus removing and leaving it to the default (256).
--- arch/arm/boot/dts/at91-sam9x60ek.dts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arm/boot/dts/at91-sam9x60ek.dts +1 -2
@@ -233,10 +233,9 @@ status = "okay"; eeprom@53 { - compatible = "atmel,24c32"; + compatible = "atmel,24c02"; reg = <0x53>; pagesize = <16>; - size = <128>; status = "okay"; }; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 37/55 ARM: dts: at91: sama5d2_icp: fix eeprom compatibles
In reply to Greg Kroah-HartmanFrom: Eugen Hristev <[email protected]>
[ Upstream commit 416ce193d73a734ded6d09fe141017b38af1c567 ]
The eeprom memories on the board are microchip 24aa025e48, which are 2 Kbits and are compatible with at24c02 not at24c32.
--- arch/arm/boot/dts/at91-sama5d2_icp.dts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/at91-sama5d2_icp.dts +3 -3
@@ -317,21 +317,21 @@ status = "okay"; eeprom@50 { - compatible = "atmel,24c32"; + compatible = "atmel,24c02"; reg = <0x50>; pagesize = <16>; status = "okay"; }; eeprom@52 { - compatible = "atmel,24c32"; + compatible = "atmel,24c02"; reg = <0x52>; pagesize = <16>; status = "disabled"; }; eeprom@53 { - compatible = "atmel,24c32"; + compatible = "atmel,24c02"; reg = <0x53>; pagesize = <16>; status = "disabled";
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 38/55 xsk: Clear page contiguity bit when unmapping pool
In reply to Greg Kroah-HartmanFrom: Ivan Malov <[email protected]>
[ Upstream commit 512d1999b8e94a5d43fba3afc73e774849674742 ]
When a XSK pool gets mapped, xp_check_dma_contiguity() adds bit 0x1 to pages' DMA addresses that go in ascending order and at 4K stride.
The problem is that the bit does not get cleared before doing unmap. As a result, a lot of warnings from iommu_dma_unmap_page() are seen in dmesg, which indicates that lookups by iommu_iova_to_phys() fail.
--- net/xdp/xsk_buff_pool.c | 1 + 1 file changed, 1 insertion(+)
net/xdp/xsk_buff_pool.c +1 -0
@@ -318,6 +318,7 @@ static void __xp_dma_unmap(struct xsk_dma_map *dma_map, unsigned long attrs)for (i =0 ; i < dma_map->dma_pages_cnt; i++) { dma = &dma_map->dma_pages[i];if (*dma) { + *dma &= ~XSK_NEXT_PG_CONTIG_MASK ;dma_unmap_page_attrs (dma_map->dev, *dma,PAGE_SIZE ,DMA_BIDIRECTIONAL , attrs); *dma =0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 39/55 i40e: Fix dropped jumbo frames statistics
In reply to Greg Kroah-HartmanFrom: Lukasz Cieplicki <[email protected]>
[ Upstream commit 1adb1563e7b7ec659379a18e607e8bc3522d8a78 ]
Dropped packets caused by too large frames were not included in dropped RX packets statistics.
Issue was caused by not reading the GL_RXERR1 register. That register stores count of packet which was have been dropped due to too large size.
Fix it by reading GL_RXERR1 register for each interface.
Repro steps:
Send a packet larger than the set MTU to SUT
Observe rx statists: ethtool -S <interface> | grep rx | grep -v ": 0"
--- drivers/net/ethernet/intel/i40e/i40e.h | 16 ++++ drivers/net/ethernet/intel/i40e/i40e_main.c | 73 +++++++++++++++++++ .../net/ethernet/intel/i40e/i40e_register.h | 13 ++++ drivers/net/ethernet/intel/i40e/i40e_type.h | 1 + 4 files changed, 103 insertions(+)
drivers/net/ethernet/intel/i40e/i40e.h +16 -0
@@ -37,6 +37,7 @@#include <net/tc_act/tc_mirred.h> #include <net/udp_tunnel.h> #include <net/xdp_sock.h> +#include <linux/bitfield.h> #include "i40e_type.h" #include "i40e_prototype.h" #include <linux/net/intel/i40e_client.h>
@@ -991,6 +992,21 @@ static inline void i40e_write_fd_input_set(struct i40e_pf *pf, (u32)(val & 0xFFFFFFFFULL)); } +/** +* i40e_get_pf_count - get PCI PF count. +* @hw: pointer to a hw. +* +* Reports the function number of the highest PCI physical +* function plus 1 as it is loaded from the NVM. +* +* Return: PCI PF count. +**/ +static inline u32 i40e_get_pf_count (struct i40e_hw *hw) +{ +return FIELD_GET (I40E_GLGEN_PCIFCNCNT_PCIPFCNT_MASK , +rd32 (hw,I40E_GLGEN_PCIFCNCNT )); +} +/* needed by i40e_ethtool.c */ int i40e_up (struct i40e_vsi *vsi);void i40e_down (struct i40e_vsi *vsi);
drivers/net/ethernet/intel/i40e/i40e_main.c +73 -0
91 lines not on this page · raw message
drivers/net/ethernet/intel/i40e/i40e_register.h +13 -0
@@ -77,6 +77,11 @@#define I40E_GLGEN_MSRWD_MDIWRDATA_SHIFT 0#define I40E_GLGEN_MSRWD_MDIRDDATA_SHIFT 16#define I40E_GLGEN_MSRWD_MDIRDDATA_MASK I40E_MASK(0xFFFF, I40E_GLGEN_MSRWD_MDIRDDATA_SHIFT) +#define I40E_GLGEN_PCIFCNCNT 0x001C0AB4/* Reset: PCIR */ +#define I40E_GLGEN_PCIFCNCNT_PCIPFCNT_SHIFT 0 +#define I40E_GLGEN_PCIFCNCNT_PCIPFCNT_MASK I40E_MASK(0x1F, I40E_GLGEN_PCIFCNCNT_PCIPFCNT_SHIFT) +#define I40E_GLGEN_PCIFCNCNT_PCIVFCNT_SHIFT 16 +#define I40E_GLGEN_PCIFCNCNT_PCIVFCNT_MASK I40E_MASK(0xFF, I40E_GLGEN_PCIFCNCNT_PCIVFCNT_SHIFT)#define I40E_GLGEN_RSTAT 0x000B8188/* Reset: POR */ #define I40E_GLGEN_RSTAT_DEVSTATE_SHIFT 0#define I40E_GLGEN_RSTAT_DEVSTATE_MASK I40E_MASK(0x3, I40E_GLGEN_RSTAT_DEVSTATE_SHIFT)
@@ -461,6 +466,14 @@#define I40E_VFQF_HKEY1_MAX_INDEX 12#define I40E_VFQF_HLUT1 (_i, _VF) (0x00220000 + ((_i) * 1024 + (_VF) * 4))/* _i=0...15, _VF=0...127 */ /* Reset: CORER */ #define I40E_VFQF_HLUT1_MAX_INDEX 15 +#define I40E_GL_RXERR1H (_i) (0x00318004 + ((_i) * 8))/* _i=0...143 */ /* Reset: CORER */ +#define I40E_GL_RXERR1H_MAX_INDEX 143 +#define I40E_GL_RXERR1H_RXERR1H_SHIFT 0 +#define I40E_GL_RXERR1H_RXERR1H_MASK I40E_MASK(0xFFFFFFFF, I40E_GL_RXERR1H_RXERR1H_SHIFT) +#define I40E_GL_RXERR1L (_i) (0x00318000 + ((_i) * 8))/* _i=0...143 */ /* Reset: CORER */ +#define I40E_GL_RXERR1L_MAX_INDEX 143 +#define I40E_GL_RXERR1L_RXERR1L_SHIFT 0 +#define I40E_GL_RXERR1L_RXERR1L_MASK I40E_MASK(0xFFFFFFFF, I40E_GL_RXERR1L_RXERR1L_SHIFT)#define I40E_GLPRT_BPRCH (_i) (0x003005E4 + ((_i) * 8))/* _i=0...3 */ /* Reset: CORER */ #define I40E_GLPRT_BPRCL (_i) (0x003005E0 + ((_i) * 8))/* _i=0...3 */ /* Reset: CORER */ #define I40E_GLPRT_BPTCH (_i) (0x00300A04 + ((_i) * 8))/* _i=0...3 */ /* Reset: CORER */
drivers/net/ethernet/intel/i40e/i40e_type.h +1 -0
@@ -1172,6 +1172,7 @@ struct i40e_eth_stats {u64 tx_broadcast;/* bptc */ u64 tx_discards;/* tdpc */ u64 tx_errors;/* tepc */ +u64 rx_discards_other;/* rxerr1 */ };/* Statistics collected per VEB per TC */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 40/55 ibmvnic: Properly dispose of all skbs during a failover.
In reply to Greg Kroah-HartmanFrom: Rick Lindsley <[email protected]>
[ Upstream commit 1b18f09d31cfa7148df15a7d5c5e0e86f105f7d1 ]
During a reset, there may have been transmits in flight that are no longer valid and cannot be fulfilled. Resetting and clearing the queues is insufficient; each skb also needs to be explicitly freed so that upper levels are not left waiting for confirmation of a transmit that will never happen. If this happens frequently enough, the apparent backlog will cause TCP to begin "congestion control" unnecessarily, culminating in permanently decreased throughput.
--- drivers/net/ethernet/ibm/ibmvnic.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/net/ethernet/ibm/ibmvnic.c +9 -0
@@ -5228,6 +5228,15 @@ static int ibmvnic_reset_init(struct ibmvnic_adapter *adapter, bool reset)release_sub_crqs (adapter,0 ); rc =init_sub_crqs (adapter); }else { +/* no need to reinitialize completely, but we do +* need to clean up transmits that were in flight +* when we processed the reset. Failure to do so +* will confound the upper layer, usually TCP, by +* creating the illusion of transmits that are +* awaiting completion. +*/ +clean_tx_pools (adapter); + rc =reset_sub_crq_queues (adapter); } }else {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 41/55 selftests: forwarding: fix flood_unicast_test when h2 supports IFF_UNICAST_FLT
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit b8e629b05f5d23f9649c901bef09fab8b0c2e4b9 ]
As mentioned in the blamed commit, flood_unicast_test() works by checking the match count on a tc filter placed on the receiving interface.
But the second host interface (host2_if) has no interest in receiving a packet with MAC DA de:ad:be:ef:13:37, so its RX filter drops it even before the ingress tc filter gets to be executed. So we will incorrectly get the message "Packet was not flooded when should", when in fact, the packet was flooded as expected but dropped due to an unrelated reason, at some other layer on the receiving side.
Force h2 to accept this packet by temporarily placing it in promiscuous mode. Alternatively we could either deliver to its MAC address or use tcpdump_start, but this has the fewest complications.
This fixes the "flooding" test from bridge_vlan_aware.sh and bridge_vlan_unaware.sh, which calls flood_test from the lib.
--- tools/testing/selftests/net/forwarding/lib.sh | 2 ++ 1 file changed, 2 insertions(+)
tools/testing/selftests/net/forwarding/lib.sh +2 -0
@@ -1129,6 +1129,7 @@ flood_test_do() # Add an ACL on `host2_if` which will tell us whether the packet # was flooded to it or not. + ip link set $host2_if promisc on tc qdisc add dev $host2_if ingress tc filter add dev $host2_if ingress protocol ip pref 1 handle 101 \ flower dst_mac $mac action drop
@@ -1146,6 +1147,7 @@ flood_test_do() tc filter del dev $host2_if ingress protocol ip pref 1 handle 101 flower tc qdisc del dev $host2_if ingress + ip link set $host2_if promisc off return $err }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 42/55 selftests: forwarding: fix learning_test when h1 supports IFF_UNICAST_FLT
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit 1a635d3e1c80626237fdae47a5545b6655d8d81c ]
The first host interface has by default no interest in receiving packets MAC DA de:ad:be:ef:13:37, so it might drop them before they hit the tc filter and this might confuse the selftest.
Enable promiscuous mode such that the filter properly counts received packets.
--- tools/testing/selftests/net/forwarding/lib.sh | 2 ++ 1 file changed, 2 insertions(+)
tools/testing/selftests/net/forwarding/lib.sh +2 -0
@@ -1063,6 +1063,7 @@ learning_test() # FDB entry was installed. bridge link set dev $br_port1 flood off + ip link set $host1_if promisc on tc qdisc add dev $host1_if ingress tc filter add dev $host1_if ingress protocol ip pref 1 handle 101 \ flower dst_mac $mac action drop
@@ -1112,6 +1113,7 @@ learning_test() tc filter del dev $host1_if ingress protocol ip pref 1 handle 101 flower tc qdisc del dev $host1_if ingress + ip link set $host1_if promisc off bridge link set dev $br_port1 flood on
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 43/55 selftests: forwarding: fix error message in learning_test
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit 83844aacab2015da1dba1df0cc61fc4b4c4e8076 ]
When packets are not received, they aren't received on $host1_if, so the message talking about the second host not receiving them is incorrect. Fix it.
--- tools/testing/selftests/net/forwarding/lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/forwarding/lib.sh +1 -1
@@ -1074,7 +1074,7 @@ learning_test() tc -j -s filter show dev $host1_if ingress \ | jq -e ".[] | select(.options.handle == 101) \ | select(.options.actions[0].stats.packets == 1)" &> /dev/null - check_fail $? "Packet reached second host when should not" + check_fail $? "Packet reached first host when should not" $MZ $host1_if -c 1 -p 64 -a $mac -t ip -q sleep 1
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 44/55 r8169: fix accessing unset transport header
In reply to Greg Kroah-HartmanFrom: Heiner Kallweit <[email protected]>
[ Upstream commit faa4e04e5e140a6d02260289a8fba8fd8d7a3003 ]
66e4c8d95008 ("net: warn if transport header was not set") added a check that triggers a warning in r8169, see [0].
The commit referenced in the Fixes tag refers to the change from which the patch applies cleanly, there's nothing wrong with this commit. It seems the actual issue (not bug, because the warning is harmless here) was introduced with bdfa4ed68187 ("r8169: use Giant Send").
[0] https://bugzilla.kernel.org/show_bug.cgi?id=216157
--- drivers/net/ethernet/realtek/r8169_main.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/net/ethernet/realtek/r8169_main.c +4 -6
@@ -4183,7 +4183,6 @@ static void rtl8169_tso_csum_v1(struct sk_buff *skb, u32 *opts)static bool rtl8169_tso_csum_v2 (struct rtl8169_private *tp,struct sk_buff *skb,u32 *opts) { -u32 transport_offset = (u32 )skb_transport_offset (skb);struct skb_shared_info *shinfo =skb_shinfo (skb);u32 mss = shinfo->gso_size;
@@ -4200,7 +4199,7 @@ static bool rtl8169_tso_csum_v2(struct rtl8169_private *tp,WARN_ON_ONCE (1 ); } - opts[0 ] |= transport_offset <<GTTCPHO_SHIFT ; + opts[0 ] |=skb_transport_offset (skb) <<GTTCPHO_SHIFT ; opts[1 ] |= mss <<TD1_MSS_SHIFT ; }else if (skb->ip_summed ==CHECKSUM_PARTIAL ) {u8 ip_protocol;
@@ -4228,7 +4227,7 @@ static bool rtl8169_tso_csum_v2(struct rtl8169_private *tp,else WARN_ON_ONCE (1 ); - opts[1 ] |= transport_offset <<TCPHO_SHIFT ; + opts[1 ] |=skb_transport_offset (skb) <<TCPHO_SHIFT ; }else {unsigned int padto =rtl_quirk_packet_padto (tp, skb);
@@ -4401,14 +4400,13 @@ static netdev_features_t rtl8169_features_check(struct sk_buff *skb, struct net_device *dev, netdev_features_t features) { - int transport_offset = skb_transport_offset(skb);struct rtl8169_private *tp =netdev_priv (dev);if (skb_is_gso (skb)) {if (tp->mac_version ==RTL_GIGA_MAC_VER_34 ) features =rtl8168evl_fix_tso (skb, features); -if (transport_offset >GTTCPHO_MAX && +if (skb_transport_offset (skb) >GTTCPHO_MAX &&rtl_chip_supports_csum_v2 (tp)) features &= ~NETIF_F_ALL_TSO ; }else if (skb->ip_summed ==CHECKSUM_PARTIAL ) {
@@ -4419,7 +4417,7 @@ static netdev_features_t rtl8169_features_check(struct sk_buff *skb,if (rtl_quirk_packet_padto (tp, skb)) features &= ~NETIF_F_CSUM_MASK ; -if (transport_offset >TCPHO_MAX && +if (skb_transport_offset (skb) >TCPHO_MAX &&rtl_chip_supports_csum_v2 (tp)) features &= ~NETIF_F_CSUM_MASK ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 45/55 i2c: cadence: Unregister the clk notifier in error path
In reply to Greg Kroah-HartmanFrom: Satish Nagireddy <[email protected]>
[ Upstream commit 3501f0c663063513ad604fb1b3f06af637d3396d ]
This patch ensures that the clock notifier is unregistered when driver probe is returning error.
--- drivers/i2c/busses/i2c-cadence.c | 1 + 1 file changed, 1 insertion(+)
drivers/i2c/busses/i2c-cadence.c +1 -0
@@ -1289,6 +1289,7 @@ static int cdns_i2c_probe(struct platform_device *pdev)return 0 ; err_clk_dis: +clk_notifier_unregister (id->clk, &id->clk_rate_change_nb);clk_disable_unprepare (id->clk);pm_runtime_disable (&pdev->dev);pm_runtime_set_suspended (&pdev->dev);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 46/55 dmaengine: imx-sdma: Allow imx8m for imx7 FW revs
In reply to Greg Kroah-HartmanFrom: Peter Robinson <[email protected]>
commit a7cd3cf0b2e5aaacfe5e02c472bd28e98e640be7 upstream.
The revision of the imx-sdma IP that is in the i.MX8M series is the same is that as that in the i.MX7 series but the imx7d MODULE_FIRMWARE directive is wrapped in a condiditional which means it's not defined when built for aarch64 SOC_IMX8M platforms and hence you get the following errors when the driver loads on imx8m devices:
imx-sdma 302c0000.dma-controller: Direct firmware load for imx/sdma/sdma-imx7d.bin failed with error -2 imx-sdma 302c0000.dma-controller: external firmware not found, using ROM firmware
Add the SOC_IMX8M into the check so the firmware can load on i.MX8.
--- drivers/dma/imx-sdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/imx-sdma.c +1 -1
@@ -2212,7 +2212,7 @@ MODULE_DESCRIPTION("i.MX SDMA driver");#if IS_ENABLED (CONFIG_SOC_IMX6Q )MODULE_FIRMWARE ("imx/sdma/sdma-imx6q.bin" );#endif -#if IS_ENABLED (CONFIG_SOC_IMX7D ) +#if IS_ENABLED (CONFIG_SOC_IMX7D ) ||IS_ENABLED (CONFIG_SOC_IMX8M )MODULE_FIRMWARE ("imx/sdma/sdma-imx7d.bin" );#endif MODULE_LICENSE ("GPL" );
Greg Kroah-Hartman
maintainerPATCH 47/55 misc: rtsx_usb: fix use of dma mapped buffer for usb bulk transfer
In reply to Greg Kroah-HartmanFrom: Shuah Khan <[email protected]>
commit eb7f8e28420372787933eec079735c35034bda7d upstream.
rtsx_usb driver allocates coherent dma buffer for urb transfers. This buffer is passed to usb_bulk_msg() and usb core tries to map already mapped buffer running into a dma mapping error.
xhci_hcd 0000:01:00.0: rejecting DMA map of vmalloc memory
WARNING: CPU: 1 PID: 279 at include/linux/dma-mapping.h:326 usb_ hcd_map_urb_for_dma+0x7d6/0x820
...
xhci_map_urb_for_dma+0x291/0x4e0 usb_hcd_submit_urb+0x199/0x12b0 ... usb_submit_urb+0x3b8/0x9e0 usb_start_wait_urb+0xe3/0x2d0 usb_bulk_msg+0x115/0x240 rtsx_usb_transfer_data+0x185/0x1a8 [rtsx_usb] rtsx_usb_send_cmd+0xbb/0x123 [rtsx_usb] rtsx_usb_write_register+0x12c/0x143 [rtsx_usb] rtsx_usb_probe+0x226/0x4b2 [rtsx_usb]
Fix it to use kmalloc() to get DMA-able memory region instead.
--- drivers/misc/cardreader/rtsx_usb.c | 13 +++++++------ include/linux/rtsx_usb.h | 1 - 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/misc/cardreader/rtsx_usb.c +7 -6
@@ -631,8 +631,7 @@ static int rtsx_usb_probe(struct usb_int ucr->pusb_dev = usb_dev; - ucr->iobuf =usb_alloc_coherent (ucr->pusb_dev,IOBUF_SIZE , -GFP_KERNEL , &ucr->iobuf_dma); + ucr->iobuf =kmalloc (IOBUF_SIZE ,GFP_KERNEL );if (!ucr->iobuf)return -ENOMEM ;
@@ -668,8 +667,9 @@ static int rtsx_usb_probe(struct usb_int out_init_fail:usb_set_intfdata (ucr->pusb_intf,NULL ); -usb_free_coherent (ucr->pusb_dev,IOBUF_SIZE , ucr->iobuf, - ucr->iobuf_dma); +kfree (ucr->iobuf); + ucr->iobuf =NULL ; + ucr->cmd_buf = ucr->rsp_buf =NULL ;return ret; }
@@ -682,8 +682,9 @@ static void rtsx_usb_disconnect(struct umfd_remove_devices (&intf->dev);usb_set_intfdata (ucr->pusb_intf,NULL ); -usb_free_coherent (ucr->pusb_dev,IOBUF_SIZE , ucr->iobuf, - ucr->iobuf_dma); +kfree (ucr->iobuf); + ucr->iobuf =NULL ; + ucr->cmd_buf = ucr->rsp_buf =NULL ; }#ifdef CONFIG_PM
include/linux/rtsx_usb.h +0 -1
@@ -55,7 +55,6 @@ struct rtsx_ucr {struct usb_interface *pusb_intf;struct usb_sg_request current_sg;unsigned char *iobuf; -dma_addr_t iobuf_dma;struct timer_list sg_timer;struct mutex dev_mutex;
Greg Kroah-Hartman
maintainerPATCH 48/55 misc: rtsx_usb: use separate command and response buffers
In reply to Greg Kroah-HartmanFrom: Shuah Khan <[email protected]>
commit 3776c78559853fd151be7c41e369fd076fb679d5 upstream.
rtsx_usb uses same buffer for command and response. There could be a potential conflict using the same buffer for both especially if retries and timeouts are involved.
Use separate command and response buffers to avoid conflicts.
--- drivers/misc/cardreader/rtsx_usb.c | 26 +++++++++++++++++--------- include/linux/rtsx_usb.h | 1 - 2 files changed, 17 insertions(+), 10 deletions(-)
drivers/misc/cardreader/rtsx_usb.c +17 -9
@@ -631,15 +631,18 @@ static int rtsx_usb_probe(struct usb_int ucr->pusb_dev = usb_dev; - ucr->iobuf =kmalloc (IOBUF_SIZE ,GFP_KERNEL ); -if (!ucr->iobuf) + ucr->cmd_buf =kmalloc (IOBUF_SIZE ,GFP_KERNEL ); +if (!ucr->cmd_buf)return -ENOMEM ; + ucr->rsp_buf =kmalloc (IOBUF_SIZE ,GFP_KERNEL ); +if (!ucr->rsp_buf) + goto out_free_cmd_buf; +usb_set_intfdata (intf, ucr); ucr->vendor_id = id->idVendor; ucr->product_id = id->idProduct; - ucr->cmd_buf = ucr->rsp_buf = ucr->iobuf;mutex_init (&ucr->dev_mutex);
@@ -667,9 +670,11 @@ static int rtsx_usb_probe(struct usb_int out_init_fail:usb_set_intfdata (ucr->pusb_intf,NULL ); -kfree (ucr->iobuf); - ucr->iobuf =NULL ; - ucr->cmd_buf = ucr->rsp_buf =NULL ; +kfree (ucr->rsp_buf); + ucr->rsp_buf =NULL ; +out_free_cmd_buf: +kfree (ucr->cmd_buf); + ucr->cmd_buf =NULL ;return ret; }
@@ -682,9 +687,12 @@ static void rtsx_usb_disconnect(struct umfd_remove_devices (&intf->dev);usb_set_intfdata (ucr->pusb_intf,NULL ); -kfree (ucr->iobuf); - ucr->iobuf =NULL ; - ucr->cmd_buf = ucr->rsp_buf =NULL ; + +kfree (ucr->cmd_buf); + ucr->cmd_buf =NULL ; + +kfree (ucr->rsp_buf); + ucr->rsp_buf =NULL ; }#ifdef CONFIG_PM
include/linux/rtsx_usb.h +0 -1
@@ -54,7 +54,6 @@ struct rtsx_ucr {struct usb_device *pusb_dev;struct usb_interface *pusb_intf;struct usb_sg_request current_sg; -unsigned char *iobuf;struct timer_list sg_timer;struct mutex dev_mutex;
Greg Kroah-Hartman
maintainerPATCH 49/55 misc: rtsx_usb: set return value in rsp_buf alloc err path
In reply to Greg Kroah-HartmanFrom: Shuah Khan <[email protected]>
commit 2cd37c2e72449a7add6da1183d20a6247d6db111 upstream.
Set return value in rsp_buf alloc error path before going to error handling.
drivers/misc/cardreader/rtsx_usb.c:639:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (!ucr->rsp_buf)
^~~~~~~~~~~~~
drivers/misc/cardreader/rtsx_usb.c:678:9: note: uninitialized use occurs here
return ret;
^~~
drivers/misc/cardreader/rtsx_usb.c:639:2: note: remove the 'if' if its condition is always false
if (!ucr->rsp_buf)
^~~~~~~~~~~~~~~~~~
drivers/misc/cardreader/rtsx_usb.c:622:9: note: initialize the variable 'ret' to silence this warning
int ret;
^
= 0--- drivers/misc/cardreader/rtsx_usb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/misc/cardreader/rtsx_usb.c +3 -1
@@ -636,8 +636,10 @@ static int rtsx_usb_probe(struct usb_intreturn -ENOMEM ; ucr->rsp_buf =kmalloc (IOBUF_SIZE ,GFP_KERNEL ); -if (!ucr->rsp_buf) +if (!ucr->rsp_buf) { + ret = -ENOMEM ; goto out_free_cmd_buf; + }usb_set_intfdata (intf, ucr);
Greg Kroah-Hartman
maintainerPATCH 50/55 dt-bindings: dma: allwinner,sun50i-a64-dma: Fix min/max typo
In reply to Greg Kroah-HartmanFrom: Samuel Holland <[email protected]>
commit 607a48c78e6b427b0b684d24e61c19e846ad65d6 upstream.
The conditional block for variants with a second clock should have set minItems, not maxItems, which was already 2. Since clock-names requires two items, this typo should not have caused any problems.
--- Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml +1 -1
@@ -61,7 +61,7 @@ if: then: properties: clocks: - maxItems: 2 + minItems: 2 required: - clock-names
Greg Kroah-Hartman
maintainerPATCH 51/55 ida: dont use BUG_ON() for debugging
In reply to Greg Kroah-HartmanFrom: Linus Torvalds <[email protected]>
commit fc82bbf4dede758007763867d0282353c06d1121 upstream.
This is another old BUG_ON() that just shouldn't exist (see also commita382f8fee42c: "signal handling: don't use BUG_ON() for debugging").
In fact, as Matthew Wilcox points out, this condition shouldn't really even result in a warning, since a negative id allocation result is just a normal allocation failure:
"I wonder if we should even warn here -- sure, the caller is trying to
free something that wasn't allocated, but we don't warn for kfree(NULL)"
and goes on to point out how that current error check is only causing people to unnecessarily do their own index range checking before freeing it.
This was noted by Itay Iellin, because the bluetooth HCI socket cookie code does *not* do that range checking, and ends up just freeing the error case too, triggering the BUG_ON().
The HCI code requires CAP_NET_RAW, and seems to just result in an ugly splat, but there really is no reason to BUG_ON() here, and we have generally striven for allocation models where it's always ok to just do
free(alloc());
even if the allocation were to fail for some random reason (usually obviously that "random" reason being some resource limit).
--- lib/idr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
lib/idr.c +2 -1
@@ -491,7 +491,8 @@ void ida_free(struct ida *ida, unsignedstruct ida_bitmap *bitmap;unsigned long flags; -BUG_ON ((int )id <0 ); +if ((int )id <0 ) +return ;xas_lock_irqsave (&xas, flags); bitmap =xas_load (&xas);
Greg Kroah-Hartman
maintainerPATCH 52/55 dmaengine: pl330: Fix lockdep warning about non-static key
In reply to Greg Kroah-HartmanFrom: Dmitry Osipenko <[email protected]>
commit b64b3b2f1d81f83519582e1feee87d77f51f5f17 upstream.
The DEFINE_SPINLOCK() macro shouldn't be used for dynamically allocated spinlocks. The lockdep warns about this and disables locking validator. Fix the warning by making lock static.
INFO: trying to register non-static key.
The code is fine but needs lockdep annotation, or maybe you didn't initialize this object before use? turning off the locking correctness validator.
Hardware name: Radxa ROCK Pi 4C (DT) Call trace: dump_backtrace.part.0+0xcc/0xe0 show_stack+0x18/0x6c dump_stack_lvl+0x8c/0xb8 dump_stack+0x18/0x34 register_lock_class+0x4a8/0x4cc __lock_acquire+0x78/0x20cc lock_acquire.part.0+0xe0/0x230 lock_acquire+0x68/0x84 _raw_spin_lock_irqsave+0x84/0xc4 add_desc+0x44/0xc0 pl330_get_desc+0x15c/0x1d0 pl330_prep_dma_cyclic+0x100/0x270 snd_dmaengine_pcm_trigger+0xec/0x1c0 dmaengine_pcm_trigger+0x18/0x24 ...
--- drivers/dma/pl330.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/pl330.c +1 -1
@@ -2591,7 +2591,7 @@ static struct dma_pl330_desc *pl330_get_/* If the DMAC pool is empty, alloc new */ if (!desc) { -DEFINE_SPINLOCK (lock); +static DEFINE_SPINLOCK (lock);LIST_HEAD (pool);if (!add_desc (&pool, &lock,GFP_ATOMIC ,1 ))
Greg Kroah-Hartman
maintainerPATCH 53/55 dmaengine: at_xdma: handle errors of at_xdmac_alloc_desc() correctly
In reply to Greg Kroah-HartmanFrom: Michael Walle <[email protected]>
commit 3770d92bd5237d686e49da7b2fb86f53ee6ed259 upstream.
It seems that it is valid to have less than the requested number of descriptors. But what is not valid and leads to subsequent errors is to have zero descriptors. In that case, abort the probing.
--- drivers/dma/at_xdmac.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/dma/at_xdmac.c +5 -0
@@ -1838,6 +1838,11 @@ static int at_xdmac_alloc_chan_resourcesfor (i =0 ; i < init_nr_desc_per_channel; i++) { desc =at_xdmac_alloc_desc (chan,GFP_KERNEL );if (!desc) { +if (i ==0 ) { +dev_warn (chan2dev (chan), +"can't allocate any descriptors\n" ); +return -EIO ; + }dev_warn (chan2dev (chan),"only %d descriptors have been allocated\n" , i);break ;
Greg Kroah-Hartman
maintainerPATCH 54/55 dmaengine: ti: Fix refcount leak in ti_dra7_xbar_route_allocate
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
commit c132fe78ad7b4ce8b5d49a501a15c29d08eeb23a upstream.
of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not needed anymore.
Add missing of_node_put() in to fix this.
--- drivers/dma/ti/dma-crossbar.c | 1 + 1 file changed, 1 insertion(+)
drivers/dma/ti/dma-crossbar.c +1 -0
@@ -268,6 +268,7 @@ static void *ti_dra7_xbar_route_allocatemutex_unlock (&xbar->mutex);dev_err (&pdev->dev,"Run out of free DMA requests\n" );kfree (map); +of_node_put (dma_spec->np);return ERR_PTR (-ENOMEM ); }set_bit (map->xbar_out, xbar->dma_inuse);
Greg Kroah-Hartman
maintainerPATCH 55/55 dmaengine: ti: Add missing put_device in ti_dra7_xbar_route_allocate
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
commit 615a4bfc426e11dba05c2cf343f9ac752fb381d2 upstream.
of_find_device_by_node() takes reference, we should use put_device() to release it when not need anymore.
--- drivers/dma/ti/dma-crossbar.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/dma/ti/dma-crossbar.c +4 -0
@@ -245,6 +245,7 @@ static void *ti_dra7_xbar_route_allocateif (dma_spec->args[0 ] >= xbar->xbar_requests) {dev_err (&pdev->dev,"Invalid XBAR request number: %d\n" , dma_spec->args[0 ]); +put_device (&pdev->dev);return ERR_PTR (-EINVAL ); }
@@ -252,12 +253,14 @@ static void *ti_dra7_xbar_route_allocate dma_spec->np =of_parse_phandle (ofdma->of_node,"dma-masters" ,0 );if (!dma_spec->np) {dev_err (&pdev->dev,"Can't get DMA master\n" ); +put_device (&pdev->dev);return ERR_PTR (-EINVAL ); } map =kzalloc (sizeof (*map),GFP_KERNEL );if (!map) {of_node_put (dma_spec->np); +put_device (&pdev->dev);return ERR_PTR (-ENOMEM ); }
@@ -269,6 +272,7 @@ static void *ti_dra7_xbar_route_allocatedev_err (&pdev->dev,"Run out of free DMA requests\n" );kfree (map);of_node_put (dma_spec->np); +put_device (&pdev->dev);return ERR_PTR (-ENOMEM ); }set_bit (map->xbar_out, xbar->dma_inuse);
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 5.10.130 release. There are 55 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
CIP testing did not find any problems here:
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-5.10.y
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.130 release. There are 55 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 13 Jul 2022 09:05:28 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.130-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.10.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels:
Signature · 1 line
Florian
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.130 release. There are 55 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 13 Jul 2022 09:05:28 +0000. Anything received after that time might be too late.
Build results:
total: 163 pass: 163 fail: 0 Qemu test results: total: 477 pass: 477 fail: 0
Guenter
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.130 release. There are 55 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 13 Jul 2022 09:05:28 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.130-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.10.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.130 release. There are 55 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 13 Jul 2022 09:05:28 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.130-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.10.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
## Build
* kernel: 5.10.130-rc1
* git: https://gitlab.com/Linaro/lkft/mirrors/stable/linux-stable-rc
* git branch: linux-5.10.y
* git commit: b344d768cea41307cf893102087e3134995cf1ea
* git describe: v5.10.129-56-gb344d768cea4
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.10.y/build/v5.10.129-56-gb344d768cea4
## Test Regressions (compared to v5.10.129)
No test regressions found.
## Metric Regressions (compared to v5.10.129)
No metric regressions found.
## Test Fixes (compared to v5.10.129)
No test fixes found.
## Metric Fixes (compared to v5.10.129)
No metric fixes found.
## Test result summary
total: 133598, pass: 120651, fail: 512, skip: 11641, xfail: 794
## Build Summary
* arc: 10 total, 10 passed, 0 failed
* arm: 308 total, 308 passed, 0 failed
* arm64: 62 total, 62 passed, 0 failed
* i386: 52 total, 49 passed, 3 failed
* mips: 48 total, 48 passed, 0 failed
* parisc: 12 total, 12 passed, 0 failed
* powerpc: 51 total, 51 passed, 0 failed
* riscv: 27 total, 27 passed, 0 failed
* s390: 21 total, 21 passed, 0 failed
* sh: 24 total, 24 passed, 0 failed
* sparc: 12 total, 12 passed, 0 failed
* x86_64: 56 total, 55 passed, 1 failed
## Test suites summary
* fwts
* igt-gpu-tools
* kunit
* kvm-unit-tests
* libgpiod
* libhugetlbfs
* log-parser-boot
* log-parser-test
* ltp-cap_bounds
* ltp-commands
* ltp-containers
* ltp-controllers
* ltp-cpuhotplug
* ltp-crypto
* ltp-cve
* ltp-dio
* ltp-fcntl-locktests
* ltp-filecaps
* ltp-fs
* ltp-fs_bind
* ltp-fs_perms_simple
* ltp-fsx
* ltp-hugetlb
* ltp-io
* ltp-ipc
* ltp-math
* ltp-mm
* ltp-nptl
* ltp-open-posix-tests
* ltp-pty
* ltp-sched
* ltp-securebits
* ltp-smoke
* ltp-syscalls
* ltp-tracing
* network-basic-tests
* packetdrill
* perf
* perf/Zstd-perf.data-compression
* rcutorture
* ssuite
* v4l2-compliance
* vdso
--
Linaro LKFT
https://lkft.linaro.org
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.130 release. There are 55 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 13 Jul 2022 09:05:28 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.130-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.10.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v5.10:
10 builds: 10 pass, 0 fail
28 boots: 28 pass, 0 fail
75 tests: 75 pass, 0 failLinux version: 5.10.130-rc1-gb344d768cea4
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra194-p3509-0000+p3668-0000,
tegra20-ventana, tegra210-p2371-2180,
tegra210-p3450-0000, tegra30-cardhu-a04Jon
Hi Greg,
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.130 release. There are 55 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 13 Jul 2022 09:05:28 +0000. Anything received after that time might be too late.
Build test (gcc version 11.3.1 20220706):
mips: 63 configs -> no failure
arm: 104 configs -> no failure
arm64: 3 configs -> no failurex86_64: 4 configs -> no failure alpha allmodconfig -> no failure powerpc allmodconfig -> no failure riscv allmodconfig -> no failure s390 allmodconfig -> no failure xtensa allmodconfig -> no failure
Boot test:x86_64: Booted on my test laptop. No regression.x86_64: Booted on qemu. No regression. [1]
arm64: Booted on rpi4b (4GB model). No regression. [2]
[1]. https://openqa.qa.codethink.co.uk/tests/1486
[2]. https://openqa.qa.codethink.co.uk/tests/1496
--
Regards
Sudip