4.9.336-rc1 review
Subsystems (2)
Greg Kroah-Hartman
maintainercover 4.9.336-rc1 review
This is the start of the stable review cycle for the 4.9.336 release. There are 31 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, 14 Dec 2022 13:08:57 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.336-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.9.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.9.336-rc1
Dan Carpenter <[email protected]>
net: mvneta: Fix an out of bounds check
Yang Yingliang <[email protected]>
net: plip: don't call kfree_skb/dev_kfree_skb() under spin_lock_irq()
Juergen Gross <[email protected]>
xen/netback: fix build warning
Zhang Changzhong <[email protected]>
ethernet: aeroflex: fix potential skb leak in greth_init_rings()
YueHaibing <[email protected]>
tipc: Fix potential OOB in tipc_link_proto_rcv()
Liu Jian <[email protected]>
net: hisilicon: Fix potential use-after-free in hix5hd2_rx()
Liu Jian <[email protected]>
net: hisilicon: Fix potential use-after-free in hisi_femac_rx()
Kees Cook <[email protected]>
NFC: nci: Bounds check struct nfc_target arrays
Dan Carpenter <[email protected]>
net: mvneta: Prevent out of bounds read in mvneta_config_rss()
Valentina Goncharenko <[email protected]>
net: encx24j600: Fix invalid logic in reading of MISTAT register
Valentina Goncharenko <[email protected]>
net: encx24j600: Add parentheses to fix precedence
Wei Yongjun <[email protected]>
mac802154: fix missing INIT_LIST_HEAD in ieee802154_if_add()
Wang ShaoBo <[email protected]>
Bluetooth: 6LoWPAN: add missing hci_dev_put() in get_l2cap_conn()
Akihiko Odaki <[email protected]>
igb: Allocate MSI-X vector when testing
Akihiko Odaki <[email protected]>
e1000e: Fix TX dispatch condition
Xiongfeng Wang <[email protected]>
gpio: amd8111: Fix PCI device reference count leak
Ziyang Xuan <[email protected]>
ieee802154: cc2520: Fix error return code in cc2520_hw_init()
ZhangPeng <[email protected]>
HID: core: fix shift-out-of-bounds in hid_report_raw_event
Anastasia Belova <[email protected]>
HID: hid-lg4ff: Add check for empty lbuf
Hans Verkuil <[email protected]>
media: v4l2-dv-timings.c: fix too strict blanking sanity checks
Adrian Hunter <[email protected]>
mmc: sdhci: Fix voltage switch delay
Masahiro Yamada <[email protected]>
mmc: sdhci: use FIELD_GET for preset value bit masks
Connor Shu <[email protected]>
rcutorture: Automatically create initrd directory
Juergen Gross <[email protected]>
xen/netback: don't call kfree_skb() with interrupts disabled
Juergen Gross <[email protected]>
xen/netback: do some code cleanup
Ross Lagerwall <[email protected]>
xen/netback: Ensure protocol headers don't fall in the non-linear area
Srinivasa Rao Mandadapu <[email protected]>
ASoC: soc-pcm: Add NULL check in BE reparenting
Kees Cook <[email protected]>
ALSA: seq: Fix function prototype mismatch in snd_seq_expand_var_event
Tomislav Novak <[email protected]>
ARM: 9251/1: perf: Fix stacktraces for tracepoint events in THUMB2 kernels
Johan Jonker <[email protected]>
ARM: dts: rockchip: fix ir-receiver node names
Sebastian Reichel <[email protected]>
arm: dts: rockchip: fix node name for hym8563 rtc
-------------
Diffstat:
Makefile | 4 +- arch/arm/boot/dts/rk3036-evb.dts | 2 +- arch/arm/boot/dts/rk3188-radxarock.dts | 2 +- arch/arm/boot/dts/rk3288-evb-act8846.dts | 2 +- arch/arm/boot/dts/rk3288-firefly.dtsi | 2 +- arch/arm/boot/dts/rk3288-miqi.dts | 2 +- arch/arm/boot/dts/rk3288-rock2-square.dts | 2 +- arch/arm/include/asm/perf_event.h | 2 +- drivers/gpio/gpio-amd8111.c | 4 + drivers/hid/hid-core.c | 3 + drivers/hid/hid-lg4ff.c | 6 + drivers/media/v4l2-core/v4l2-dv-timings.c | 20 +- drivers/mmc/host/sdhci.c | 73 +++++-- drivers/mmc/host/sdhci.h | 12 +- drivers/net/ethernet/aeroflex/greth.c | 1 + drivers/net/ethernet/hisilicon/hisi_femac.c | 2 +- drivers/net/ethernet/hisilicon/hix5hd2_gmac.c | 2 +- drivers/net/ethernet/intel/e1000e/netdev.c | 4 +- drivers/net/ethernet/intel/igb/igb_ethtool.c | 2 + drivers/net/ethernet/marvell/mvneta.c | 2 +- drivers/net/ethernet/microchip/encx24j600-regmap.c | 4 +- drivers/net/ieee802154/cc2520.c | 2 +- drivers/net/plip/plip.c | 4 +- drivers/net/xen-netback/common.h | 14 +- drivers/net/xen-netback/interface.c | 22 +- drivers/net/xen-netback/netback.c | 229 ++++++++++++--------- drivers/net/xen-netback/rx.c | 10 +- net/bluetooth/6lowpan.c | 1 + net/mac802154/iface.c | 1 + net/nfc/nci/ntf.c | 6 + net/tipc/link.c | 4 +- sound/core/seq/seq_memory.c | 11 +- sound/soc/soc-pcm.c | 2 + tools/testing/selftests/rcutorture/bin/kvm.sh | 8 + tools/testing/selftests/rcutorture/bin/mkinitrd.sh | 60 ++++++ 35 files changed, 342 insertions(+), 185 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/31 arm: dts: rockchip: fix node name for hym8563 rtc
From: Sebastian Reichel <[email protected]>
[ Upstream commit 17b57beafccb4569accbfc8c11390744cf59c021 ]
Fix the node name for hym8563 in all arm rockchip devicetrees.
--- arch/arm/boot/dts/rk3036-evb.dts | 2 +- arch/arm/boot/dts/rk3288-evb-act8846.dts | 2 +- arch/arm/boot/dts/rk3288-firefly.dtsi | 2 +- arch/arm/boot/dts/rk3288-miqi.dts | 2 +- arch/arm/boot/dts/rk3288-rock2-square.dts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)
arch/arm/boot/dts/rk3036-evb.dts +1 -1
@@ -69,7 +69,7 @@ &i2c1 { status = "okay"; - hym8563: hym8563@51 { + hym8563: rtc@51 { compatible = "haoyu,hym8563"; reg = <0x51>; #clock-cells = <0>;
arch/arm/boot/dts/rk3288-evb-act8846.dts +1 -1
@@ -91,7 +91,7 @@ vin-supply = <&vcc_sys>; }; - hym8563@51 { + rtc@51 { compatible = "haoyu,hym8563"; reg = <0x51>;
arch/arm/boot/dts/rk3288-firefly.dtsi +1 -1
@@ -253,7 +253,7 @@ vin-supply = <&vcc_sys>; }; - hym8563: hym8563@51 { + hym8563: rtc@51 { compatible = "haoyu,hym8563"; reg = <0x51>; #clock-cells = <0>;
arch/arm/boot/dts/rk3288-miqi.dts +1 -1
@@ -186,7 +186,7 @@ vin-supply = <&vcc_sys>; }; - hym8563: hym8563@51 { + hym8563: rtc@51 { compatible = "haoyu,hym8563"; reg = <0x51>; #clock-cells = <0>;
arch/arm/boot/dts/rk3288-rock2-square.dts +1 -1
@@ -159,7 +159,7 @@ }; &i2c0 { - hym8563: hym8563@51 { + hym8563: rtc@51 { compatible = "haoyu,hym8563"; reg = <0x51>; #clock-cells = <0>;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 2/31 ARM: dts: rockchip: fix ir-receiver node names
In reply to Greg Kroah-HartmanFrom: Johan Jonker <[email protected]>
[ Upstream commit dd847fe34cdf1e89afed1af24986359f13082bfb ]
Fix ir-receiver node names on Rockchip boards,
so that they match with regex: '^ir(-receiver)?(@[a-f0-9]+)?$'
--- arch/arm/boot/dts/rk3188-radxarock.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/rk3188-radxarock.dts +1 -1
@@ -104,7 +104,7 @@ #sound-dai-cells = <0>; }; - ir_recv: gpio-ir-receiver { + ir_recv: ir-receiver { compatible = "gpio-ir-receiver"; gpios = <&gpio0 10 1>; pinctrl-names = "default";
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 3/31 ARM: 9251/1: perf: Fix stacktraces for tracepoint events in THUMB2 kernels
In reply to Greg Kroah-HartmanFrom: Tomislav Novak <[email protected]>
[ Upstream commit 612695bccfdbd52004551308a55bae410e7cd22f ]
Store the frame address where arm_get_current_stackframe() looks for it (ARM_r7 instead of ARM_fp if CONFIG_THUMB2_KERNEL=y). Otherwise frame->fp gets set to 0, causing unwind_frame() to fail.
# bpftrace -e 't:sched:sched_switch { @[kstack] = count(); exit(); }'
Attaching 1 probe...
@[
__schedule+1059
]: 1A typical first unwind instruction is 0x97 (SP = R7), so after executing it SP ends up being 0 and -URC_FAILURE is returned.
unwind_frame(pc = ac9da7d7 lr = 00000000 sp = c69bdda0 fp = 00000000) unwind_find_idx(ac9da7d7)
unwind_exec_insn: insn = 00000097
unwind_exec_insn: fp = 00000000 sp = 00000000 lr = 00000000 pc = 00000000
With this patch:
# bpftrace -e 't:sched:sched_switch { @[kstack] = count(); exit(); }'
Attaching 1 probe...
@[
__schedule+1059
__schedule+1059
schedule+79
schedule_hrtimeout_range_clock+163
schedule_hrtimeout_range+17
ep_poll+471
SyS_epoll_wait+111
sys_epoll_pwait+231
__ret_fast_syscall+1
]: 1--- arch/arm/include/asm/perf_event.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/include/asm/perf_event.h +1 -1
@@ -21,7 +21,7 @@ extern unsigned long perf_misc_flags(struct pt_regs *regs);#define perf_arch_fetch_caller_regs (regs, __ip) { \ (regs)->ARM_pc = (__ip); \ - (regs)->ARM_fp = (unsigned long) __builtin_frame_address(0); \ + frame_pointer((regs)) = (unsigned long) __builtin_frame_address(0); \ (regs)->ARM_sp = current_stack_pointer; \ (regs)->ARM_cpsr = SVC_MODE; \ }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 4/31 ALSA: seq: Fix function prototype mismatch in snd_seq_expand_var_event
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit 05530ef7cf7c7d700f6753f058999b1b5099a026 ]
With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG), indirect call targets are validated against the expected function pointer prototype to make sure the call target is valid to help mitigate ROP attacks. If they are not identical, there is a failure at run time, which manifests as either a kernel panic or thread getting killed.
seq_copy_in_user() and seq_copy_in_kernel() did not have prototypes matching snd_seq_dump_func_t. Adjust this and remove the casts. There are not resulting binary output differences.
This was found as a result of Clang's new -Wcast-function-type-strict flag, which is more sensitive than the simpler -Wcast-function-type, which only checks for type width mismatches.
--- sound/core/seq/seq_memory.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
sound/core/seq/seq_memory.c +7 -4
@@ -126,15 +126,19 @@ EXPORT_SYMBOL(snd_seq_dump_var_event);* expand the variable length event to linear buffer space. */ -static int seq_copy_in_kernel (char **bufptr,const void *src,int size) +static int seq_copy_in_kernel (void *ptr,void *src,int size) { +char **bufptr = ptr; +memcpy (*bufptr, src, size); *bufptr += size;return 0 ; } -static int seq_copy_in_user (char __user **bufptr,const void *src,int size) +static int seq_copy_in_user (void *ptr,void *src,int size) { +char __user **bufptr = ptr; +if (copy_to_user (*bufptr, src, size))return -EFAULT ; *bufptr += size;
@@ -163,8 +167,7 @@ int snd_seq_expand_var_event(const struct snd_seq_event *event, int count, charreturn newlen; } err =snd_seq_dump_var_event (event, - in_kernel ? (snd_seq_dump_func_t )seq_copy_in_kernel : - (snd_seq_dump_func_t )seq_copy_in_user, + in_kernel ? seq_copy_in_kernel : seq_copy_in_user, &buf);return err <0 ? err : newlen; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 5/31 ASoC: soc-pcm: Add NULL check in BE reparenting
In reply to Greg Kroah-HartmanFrom: Srinivasa Rao Mandadapu <[email protected]>
[ Upstream commit db8f91d424fe0ea6db337aca8bc05908bbce1498 ]
Add NULL check in dpcm_be_reparent API, to handle kernel NULL pointer dereference error. The issue occurred in fuzzing test.
--- sound/soc/soc-pcm.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/soc-pcm.c +2 -0
@@ -1182,6 +1182,8 @@ static void dpcm_be_reparent(struct snd_soc_pcm_runtime *fe,return ; be_substream =snd_soc_dpcm_get_substream (be, stream); +if (!be_substream) +return ;list_for_each_entry (dpcm, &be->dpcm[stream].fe_clients, list_fe) {if (dpcm->fe == fe)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 6/31 xen/netback: Ensure protocol headers dont fall in the non-linear area
In reply to Greg Kroah-HartmanFrom: Ross Lagerwall <[email protected]>
[ Upstream commit ad7f402ae4f466647c3a669b8a6f3e5d4271c84a ]
In some cases, the frontend may send a packet where the protocol headers are spread across multiple slots. This would result in netback creating an skb where the protocol headers spill over into the non-linear area. Some drivers and NICs don't handle this properly resulting in an interface reset or worse.
This issue was introduced by the removal of an unconditional skb pull in the tx path to improve performance. Fix this without reintroducing the pull by setting up grant copy ops for as many slots as needed to reach the XEN_NETBACK_TX_COPY_LEN size. Adjust the rest of the code to handle multiple copy operations per skb.
This is XSA-423 / CVE-2022-3643.
--- drivers/net/xen-netback/netback.c | 223 ++++++++++++++++-------------- 1 file changed, 123 insertions(+), 100 deletions(-)
drivers/net/xen-netback/netback.c +123 -100
@@ -323,10 +323,13 @@ static int xenvif_count_requests(struct xenvif_queue *queue,struct xenvif_tx_cb { -u16 pending_idx; +u16 copy_pending_idx[XEN_NETBK_LEGACY_SLOTS_MAX +1 ]; +u8 copy_count; };#define XENVIF_TX_CB (skb) ((struct xenvif_tx_cb *)(skb)->cb) +#define copy_pending_idx (skb, i) (XENVIF_TX_CB(skb)->copy_pending_idx[i]) +#define copy_count (skb) (XENVIF_TX_CB(skb)->copy_count) static inline void xenvif_tx_create_map_op(struct xenvif_queue *queue, u16 pending_idx,
@@ -361,31 +364,93 @@ static inline struct sk_buff *xenvif_alloc_skb(unsigned int size)return skb; } -static struct gnttab_map_grant_ref *xenvif_get_requests (struct xenvif_queue *queue, -struct sk_buff *skb, -struct xen_netif_tx_request *txp, -struct gnttab_map_grant_ref *gop, -unsigned int frag_overflow, -struct sk_buff *nskb) +static void xenvif_get_requests (struct xenvif_queue *queue, +struct sk_buff *skb, +struct xen_netif_tx_request *first, +struct xen_netif_tx_request *txfrags, +unsigned *copy_ops, +unsigned *map_ops, +unsigned int frag_overflow, +struct sk_buff *nskb, +unsigned int extra_count, +unsigned int data_len) {struct skb_shared_info *shinfo =skb_shinfo (skb);skb_frag_t *frags = shinfo->frags; -u16 pending_idx =XENVIF_TX_CB (skb)->pending_idx; -int start; +u16 pending_idx;pending_ring_idx_t index;unsigned int nr_slots; +struct gnttab_copy *cop = queue->tx_copy_ops + *copy_ops; +struct gnttab_map_grant_ref *gop = queue->tx_map_ops + *map_ops; +struct xen_netif_tx_request *txp = first; + + nr_slots = shinfo->nr_frags +1 ; + +copy_count (skb) =0 ; + +/* Create copy ops for exactly data_len bytes into the skb head. */ +__skb_put (skb, data_len); +while (data_len >0 ) { +int amount = data_len > txp->size ? txp->size : data_len; + + cop->source.u.ref = txp->gref; + cop->source.domid = queue->vif->domid; + cop->source.offset = txp->offset; + + cop->dest.domid =DOMID_SELF ; + cop->dest.offset = (offset_in_page (skb->data + +skb_headlen (skb) - + data_len)) & ~XEN_PAGE_MASK ; + cop->dest.u.gmfn =virt_to_gfn (skb->data +skb_headlen (skb) + - data_len); + + cop->len = amount; + cop->flags = GNTCOPY_source_gref; - nr_slots = shinfo->nr_frags; + index =pending_index (queue->pending_cons); + pending_idx = queue->pending_ring[index]; +callback_param (queue, pending_idx).ctx =NULL ; +copy_pending_idx (skb,copy_count (skb)) = pending_idx; +copy_count (skb)++; + + cop++; + data_len -= amount; -/* Skip first skb fragment if it is on same page as header fragment. */ - start = (frag_get_pending_idx (&shinfo->frags[0 ]) == pending_idx); +if (amount == txp->size) { +/* The copy op covered the full tx_request */ + +memcpy (&queue->pending_tx_info[pending_idx].req, + txp,sizeof (*txp)); + queue->pending_tx_info[pending_idx].extra_count = + (txp == first) ? extra_count :0 ; + +if (txp == first) + txp = txfrags; +else + txp++; + queue->pending_cons++; + nr_slots--; + }else { +/* The copy op partially covered the tx_request. +* The remainder will be mapped. +*/ + txp->offset += amount; + txp->size -= amount; + } + } -for (shinfo->nr_frags = start; shinfo->nr_frags < nr_slots; - shinfo->nr_frags++, txp++, gop++) { +for (shinfo->nr_frags =0 ; shinfo->nr_frags < nr_slots; + shinfo->nr_frags++, gop++) { index =pending_index (queue->pending_cons++); pending_idx = queue->pending_ring[index]; -xenvif_tx_create_map_op (queue, pending_idx, txp,0 , gop); +xenvif_tx_create_map_op (queue, pending_idx, txp, + txp == first ? extra_count :0 , gop);frag_set_pending_idx (&frags[shinfo->nr_frags], pending_idx); + +if (txp == first) + txp = txfrags; +else + txp++; }if (frag_overflow) {
@@ -406,7 +471,8 @@ static struct gnttab_map_grant_ref *xenvif_get_requests(struct xenvif_queue *queskb_shinfo (skb)->frag_list = nskb; } -return gop; + (*copy_ops) = cop - queue->tx_copy_ops; + (*map_ops) = gop - queue->tx_map_ops; } static inline void xenvif_grant_handle_set(struct xenvif_queue *queue,
@@ -442,7 +508,7 @@ static int xenvif_tx_check_gop(struct xenvif_queue *queue, struct gnttab_copy **gopp_copy) {struct gnttab_map_grant_ref *gop_map = *gopp_map; -u16 pending_idx =XENVIF_TX_CB (skb)->pending_idx; +u16 pending_idx;/* This always points to the shinfo of the skb being checked, which * could be either the first or the one on the frag_list */
@@ -453,24 +519,37 @@ static int xenvif_tx_check_gop(struct xenvif_queue *queue,struct skb_shared_info *first_shinfo =NULL ;int nr_frags = shinfo->nr_frags;const bool sharedslot = nr_frags && -frag_get_pending_idx (&shinfo->frags[0 ]) == pending_idx; +frag_get_pending_idx (&shinfo->frags[0 ]) == +copy_pending_idx (skb,copy_count (skb) -1 );int i, err; -/* Check status of header. */ - err = (*gopp_copy)->status; -if (unlikely (err)) { -if (net_ratelimit ()) -netdev_dbg (queue->vif->dev, -"Grant copy of header failed! status: %d pending_idx: %u ref: %u\n" , - (*gopp_copy)->status, - pending_idx, - (*gopp_copy)->source.u.ref); -/* The first frag might still have this slot mapped */ -if (!sharedslot) -xenvif_idx_release (queue, pending_idx, -XEN_NETIF_RSP_ERROR ); +for (i =0 ; i <copy_count (skb); i++) { +int newerr; + +/* Check status of header. */ + pending_idx =copy_pending_idx (skb, i); + + newerr = (*gopp_copy)->status; +if (likely (!newerr)) { +/* The first frag might still have this slot mapped */ +if (i <copy_count (skb) -1 || !sharedslot) +xenvif_idx_release (queue, pending_idx, +XEN_NETIF_RSP_OKAY ); + }else { + err = newerr; +if (net_ratelimit ()) +netdev_dbg (queue->vif->dev, +"Grant copy of header failed! status: %d pending_idx: %u ref: %u\n" , + (*gopp_copy)->status, + pending_idx, + (*gopp_copy)->source.u.ref); +/* The first frag might still have this slot mapped */ +if (i <copy_count (skb) -1 || !sharedslot) +xenvif_idx_release (queue, pending_idx, +XEN_NETIF_RSP_ERROR ); + } + (*gopp_copy)++; } - (*gopp_copy)++; check_frags:for (i =0 ; i < nr_frags; i++, gop_map++) {
@@ -517,14 +596,6 @@ static int xenvif_tx_check_gop(struct xenvif_queue *queue,if (err)continue ; -/* First error: if the header haven't shared a slot with the -* first frag, release it as well. -*/ -if (!sharedslot) -xenvif_idx_release (queue, -XENVIF_TX_CB (skb)->pending_idx, -XEN_NETIF_RSP_OKAY ); -/* Invalidate preceding fragments of this skb. */ for (j =0 ; j < i; j++) { pending_idx =frag_get_pending_idx (&shinfo->frags[j]);
@@ -796,7 +867,6 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue,unsigned *copy_ops, unsigned *map_ops) { - struct gnttab_map_grant_ref *gop = queue->tx_map_ops; struct sk_buff *skb, *nskb;int ret;unsigned int frag_overflow;
@@ -878,8 +948,12 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue,continue ; } + data_len = (txreq.size >XEN_NETBACK_TX_COPY_LEN ) ? +XEN_NETBACK_TX_COPY_LEN : txreq.size; + ret =xenvif_count_requests (queue, &txreq, extra_count, txfrags, work_to_do); +if (unlikely (ret <0 ))break ;
@@ -905,9 +979,8 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue, index =pending_index (queue->pending_cons); pending_idx = queue->pending_ring[index]; - data_len = (txreq.size >XEN_NETBACK_TX_COPY_LEN && - ret <XEN_NETBK_LEGACY_SLOTS_MAX ) ? -XEN_NETBACK_TX_COPY_LEN : txreq.size; +if (ret >=XEN_NETBK_LEGACY_SLOTS_MAX -1 && data_len < txreq.size) + data_len = txreq.size; skb =xenvif_alloc_skb (data_len);if (unlikely (skb ==NULL )) {
@@ -918,8 +991,6 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue, }skb_shinfo (skb)->nr_frags = ret; -if (data_len < txreq.size) -skb_shinfo (skb)->nr_frags++;/* At this point shinfo->nr_frags is in fact the number of * slots, which can be as large as XEN_NETBK_LEGACY_SLOTS_MAX. */
@@ -981,54 +1052,19 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue, type); } -XENVIF_TX_CB (skb)->pending_idx = pending_idx; - -__skb_put (skb, data_len); - queue->tx_copy_ops[*copy_ops].source.u.ref = txreq.gref; - queue->tx_copy_ops[*copy_ops].source.domid = queue->vif->domid; - queue->tx_copy_ops[*copy_ops].source.offset = txreq.offset; - - queue->tx_copy_ops[*copy_ops].dest.u.gmfn = -virt_to_gfn (skb->data); - queue->tx_copy_ops[*copy_ops].dest.domid =DOMID_SELF ; - queue->tx_copy_ops[*copy_ops].dest.offset = -offset_in_page (skb->data) & ~XEN_PAGE_MASK ; - - queue->tx_copy_ops[*copy_ops].len = data_len; - queue->tx_copy_ops[*copy_ops].flags = GNTCOPY_source_gref; - - (*copy_ops)++; - -if (data_len < txreq.size) { -frag_set_pending_idx (&skb_shinfo (skb)->frags[0 ], - pending_idx); -xenvif_tx_create_map_op (queue, pending_idx, &txreq, - extra_count, gop); - gop++; - }else { -frag_set_pending_idx (&skb_shinfo (skb)->frags[0 ], -INVALID_PENDING_IDX ); -memcpy (&queue->pending_tx_info[pending_idx].req, - &txreq,sizeof (txreq)); - queue->pending_tx_info[pending_idx].extra_count = - extra_count; - } - - queue->pending_cons++; - - gop =xenvif_get_requests (queue, skb, txfrags, gop, - frag_overflow, nskb); +xenvif_get_requests (queue, skb, &txreq, txfrags, copy_ops, + map_ops, frag_overflow, nskb, extra_count, + data_len);__skb_queue_tail (&queue->tx_queue, skb); queue->tx.req_cons = idx; -if (((gop-queue->tx_map_ops) >=ARRAY_SIZE (queue->tx_map_ops)) || +if ((*map_ops >=ARRAY_SIZE (queue->tx_map_ops)) || (*copy_ops >=ARRAY_SIZE (queue->tx_copy_ops)))break ; } - (*map_ops) = gop - queue->tx_map_ops;return ; }
@@ -1107,9 +1143,8 @@ static int xenvif_tx_submit(struct xenvif_queue *queue)while ((skb =__skb_dequeue (&queue->tx_queue)) !=NULL ) {struct xen_netif_tx_request *txp;u16 pending_idx; -unsigned data_len; - pending_idx =XENVIF_TX_CB (skb)->pending_idx; + pending_idx =copy_pending_idx (skb,0 ); txp = &queue->pending_tx_info[pending_idx].req;/* Check the remap error code. */
@@ -1128,18 +1163,6 @@ static int xenvif_tx_submit(struct xenvif_queue *queue)continue ; } - data_len = skb->len; -callback_param (queue, pending_idx).ctx =NULL ; -if (data_len < txp->size) { -/* Append the packet payload as a fragment. */ - txp->offset += data_len; - txp->size -= data_len; - }else { -/* Schedule a response immediately. */ -xenvif_idx_release (queue, pending_idx, -XEN_NETIF_RSP_OKAY ); - } -if (txp->flags & XEN_NETTXF_csum_blank) skb->ip_summed =CHECKSUM_PARTIAL ;else if (txp->flags & XEN_NETTXF_data_validated)
@@ -1316,7 +1339,7 @@ static inline void xenvif_tx_dealloc_action(struct xenvif_queue *queue)/* Called after netfront has transmitted */ int xenvif_tx_action (struct xenvif_queue *queue,int budget) { -unsigned nr_mops, nr_cops =0 ; +unsigned nr_mops =0 , nr_cops =0 ;int work_done, ret;if (unlikely (!tx_work_todo (queue)))
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 7/31 xen/netback: do some code cleanup
In reply to Greg Kroah-HartmanFrom: Juergen Gross <[email protected]>
[ Upstream commit 5834e72eda0b7e5767eb107259d98eef19ebd11f ]
Remove some unused macros and functions, make local functions static.
Stable-dep-of: 74e7e1efdad4 ("xen/netback: don't call kfree_skb() with interrupts disabled")
--- drivers/net/xen-netback/common.h | 12 ------------ drivers/net/xen-netback/interface.c | 16 +--------------- drivers/net/xen-netback/netback.c | 4 +++- drivers/net/xen-netback/rx.c | 2 +- 4 files changed, 5 insertions(+), 29 deletions(-)
drivers/net/xen-netback/common.h +0 -12
@@ -48,7 +48,6 @@#include <linux/debugfs.h> typedef unsigned int pending_ring_idx_t ; -#define INVALID_PENDING_RING_IDX (~0U)struct pending_tx_info {struct xen_netif_tx_request req;/* tx request */
@@ -82,8 +81,6 @@ struct xenvif_rx_meta {/* Discriminate from any valid pending_idx value. */ #define INVALID_PENDING_IDX 0xFFFF -#define MAX_BUFFER_OFFSET XEN_PAGE_SIZE -#define MAX_PENDING_REQS XEN_NETIF_TX_RING_SIZE/* The maximum number of frags is derived from the size of a grant (same
@@ -345,11 +342,6 @@ void xenvif_free(struct xenvif *vif);int xenvif_xenbus_init (void );void xenvif_xenbus_fini (void ); -int xenvif_schedulable (struct xenvif *vif); - -int xenvif_queue_stopped (struct xenvif_queue *queue); -void xenvif_wake_queue (struct xenvif_queue *queue); -/* (Un)Map communication rings. */ void xenvif_unmap_frontend_data_rings (struct xenvif_queue *queue); int xenvif_map_frontend_data_rings(struct xenvif_queue *queue,
@@ -372,7 +364,6 @@ int xenvif_dealloc_kthread(void *data);irqreturn_t xenvif_ctrl_irq_fn (int irq,void *data);bool xenvif_have_rx_work (struct xenvif_queue *queue,bool test_kthread); -void xenvif_rx_action (struct xenvif_queue *queue);void xenvif_rx_queue_tail (struct xenvif_queue *queue,struct sk_buff *skb);void xenvif_carrier_on (struct xenvif *vif);
@@ -380,9 +371,6 @@ void xenvif_carrier_on(struct xenvif *vif);/* Callback from stack when TX packet can be released */ void xenvif_zerocopy_callback (struct ubuf_info *ubuf,bool zerocopy_success); -/* Unmap a pending page and release it back to the guest */ -void xenvif_idx_unmap (struct xenvif_queue *queue,u16 pending_idx); -static inline pending_ring_idx_t nr_pending_reqs (struct xenvif_queue *queue) { return MAX_PENDING_REQS -
drivers/net/xen-netback/interface.c +1 -15
@@ -69,7 +69,7 @@ void xenvif_skb_zerocopy_complete(struct xenvif_queue *queue)wake_up (&queue->dealloc_wq); } -int xenvif_schedulable (struct xenvif *vif) +static int xenvif_schedulable (struct xenvif *vif) {return netif_running (vif->dev) && test_bit(VIF_STATUS_CONNECTED, &vif->status) &&
@@ -177,20 +177,6 @@ irqreturn_t xenvif_interrupt(int irq, void *dev_id)return IRQ_HANDLED ; } -int xenvif_queue_stopped (struct xenvif_queue *queue) -{ -struct net_device *dev = queue->vif->dev; -unsigned int id = queue->id; -return netif_tx_queue_stopped (netdev_get_tx_queue (dev, id)); -} - -void xenvif_wake_queue (struct xenvif_queue *queue) -{ -struct net_device *dev = queue->vif->dev; -unsigned int id = queue->id; -netif_tx_wake_queue (netdev_get_tx_queue (dev, id)); -} -static u16 xenvif_select_queue (struct net_device *dev,struct sk_buff *skb,void *accel_priv,select_queue_fallback_t fallback)
drivers/net/xen-netback/netback.c +3 -1
@@ -105,6 +105,8 @@ static void make_tx_response(struct xenvif_queue *queue, s8 st);static void push_tx_responses (struct xenvif_queue *queue); +static void xenvif_idx_unmap (struct xenvif_queue *queue,u16 pending_idx); +static inline int tx_work_todo (struct xenvif_queue *queue); static inline unsigned long idx_to_pfn(struct xenvif_queue *queue,
@@ -1426,7 +1428,7 @@ static void push_tx_responses(struct xenvif_queue *queue)notify_remote_via_irq (queue->tx_irq); } -void xenvif_idx_unmap (struct xenvif_queue *queue,u16 pending_idx) +static void xenvif_idx_unmap (struct xenvif_queue *queue,u16 pending_idx) {int ret;struct gnttab_unmap_grant_ref tx_unmap_op;
drivers/net/xen-netback/rx.c +1 -1
@@ -473,7 +473,7 @@ void xenvif_rx_skb(struct xenvif_queue *queue)#define RX_BATCH_SIZE 64 -void xenvif_rx_action (struct xenvif_queue *queue) +static void xenvif_rx_action (struct xenvif_queue *queue) {struct sk_buff_head completed_skbs;unsigned int work_done =0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 8/31 xen/netback: dont call kfree_skb() with interrupts disabled
In reply to Greg Kroah-HartmanFrom: Juergen Gross <[email protected]>
[ Upstream commit 74e7e1efdad45580cc3839f2a155174cf158f9b5 ]
It is not allowed to call kfree_skb() from hardware interrupt context or with interrupts being disabled. So remove kfree_skb() from the spin_lock_irqsave() section and use the already existing "drop" label in xenvif_start_xmit() for dropping the SKB. At the same time replace the dev_kfree_skb() call there with a call of dev_kfree_skb_any(), as xenvif_start_xmit() can be called with disabled interrupts.
This is XSA-424 / CVE-2022-42328 / CVE-2022-42329.
--- drivers/net/xen-netback/common.h | 2 +- drivers/net/xen-netback/interface.c | 6 ++++-- drivers/net/xen-netback/rx.c | 8 +++++--- 3 files changed, 10 insertions(+), 6 deletions(-)
drivers/net/xen-netback/common.h +1 -1
@@ -364,7 +364,7 @@ int xenvif_dealloc_kthread(void *data);irqreturn_t xenvif_ctrl_irq_fn (int irq,void *data);bool xenvif_have_rx_work (struct xenvif_queue *queue,bool test_kthread); -void xenvif_rx_queue_tail (struct xenvif_queue *queue,struct sk_buff *skb); +bool xenvif_rx_queue_tail (struct xenvif_queue *queue,struct sk_buff *skb);void xenvif_carrier_on (struct xenvif *vif);
drivers/net/xen-netback/interface.c +4 -2
@@ -249,14 +249,16 @@ xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev)if (vif->hash.alg ==XEN_NETIF_CTRL_HASH_ALGORITHM_NONE )skb_clear_hash (skb); -xenvif_rx_queue_tail (queue, skb); +if (!xenvif_rx_queue_tail (queue, skb)) + goto drop; +xenvif_kick_thread (queue);return NETDEV_TX_OK ; drop: vif->dev->stats.tx_dropped++; -dev_kfree_skb (skb); +dev_kfree_skb_any (skb);return NETDEV_TX_OK ; }
drivers/net/xen-netback/rx.c +5 -3
@@ -82,9 +82,10 @@ static bool xenvif_rx_ring_slots_available(struct xenvif_queue *queue)return false; } -void xenvif_rx_queue_tail (struct xenvif_queue *queue,struct sk_buff *skb) +bool xenvif_rx_queue_tail (struct xenvif_queue *queue,struct sk_buff *skb) {unsigned long flags; +bool ret = true;spin_lock_irqsave (&queue->rx_queue.lock, flags);
@@ -92,8 +93,7 @@ void xenvif_rx_queue_tail(struct xenvif_queue *queue, struct sk_buff *skb)struct net_device *dev = queue->vif->dev;netif_tx_stop_queue (netdev_get_tx_queue (dev, queue->id)); -kfree_skb (skb); - queue->vif->dev->stats.rx_dropped++; + ret = false; }else {if (skb_queue_empty (&queue->rx_queue))xenvif_update_needed_slots (queue, skb);
@@ -104,6 +104,8 @@ void xenvif_rx_queue_tail(struct xenvif_queue *queue, struct sk_buff *skb) }spin_unlock_irqrestore (&queue->rx_queue.lock, flags); + +return ret; }static struct sk_buff *xenvif_rx_dequeue (struct xenvif_queue *queue)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 9/31 rcutorture: Automatically create initrd directory
In reply to Greg Kroah-HartmanFrom: Connor Shu <[email protected]>
[ Upstream commit 8f15c682ac5a778feb8e343f9057b89beb40d85b ]
The rcutorture scripts currently expect the user to create the tools/testing/selftests/rcutorture/initrd directory. Should the user fail to do this, the kernel build will fail with obscure and confusing error messages. This commit therefore adds explicit checks for the tools/testing/selftests/rcutorture/initrd directory, and if not present, creates one on systems on which dracut is installed. If this directory could not be created, a less obscure error message is emitted and the test is aborted.
[ paulmck: Adapt the script to fit into the rcutorture framework and
severely abbreviate the initrd/init script. ]
--- tools/testing/selftests/rcutorture/bin/kvm.sh | 8 ++ tools/testing/selftests/rcutorture/bin/mkinitrd.sh | 60 +++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100755 tools/testing/selftests/rcutorture/bin/mkinitrd.sh
tools/testing/selftests/rcutorture/bin/kvm.sh +8 -0
@@ -175,6 +175,14 @@ do shift done +if test -z "$TORTURE_INITRD" || tools/testing/selftests/rcutorture/bin/mkinitrd.sh +then + : +else + echo No initrd and unable to create one, aborting test >&2 + exit 1 +fi + CONFIGFRAG=${KVM}/configs/${TORTURE_SUITE}; export CONFIGFRAG if test -z "$configs"
tools/testing/selftests/rcutorture/bin/mkinitrd.sh new file +60 -0
60 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 10/31 mmc: sdhci: use FIELD_GET for preset value bit masks
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
commit fa0910107a9fea170b817f31da2a65463e00e80e upstream.
Use the FIELD_GET macro to get access to the register fields. Delete the shift macros.
--- drivers/mmc/host/sdhci.c | 10 +++++----- drivers/mmc/host/sdhci.h | 10 ++++------ 2 files changed, 9 insertions(+), 11 deletions(-)
drivers/mmc/host/sdhci.c +5 -5
@@ -13,6 +13,7 @@* - JMicron (hardware and technical support) */ +#include <linux/bitfield.h> #include <linux/delay.h> #include <linux/highmem.h> #include <linux/io.h>
@@ -1266,10 +1267,9 @@ u16 sdhci_calc_clk(struct sdhci_host *ho clk =sdhci_readw (host,SDHCI_CLOCK_CONTROL ); pre_val =sdhci_get_preset_value (host); - div = (pre_val &SDHCI_PRESET_SDCLK_FREQ_MASK ) - >>SDHCI_PRESET_SDCLK_FREQ_SHIFT ; + div =FIELD_GET (SDHCI_PRESET_SDCLK_FREQ_MASK , pre_val);if (host->clk_mul && - (pre_val &SDHCI_PRESET_CLKGEN_SEL_MASK )) { + (pre_val &SDHCI_PRESET_CLKGEN_SEL )) { clk =SDHCI_PROG_CLOCK_MODE ; real_div = div +1 ; clk_mul = host->clk_mul;
@@ -1720,8 +1720,8 @@ static void sdhci_set_ios(struct mmc_hossdhci_enable_preset_value (host, true); preset =sdhci_get_preset_value (host); - ios->drv_type = (preset &SDHCI_PRESET_DRV_MASK ) - >>SDHCI_PRESET_DRV_SHIFT ; + ios->drv_type =FIELD_GET (SDHCI_PRESET_DRV_MASK , + preset); }/* Re-enable SD Clock */
drivers/mmc/host/sdhci.h +4 -6
@@ -13,6 +13,7 @@#ifndef __SDHCI_HW_H#define __SDHCI_HW_H +#include <linux/bits.h> #include <linux/scatterlist.h> #include <linux/compiler.h> #include <linux/types.h>
@@ -244,12 +245,9 @@#define SDHCI_PRESET_FOR_SDR104 0x6C#define SDHCI_PRESET_FOR_DDR50 0x6E#define SDHCI_PRESET_FOR_HS400 0x74/* Non-standard */ -#define SDHCI_PRESET_DRV_MASK 0xC000 -#define SDHCI_PRESET_DRV_SHIFT 14 -#define SDHCI_PRESET_CLKGEN_SEL_MASK 0x400 -#define SDHCI_PRESET_CLKGEN_SEL_SHIFT 10 -#define SDHCI_PRESET_SDCLK_FREQ_MASK 0x3FF -#define SDHCI_PRESET_SDCLK_FREQ_SHIFT 0 +#define SDHCI_PRESET_DRV_MASK GENMASK(15, 14) +#define SDHCI_PRESET_CLKGEN_SEL BIT(10) +#define SDHCI_PRESET_SDCLK_FREQ_MASK GENMASK(9, 0)#define SDHCI_SLOT_INT_STATUS 0xFC
Greg Kroah-Hartman
maintainerPATCH 11/31 mmc: sdhci: Fix voltage switch delay
In reply to Greg Kroah-HartmanFrom: Adrian Hunter <[email protected]>
commit c981cdfb9925f64a364f13c2b4f98f877308a408 upstream.
Commit 20b92a30b561 ("mmc: sdhci: update signal voltage switch code") removed voltage switch delays from sdhci because mmc core had been enhanced to support them. However that assumed that sdhci_set_ios() did a single clock change, which it did not, and so the delays in mmc core, which should have come after the first clock change, were not effective.
Fix by avoiding re-configuring UHS and preset settings when the clock is turning on and the settings have not changed. That then also avoids the associated clock changes, so that then sdhci_set_ios() does a single clock change when voltage switching, and the mmc core delays become effective.
To do that has meant keeping track of driver strength (host->drv_type), and cases of reinitialization (host->reinit_uhs).
Note also, the 'turning_on_clk' restriction should not be necessary but is done to minimize the impact of the change on stable kernels.
--- drivers/mmc/host/sdhci.c | 63 +++++++++++++++++++++++++++++++++++++++++------ drivers/mmc/host/sdhci.h | 2 + 2 files changed, 57 insertions(+), 8 deletions(-)
drivers/mmc/host/sdhci.c +55 -8
@@ -240,6 +240,7 @@ static void sdhci_init(struct sdhci_hostif (soft) {/* force clock reconfiguration */ host->clock =0 ; + host->reinit_uhs = true; mmc->ops->set_ios (mmc, &mmc->ios); } }
@@ -1580,12 +1581,47 @@ void sdhci_set_uhs_signaling(struct sdhc }EXPORT_SYMBOL_GPL (sdhci_set_uhs_signaling); +static bool sdhci_timing_has_preset (unsigned char timing) +{ +switch (timing) { +case MMC_TIMING_UHS_SDR12 : +case MMC_TIMING_UHS_SDR25 : +case MMC_TIMING_UHS_SDR50 : +case MMC_TIMING_UHS_SDR104 : +case MMC_TIMING_UHS_DDR50 : +case MMC_TIMING_MMC_DDR52 : +return true; + }; +return false; +} + +static bool sdhci_preset_needed (struct sdhci_host *host,unsigned char timing) +{ +return !(host->quirks2 &SDHCI_QUIRK2_PRESET_VALUE_BROKEN ) && +sdhci_timing_has_preset (timing); +} + +static bool sdhci_presetable_values_change (struct sdhci_host *host,struct mmc_ios *ios) +{ +/* +* Preset Values are: Driver Strength, Clock Generator and SDCLK/RCLK +* Frequency. Check if preset values need to be enabled, or the Driver +* Strength needs updating. Note, clock changes are handled separately. +*/ +return !host->preset_enabled && + (sdhci_preset_needed (host, ios->timing) || host->drv_type != ios->drv_type); +} +static void sdhci_set_ios (struct mmc_host *mmc,struct mmc_ios *ios) {struct sdhci_host *host =mmc_priv (mmc); +bool reinit_uhs = host->reinit_uhs; +bool turning_on_clk = false;unsigned long flags;u8 ctrl; + host->reinit_uhs = false; +spin_lock_irqsave (&host->lock, flags);if (host->flags &SDHCI_DEVICE_DEAD ) {
@@ -1611,6 +1647,8 @@ static void sdhci_set_ios(struct mmc_hossdhci_enable_preset_value (host, false);if (!ios->clock || ios->clock != host->clock) { + turning_on_clk = ios->clock && !host->clock; + host->ops->set_clock (host, ios->clock); host->clock = ios->clock;
@@ -1637,6 +1675,17 @@ static void sdhci_set_ios(struct mmc_hos host->ops->set_bus_width (host, ios->bus_width); +/* +* Special case to avoid multiple clock changes during voltage +* switching. +*/ +if (!reinit_uhs && + turning_on_clk && + host->timing == ios->timing && + host->version >=SDHCI_SPEC_300 && + !sdhci_presetable_values_change (host, ios)) + goto out; + ctrl =sdhci_readb (host,SDHCI_HOST_CONTROL ); if ((ios->timing == MMC_TIMING_SD_HS ||
@@ -1682,6 +1731,7 @@ static void sdhci_set_ios(struct mmc_hos }sdhci_writew (host, ctrl_2,SDHCI_HOST_CONTROL2 ); + host->drv_type = ios->drv_type; }else {/* * According to SDHC Spec v3.00, if the Preset Value
@@ -1709,26 +1759,21 @@ static void sdhci_set_ios(struct mmc_hos host->ops->set_uhs_signaling (host, ios->timing); host->timing = ios->timing; -if (!(host->quirks2 &SDHCI_QUIRK2_PRESET_VALUE_BROKEN ) && - ((ios->timing ==MMC_TIMING_UHS_SDR12 ) || - (ios->timing ==MMC_TIMING_UHS_SDR25 ) || - (ios->timing ==MMC_TIMING_UHS_SDR50 ) || - (ios->timing ==MMC_TIMING_UHS_SDR104 ) || - (ios->timing ==MMC_TIMING_UHS_DDR50 ) || - (ios->timing ==MMC_TIMING_MMC_DDR52 ))) { +if (sdhci_preset_needed (host, ios->timing)) {u16 preset;sdhci_enable_preset_value (host, true); preset =sdhci_get_preset_value (host); ios->drv_type =FIELD_GET (SDHCI_PRESET_DRV_MASK , preset); + host->drv_type = ios->drv_type; }/* Re-enable SD Clock */ host->ops->set_clock (host, host->clock); }else sdhci_writeb (host, ctrl,SDHCI_HOST_CONTROL ); - +out:/* * Some (ENE) controllers go apeshit on some ios operation, * signalling timeout and CRC errors even on CMD0. Resetting
@@ -2882,6 +2927,7 @@ int sdhci_resume_host(struct sdhci_hostsdhci_init (host,0 ); host->pwr =0 ; host->clock =0 ; + host->reinit_uhs = true; mmc->ops->set_ios (mmc, &mmc->ios); }else {sdhci_init (host, (host->mmc->pm_flags &MMC_PM_KEEP_POWER ));
@@ -2946,6 +2992,7 @@ int sdhci_runtime_resume_host(struct sdh/* Force clock and power re-program */ host->pwr =0 ; host->clock =0 ; + host->reinit_uhs = true; mmc->ops->start_signal_voltage_switch (mmc, &mmc->ios); mmc->ops->set_ios (mmc, &mmc->ios);
drivers/mmc/host/sdhci.h +2 -0
@@ -466,6 +466,8 @@ struct sdhci_host {unsigned int clock;/* Current clock (MHz) */ u8 pwr;/* Current voltage */ +u8 drv_type;/* Current UHS-I driver type */ +bool reinit_uhs;/* Force UHS-related re-initialization */ bool runtime_suspended;/* Host is runtime suspended */ bool bus_on;/* Bus power prevents runtime suspend */
Greg Kroah-Hartman
maintainerPATCH 12/31 media: v4l2-dv-timings.c: fix too strict blanking sanity checks
In reply to Greg Kroah-HartmanFrom: Hans Verkuil <[email protected]>
commit 5eef2141776da02772c44ec406d6871a790761ee upstream.
Sanity checks were added to verify the v4l2_bt_timings blanking fields in order to avoid integer overflows when userspace passes weird values.
But that assumed that userspace would correctly fill in the front porch, backporch and sync values, but sometimes all you know is the total blanking, which is then assigned to just one of these fields.
And that can fail with these checks.
So instead set a maximum for the total horizontal and vertical blanking and check that each field remains below that.
That is still sufficient to avoid integer overflows, but it also allows for more flexibility in how userspace fills in these fields.
--- drivers/media/v4l2-core/v4l2-dv-timings.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/media/v4l2-core/v4l2-dv-timings.c +14 -6
@@ -155,6 +155,8 @@ bool v4l2_valid_dv_timings(const structconst struct v4l2_bt_timings *bt = &t->bt;const struct v4l2_bt_timings_cap *cap = &dvcap->bt;u32 caps = cap->capabilities; +const u32 max_vert =10240 ; +u32 max_hor =3 * bt->width;if (t->type !=V4L2_DV_BT_656_1120 )return false;
@@ -176,14 +178,20 @@ bool v4l2_valid_dv_timings(const structif (!bt->interlaced && (bt->il_vbackporch || bt->il_vsync || bt->il_vfrontporch))return false; -if (bt->hfrontporch >2 * bt->width || - bt->hsync >1024 || bt->hbackporch >1024 ) +/* +* Some video receivers cannot properly separate the frontporch, +* backporch and sync values, and instead they only have the total +* blanking. That can be assigned to any of these three fields. +* So just check that none of these are way out of range. +*/ +if (bt->hfrontporch > max_hor || + bt->hsync > max_hor || bt->hbackporch > max_hor)return false; -if (bt->vfrontporch >4096 || - bt->vsync >128 || bt->vbackporch >4096 ) +if (bt->vfrontporch > max_vert || + bt->vsync > max_vert || bt->vbackporch > max_vert)return false; -if (bt->interlaced && (bt->il_vfrontporch >4096 || - bt->il_vsync >128 || bt->il_vbackporch >4096 )) +if (bt->interlaced && (bt->il_vfrontporch > max_vert || + bt->il_vsync > max_vert || bt->il_vbackporch > max_vert))return false;return fnc ==NULL ||fnc (t, fnc_handle); }
Greg Kroah-Hartman
maintainerPATCH 13/31 HID: hid-lg4ff: Add check for empty lbuf
In reply to Greg Kroah-HartmanFrom: Anastasia Belova <[email protected]>
commit d180b6496143cd360c5d5f58ae4b9a8229c1f344 upstream.
If an empty buf is received, lbuf is also empty. So lbuf is accessed by index -1.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/hid/hid-lg4ff.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/hid/hid-lg4ff.c +6 -0
@@ -880,6 +880,12 @@ static ssize_t lg4ff_alternate_modes_storeturn -ENOMEM ; i =strlen (lbuf); + +if (i ==0 ) { +kfree (lbuf); +return -EINVAL ; + } +if (lbuf[i-1 ] =='\n' ) {if (i ==1 ) {kfree (lbuf);
Greg Kroah-Hartman
maintainerPATCH 14/31 HID: core: fix shift-out-of-bounds in hid_report_raw_event
In reply to Greg Kroah-HartmanFrom: ZhangPeng <[email protected]>
commit ec61b41918587be530398b0d1c9a0d16619397e5 upstream.
Syzbot reported shift-out-of-bounds in hid_report_raw_event.
microsoft 0003:045E:07DA.0001: hid_field_extract() called with n (128) > 32! (swapper/0)
======================================================================
UBSAN: shift-out-of-bounds in drivers/hid/hid-core.c:1323:20 shift exponent 127 is too large for 32-bit type 'int' CPU: 0 PID: 0 Comm: swapper/0 Not tainted 6.1.0-rc4-syzkaller-00159-g4bbf3422df78 #0 Hardware name: Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Call Trace: <IRQ> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 ubsan_epilogue lib/ubsan.c:151 [inline] __ubsan_handle_shift_out_of_bounds+0x3a6/0x420 lib/ubsan.c:322 snto32 drivers/hid/hid-core.c:1323 [inline] hid_input_fetch_field drivers/hid/hid-core.c:1572 [inline] hid_process_report drivers/hid/hid-core.c:1665 [inline] hid_report_raw_event+0xd56/0x18b0 drivers/hid/hid-core.c:1998 hid_input_report+0x408/0x4f0 drivers/hid/hid-core.c:2066 hid_irq_in+0x459/0x690 drivers/hid/usbhid/hid-core.c:284 __usb_hcd_giveback_urb+0x369/0x530 drivers/usb/core/hcd.c:1671 dummy_timer+0x86b/0x3110 drivers/usb/gadget/udc/dummy_hcd.c:1988 call_timer_fn+0xf5/0x210 kernel/time/timer.c:1474 expire_timers kernel/time/timer.c:1519 [inline] __run_timers+0x76a/0x980 kernel/time/timer.c:1790 run_timer_softirq+0x63/0xf0 kernel/time/timer.c:1803 __do_softirq+0x277/0x75b kernel/softirq.c:571 __irq_exit_rcu+0xec/0x170 kernel/softirq.c:650 irq_exit_rcu+0x5/0x20 kernel/softirq.c:662 sysvec_apic_timer_interrupt+0x91/0xb0 arch/x86/kernel/apic/apic.c:1107 ======================================================================
If the size of the integer (unsigned n) is bigger than 32 in snto32(), shift exponent will be too large for 32-bit type 'int', resulting in a shift-out-of-bounds bug.
Fix this by adding a check on the size of the integer (unsigned n) in snto32(). To add support for n greater than 32 bits, set n to 32, if n is greater than 32.
--- drivers/hid/hid-core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/hid/hid-core.c +3 -0
@@ -1112,6 +1112,9 @@ static s32 snto32(__u32 value, unsignedif (!value || !n)return 0 ; +if (n >32 ) + n =32 ; +switch (n) {case 8 :return ((__s8 )value);case 16 :return ((__s16 )value);
Greg Kroah-Hartman
maintainerPATCH 15/31 ieee802154: cc2520: Fix error return code in cc2520_hw_init()
In reply to Greg Kroah-HartmanFrom: Ziyang Xuan <[email protected]>
[ Upstream commit 4d002d6a2a00ac1c433899bd7625c6400a74cfba ]
In cc2520_hw_init(), if oscillator start failed, the error code should be returned.
--- drivers/net/ieee802154/cc2520.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ieee802154/cc2520.c +1 -1
@@ -979,7 +979,7 @@ static int cc2520_hw_init(struct cc2520_private *priv)if (timeout-- <=0 ) {dev_err (&priv->spi->dev,"oscillator start failed!\n" ); -return ret; +return -ETIMEDOUT ; }udelay (1 ); }while (!(status &CC2520_STATUS_XOSC32M_STABLE ));
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 16/31 gpio: amd8111: Fix PCI device reference count leak
In reply to Greg Kroah-HartmanFrom: Xiongfeng Wang <[email protected]>
[ Upstream commit 45fecdb9f658d9c82960c98240bc0770ade19aca ]
for_each_pci_dev() is implemented by pci_get_device(). The comment of pci_get_device() says that it will increase the reference count for the returned pci_dev and also decrease the reference count for the input pci_dev @from if it is not NULL.
If we break for_each_pci_dev() loop with pdev not NULL, we need to call pci_dev_put() to decrease the reference count. Add the missing pci_dev_put() after the 'out' label. Since pci_dev_put() can handle NULL input parameter, there is no problem for the 'Device not found' branch. For the normal path, add pci_dev_put() in amd_gpio_exit().
--- drivers/gpio/gpio-amd8111.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpio/gpio-amd8111.c +4 -0
@@ -231,7 +231,10 @@ static int __init amd_gpio_init(void)ioport_unmap (gp.pm); goto out; } +return 0 ; + out: +pci_dev_put (pdev);return err; }
@@ -239,6 +242,7 @@ static void __exit amd_gpio_exit(void) {gpiochip_remove (&gp.chip);ioport_unmap (gp.pm); +pci_dev_put (gp.pdev); }module_init (amd_gpio_init);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 17/31 e1000e: Fix TX dispatch condition
In reply to Greg Kroah-HartmanFrom: Akihiko Odaki <[email protected]>
[ Upstream commit eed913f6919e253f35d454b2f115f2a4db2b741a ]
e1000_xmit_frame is expected to stop the queue and dispatch frames to hardware if there is not sufficient space for the next frame in the buffer, but sometimes it failed to do so because the estimated maximum size of frame was wrong. As the consequence, the later invocation of e1000_xmit_frame failed with NETDEV_TX_BUSY, and the frame in the buffer remained forever, resulting in a watchdog failure.
This change fixes the estimated size by making it match with the condition for NETDEV_TX_BUSY. Apparently, the old estimation failed to account for the following lines which determines the space requirement for not causing NETDEV_TX_BUSY:
```
/* reserve a descriptor for the offload context */
if ((mss) || (skb->ip_summed == CHECKSUM_PARTIAL))
count++;
count++;
count += DIV_ROUND_UP(len, adapter->tx_fifo_limit);
```This issue was found when running http-stress02 test included in Linux Test Project 20220930 on QEMU with the following commandline:
``` qemu-system-x86_64 -M q35,accel=kvm -m 8G -smp 8 -drive if=virtio,format=raw,file=root.img,file.locking=on -device e1000e,netdev=netdev -netdev tap,script=ifup,downscript=no,id=netdev ```
--- drivers/net/ethernet/intel/e1000e/netdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/e1000e/netdev.c +2 -2
@@ -5875,9 +5875,9 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,e1000_tx_queue (tx_ring, tx_flags, count);/* Make sure there is space in the ring for the next send. */ e1000_maybe_stop_tx (tx_ring, - (MAX_SKB_FRAGS * + ((MAX_SKB_FRAGS +1 ) *DIV_ROUND_UP (PAGE_SIZE , - adapter->tx_fifo_limit) +2 )); + adapter->tx_fifo_limit) +4 ));if (!skb->xmit_more ||netif_xmit_stopped (netdev_get_tx_queue (netdev,0 ))) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 18/31 igb: Allocate MSI-X vector when testing
In reply to Greg Kroah-HartmanFrom: Akihiko Odaki <[email protected]>
[ Upstream commit 28e96556baca7056d11d9fb3cdd0aba4483e00d8 ]
Without this change, the interrupt test fail with MSI-X environment:
$ sudo ethtool -t enp0s2 offline [ 43.921783] igb 0000:00:02.0: offline testing starting [ 44.855824] igb 0000:00:02.0 enp0s2: igb: enp0s2 NIC Link is Down [ 44.961249] igb 0000:00:02.0 enp0s2: igb: enp0s2 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX/TX [ 51.272202] igb 0000:00:02.0: testing shared interrupt [ 56.996975] igb 0000:00:02.0 enp0s2: igb: enp0s2 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX/TX The test result is FAIL The test extra info: Register test (offline) 0 Eeprom test (offline) 0 Interrupt test (offline) 4 Loopback test (offline) 0 Link test (on/offline) 0
Here, "4" means an expected interrupt was not delivered.
To fix this, route IRQs correctly to the first MSI-X vector by setting IVAR_MISC. Also, set bit 0 of EIMS so that the vector will not be masked. The interrupt test now runs properly with this change:
$ sudo ethtool -t enp0s2 offline [ 42.762985] igb 0000:00:02.0: offline testing starting [ 50.141967] igb 0000:00:02.0: testing shared interrupt [ 56.163957] igb 0000:00:02.0 enp0s2: igb: enp0s2 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX/TX The test result is PASS The test extra info: Register test (offline) 0 Eeprom test (offline) 0 Interrupt test (offline) 0 Loopback test (offline) 0 Link test (on/offline) 0
--- drivers/net/ethernet/intel/igb/igb_ethtool.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/intel/igb/igb_ethtool.c +2 -0
@@ -1401,6 +1401,8 @@ static int igb_intr_test(struct igb_adapter *adapter, u64 *data) *data =1 ;return -1 ; } +wr32 (E1000_IVAR_MISC ,E1000_IVAR_VALID <<8 ); +wr32 (E1000_EIMS ,BIT (0 )); }else if (adapter->flags &IGB_FLAG_HAS_MSI ) { shared_int = false; if (request_irq(irq,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 19/31 Bluetooth: 6LoWPAN: add missing hci_dev_put() in get_l2cap_conn()
In reply to Greg Kroah-HartmanFrom: Wang ShaoBo <[email protected]>
[ Upstream commit 747da1308bdd5021409974f9180f0d8ece53d142 ]
hci_get_route() takes reference, we should use hci_dev_put() to release it when not need anymore.
--- net/bluetooth/6lowpan.c | 1 + 1 file changed, 1 insertion(+)
net/bluetooth/6lowpan.c +1 -0
@@ -1119,6 +1119,7 @@ static int get_l2cap_conn(char *buf, bdaddr_t *addr, u8 *addr_type,hci_dev_lock (hdev); hcon =hci_conn_hash_lookup_le (hdev, addr, *addr_type);hci_dev_unlock (hdev); +hci_dev_put (hdev);if (!hcon)return -ENOENT ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 20/31 mac802154: fix missing INIT_LIST_HEAD in ieee802154_if_add()
In reply to Greg Kroah-HartmanFrom: Wei Yongjun <[email protected]>
[ Upstream commit b3d72d3135d2ef68296c1ee174436efd65386f04 ]
Kernel fault injection test reports null-ptr-deref as follows:
BUG: kernel NULL pointer dereference, address: 0000000000000008 RIP: 0010:cfg802154_netdev_notifier_call+0x120/0x310 include/linux/list.h:114 Call Trace: <TASK> raw_notifier_call_chain+0x6d/0xa0 kernel/notifier.c:87 call_netdevice_notifiers_info+0x6e/0xc0 net/core/dev.c:1944 unregister_netdevice_many_notify+0x60d/0xcb0 net/core/dev.c:1982 unregister_netdevice_queue+0x154/0x1a0 net/core/dev.c:10879 register_netdevice+0x9a8/0xb90 net/core/dev.c:10083 ieee802154_if_add+0x6ed/0x7e0 net/mac802154/iface.c:659 ieee802154_register_hw+0x29c/0x330 net/mac802154/main.c:229 mcr20a_probe+0xaaa/0xcb1 drivers/net/ieee802154/mcr20a.c:1316
ieee802154_if_add() allocates wpan_dev as netdev's private data, but not init the list in struct wpan_dev. cfg802154_netdev_notifier_call() manage the list when device register/unregister, and may lead to null-ptr-deref.
Use INIT_LIST_HEAD() on it to initialize it correctly.
--- net/mac802154/iface.c | 1 + 1 file changed, 1 insertion(+)
net/mac802154/iface.c +1 -0
@@ -670,6 +670,7 @@ ieee802154_if_add(struct ieee802154_local *local, const char *name, sdata->dev = ndev; sdata->wpan_dev.wpan_phy = local->hw.phy; sdata->local = local; +INIT_LIST_HEAD (&sdata->wpan_dev.list);/* setup type-dependent data */ ret =ieee802154_setup_sdata (sdata, type);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 21/31 net: encx24j600: Add parentheses to fix precedence
In reply to Greg Kroah-HartmanFrom: Valentina Goncharenko <[email protected]>
[ Upstream commit 167b3f2dcc62c271f3555b33df17e361bb1fa0ee ]
In functions regmap_encx24j600_phy_reg_read() and regmap_encx24j600_phy_reg_write() in the conditions of the waiting cycles for filling the variable 'ret' it is necessary to add parentheses to prevent wrong assignment due to logical operations precedence.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/net/ethernet/microchip/encx24j600-regmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/microchip/encx24j600-regmap.c +2 -2
@@ -363,7 +363,7 @@ static int regmap_encx24j600_phy_reg_read(void *context, unsigned int reg, goto err_out;usleep_range (26 ,100 ); -while ((ret =regmap_read (ctx->regmap,MISTAT , &mistat) !=0 ) && +while (((ret =regmap_read (ctx->regmap,MISTAT , &mistat)) !=0 ) && (mistat &BUSY ))cpu_relax ();
@@ -401,7 +401,7 @@ static int regmap_encx24j600_phy_reg_write(void *context, unsigned int reg, goto err_out;usleep_range (26 ,100 ); -while ((ret =regmap_read (ctx->regmap,MISTAT , &mistat) !=0 ) && +while (((ret =regmap_read (ctx->regmap,MISTAT , &mistat)) !=0 ) && (mistat &BUSY ))cpu_relax ();
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 22/31 net: encx24j600: Fix invalid logic in reading of MISTAT register
In reply to Greg Kroah-HartmanFrom: Valentina Goncharenko <[email protected]>
[ Upstream commit 25f427ac7b8d89b0259f86c0c6407b329df742b2 ]
A loop for reading MISTAT register continues while regmap_read() fails and (mistat & BUSY), but if regmap_read() fails a value of mistat is undefined.
The patch proposes to check for BUSY flag only when regmap_read() succeed. Compile test only.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/net/ethernet/microchip/encx24j600-regmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/microchip/encx24j600-regmap.c +2 -2
@@ -363,7 +363,7 @@ static int regmap_encx24j600_phy_reg_read(void *context, unsigned int reg, goto err_out;usleep_range (26 ,100 ); -while (((ret =regmap_read (ctx->regmap,MISTAT , &mistat)) !=0 ) && +while (((ret =regmap_read (ctx->regmap,MISTAT , &mistat)) ==0 ) && (mistat &BUSY ))cpu_relax ();
@@ -401,7 +401,7 @@ static int regmap_encx24j600_phy_reg_write(void *context, unsigned int reg, goto err_out;usleep_range (26 ,100 ); -while (((ret =regmap_read (ctx->regmap,MISTAT , &mistat)) !=0 ) && +while (((ret =regmap_read (ctx->regmap,MISTAT , &mistat)) ==0 ) && (mistat &BUSY ))cpu_relax ();
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 23/31 net: mvneta: Prevent out of bounds read in mvneta_config_rss()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit e8b4fc13900b8e8be48debffd0dfd391772501f7 ]
The pp->indir[0] value comes from the user. It is passed to:
if (cpu_online(pp->rxq_def))
inside the mvneta_percpu_elect() function. It needs bounds checkeding to ensure that it is not beyond the end of the cpu bitmap.
--- drivers/net/ethernet/marvell/mvneta.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/marvell/mvneta.c +3 -0
@@ -3761,6 +3761,9 @@ static int mvneta_config_rss(struct mvneta_port *pp)napi_disable (&pcpu_port->napi); } +if (pp->indir[0 ] >= nr_cpu_ids) +return -EINVAL ; + pp->rxq_def = pp->indir[0 ];/* Update unicast mapping */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 24/31 NFC: nci: Bounds check struct nfc_target arrays
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit e329e71013c9b5a4535b099208493c7826ee4a64 ]
While running under CONFIG_FORTIFY_SOURCE=y, syzkaller reported:
memcpy: detected field-spanning write (size 129) of single field "target->sensf_res" at net/nfc/nci/ntf.c:260 (size 18)
This appears to be a legitimate lack of bounds checking in nci_add_new_protocol(). Add the missing checks.
--- net/nfc/nci/ntf.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/nfc/nci/ntf.c +6 -0
@@ -230,6 +230,8 @@ static int nci_add_new_protocol(struct nci_dev *ndev, target->sens_res = nfca_poll->sens_res; target->sel_res = nfca_poll->sel_res; target->nfcid1_len = nfca_poll->nfcid1_len; +if (target->nfcid1_len >ARRAY_SIZE (target->nfcid1)) +return -EPROTO ;if (target->nfcid1_len >0 ) {memcpy (target->nfcid1, nfca_poll->nfcid1, target->nfcid1_len);
@@ -238,6 +240,8 @@ static int nci_add_new_protocol(struct nci_dev *ndev, nfcb_poll = (struct rf_tech_specific_params_nfcb_poll *)params; target->sensb_res_len = nfcb_poll->sensb_res_len; +if (target->sensb_res_len >ARRAY_SIZE (target->sensb_res)) +return -EPROTO ;if (target->sensb_res_len >0 ) {memcpy (target->sensb_res, nfcb_poll->sensb_res, target->sensb_res_len);
@@ -246,6 +250,8 @@ static int nci_add_new_protocol(struct nci_dev *ndev, nfcf_poll = (struct rf_tech_specific_params_nfcf_poll *)params; target->sensf_res_len = nfcf_poll->sensf_res_len; +if (target->sensf_res_len >ARRAY_SIZE (target->sensf_res)) +return -EPROTO ;if (target->sensf_res_len >0 ) {memcpy (target->sensf_res, nfcf_poll->sensf_res, target->sensf_res_len);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 25/31 net: hisilicon: Fix potential use-after-free in hisi_femac_rx()
In reply to Greg Kroah-HartmanFrom: Liu Jian <[email protected]>
[ Upstream commit 4640177049549de1a43e9bc49265f0cdfce08cfd ]
The skb is delivered to napi_gro_receive() which may free it, after calling this, dereferencing skb may trigger use-after-free.
--- drivers/net/ethernet/hisilicon/hisi_femac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hisi_femac.c +1 -1
@@ -295,7 +295,7 @@ static int hisi_femac_rx(struct net_device *dev, int limit) skb->protocol =eth_type_trans (skb, dev);napi_gro_receive (&priv->napi, skb); dev->stats.rx_packets++; - dev->stats.rx_bytes += skb->len; + dev->stats.rx_bytes += len; next: pos = (pos +1 ) % rxq->num;if (rx_pkts_num >= limit)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 26/31 net: hisilicon: Fix potential use-after-free in hix5hd2_rx()
In reply to Greg Kroah-HartmanFrom: Liu Jian <[email protected]>
[ Upstream commit 433c07a13f59856e4585e89e86b7d4cc59348fab ]
The skb is delivered to napi_gro_receive() which may free it, after calling this, dereferencing skb may trigger use-after-free.
--- drivers/net/ethernet/hisilicon/hix5hd2_gmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hix5hd2_gmac.c +1 -1
@@ -498,7 +498,7 @@ static int hix5hd2_rx(struct net_device *dev, int limit) skb->protocol =eth_type_trans (skb, dev);napi_gro_receive (&priv->napi, skb); dev->stats.rx_packets++; - dev->stats.rx_bytes += skb->len; + dev->stats.rx_bytes += len; next: pos =dma_ring_incr (pos,RX_DESC_NUM ); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 27/31 tipc: Fix potential OOB in tipc_link_proto_rcv()
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit 743117a997bbd4840e827295c07e59bcd7f7caa3 ]
Fix the potential risk of OOB if skb_linearize() fails in tipc_link_proto_rcv().
--- net/tipc/link.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/tipc/link.c +3 -1
@@ -1456,7 +1456,9 @@ static int tipc_link_proto_rcv(struct tipc_link *l, struct sk_buff *skb,if (tipc_own_addr (l->net) >msg_prevnode (hdr)) l->net_plane =msg_net_plane (hdr); -skb_linearize (skb); +if (skb_linearize (skb)) + goto exit; + hdr =buf_msg (skb); data =msg_data (hdr);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 28/31 ethernet: aeroflex: fix potential skb leak in greth_init_rings()
In reply to Greg Kroah-HartmanFrom: Zhang Changzhong <[email protected]>
[ Upstream commit 063a932b64db3317ec020c94466fe52923a15f60 ]
The greth_init_rings() function won't free the newly allocated skb when dma_mapping_error() returns error, so add dev_kfree_skb() to fix it.
Compile tested only.
--- drivers/net/ethernet/aeroflex/greth.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/aeroflex/greth.c +1 -0
@@ -261,6 +261,7 @@ static int greth_init_rings(struct greth_private *greth)if (dma_mapping_error (greth->dev, dma_addr)) {if (netif_msg_ifup (greth))dev_err (greth->dev,"Could not create initial DMA mapping\n" ); +dev_kfree_skb (skb); goto cleanup; } greth->rx_skbuff[i] = skb;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 29/31 xen/netback: fix build warning
In reply to Greg Kroah-HartmanFrom: Juergen Gross <[email protected]>
[ Upstream commit 7dfa764e0223a324366a2a1fc056d4d9d4e95491 ]
Commit ad7f402ae4f4 ("xen/netback: Ensure protocol headers don't fall in the non-linear area") introduced a (valid) build warning. There have even been reports of this problem breaking networking of Xen guests.
--- drivers/net/xen-netback/netback.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/xen-netback/netback.c +1 -1
@@ -523,7 +523,7 @@ static int xenvif_tx_check_gop(struct xenvif_queue *queue,const bool sharedslot = nr_frags &&frag_get_pending_idx (&shinfo->frags[0 ]) ==copy_pending_idx (skb,copy_count (skb) -1 ); -int i, err; +int i, err =0 ;for (i =0 ; i <copy_count (skb); i++) {int newerr;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 30/31 net: plip: dont call kfree_skb/dev_kfree_skb() under spin_lock_irq()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 7d8c19bfc8ff3f78e5337107ca9246327fcb6b45 ]
It is not allowed to call kfree_skb() or consume_skb() from hardware interrupt context or with interrupts being disabled. So replace kfree_skb/dev_kfree_skb() with dev_kfree_skb_irq() and dev_consume_skb_irq() under spin_lock_irq().
--- drivers/net/plip/plip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/plip/plip.c +2 -2
@@ -449,12 +449,12 @@ plip_bh_timeout_error(struct net_device *dev, struct net_local *nl, } rcv->state =PLIP_PK_DONE ;if (rcv->skb) { -kfree_skb (rcv->skb); +dev_kfree_skb_irq (rcv->skb); rcv->skb =NULL ; } snd->state =PLIP_PK_DONE ;if (snd->skb) { -dev_kfree_skb (snd->skb); +dev_consume_skb_irq (snd->skb); snd->skb =NULL ; }spin_unlock_irq (&nl->lock);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 31/31 net: mvneta: Fix an out of bounds check
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit cdd97383e19d4afe29adc3376025a15ae3bab3a3 ]
In an earlier commit, I added a bounds check to prevent an out of bounds read and a WARN(). On further discussion and consideration that check was probably too aggressive. Instead of returning -EINVAL, a better fix would be to just prevent the out of bounds read but continue the process.
Background: The value of "pp->rxq_def" is a number between 0-7 by default, or even higher depending on the value of "rxq_number", which is a module parameter. If the value is more than the number of available CPUs then it will trigger the WARN() in cpu_max_bits_warn().
--- drivers/net/ethernet/marvell/mvneta.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/net/ethernet/marvell/mvneta.c +1 -4
@@ -3278,7 +3278,7 @@ static void mvneta_percpu_elect(struct mvneta_port *pp)/* Use the cpu associated to the rxq when it is online, in all * the other cases, use the cpu 0 which can't be offline. */ -if (cpu_online (pp->rxq_def)) +if (pp->rxq_def < nr_cpu_ids &&cpu_online (pp->rxq_def)) elected_cpu = pp->rxq_def; max_cpu =num_present_cpus ();
@@ -3761,9 +3761,6 @@ static int mvneta_config_rss(struct mvneta_port *pp)napi_disable (&pcpu_port->napi); } -if (pp->indir[0 ] >= nr_cpu_ids) -return -EINVAL ; - pp->rxq_def = pp->indir[0 ];/* Update unicast mapping */
Signature · 1 line
2.35.1
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 4.9.336 release. There are 31 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-4.9.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 4.9.336 release. There are 31 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, 14 Dec 2022 13:08:57 +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/v4.x/stable-review/patch-4.9.336-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.9.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v4.9:
8 builds: 8 pass, 0 fail
16 boots: 16 pass, 0 fail
32 tests: 32 pass, 0 failLinux version: 4.9.336-rc1-gc4da25efd82f
Boards tested: tegra124-jetson-tk1, tegra20-ventana,
tegra210-p2371-2180, tegra30-cardhu-a04
Jon
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.336 release. There are 31 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, 14 Dec 2022 13:08:57 +0000. Anything received after that time might be too late.
4.9.336-rc1 compiled and booted on x86_64 test systems, no errors or regressions.
Yours,
-- Slade
Slade Watkins
Tested-byQuoted 4 lines · Slade Watkins
4.9.336-rc1 compiled and booted on
x86_64test systems, no errors or regressions.
Apologies, for some reason my Tested-by: didn't insert within my script. Aagh. Will fix that now.
For now...
Sorry about that,
-- Slade
Quoted 111 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.336 release. There are 31 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, 14 Dec 2022 13:08:57 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.336-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.9.y
and the diffstat can be found below.thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:Greg Kroah-Hartman <[email protected]>
Linux 4.9.336-rc1Dan Carpenter <[email protected]>
net: mvneta: Fix an out of bounds checkYang Yingliang <[email protected]>
net: plip: don't call kfree_skb/dev_kfree_skb() underspin_lock_irq()Juergen Gross <[email protected]>
xen/netback: fix build warningZhang Changzhong <[email protected]>
ethernet: aeroflex: fix potential skb leak ingreth_init_rings()YueHaibing <[email protected]>
tipc: Fix potential OOB intipc_link_proto_rcv()Liu Jian <[email protected]>
net: hisilicon: Fix potential use-after-free inhix5hd2_rx()Liu Jian <[email protected]>
net: hisilicon: Fix potential use-after-free inhisi_femac_rx()Kees Cook <[email protected]>
NFC: nci: Bounds check structnfc_targetarraysDan Carpenter <[email protected]>
net: mvneta: Prevent out of bounds read inmvneta_config_rss()Valentina Goncharenko <[email protected]>
net: encx24j600: Fix invalid logic in reading of MISTAT registerValentina Goncharenko <[email protected]>
net: encx24j600: Add parentheses to fix precedenceWei Yongjun <[email protected]>
mac802154: fix missing INIT_LIST_HEAD in ieee802154_if_add()Wang ShaoBo <[email protected]>
Bluetooth: 6LoWPAN: add missinghci_dev_put()inget_l2cap_conn()Akihiko Odaki <[email protected]>
igb: Allocate MSI-X vector when testingAkihiko Odaki <[email protected]>
e1000e: Fix TX dispatch conditionXiongfeng Wang <[email protected]>
gpio: amd8111: Fix PCI device reference count leakZiyang Xuan <[email protected]>
ieee802154: cc2520: Fix error return code in cc2520_hw_init()ZhangPeng <[email protected]>
HID: core: fix shift-out-of-bounds inhid_report_raw_eventAnastasia Belova <[email protected]>
HID: hid-lg4ff: Add check for empty lbufHans Verkuil <[email protected]>
media:v4l2-dv-timings.c: fix too strict blanking sanity checksAdrian Hunter <[email protected]>
mmc: sdhci: Fix voltage switch delayMasahiro Yamada <[email protected]>
mmc: sdhci: useFIELD_GETfor preset value bit masksConnor Shu <[email protected]>
rcutorture: Automatically create initrd directoryJuergen Gross <[email protected]>
xen/netback: don't callkfree_skb()with interrupts disabledJuergen Gross <[email protected]>
xen/netback: do some code cleanupRoss Lagerwall <[email protected]>
xen/netback: Ensure protocol headers don't fall in the non-linear areaSrinivasa Rao Mandadapu <[email protected]>
ASoC: soc-pcm: Add NULL check in BE reparentingKees Cook <[email protected]>
ALSA: seq: Fix function prototype mismatch insnd_seq_expand_var_eventTomislav Novak <[email protected]>
ARM: 9251/1: perf: Fix stacktraces for tracepoint events in THUMB2 kernels
Quoted 8 lines
Johan Jonker <[email protected]>
ARM: dts: rockchip: fix ir-receiver node namesSebastian Reichel <[email protected]>
arm: dts: rockchip: fix node name for hym8563 rtc-------------
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels, build tested on BMIPS_GENERIC:
Signature · 1 line
Florian
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.336 release. There are 31 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, 14 Dec 2022 13:08:57 +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/v4.x/stable-review/patch-4.9.336-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.9.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 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.336 release. There are 31 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, 14 Dec 2022 13:08:57 +0000. Anything received after that time might be too late.
Build results:
total: 162 pass: 162 fail: 0 Qemu test results: total: 395 pass: 395 fail: 0
Guenter
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.336 release. There are 31 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, 14 Dec 2022 13:08:57 +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/v4.x/stable-review/patch-4.9.336-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.9.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: 4.9.336-rc1
* git: https://gitlab.com/Linaro/lkft/mirrors/stable/linux-stable-rc
* git branch: linux-4.9.y
* git commit: c4da25efd82f1a9c340da79342fe0f5228fc5165
* git describe: v4.9.335-32-gc4da25efd82f
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-4.9.y/build/v4.9.335-32-gc4da25efd82f
## Test Regressions (compared to v4.9.335)
## Metric Regressions (compared to v4.9.335)
## Test Fixes (compared to v4.9.335)
## Metric Fixes (compared to v4.9.335)
## Test result summary
total: 72922, pass: 62808, fail: 998, skip: 8302, xfail: 814
## Build Summary
* arc: 10 total, 10 passed, 0 failed
* arm: 280 total, 277 passed, 3 failed
* arm64: 51 total, 46 passed, 5 failed
* i386: 29 total, 28 passed, 1 failed
* mips: 41 total, 40 passed, 1 failed
* powerpc: 45 total, 19 passed, 26 failed
* s390: 15 total, 11 passed, 4 failed
* sh: 24 total, 24 passed, 0 failed
* sparc: 12 total, 12 passed, 0 failed
* x86_64: 48 total, 47 passed, 1 failed
## Test suites summary
* boot
* fwts
* igt-gpu-tools
* kselftest-android
* kselftest-arm64
* kselftest-arm64/arm64.btitest.bti_c_func
* kselftest-arm64/arm64.btitest.bti_j_func
* kselftest-arm64/arm64.btitest.bti_jc_func
* kselftest-arm64/arm64.btitest.bti_none_func
* kselftest-arm64/arm64.btitest.nohint_func
* kselftest-arm64/arm64.btitest.paciasp_func
* kselftest-arm64/arm64.nobtitest.bti_c_func
* kselftest-arm64/arm64.nobtitest.bti_j_func
* kselftest-arm64/arm64.nobtitest.bti_jc_func
* kselftest-arm64/arm64.nobtitest.bti_none_func
* kselftest-arm64/arm64.nobtitest.nohint_func
* kselftest-arm64/arm64.nobtitest.paciasp_func
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-drivers-dma-buf
* kselftest-efivarfs
* kselftest-filesystems
* kselftest-filesystems-binderfs
* kselftest-firmware
* kselftest-fpu
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-ir
* kselftest-kcmp
* kselftest-kexec
* kselftest-kvm
* kselftest-lib
* kselftest-livepatch
* kselftest-membarrier
* kselftest-net-forwarding
* kselftest-netfilter
* kselftest-nsfs
* kselftest-openat2
* kselftest-pid_namespace
* kselftest-pidfd
* kselftest-proc
* kselftest-pstore
* kselftest-ptrace
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-splice
* kselftest-static_keys
* kselftest-sync
* kselftest-sysctl
* kselftest-tc-testing
* kselftest-timens
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user
* kselftest-vm
* kselftest-x86
* kselftest-zram
* kunit
* kvm-unit-tests
* 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
* rcutorture
* v4l2-compliance
* vdso
--
Linaro LKFT
https://lkft.linaro.org