4.19.185-rc1 review
Subsystems (2)
Greg Kroah-Hartman
maintainercover 4.19.185-rc1 review
This is the start of the stable review cycle for the 4.19.185 release. There are 56 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, 07 Apr 2021 08:50:09 +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.19.185-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.19.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.19.185-rc1
Du Cheng <[email protected]>
drivers: video: fbcon: fix NULL dereference in fbcon_cursor()
Atul Gopinathan <[email protected]>
staging: rtl8192e: Change state information from u16 to u8
Atul Gopinathan <[email protected]>
staging: rtl8192e: Fix incorrect source in memcpy()
Artur Petrosyan <[email protected]>
usb: dwc2: Fix HPRT0.PrtSusp bit setting for HiKey 960 board.
Tong Zhang <[email protected]>
usb: gadget: udc: amd5536udc_pci fix null-ptr-dereference
Johan Hovold <[email protected]>
USB: cdc-acm: fix use-after-free after probe failure
Johan Hovold <[email protected]>
USB: cdc-acm: fix double free on probe failure
Oliver Neukum <[email protected]>
USB: cdc-acm: downgrade message to debug
Oliver Neukum <[email protected]>
USB: cdc-acm: untangle a circular dependency between callback and softint
Oliver Neukum <[email protected]>
cdc-acm: fix BREAK rx code path adding necessary calls
Chunfeng Yun <[email protected]>
usb: xhci-mtk: fix broken streams issue on 0.96 xHCI
Tony Lindgren <[email protected]>
usb: musb: Fix suspend with devices connected for a64
Vincent Palatin <[email protected]>
USB: quirks: ignore remote wake-up on Fibocom L850-GL LTE modem
Shuah Khan <[email protected]>
usbip: vhci_hcd fix shift out-of-bounds in vhci_hub_control()
Zheyu Ma <[email protected]>
firewire: nosy: Fix a use-after-free bug in nosy_ioctl()
Dinghao Liu <[email protected]>
extcon: Fix error handling in extcon_dev_register
Krzysztof Kozlowski <[email protected]>
extcon: Add stubs for extcon_register_notifier_all() functions
Wang Panzhenzhuan <[email protected]>
pinctrl: rockchip: fix restore error in resume
Tetsuo Handa <[email protected]>
reiserfs: update reiserfs_xattrs_initialized() condition
Xℹ Ruoyao <[email protected]>
drm/amdgpu: check alignment on CPU page for bo map
Nirmoy Das <[email protected]>
drm/amdgpu: fix offset calculation in amdgpu_vm_bo_clear_mappings()
Ilya Lipnitskiy <[email protected]>
mm: fix race by making init_zero_pfn() early_initcall
Steven Rostedt (VMware) <[email protected]>
tracing: Fix stack trace event size
Adrian Hunter <[email protected]>
PM: runtime: Fix ordering in pm_runtime_get_suppliers()
Adrian Hunter <[email protected]>
PM: runtime: Fix race getting/putting suppliers at probe
Hui Wang <[email protected]>
ALSA: hda/realtek: call alc_update_headset_mode() in hp_automute_hook
Hui Wang <[email protected]>
ALSA: hda/realtek: fix a determine_headset_type issue for a Dell AIO
Ikjoon Jang <[email protected]>
ALSA: usb-audio: Apply sample rate quirk to Logitech Connect
Jesper Dangaard Brouer <[email protected]>
bpf: Remove MTU check in __bpf_skb_max_len
Tong Zhang <[email protected]>
net: wan/lmc: unregister device when no matching device is found
Doug Brown <[email protected]>
appletalk: Fix skb allocation size in loopback case
Nathan Rossi <[email protected]>
net: ethernet: aquantia: Handle error cleanup of start on open
Shuah Khan <[email protected]>
ath10k: hold RCU lock when calling ieee80211_find_sta_by_ifaddr()
Luca Pesce <[email protected]>
brcmfmac: clear EAP/association status bits on linkdown events
zhangyi (F) <[email protected]>
ext4: do not iput inode under running transaction in ext4_rename()
Waiman Long <[email protected]>
locking/ww_mutex: Simplify use_ww_ctx & ww_ctx handling
Manaf Meethalavalappu Pallikunhi <[email protected]>
thermal/core: Add NULL pointer check before using cooling device stats
Sameer Pujar <[email protected]>
ASoC: rt5659: Update MCLK rate in set_sysclk()
Tong Zhang <[email protected]>
staging: comedi: cb_pcidas64: fix request_irq() warn
Tong Zhang <[email protected]>
staging: comedi: cb_pcidas: fix request_irq() warn
Alexey Dobriyan <[email protected]>
scsi: qla2xxx: Fix broken #endif placement
Lv Yunlong <[email protected]>
scsi: st: Fix a use after free in st_open()
Laurent Vivier <[email protected]>
vhost: Fix vhost_vq_reset()
Lucas Tanure <[email protected]>
ASoC: cs42l42: Always wait at least 3ms after reset
Lucas Tanure <[email protected]>
ASoC: cs42l42: Fix mixer volume control
Lucas Tanure <[email protected]>
ASoC: cs42l42: Fix channel width support
Lucas Tanure <[email protected]>
ASoC: cs42l42: Fix Bitclock polarity inversion
Hans de Goede <[email protected]>
ASoC: es8316: Simplify adc_pga_gain_tlv table
Benjamin Rood <[email protected]>
ASoC: sgtl5000: set DAP_AVC_CTRL register to correct default value on probe
Hans de Goede <[email protected]>
ASoC: rt5651: Fix dac- and adc- vol-tlv values being off by a factor of 10
Hans de Goede <[email protected]>
ASoC: rt5640: Fix dac- and adc- vol-tlv values being off by a factor of 10
J. Bruce Fields <[email protected]>
rpc: fix NULL dereference on kmalloc failure
Zhaolong Zhang <[email protected]>
ext4: fix bh ref count on error paths
Jakub Kicinski <[email protected]>
ipv6: weaken the v4mapped source check
Alexander Ovechkin <[email protected]>
tcp: relookup sock for RST+ACK packets handled by obsolete req sock
David Brazdil <[email protected]>
selinux: vsock: Set SID for socket returned by accept()
-------------
Diffstat:
Makefile | 4 +- drivers/base/power/runtime.c | 10 ++- drivers/extcon/extcon.c | 1 + drivers/firewire/nosy.c | 9 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 10 +-- drivers/net/ethernet/aquantia/atlantic/aq_main.c | 4 +- drivers/net/wan/lmc/lmc_main.c | 2 + drivers/net/wireless/ath/ath10k/wmi-tlv.c | 7 +- .../broadcom/brcm80211/brcmfmac/cfg80211.c | 7 +- drivers/pinctrl/pinctrl-rockchip.c | 13 ++-- drivers/scsi/qla2xxx/qla_target.h | 2 +- drivers/scsi/st.c | 2 +- drivers/staging/comedi/drivers/cb_pcidas.c | 2 +- drivers/staging/comedi/drivers/cb_pcidas64.c | 2 +- drivers/staging/rtl8192e/rtllib.h | 2 +- drivers/staging/rtl8192e/rtllib_rx.c | 2 +- drivers/thermal/thermal_sysfs.c | 3 + drivers/usb/class/cdc-acm.c | 61 ++++++++++++------ drivers/usb/core/quirks.c | 4 ++ drivers/usb/dwc2/hcd.c | 2 +- drivers/usb/gadget/udc/amd5536udc_pci.c | 10 +-- drivers/usb/host/xhci-mtk.c | 10 ++- drivers/usb/musb/musb_core.c | 12 ++-- drivers/usb/usbip/vhci_hcd.c | 2 + drivers/vhost/vhost.c | 2 +- drivers/video/fbdev/core/fbcon.c | 3 + fs/ext4/inode.c | 6 +- fs/ext4/namei.c | 18 +++--- fs/reiserfs/xattr.h | 2 +- include/linux/extcon.h | 23 +++++++ include/net/inet_connection_sock.h | 2 +- kernel/locking/mutex.c | 25 ++++---- kernel/trace/trace.c | 3 +- mm/memory.c | 2 +- net/appletalk/ddp.c | 33 ++++++---- net/core/filter.c | 12 ++-- net/dccp/ipv6.c | 5 ++ net/ipv4/inet_connection_sock.c | 7 +- net/ipv4/tcp_minisocks.c | 7 +- net/ipv6/ip6_input.c | 10 --- net/ipv6/tcp_ipv6.c | 5 ++ net/sunrpc/auth_gss/svcauth_gss.c | 11 ++-- net/vmw_vsock/af_vsock.c | 1 + sound/pci/hda/patch_realtek.c | 3 +- sound/soc/codecs/cs42l42.c | 74 ++++++++++------------ sound/soc/codecs/cs42l42.h | 13 ++-- sound/soc/codecs/es8316.c | 9 +-- sound/soc/codecs/rt5640.c | 4 +- sound/soc/codecs/rt5651.c | 4 +- sound/soc/codecs/rt5659.c | 5 ++ sound/soc/codecs/sgtl5000.c | 2 +- sound/usb/quirks.c | 1 + 52 files changed, 293 insertions(+), 182 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/56 selinux: vsock: Set SID for socket returned by accept()
From: David Brazdil <[email protected]>
[ Upstream commit 1f935e8e72ec28dddb2dc0650b3b6626a293d94b ]
For AF_VSOCK, accept() currently returns sockets that are unlabelled. Other socket families derive the child's SID from the SID of the parent and the SID of the incoming packet. This is typically done as the connected socket is placed in the queue that accept() removes from.
Reuse the existing 'security_sk_clone' hook to copy the SID from the parent (server) socket to the child. There is no packet SID in this case.
--- net/vmw_vsock/af_vsock.c | 1 + 1 file changed, 1 insertion(+)
net/vmw_vsock/af_vsock.c +1 -0
@@ -628,6 +628,7 @@ struct sock *__vsock_create(struct net *net, vsk->trusted = psk->trusted; vsk->owner =get_cred (psk->owner); vsk->connect_timeout = psk->connect_timeout; +security_sk_clone (parent, sk); }else { vsk->trusted =ns_capable_noaudit (&init_user_ns,CAP_NET_ADMIN ); vsk->owner =get_current_cred ();
Signature · 1 line
2.30.1
Greg Kroah-Hartman
maintainerPATCH 2/56 tcp: relookup sock for RST+ACK packets handled by obsolete req sock
In reply to Greg Kroah-HartmanFrom: Alexander Ovechkin <[email protected]>
commit 7233da86697efef41288f8b713c10c2499cffe85 upstream.
Currently tcp_check_req can be called with obsolete req socket for which big socket have been already created (because of CPU race or early demux assigning req socket to multiple packets in gro batch).
Commit e0f9759f530bf789e984 ("tcp: try to keep packet if SYN_RCV race is lost") added retry in case when tcp_check_req is called for PSH|ACK packet. But if client sends RST+ACK immediatly after connection being established (it is performing healthcheck, for example) retry does not occur. In that case tcp_check_req tries to close req socket, leaving big socket active.
--- include/net/inet_connection_sock.h | 2 +- net/ipv4/inet_connection_sock.c | 7 +++++-- net/ipv4/tcp_minisocks.c | 7 +++++-- 3 files changed, 11 insertions(+), 5 deletions(-)
include/net/inet_connection_sock.h +1 -1
@@ -288,7 +288,7 @@ static inline int inet_csk_reqsk_queue_is_full(const struct sock *sk)return inet_csk_reqsk_queue_len (sk) >= sk->sk_max_ack_backlog; } -void inet_csk_reqsk_queue_drop (struct sock *sk,struct request_sock *req); +bool inet_csk_reqsk_queue_drop (struct sock *sk,struct request_sock *req);void inet_csk_reqsk_queue_drop_and_put (struct sock *sk,struct request_sock *req);void inet_csk_destroy_sock (struct sock *sk);
net/ipv4/inet_connection_sock.c +5 -2
@@ -698,12 +698,15 @@ static bool reqsk_queue_unlink(struct request_sock_queue *queue,return found; } -void inet_csk_reqsk_queue_drop (struct sock *sk,struct request_sock *req) +bool inet_csk_reqsk_queue_drop (struct sock *sk,struct request_sock *req) { -if (reqsk_queue_unlink (&inet_csk (sk)->icsk_accept_queue, req)) { +bool unlinked =reqsk_queue_unlink (&inet_csk (sk)->icsk_accept_queue, req); + +if (unlinked) {reqsk_queue_removed (&inet_csk (sk)->icsk_accept_queue, req);reqsk_put (req); } +return unlinked; }EXPORT_SYMBOL (inet_csk_reqsk_queue_drop);
net/ipv4/tcp_minisocks.c +5 -2
@@ -815,8 +815,11 @@ embryonic_reset:tcp_reset (sk); }if (!fastopen) { -inet_csk_reqsk_queue_drop (sk, req); -__NET_INC_STATS (sock_net (sk),LINUX_MIB_EMBRYONICRSTS ); +bool unlinked =inet_csk_reqsk_queue_drop (sk, req); + +if (unlinked) +__NET_INC_STATS (sock_net (sk),LINUX_MIB_EMBRYONICRSTS ); + *req_stolen = !unlinked; }return NULL ; }
Signature · 1 line
2.30.1
Greg Kroah-Hartman
maintainerPATCH 3/56 ipv6: weaken the v4mapped source check
In reply to Greg Kroah-HartmanFrom: Jakub Kicinski <[email protected]>
[ Upstream commit dcc32f4f183ab8479041b23a1525d48233df1d43 ]
This reverts commit 6af1799aaf3f1bc8defedddfa00df3192445bbf3.
Commit 6af1799aaf3f ("ipv6: drop incoming packets having a v4mapped source address") introduced an input check against v4mapped addresses. Use of such addresses on the wire is indeed questionable and not allowed on public Internet. As the commit pointed out
https://tools.ietf.org/html/draft-itojun-v6ops-v4mapped-harmful-02
lists potential issues.
Unfortunately there are applications which use v4mapped addresses, and breaking them is a clear regression. For example v4mapped addresses (or any semi-valid addresses, really) may be used for uni-direction event streams or packet export.
Since the issue which sparked the addition of the check was with TCP and request_socks in particular push the check down to TCPv6 and DCCP. This restores the ability to receive UDPv6 packets with v4mapped address as the source.
Keep using the IPSTATS_MIB_INHDRERRORS statistic to minimize the user-visible changes.
--- net/dccp/ipv6.c | 5 +++++ net/ipv6/ip6_input.c | 10 ---------- net/ipv6/tcp_ipv6.c | 5 +++++ 3 files changed, 10 insertions(+), 10 deletions(-)
net/dccp/ipv6.c +5 -0
@@ -319,6 +319,11 @@ static int dccp_v6_conn_request(struct sock *sk, struct sk_buff *skb)if (!ipv6_unicast_destination (skb))return 0 ;/* discard, don't send a reset here */ +if (ipv6_addr_v4mapped (&ipv6_hdr (skb)->saddr)) { +__IP6_INC_STATS (sock_net (sk),NULL ,IPSTATS_MIB_INHDRERRORS ); +return 0 ; + } +if (dccp_bad_service_code (sk, service)) { dcb->dccpd_reset_code =DCCP_RESET_CODE_BAD_SERVICE_CODE ; goto drop;
net/ipv6/ip6_input.c +0 -10
@@ -222,16 +222,6 @@ static struct sk_buff *ip6_rcv_core(struct sk_buff *skb, struct net_device *dev,if (ipv6_addr_is_multicast (&hdr->saddr)) goto err; -/* While RFC4291 is not explicit about v4mapped addresses -* in IPv6 headers, it seems clear linux dual-stack -* model can not deal properly with these. -* Security models could be fooled by ::ffff:127.0.0.1 for example. -* -* https://tools.ietf.org/html/draft-itojun-v6ops-v4mapped-harmful-02 -*/ -if (ipv6_addr_v4mapped (&hdr->saddr)) - goto err; - skb->transport_header = skb->network_header +sizeof (*hdr);IP6CB (skb)->nhoff = offsetof(struct ipv6hdr , nexthdr);
net/ipv6/tcp_ipv6.c +5 -0
@@ -1039,6 +1039,11 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)if (!ipv6_unicast_destination (skb)) goto drop; +if (ipv6_addr_v4mapped (&ipv6_hdr (skb)->saddr)) { +__IP6_INC_STATS (sock_net (sk),NULL ,IPSTATS_MIB_INHDRERRORS ); +return 0 ; + } +return tcp_conn_request (&tcp6_request_sock_ops, &tcp_request_sock_ipv6_ops, sk, skb);
Signature · 1 line
2.30.1
Greg Kroah-Hartman
maintainerPATCH 4/56 ext4: fix bh ref count on error paths
In reply to Greg Kroah-HartmanFrom: Zhaolong Zhang <[email protected]>
[ Upstream commit c915fb80eaa6194fa9bd0a4487705cd5b0dda2f1 ]
__ext4_journalled_writepage should drop bhs' ref count on error paths
--- fs/ext4/inode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/ext4/inode.c +3 -3
@@ -2072,13 +2072,13 @@ static int __ext4_journalled_writepage(struct page *page,if (!ret) ret = err; -if (!ext4_has_inline_data (inode)) -ext4_walk_page_buffers (NULL , page_bufs,0 , len, -NULL , bput_one);ext4_set_inode_state (inode,EXT4_STATE_JDATA ); out:unlock_page (page); out_no_pagelock: +if (!inline_data && page_bufs) +ext4_walk_page_buffers (NULL , page_bufs,0 , len, +NULL , bput_one);brelse (inode_bh);return ret; }
Signature · 1 line
2.30.1
Greg Kroah-Hartman
maintainerPATCH 5/56 rpc: fix NULL dereference on kmalloc failure
In reply to Greg Kroah-HartmanFrom: J. Bruce Fields <[email protected]>
[ Upstream commit 0ddc942394013f08992fc379ca04cffacbbe3dae ]
I think this is unlikely but possible:
svc_authenticate sets rq_authop and calls svcauth_gss_accept. The kmalloc(sizeof(*svcdata), GFP_KERNEL) fails, leaving rq_auth_data NULL, and returning SVC_DENIED.
This causes svc_process_common to go to err_bad_auth, and eventually call svc_authorise. That calls ->release == svcauth_gss_release, which tries to dereference rq_auth_data.
--- net/sunrpc/auth_gss/svcauth_gss.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
net/sunrpc/auth_gss/svcauth_gss.c +7 -4
@@ -1766,11 +1766,14 @@ static int svcauth_gss_release(struct svc_rqst *rqstp) {struct gss_svc_data *gsd = (struct gss_svc_data *)rqstp->rq_auth_data; -struct rpc_gss_wire_cred *gc = &gsd->clcred; +struct rpc_gss_wire_cred *gc;struct xdr_buf *resbuf = &rqstp->rq_res;int stat = -EINVAL ;struct sunrpc_net *sn =net_generic (SVC_NET (rqstp), sunrpc_net_id); +if (!gsd) + goto out; + gc = &gsd->clcred;if (gc->gc_proc !=RPC_GSS_PROC_DATA ) goto out;/* Release can be called twice, but we only wrap once. */
@@ -1811,10 +1814,10 @@ out_err:if (rqstp->rq_cred.cr_group_info)put_group_info (rqstp->rq_cred.cr_group_info); rqstp->rq_cred.cr_group_info =NULL ; -if (gsd->rsci) +if (gsd && gsd->rsci) {cache_put (&gsd->rsci->h, sn->rsc_cache); - gsd->rsci =NULL ; - + gsd->rsci =NULL ; + }return stat; }
Signature · 1 line
2.30.1
Greg Kroah-Hartman
maintainerPATCH 6/56 ASoC: rt5640: Fix dac- and adc- vol-tlv values being off by a factor of 10
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit cfa26ed1f9f885c2fd8f53ca492989d1e16d0199 ]
The adc_vol_tlv volume-control has a range from -17.625 dB to +30 dB, not -176.25 dB to + 300 dB. This wrong scale is esp. a problem in userspace apps which translate the dB scale to a linear scale. With the logarithmic dB scale being of by a factor of 10 we loose all precision in the lower area of the range when apps translate things to a linear scale.
E.g. the 0 dB default, which corresponds with a value of 47 of the 0 - 127 range for the control, would be shown as 0/100 in alsa-mixer.
Since the centi-dB values used in the TLV struct cannot represent the 0.375 dB step size used by these controls, change the TLV definition for them to specify a min and max value instead of min + stepsize.
Note this mirrors commit 3f31f7d9b540 ("ASoC: rt5670: Fix dac- and adc- vol-tlv values being off by a factor of 10") which made the exact same change to the rt5670 codec driver.
--- sound/soc/codecs/rt5640.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/rt5640.c +2 -2
@@ -342,9 +342,9 @@ static bool rt5640_readable_register(struct device *dev, unsigned int reg) } static const DECLARE_TLV_DB_SCALE(out_vol_tlv, -4650, 150, 0); -static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -65625, 375, 0); +static const DECLARE_TLV_DB_MINMAX(dac_vol_tlv, -6562, 0); static const DECLARE_TLV_DB_SCALE(in_vol_tlv, -3450, 150, 0); -static const DECLARE_TLV_DB_SCALE(adc_vol_tlv, -17625, 375, 0); +static const DECLARE_TLV_DB_MINMAX(adc_vol_tlv, -1762, 3000); static const DECLARE_TLV_DB_SCALE(adc_bst_tlv, 0, 1200, 0);/* {0, +20, +24, +30, +35, +40, +44, +50, +52} dB */
Signature · 1 line
2.30.1
Greg Kroah-Hartman
maintainerPATCH 7/56 ASoC: rt5651: Fix dac- and adc- vol-tlv values being off by a factor of 10
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit eee51df776bd6cac10a76b2779a9fdee3f622b2b ]
The adc_vol_tlv volume-control has a range from -17.625 dB to +30 dB, not -176.25 dB to + 300 dB. This wrong scale is esp. a problem in userspace apps which translate the dB scale to a linear scale. With the logarithmic dB scale being of by a factor of 10 we loose all precision in the lower area of the range when apps translate things to a linear scale.
E.g. the 0 dB default, which corresponds with a value of 47 of the 0 - 127 range for the control, would be shown as 0/100 in alsa-mixer.
Since the centi-dB values used in the TLV struct cannot represent the 0.375 dB step size used by these controls, change the TLV definition for them to specify a min and max value instead of min + stepsize.
Note this mirrors commit 3f31f7d9b540 ("ASoC: rt5670: Fix dac- and adc- vol-tlv values being off by a factor of 10") which made the exact same change to the rt5670 codec driver.
--- sound/soc/codecs/rt5651.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/rt5651.c +2 -2
@@ -288,9 +288,9 @@ static bool rt5651_readable_register(struct device *dev, unsigned int reg) } static const DECLARE_TLV_DB_SCALE(out_vol_tlv, -4650, 150, 0); -static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -65625, 375, 0); +static const DECLARE_TLV_DB_MINMAX(dac_vol_tlv, -6562, 0); static const DECLARE_TLV_DB_SCALE(in_vol_tlv, -3450, 150, 0); -static const DECLARE_TLV_DB_SCALE(adc_vol_tlv, -17625, 375, 0); +static const DECLARE_TLV_DB_MINMAX(adc_vol_tlv, -1762, 3000); static const DECLARE_TLV_DB_SCALE(adc_bst_tlv, 0, 1200, 0);/* {0, +20, +24, +30, +35, +40, +44, +50, +52} dB */
Signature · 1 line
2.30.1
Greg Kroah-Hartman
maintainerPATCH 8/56 ASoC: sgtl5000: set DAP_AVC_CTRL register to correct default value on probe
In reply to Greg Kroah-HartmanFrom: Benjamin Rood <[email protected]>
[ Upstream commit f86f58e3594fb0ab1993d833d3b9a2496f3c928c ]
According to the SGTL5000 datasheet [1], the DAP_AVC_CTRL register has the following bit field definitions:
| BITS | FIELD | RW | RESET | DEFINITION | | 15 | RSVD | RO | 0x0 | Reserved | | 14 | RSVD | RW | 0x1 | Reserved | | 13:12 | MAX_GAIN | RW | 0x1 | Max Gain of AVC in expander mode | | 11:10 | RSVD | RO | 0x0 | Reserved | | 9:8 | LBI_RESP | RW | 0x1 | Integrator Response | | 7:6 | RSVD | RO | 0x0 | Reserved | | 5 | HARD_LMT_EN | RW | 0x0 | Enable hard limiter mode | | 4:1 | RSVD | RO | 0x0 | Reserved | | 0 | EN | RW | 0x0 | Enable/Disable AVC |
The original default value written to the DAP_AVC_CTRL register during sgtl5000_i2c_probe() was 0x0510. This would incorrectly write values to bits 4 and 10, which are defined as RESERVED. It would also not set bits 12 and 14 to their correct RESET values of 0x1, and instead set them to 0x0. While the DAP_AVC module is effectively disabled because the EN bit is 0, this default value is still writing invalid values to registers that are marked as read-only and RESERVED as well as not setting bits 12 and 14 to their correct default values as defined by the datasheet.
The correct value that should be written to the DAP_AVC_CTRL register is 0x5100, which configures the register bits to the default values defined by the datasheet, and prevents any writes to bits defined as 'read-only'. Generally speaking, it is best practice to NOT attempt to write values to registers/bits defined as RESERVED, as it generally produces unwanted/undefined behavior, or errors.
Also, all credit for this patch should go to my colleague Dan MacDonald <[email protected]> for finding this error in the first place.
[1] https://www.nxp.com/docs/en/data-sheet/SGTL5000.pdf
--- sound/soc/codecs/sgtl5000.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/sgtl5000.c +1 -1
@@ -71,7 +71,7 @@ static const struct reg_default sgtl5000_reg_defaults[] = { { SGTL5000_DAP_EQ_BASS_BAND4, 0x002f }, { SGTL5000_DAP_MAIN_CHAN, 0x8000 }, { SGTL5000_DAP_MIX_CHAN, 0x0000 }, - { SGTL5000_DAP_AVC_CTRL, 0x0510 }, + { SGTL5000_DAP_AVC_CTRL, 0x5100 }, { SGTL5000_DAP_AVC_THRESHOLD, 0x1473 }, { SGTL5000_DAP_AVC_ATTACK, 0x0028 }, { SGTL5000_DAP_AVC_DECAY, 0x0050 },
Signature · 1 line
2.30.1
Greg Kroah-Hartman
maintainerPATCH 9/56 ASoC: es8316: Simplify adc_pga_gain_tlv table
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit bb18c678754ce1514100fb4c0bf6113b5af36c48 ]
Most steps in this table are steps of 3dB (300 centi-dB), so we can simplify the table.
This not only reduces the amount of space it takes inside the kernel, this also makes alsa-lib's mixer code actually accept the table, where as before this change alsa-lib saw the "ADC PGA Gain" control as a control without a dB scale.
--- sound/soc/codecs/es8316.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
sound/soc/codecs/es8316.c +2 -7
@@ -56,13 +56,8 @@ static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(adc_pga_gain_tlv,1 ,1 ,TLV_DB_SCALE_ITEM (0 ,0 ,0 ),2 ,2 ,TLV_DB_SCALE_ITEM (250 ,0 ,0 ),3 ,3 ,TLV_DB_SCALE_ITEM (450 ,0 ,0 ), -4 ,4 ,TLV_DB_SCALE_ITEM (700 ,0 ,0 ), -5 ,5 ,TLV_DB_SCALE_ITEM (1000 ,0 ,0 ), -6 ,6 ,TLV_DB_SCALE_ITEM (1300 ,0 ,0 ), -7 ,7 ,TLV_DB_SCALE_ITEM (1600 ,0 ,0 ), -8 ,8 ,TLV_DB_SCALE_ITEM (1800 ,0 ,0 ), -9 ,9 ,TLV_DB_SCALE_ITEM (2100 ,0 ,0 ), - 10, 10, TLV_DB_SCALE_ITEM(2400, 0, 0), +4 ,7 ,TLV_DB_SCALE_ITEM (700 ,300 ,0 ), + 8, 10, TLV_DB_SCALE_ITEM(1800, 300, 0), ); static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(hpout_vol_tlv,
Signature · 1 line
2.30.1
Greg Kroah-Hartman
maintainerPATCH 10/56 ASoC: cs42l42: Fix Bitclock polarity inversion
In reply to Greg Kroah-HartmanFrom: Lucas Tanure <[email protected]>
[ Upstream commit e793c965519b8b7f2fea51a48398405e2a501729 ]
The driver was setting bit clock polarity opposite to intended polarity. Also simplify the code by grouping ADC and DAC clock configurations into a single field.
--- sound/soc/codecs/cs42l42.c | 20 ++++++++------------ sound/soc/codecs/cs42l42.h | 11 ++++++----- 2 files changed, 14 insertions(+), 17 deletions(-)
sound/soc/codecs/cs42l42.c +8 -12
@@ -801,27 +801,23 @@ static int cs42l42_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)/* Bitclock/frame inversion */ switch (fmt &SND_SOC_DAIFMT_INV_MASK ) {case SND_SOC_DAIFMT_NB_NF : + asp_cfg_val |=CS42L42_ASP_SCPOL_NOR <<CS42L42_ASP_SCPOL_SHIFT ;break ;case SND_SOC_DAIFMT_NB_IF : - asp_cfg_val |=CS42L42_ASP_POL_INV << -CS42L42_ASP_LCPOL_IN_SHIFT ; + asp_cfg_val |=CS42L42_ASP_SCPOL_NOR <<CS42L42_ASP_SCPOL_SHIFT ; + asp_cfg_val |=CS42L42_ASP_LCPOL_INV <<CS42L42_ASP_LCPOL_SHIFT ;break ;case SND_SOC_DAIFMT_IB_NF : - asp_cfg_val |=CS42L42_ASP_POL_INV << -CS42L42_ASP_SCPOL_IN_DAC_SHIFT ;break ;case SND_SOC_DAIFMT_IB_IF : - asp_cfg_val |=CS42L42_ASP_POL_INV << -CS42L42_ASP_LCPOL_IN_SHIFT ; - asp_cfg_val |=CS42L42_ASP_POL_INV << -CS42L42_ASP_SCPOL_IN_DAC_SHIFT ; + asp_cfg_val |=CS42L42_ASP_LCPOL_INV <<CS42L42_ASP_LCPOL_SHIFT ;break ; } -snd_soc_component_update_bits (component,CS42L42_ASP_CLK_CFG , -CS42L42_ASP_MODE_MASK | -CS42L42_ASP_SCPOL_IN_DAC_MASK | -CS42L42_ASP_LCPOL_IN_MASK , asp_cfg_val); +snd_soc_component_update_bits (component,CS42L42_ASP_CLK_CFG ,CS42L42_ASP_MODE_MASK | +CS42L42_ASP_SCPOL_MASK | +CS42L42_ASP_LCPOL_MASK , + asp_cfg_val);return 0 ; }
sound/soc/codecs/cs42l42.h +6 -5
@@ -262,11 +262,12 @@#define CS42L42_ASP_SLAVE_MODE 0x00#define CS42L42_ASP_MODE_SHIFT 4#define CS42L42_ASP_MODE_MASK (1 << CS42L42_ASP_MODE_SHIFT) -#define CS42L42_ASP_SCPOL_IN_DAC_SHIFT 2 -#define CS42L42_ASP_SCPOL_IN_DAC_MASK (1 << CS42L42_ASP_SCPOL_IN_DAC_SHIFT) -#define CS42L42_ASP_LCPOL_IN_SHIFT 0 -#define CS42L42_ASP_LCPOL_IN_MASK (1 << CS42L42_ASP_LCPOL_IN_SHIFT) -#define CS42L42_ASP_POL_INV 1 +#define CS42L42_ASP_SCPOL_SHIFT 2 +#define CS42L42_ASP_SCPOL_MASK (3 << CS42L42_ASP_SCPOL_SHIFT) +#define CS42L42_ASP_SCPOL_NOR 3 +#define CS42L42_ASP_LCPOL_SHIFT 0 +#define CS42L42_ASP_LCPOL_MASK (3 << CS42L42_ASP_LCPOL_SHIFT) +#define CS42L42_ASP_LCPOL_INV 3#define CS42L42_ASP_FRM_CFG (CS42L42_PAGE_12 + 0x08)#define CS42L42_ASP_STP_SHIFT 4
Signature · 1 line
2.30.1
Greg Kroah-Hartman
maintainerPATCH 11/56 ASoC: cs42l42: Fix channel width support
In reply to Greg Kroah-HartmanFrom: Lucas Tanure <[email protected]>
[ Upstream commit 2bdc4f5c6838f7c3feb4fe68e4edbeea158ec0a2 ]
Remove the hard coded 32 bits width and replace with the correct width calculated by params_width.
--- sound/soc/codecs/cs42l42.c | 47 ++++++++++++++++++-------------------- sound/soc/codecs/cs42l42.h | 1 - 2 files changed, 22 insertions(+), 26 deletions(-)
sound/soc/codecs/cs42l42.c +22 -25
@@ -695,24 +695,6 @@ static int cs42l42_pll_config(struct snd_soc_component *component)CS42L42_CLK_OASRC_SEL_MASK ,CS42L42_CLK_OASRC_SEL_12 << CS42L42_CLK_OASRC_SEL_SHIFT); -/* channel 1 on low LRCLK, 32 bit */ -snd_soc_component_update_bits (component, -CS42L42_ASP_RX_DAI0_CH1_AP_RES , -CS42L42_ASP_RX_CH_AP_MASK | -CS42L42_ASP_RX_CH_RES_MASK , - (CS42L42_ASP_RX_CH_AP_LOW << -CS42L42_ASP_RX_CH_AP_SHIFT ) | - (CS42L42_ASP_RX_CH_RES_32 << -CS42L42_ASP_RX_CH_RES_SHIFT )); -/* Channel 2 on high LRCLK, 32 bit */ -snd_soc_component_update_bits (component, -CS42L42_ASP_RX_DAI0_CH2_AP_RES , -CS42L42_ASP_RX_CH_AP_MASK | -CS42L42_ASP_RX_CH_RES_MASK , - (CS42L42_ASP_RX_CH_AP_HI << -CS42L42_ASP_RX_CH_AP_SHIFT ) | - (CS42L42_ASP_RX_CH_RES_32 << -CS42L42_ASP_RX_CH_RES_SHIFT ));if (pll_ratio_table[i].mclk_src_sel ==0 ) {/* Pass the clock straight through */ snd_soc_component_update_bits(component,
@@ -828,14 +810,29 @@ static int cs42l42_pcm_hw_params(struct snd_pcm_substream *substream, {struct snd_soc_component *component = dai->component;struct cs42l42_private *cs42l42 =snd_soc_component_get_drvdata (component); -int retval; +unsigned int width = (params_width (params) /8 ) -1 ; +unsigned int val =0 ; cs42l42->srate =params_rate (params); - cs42l42->swidth =params_width (params); - retval =cs42l42_pll_config (component); +switch (substream->stream) { +case SNDRV_PCM_STREAM_PLAYBACK : + val |= width <<CS42L42_ASP_RX_CH_RES_SHIFT ; +/* channel 1 on low LRCLK */ +snd_soc_component_update_bits (component,CS42L42_ASP_RX_DAI0_CH1_AP_RES , +CS42L42_ASP_RX_CH_AP_MASK | +CS42L42_ASP_RX_CH_RES_MASK , val); +/* Channel 2 on high LRCLK */ + val |=CS42L42_ASP_RX_CH_AP_HI <<CS42L42_ASP_RX_CH_AP_SHIFT ; +snd_soc_component_update_bits (component,CS42L42_ASP_RX_DAI0_CH2_AP_RES , +CS42L42_ASP_RX_CH_AP_MASK | +CS42L42_ASP_RX_CH_RES_MASK , val); +break ; +default : +break ; + } -return retval; +return cs42l42_pll_config (component); } static int cs42l42_set_sysclk(struct snd_soc_dai *dai,
@@ -900,9 +897,9 @@ static int cs42l42_digital_mute(struct snd_soc_dai *dai, int mute)return 0 ; } -#define CS42L42_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S18_3LE | \ - SNDRV_PCM_FMTBIT_S20_3LE | SNDRV_PCM_FMTBIT_S24_LE | \ - SNDRV_PCM_FMTBIT_S32_LE) +#define CS42L42_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\ + SNDRV_PCM_FMTBIT_S24_LE |\ + SNDRV_PCM_FMTBIT_S32_LE )static const struct snd_soc_dai_ops cs42l42_ops = {
sound/soc/codecs/cs42l42.h +0 -1
@@ -761,7 +761,6 @@ struct cs42l42_private {struct completion pdn_done;u32 sclk;u32 srate; -u32 swidth;u8 plug_state;u8 hs_type;u8 ts_inv;
Signature · 1 line
2.30.1
Greg Kroah-Hartman
maintainerPATCH 12/56 ASoC: cs42l42: Fix mixer volume control
In reply to Greg Kroah-HartmanFrom: Lucas Tanure <[email protected]>
[ Upstream commit 72d904763ae6a8576e7ad034f9da4f0e3c44bf24 ]
The minimum value is 0x3f (-63dB), which also is mute
--- sound/soc/codecs/cs42l42.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/cs42l42.c +2 -2
@@ -405,7 +405,7 @@ static const struct regmap_config cs42l42_regmap = { }; static DECLARE_TLV_DB_SCALE(adc_tlv, -9600, 100, false); -static DECLARE_TLV_DB_SCALE(mixer_tlv, -6200, 100, false); +static DECLARE_TLV_DB_SCALE(mixer_tlv, -6300, 100, true);static const char *const cs42l42_hpf_freq_text[] = {"1.86Hz" ,"120Hz" ,"235Hz" ,"466Hz"
@@ -462,7 +462,7 @@ static const struct snd_kcontrol_new cs42l42_snd_controls[] = { CS42L42_DAC_HPF_EN_SHIFT, true, false), SOC_DOUBLE_R_TLV("Mixer Volume", CS42L42_MIXER_CHA_VOL, CS42L42_MIXER_CHB_VOL, CS42L42_MIXER_CH_VOL_SHIFT, - 0x3e, 1, mixer_tlv) + 0x3f, 1, mixer_tlv) }; static int cs42l42_hpdrv_evt(struct snd_soc_dapm_widget *w,
Signature · 1 line
2.30.1
Greg Kroah-Hartman
maintainerPATCH 13/56 ASoC: cs42l42: Always wait at least 3ms after reset
In reply to Greg Kroah-HartmanFrom: Lucas Tanure <[email protected]>
[ Upstream commit 19325cfea04446bc79b36bffd4978af15f46a00e ]
This delay is part of the power-up sequence defined in the datasheet. A runtime_resume is a power-up so must also include the delay.
--- sound/soc/codecs/cs42l42.c | 3 ++- sound/soc/codecs/cs42l42.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
sound/soc/codecs/cs42l42.c +2 -1
@@ -1800,7 +1800,7 @@ static int cs42l42_i2c_probe(struct i2c_client *i2c_client,dev_dbg (&i2c_client->dev,"Found reset GPIO\n" );gpiod_set_value_cansleep (cs42l42->reset_gpio,1 ); } -mdelay (3 ); +usleep_range (CS42L42_BOOT_TIME_US ,CS42L42_BOOT_TIME_US *2 );/* Request IRQ */ ret = devm_request_threaded_irq(&i2c_client->dev,
@@ -1925,6 +1925,7 @@ static int cs42l42_runtime_resume(struct device *dev) }gpiod_set_value_cansleep (cs42l42->reset_gpio,1 ); +usleep_range (CS42L42_BOOT_TIME_US ,CS42L42_BOOT_TIME_US *2 );regcache_cache_only (cs42l42->regmap, false);regcache_sync (cs42l42->regmap);
sound/soc/codecs/cs42l42.h +1 -0
@@ -744,6 +744,7 @@#define CS42L42_FRAC2_VAL (val) (((val) & 0xff0000) >> 16)#define CS42L42_NUM_SUPPLIES 5 +#define CS42L42_BOOT_TIME_US 3000static const char *const cs42l42_supply_names[CS42L42_NUM_SUPPLIES ] = {"VA" ,
Signature · 1 line
2.30.1
Greg Kroah-Hartman
maintainerPATCH 14/56 vhost: Fix vhost_vq_reset()
In reply to Greg Kroah-HartmanFrom: Laurent Vivier <[email protected]>
[ Upstream commit beb691e69f4dec7bfe8b81b509848acfd1f0dbf9 ]
vhost_reset_is_le() is vhost_init_is_le(), and in the case of cross-endian legacy, vhost_init_is_le() depends on vq->user_be.
vq->user_be is set by vhost_disable_cross_endian().
But in vhost_vq_reset(), we have:
vhost_reset_is_le(vq);
vhost_disable_cross_endian(vq);And so user_be is used before being set.
To fix that, reverse the lines order as there is no other dependency between them.
--- drivers/vhost/vhost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vhost/vhost.c +1 -1
@@ -322,8 +322,8 @@ static void vhost_vq_reset(struct vhost_dev *dev, vq->kick =NULL ; vq->call_ctx =NULL ; vq->log_ctx =NULL ; -vhost_reset_is_le (vq);vhost_disable_cross_endian (vq); +vhost_reset_is_le (vq); vq->busyloop_timeout =0 ; vq->umem =NULL ; vq->iotlb =NULL ;
Signature · 1 line
2.30.1
Greg Kroah-Hartman
maintainerPATCH 15/56 scsi: st: Fix a use after free in st_open()
In reply to Greg Kroah-HartmanFrom: Lv Yunlong <[email protected]>
[ Upstream commit c8c165dea4c8f5ad67b1240861e4f6c5395fa4ac ]
In st_open(), if STp->in_use is true, STp will be freed by scsi_tape_put(). However, STp is still used by DEBC_printk() after. It is better to DEBC_printk() before scsi_tape_put().
--- drivers/scsi/st.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/st.c +1 -1
@@ -1265,8 +1265,8 @@ static int st_open(struct inode *inode, struct file *filp)spin_lock (&st_use_lock);if (STp->in_use) {spin_unlock (&st_use_lock); -scsi_tape_put (STp);DEBC_printk (STp,"Device already in use.\n" ); +scsi_tape_put (STp);return (-EBUSY ); }
Signature · 1 line
2.30.1
Greg Kroah-Hartman
maintainerPATCH 16/56 scsi: qla2xxx: Fix broken #endif placement
In reply to Greg Kroah-HartmanFrom: Alexey Dobriyan <[email protected]>
[ Upstream commit 5999b9e5b1f8a2f5417b755130919b3ac96f5550 ]
Only half of the file is under include guard because terminating #endif is placed too early.
--- drivers/scsi/qla2xxx/qla_target.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_target.h +1 -1
@@ -124,7 +124,6 @@ (min (1270 , ((ql) >0 ) ? (QLA_TGT_DATASEGS_PER_CMD_24XX + \ QLA_TGT_DATASEGS_PER_CONT_24XX*((ql) - 1)) : 0))#endif -#endif #define GET_TARGET_ID (ha, iocb) ((HAS_EXTENDED_IDS(ha)) \ ? le16_to_cpu((iocb)->u.isp2x.target.extended) \
@@ -257,6 +256,7 @@ struct ctio_to_2xxx {#ifndef CTIO_RET_TYPE #define CTIO_RET_TYPE 0x17/* CTIO return entry */ #define ATIO_TYPE7 0x06/* Accept target I/O entry for 24xx */ +#endif struct fcp_hdr {uint8_t r_ctl;
Signature · 1 line
2.30.1
Greg Kroah-Hartman
maintainerPATCH 17/56 staging: comedi: cb_pcidas: fix request_irq() warn
In reply to Greg Kroah-HartmanFrom: Tong Zhang <[email protected]>
[ Upstream commit 2e5848a3d86f03024ae096478bdb892ab3d79131 ]
request_irq() wont accept a name which contains slash so we need to repalce it with something else -- otherwise it will trigger a warning and the entry in /proc/irq/ will not be created
since the .name might be used by userspace and we don't want to break userspace, so we are changing the parameters passed to request_irq()
[ 1.630764] name 'pci-das1602/16' [ 1.630950] WARNING: CPU: 0 PID: 181 at fs/proc/generic.c:180 __xlate_proc_name+0x93/0xb0 [ 1.634009] RIP: 0010:__xlate_proc_name+0x93/0xb0 [ 1.639441] Call Trace: [ 1.639976] proc_mkdir+0x18/0x20 [ 1.641946] request_threaded_irq+0xfe/0x160 [ 1.642186] cb_pcidas_auto_attach+0xf4/0x610 [cb_pcidas]
--- drivers/staging/comedi/drivers/cb_pcidas.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/comedi/drivers/cb_pcidas.c +1 -1
@@ -1281,7 +1281,7 @@ static int cb_pcidas_auto_attach(struct comedi_device *dev, devpriv->amcc + AMCC_OP_REG_INTCSR); ret =request_irq (pcidev->irq, cb_pcidas_interrupt,IRQF_SHARED , - dev->board_name, dev); +"cb_pcidas" , dev);if (ret) {dev_dbg (dev->class_dev,"unable to allocate irq %d\n" , pcidev->irq);
Signature · 1 line
2.30.1
Greg Kroah-Hartman
maintainerPATCH 18/56 staging: comedi: cb_pcidas64: fix request_irq() warn
In reply to Greg Kroah-HartmanFrom: Tong Zhang <[email protected]>
[ Upstream commit d2d106fe3badfc3bf0dd3899d1c3f210c7203eab ]
request_irq() wont accept a name which contains slash so we need to repalce it with something else -- otherwise it will trigger a warning and the entry in /proc/irq/ will not be created
since the .name might be used by userspace and we don't want to break userspace, so we are changing the parameters passed to request_irq()
[ 1.565966] name 'pci-das6402/16' [ 1.566149] WARNING: CPU: 0 PID: 184 at fs/proc/generic.c:180 __xlate_proc_name+0x93/0xb0 [ 1.568923] RIP: 0010:__xlate_proc_name+0x93/0xb0 [ 1.574200] Call Trace: [ 1.574722] proc_mkdir+0x18/0x20 [ 1.576629] request_threaded_irq+0xfe/0x160 [ 1.576859] auto_attach+0x60a/0xc40 [cb_pcidas64]
--- drivers/staging/comedi/drivers/cb_pcidas64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/comedi/drivers/cb_pcidas64.c +1 -1
@@ -4021,7 +4021,7 @@ static int auto_attach(struct comedi_device *dev,init_stc_registers (dev); retval =request_irq (pcidev->irq, handle_interrupt,IRQF_SHARED , - dev->board_name, dev); +"cb_pcidas64" , dev);if (retval) {dev_dbg (dev->class_dev,"unable to allocate irq %u\n" , pcidev->irq);
Signature · 1 line
2.30.1
Greg Kroah-Hartman
maintainerPATCH 19/56 ASoC: rt5659: Update MCLK rate in set_sysclk()
In reply to Greg Kroah-HartmanFrom: Sameer Pujar <[email protected]>
[ Upstream commit dbf54a9534350d6aebbb34f5c1c606b81a4f35dd ]
Simple-card/audio-graph-card drivers do not handle MCLK clock when it is specified in the codec device node. The expectation here is that, the codec should actually own up the MCLK clock and do necessary setup in the driver.
--- sound/soc/codecs/rt5659.c | 5 +++++ 1 file changed, 5 insertions(+)
sound/soc/codecs/rt5659.c +5 -0
@@ -3466,12 +3466,17 @@ static int rt5659_set_component_sysclk(struct snd_soc_component *component, int {struct rt5659_priv *rt5659 =snd_soc_component_get_drvdata (component);unsigned int reg_val =0 ; +int ret;if (freq == rt5659->sysclk && clk_id == rt5659->sysclk_src)return 0 ;switch (clk_id) {case RT5659_SCLK_S_MCLK : + ret =clk_set_rate (rt5659->mclk, freq); +if (ret) +return ret; + reg_val |=RT5659_SCLK_SRC_MCLK ;break ;case RT5659_SCLK_S_PLL1 :
Signature · 1 line
2.30.1
Greg Kroah-Hartman
maintainerPATCH 20/56 thermal/core: Add NULL pointer check before using cooling device stats
In reply to Greg Kroah-HartmanFrom: Manaf Meethalavalappu Pallikunhi <[email protected]>
[ Upstream commit 2046a24ae121cd107929655a6aaf3b8c5beea01f ]
There is a possible chance that some cooling device stats buffer allocation fails due to very high cooling device max state value. Later cooling device update sysfs can try to access stats data for the same cooling device. It will lead to NULL pointer dereference issue.
Add a NULL pointer check before accessing thermal cooling device stats data. It fixes the following bug
[ 26.812833] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000004 [ 27.122960] Call trace: [ 27.122963] do_raw_spin_lock+0x18/0xe8 [ 27.122966] _raw_spin_lock+0x24/0x30 [ 27.128157] thermal_cooling_device_stats_update+0x24/0x98 [ 27.128162] cur_state_store+0x88/0xb8 [ 27.128166] dev_attr_store+0x40/0x58 [ 27.128169] sysfs_kf_write+0x50/0x68 [ 27.133358] kernfs_fop_write+0x12c/0x1c8 [ 27.133362] __vfs_write+0x54/0x160 [ 27.152297] vfs_write+0xcc/0x188 [ 27.157132] ksys_write+0x78/0x108 [ 27.162050] ksys_write+0xf8/0x108 [ 27.166968] __arm_smccc_hvc+0x158/0x4b0 [ 27.166973] __arm_smccc_hvc+0x9c/0x4b0 [ 27.186005] el0_svc+0x8/0xc
--- drivers/thermal/thermal_sysfs.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/thermal/thermal_sysfs.c +3 -0
@@ -770,6 +770,9 @@ void thermal_cooling_device_stats_update(struct thermal_cooling_device *cdev, {struct cooling_dev_stats *stats = cdev->stats; +if (!stats) +return ; +spin_lock (&stats->lock);if (stats->state == new_state)
Signature · 1 line
2.30.1
Greg Kroah-Hartman
maintainerPATCH 21/56 locking/ww_mutex: Simplify use_ww_ctx & ww_ctx handling
In reply to Greg Kroah-HartmanFrom: Waiman Long <[email protected]>
[ Upstream commit 5de2055d31ea88fd9ae9709ac95c372a505a60fa ]
The use_ww_ctx flag is passed to mutex_optimistic_spin(), but the function doesn't use it. The frequent use of the (use_ww_ctx && ww_ctx) combination is repetitive.
In fact, ww_ctx should not be used at all if !use_ww_ctx. Simplify ww_mutex code by dropping use_ww_ctx from mutex_optimistic_spin() an clear ww_ctx if !use_ww_ctx. In this way, we can replace (use_ww_ctx && ww_ctx) by just (ww_ctx).
--- kernel/locking/mutex.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-)
kernel/locking/mutex.c +14 -11
@@ -609,7 +609,7 @@ static inline int mutex_can_spin_on_owner(struct mutex *lock)*/ static __always_inline boolmutex_optimistic_spin (struct mutex *lock,struct ww_acquire_ctx *ww_ctx, -const bool use_ww_ctx,struct mutex_waiter *waiter) +struct mutex_waiter *waiter) {if (!waiter) {/*
@@ -685,7 +685,7 @@ fail:#else static __always_inline boolmutex_optimistic_spin (struct mutex *lock,struct ww_acquire_ctx *ww_ctx, -const bool use_ww_ctx,struct mutex_waiter *waiter) +struct mutex_waiter *waiter) {return false; }
@@ -905,10 +905,13 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,struct ww_mutex *ww;int ret; +if (!use_ww_ctx) + ww_ctx =NULL ; +might_sleep (); ww = container_of(lock, struct ww_mutex, base); -if (use_ww_ctx && ww_ctx) { +if (ww_ctx) {if (unlikely (ww_ctx ==READ_ONCE (ww->ctx)))return -EALREADY ;
@@ -925,10 +928,10 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,mutex_acquire_nest (&lock->dep_map, subclass,0 , nest_lock, ip);if (__mutex_trylock (lock) || -mutex_optimistic_spin (lock, ww_ctx, use_ww_ctx,NULL )) { +mutex_optimistic_spin (lock, ww_ctx,NULL )) {/* got the lock, yay! */ lock_acquired (&lock->dep_map, ip); -if (use_ww_ctx && ww_ctx) +if (ww_ctx)ww_mutex_set_context_fastpath (ww, ww_ctx);preempt_enable ();return 0 ;
@@ -939,7 +942,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,* After waiting to acquire the wait_lock, try again. */ if (__mutex_trylock (lock)) { -if (use_ww_ctx && ww_ctx) +if (ww_ctx)__ww_mutex_check_waiters (lock, ww_ctx); goto skip_wait;
@@ -992,7 +995,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, goto err; } -if (use_ww_ctx && ww_ctx) { +if (ww_ctx) { ret =__ww_mutex_check_kill (lock, &waiter, ww_ctx);if (ret) goto err;
@@ -1005,7 +1008,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,* ww_mutex needs to always recheck its position since its waiter * list is not FIFO ordered. */ -if ((use_ww_ctx && ww_ctx) || !first) { +if (ww_ctx || !first) { first =__mutex_waiter_is_first (lock, &waiter);if (first)__mutex_set_flag (lock,MUTEX_FLAG_HANDOFF );
@@ -1018,7 +1021,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,* or we must see its unlock and acquire. */ if (__mutex_trylock (lock) || - (first &&mutex_optimistic_spin (lock, ww_ctx, use_ww_ctx, &waiter))) + (first &&mutex_optimistic_spin (lock, ww_ctx, &waiter)))break ;spin_lock (&lock->wait_lock);
@@ -1027,7 +1030,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, acquired:__set_current_state (TASK_RUNNING ); -if (use_ww_ctx && ww_ctx) { +if (ww_ctx) {/* * Wound-Wait; we stole the lock (!first_waiter), check the * waiters as anyone might want to wound us.
@@ -1047,7 +1050,7 @@ skip_wait:/* got the lock - cleanup and rejoice! */ lock_acquired (&lock->dep_map, ip); -if (use_ww_ctx && ww_ctx) +if (ww_ctx)ww_mutex_lock_acquired (ww, ww_ctx);spin_unlock (&lock->wait_lock);
Signature · 1 line
2.30.1
Greg Kroah-Hartman
maintainerPATCH 22/56 ext4: do not iput inode under running transaction in ext4_rename()
In reply to Greg Kroah-HartmanFrom: zhangyi (F) <[email protected]>
[ Upstream commit 5dccdc5a1916d4266edd251f20bbbb113a5c495f ]
In ext4_rename(), when RENAME_WHITEOUT failed to add new entry into directory, it ends up dropping new created whiteout inode under the running transaction. After commit <9b88f9fb0d2> ("ext4: Do not iput inode under running transaction"), we follow the assumptions that evict() does not get called from a transaction context but in ext4_rename() it breaks this suggestion. Although it's not a real problem, better to obey it, so this patch add inode to orphan list and stop transaction before final iput().
--- fs/ext4/namei.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
fs/ext4/namei.c +9 -9
@@ -3624,14 +3624,14 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,*/ retval = -ENOENT ;if (!old.bh ||le32_to_cpu (old.de->inode) != old.inode->i_ino) - goto end_rename; + goto release_bh; new.bh =ext4_find_entry (new.dir, &new.dentry->d_name, &new.de, &new.inlined);if (IS_ERR (new.bh)) { retval =PTR_ERR (new.bh); new.bh =NULL ; - goto end_rename; + goto release_bh; }if (new.bh) {if (!new.inode) {
@@ -3648,15 +3648,13 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, handle =ext4_journal_start (old.dir,EXT4_HT_DIR , credits);if (IS_ERR (handle)) { retval =PTR_ERR (handle); - handle =NULL ; - goto end_rename; + goto release_bh; } }else { whiteout =ext4_whiteout_for_rename (&old, credits, &handle);if (IS_ERR (whiteout)) { retval =PTR_ERR (whiteout); - whiteout =NULL ; - goto end_rename; + goto release_bh; } }
@@ -3764,16 +3762,18 @@ end_rename:ext4_resetent (handle, &old, old.inode->i_ino, old_file_type);drop_nlink (whiteout); +ext4_orphan_add (handle, whiteout); }unlock_new_inode (whiteout); +ext4_journal_stop (handle);iput (whiteout); - + }else { +ext4_journal_stop (handle); } +release_bh:brelse (old.dir_bh);brelse (old.bh);brelse (new.bh); -if (handle) -ext4_journal_stop (handle);return retval; }
Signature · 1 line
2.30.1
Greg Kroah-Hartman
maintainerPATCH 23/56 brcmfmac: clear EAP/association status bits on linkdown events
In reply to Greg Kroah-HartmanFrom: Luca Pesce <[email protected]>
[ Upstream commit e862a3e4088070de352fdafe9bd9e3ae0a95a33c ]
This ensure that previous association attempts do not leave stale statuses on subsequent attempts.
This fixes the WARN_ON(!cr->bss)) from __cfg80211_connect_result() when connecting to an AP after a previous connection failure (e.g. where EAP fails due to incorrect psk but association succeeded). In some scenarios, indeed, brcmf_is_linkup() was reporting a link up event too early due to stale BRCMF_VIF_STATUS_ASSOC_SUCCESS bit, thus reporting to cfg80211 a connection result with a zeroed bssid (vif->profile.bssid is still empty), causing the WARN_ON due to the call to cfg80211_get_bss() with the empty bssid.
--- .../net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +5 -2
@@ -5282,7 +5282,8 @@ static bool brcmf_is_linkup(struct brcmf_cfg80211_vif *vif,return false; } -static bool brcmf_is_linkdown (const struct brcmf_event_msg *e) +static bool brcmf_is_linkdown (struct brcmf_cfg80211_vif *vif, +const struct brcmf_event_msg *e) {u32 event = e->event_code;u16 flags = e->flags;
@@ -5291,6 +5292,8 @@ static bool brcmf_is_linkdown(const struct brcmf_event_msg *e) (event == BRCMF_E_DISASSOC_IND) || ((event == BRCMF_E_LINK) && (!(flags & BRCMF_EVENT_MSG_LINK)))) {brcmf_dbg (CONN ,"Processing link down\n" ); +clear_bit (BRCMF_VIF_STATUS_EAP_SUCCESS , &vif->sme_state); +clear_bit (BRCMF_VIF_STATUS_ASSOC_SUCCESS , &vif->sme_state);return true; }return false;
@@ -5581,7 +5584,7 @@ brcmf_notify_connect_status(struct brcmf_if *ifp, }else brcmf_bss_connect_done (cfg, ndev, e, true);brcmf_net_setcarrier (ifp, true); - }else if (brcmf_is_linkdown (e)) { + }else if (brcmf_is_linkdown (ifp->vif, e)) {brcmf_dbg (CONN ,"Linkdown\n" );if (!brcmf_is_ibssmode (ifp->vif)) {brcmf_bss_connect_done (cfg, ndev, e, false);
Signature · 1 line
2.30.1
Greg Kroah-Hartman
maintainerPATCH 24/56 ath10k: hold RCU lock when calling ieee80211_find_sta_by_ifaddr()
In reply to Greg Kroah-HartmanFrom: Shuah Khan <[email protected]>
[ Upstream commit 09078368d516918666a0122f2533dc73676d3d7e ]
ieee80211_find_sta_by_ifaddr() must be called under the RCU lock and the resulting pointer is only valid under RCU lock as well.
Fix ath10k_wmi_tlv_op_pull_peer_stats_info() to hold RCU lock before it calls ieee80211_find_sta_by_ifaddr() and release it when the resulting pointer is no longer needed.
This problem was found while reviewing code to debug RCU warn from ath10k_wmi_tlv_parse_peer_stats_info().
--- drivers/net/wireless/ath/ath10k/wmi-tlv.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath10k/wmi-tlv.c +5 -2
@@ -449,13 +449,13 @@ static void ath10k_wmi_event_tdls_peer(struct ath10k *ar, struct sk_buff *skb)case WMI_TDLS_TEARDOWN_REASON_TX :case WMI_TDLS_TEARDOWN_REASON_RSSI :case WMI_TDLS_TEARDOWN_REASON_PTR_TIMEOUT : +rcu_read_lock (); station =ieee80211_find_sta_by_ifaddr (ar->hw, ev->peer_macaddr.addr,NULL );if (!station) {ath10k_warn (ar,"did not find station from tdls peer event" ); -kfree (tb); -return ; + goto exit; } arvif =ath10k_get_arvif (ar,__le32_to_cpu (ev->vdev_id)); ieee80211_tdls_oper_request(
@@ -466,6 +466,9 @@ static void ath10k_wmi_event_tdls_peer(struct ath10k *ar, struct sk_buff *skb) );break ; } + +exit: +rcu_read_unlock ();kfree (tb); }
Signature · 1 line
2.30.1
Greg Kroah-Hartman
maintainerPATCH 25/56 net: ethernet: aquantia: Handle error cleanup of start on open
In reply to Greg Kroah-HartmanFrom: Nathan Rossi <[email protected]>
[ Upstream commit 8a28af7a3e85ddf358f8c41e401a33002f7a9587 ]
The aq_nic_start function can fail in a variety of cases which leaves the device in broken state.
An example case where the start function fails is the request_threaded_irq which can be interrupted, resulting in a EINTR result. This can be manually triggered by bringing the link up (e.g. ip link set up) and triggering a SIGINT on the initiating process (e.g. Ctrl+C). This would put the device into a half configured state. Subsequently bringing the link up again would cause the napi_enable to BUG.
In order to correctly clean up the failed attempt to start a device call aq_nic_stop.
--- drivers/net/ethernet/aquantia/atlantic/aq_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/aquantia/atlantic/aq_main.c +3 -1
@@ -50,8 +50,10 @@ static int aq_ndev_open(struct net_device *ndev)if (err <0 ) goto err_exit; err =aq_nic_start (aq_nic); -if (err <0 ) +if (err <0 ) { +aq_nic_stop (aq_nic); goto err_exit; + } err_exit:if (err <0 )
Signature · 1 line
2.30.1
Greg Kroah-Hartman
maintainerPATCH 26/56 appletalk: Fix skb allocation size in loopback case
In reply to Greg Kroah-HartmanFrom: Doug Brown <[email protected]>
[ Upstream commit 39935dccb21c60f9bbf1bb72d22ab6fd14ae7705 ]
If a DDP broadcast packet is sent out to a non-gateway target, it is also looped back. There is a potential for the loopback device to have a longer hardware header length than the original target route's device, which can result in the skb not being created with enough room for the loopback device's hardware header. This patch fixes the issue by determining that a loopback will be necessary prior to allocating the skb, and if so, ensuring the skb has enough room.
This was discovered while testing a new driver that creates a LocalTalk network interface (LTALK_HLEN = 1). It caused an skb_under_panic.
--- net/appletalk/ddp.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-)
net/appletalk/ddp.c +21 -12
@@ -1573,8 +1573,8 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)struct sk_buff *skb;struct net_device *dev;struct ddpehdr *ddp; -int size; -struct atalk_route *rt; +int size, hard_header_len; +struct atalk_route *rt, *rt_lo =NULL ;int err;if (flags & ~(MSG_DONTWAIT |MSG_CMSG_COMPAT ))
@@ -1637,7 +1637,22 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)SOCK_DEBUG (sk,"SK %p: Size needed %d, device %s\n" , sk, size, dev->name); - size += dev->hard_header_len; + hard_header_len = dev->hard_header_len; +/* Leave room for loopback hardware header if necessary */ +if (usat->sat_addr.s_node ==ATADDR_BCAST && + (dev->flags &IFF_LOOPBACK || !(rt->flags &RTF_GATEWAY ))) { +struct atalk_addr at_lo; + + at_lo.s_node =0 ; + at_lo.s_net =0 ; + + rt_lo =atrtr_find (&at_lo); + +if (rt_lo && rt_lo->dev->hard_header_len > hard_header_len) + hard_header_len = rt_lo->dev->hard_header_len; + } + + size += hard_header_len;release_sock (sk); skb =sock_alloc_send_skb (sk, size, (flags &MSG_DONTWAIT ), &err);lock_sock (sk);
@@ -1645,7 +1660,7 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) goto out;skb_reserve (skb, ddp_dl->header_length); -skb_reserve (skb, dev->hard_header_len); +skb_reserve (skb, hard_header_len); skb->dev = dev;SOCK_DEBUG (sk,"SK %p: Begin build.\n" , sk);
@@ -1696,18 +1711,12 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)/* loop back */ skb_orphan (skb);if (ddp->deh_dnode ==ATADDR_BCAST ) { -struct atalk_addr at_lo; - - at_lo.s_node =0 ; - at_lo.s_net =0 ; - - rt =atrtr_find (&at_lo); -if (!rt) { +if (!rt_lo) {kfree_skb (skb); err = -ENETUNREACH ; goto out; } - dev = rt->dev; + dev = rt_lo->dev; skb->dev = dev; } ddp_dl->request (ddp_dl, skb, dev->dev_addr);
Signature · 1 line
2.30.1
Greg Kroah-Hartman
maintainerPATCH 27/56 net: wan/lmc: unregister device when no matching device is found
In reply to Greg Kroah-HartmanFrom: Tong Zhang <[email protected]>
[ Upstream commit 62e69bc419772638369eff8ff81340bde8aceb61 ]
lmc set sc->lmc_media pointer when there is a matching device. However, when no matching device is found, this pointer is NULL and the following dereference will result in a null-ptr-deref.
To fix this issue, unregister the hdlc device and return an error.
[ 4.569359] BUG: KASAN: null-ptr-deref in lmc_init_one.cold+0x2b6/0x55d [lmc] [ 4.569748] Read of size 8 at addr 0000000000000008 by task modprobe/95 [ 4.570102] [ 4.570187] CPU: 0 PID: 95 Comm: modprobe Not tainted 5.11.0-rc7 #94 [ 4.570527] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-48-gd9c812dda519-preb4 [ 4.571125] Call Trace: [ 4.571261] dump_stack+0x7d/0xa3 [ 4.571445] kasan_report.cold+0x10c/0x10e [ 4.571667] ? lmc_init_one.cold+0x2b6/0x55d [lmc] [ 4.571932] lmc_init_one.cold+0x2b6/0x55d [lmc] [ 4.572186] ? lmc_mii_readreg+0xa0/0xa0 [lmc] [ 4.572432] local_pci_probe+0x6f/0xb0 [ 4.572639] pci_device_probe+0x171/0x240 [ 4.572857] ? pci_device_remove+0xe0/0xe0 [ 4.573080] ? kernfs_create_link+0xb6/0x110 [ 4.573315] ? sysfs_do_create_link_sd.isra.0+0x76/0xe0 [ 4.573598] really_probe+0x161/0x420 [ 4.573799] driver_probe_device+0x6d/0xd0 [ 4.574022] device_driver_attach+0x82/0x90 [ 4.574249] ? device_driver_attach+0x90/0x90 [ 4.574485] __driver_attach+0x60/0x100 [ 4.574694] ? device_driver_attach+0x90/0x90 [ 4.574931] bus_for_each_dev+0xe1/0x140 [ 4.575146] ? subsys_dev_iter_exit+0x10/0x10 [ 4.575387] ? klist_node_init+0x61/0x80 [ 4.575602] bus_add_driver+0x254/0x2a0 [ 4.575812] driver_register+0xd3/0x150 [ 4.576021] ? 0xffffffffc0018000 [ 4.576202] do_one_initcall+0x84/0x250 [ 4.576411] ? trace_event_raw_event_initcall_finish+0x150/0x150 [ 4.576733] ? unpoison_range+0xf/0x30 [ 4.576938] ? ____kasan_kmalloc.constprop.0+0x84/0xa0 [ 4.577219] ? unpoison_range+0xf/0x30 [ 4.577423] ? unpoison_range+0xf/0x30 [ 4.577628] do_init_module+0xf8/0x350 [ 4.577833] load_module+0x3fe6/0x4340 [ 4.578038] ? vm_unmap_ram+0x1d0/0x1d0 [ 4.578247] ? ____kasan_kmalloc.constprop.0+0x84/0xa0 [ 4.578526] ? module_frob_arch_sections+0x20/0x20 [ 4.578787] ? __do_sys_finit_module+0x108/0x170 [ 4.579037] __do_sys_finit_module+0x108/0x170 [ 4.579278] ? __ia32_sys_init_module+0x40/0x40 [ 4.579523] ? file_open_root+0x200/0x200 [ 4.579742] ? do_sys_open+0x85/0xe0 [ 4.579938] ? filp_open+0x50/0x50 [ 4.580125] ? exit_to_user_mode_prepare+0xfc/0x130 [ 4.580390] do_syscall_64+0x33/0x40 [ 4.580586] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 4.580859] RIP: 0033:0x7f1a724c3cf7 [ 4.581054] Code: 48 89 57 30 48 8b 04 24 48 89 47 38 e9 1d a0 02 00 48 89 f8 48 89 f7 48 89 d6 48 891 [ 4.582043] RSP: 002b:00007fff44941c68 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 [ 4.582447] RAX: ffffffffffffffda RBX: 00000000012ada70 RCX: 00007f1a724c3cf7 [ 4.582827] RDX: 0000000000000000 RSI: 00000000012ac9e0 RDI: 0000000000000003 [ 4.583207] RBP: 0000000000000003 R08: 0000000000000000 R09: 0000000000000001 [ 4.583587] R10: 00007f1a72527300 R11: 0000000000000246 R12: 00000000012ac9e0 [ 4.583968] R13: 0000000000000000 R14: 00000000012acc90 R15: 0000000000000001 [ 4.584349] ==================================================================
--- drivers/net/wan/lmc/lmc_main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wan/lmc/lmc_main.c +2 -0
@@ -915,6 +915,8 @@ static int lmc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)break ;default :printk (KERN_WARNING "%s: LMC UNKNOWN CARD!\n" , dev->name); +unregister_hdlc_device (dev); +return -EIO ;break ; }
Signature · 1 line
2.30.1
Greg Kroah-Hartman
maintainerPATCH 28/56 bpf: Remove MTU check in __bpf_skb_max_len
In reply to Greg Kroah-HartmanFrom: Jesper Dangaard Brouer <[email protected]>
commit 6306c1189e77a513bf02720450bb43bd4ba5d8ae upstream.
Multiple BPF-helpers that can manipulate/increase the size of the SKB uses __bpf_skb_max_len() as the max-length. This function limit size against the current net_device MTU (skb->dev->mtu).
When a BPF-prog grow the packet size, then it should not be limited to the MTU. The MTU is a transmit limitation, and software receiving this packet should be allowed to increase the size. Further more, current MTU check in __bpf_skb_max_len uses the MTU from ingress/current net_device, which in case of redirects uses the wrong net_device.
This patch keeps a sanity max limit of SKB_MAX_ALLOC (16KiB). The real limit is elsewhere in the system. Jesper's testing[1] showed it was not possible to exceed 8KiB when expanding the SKB size via BPF-helper. The limiting factor is the define KMALLOC_MAX_CACHE_SIZE which is 8192 for SLUB-allocator (CONFIG_SLUB) in-case PAGE_SIZE is 4096. This define is in-effect due to this being called from softirq context see code __gfp_pfmemalloc_flags() and __do_kmalloc_node(). Jakub's testing showed that frames above 16KiB can cause NICs to reset (but not crash). Keep this sanity limit at this level as memory layer can differ based on kernel config.
[1] https://github.com/xdp-project/bpf-examples/tree/master/MTU-tests
--- net/core/filter.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
net/core/filter.c +4 -8
@@ -2836,18 +2836,14 @@ static int bpf_skb_net_shrink(struct sk_return 0 ; } -static u32 __bpf_skb_max_len (const struct sk_buff *skb) -{ -return skb->dev ? skb->dev->mtu + skb->dev->hard_header_len : -SKB_MAX_ALLOC ; -} +#define BPF_SKB_MAX_LEN SKB_MAX_ALLOCstatic int bpf_skb_adjust_net (struct sk_buff *skb,s32 len_diff) {bool trans_same = skb->transport_header == skb->network_header;u32 len_cur, len_diff_abs =abs (len_diff);u32 len_min =bpf_skb_net_base_len (skb); -u32 len_max =__bpf_skb_max_len (skb); +u32 len_max =BPF_SKB_MAX_LEN ;__be16 proto =skb_protocol (skb, true);bool shrink = len_diff <0 ;int ret;
@@ -2926,7 +2922,7 @@ static int bpf_skb_trim_rcsum(struct sk_static inline int __bpf_skb_change_tail (struct sk_buff *skb,u32 new_len,u64 flags) { -u32 max_len =__bpf_skb_max_len (skb); +u32 max_len =BPF_SKB_MAX_LEN ;u32 min_len =__bpf_skb_min_len (skb);int ret;
@@ -3002,7 +2998,7 @@ static const struct bpf_func_proto sk_skstatic inline int __bpf_skb_change_head (struct sk_buff *skb,u32 head_room,u64 flags) { -u32 max_len =__bpf_skb_max_len (skb); +u32 max_len =BPF_SKB_MAX_LEN ;u32 new_len = skb->len + head_room;int ret;
Greg Kroah-Hartman
maintainerPATCH 29/56 ALSA: usb-audio: Apply sample rate quirk to Logitech Connect
In reply to Greg Kroah-HartmanFrom: Ikjoon Jang <[email protected]>
commit 625bd5a616ceda4840cd28f82e957c8ced394b6a upstream.
Logitech ConferenceCam Connect is a compound USB device with UVC and UAC. Not 100% reproducible but sometimes it keeps responding STALL to every control transfer once it receives get_freq request.
This patch adds 046d:0x084c to a snd_usb_get_sample_rate_quirk list.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=203419
--- sound/usb/quirks.c | 1 + 1 file changed, 1 insertion(+)
sound/usb/quirks.c +1 -0
@@ -1187,6 +1187,7 @@ bool snd_usb_get_sample_rate_quirk(struccase USB_ID (0x21B4 ,0x0081 ):/* AudioQuest DragonFly */ case USB_ID (0x2912 ,0x30c8 ):/* Audioengine D1 */ case USB_ID (0x413c ,0xa506 ):/* Dell AE515 sound bar */ +case USB_ID (0x046d ,0x084c ):/* Logitech ConferenceCam Connect */ return true; }
Greg Kroah-Hartman
maintainerPATCH 30/56 ALSA: hda/realtek: fix a determine_headset_type issue for a Dell AIO
In reply to Greg Kroah-HartmanFrom: Hui Wang <[email protected]>
commit febf22565549ea7111e7d45e8f2d64373cc66b11 upstream.
We found a recording issue on a Dell AIO, users plug a headset-mic and select headset-mic from UI, but can't record any sound from headset-mic. The root cause is the determine_headset_type() returns a wrong type, e.g. users plug a ctia type headset, but that function returns omtp type.
On this machine, the internal mic is not connected to the codec, the "Input Source" is headset mic by default. And when users plug a headset, the determine_headset_type() will be called immediately, the codec on this AIO is alc274, the delay time for this codec in the determine_headset_type() is only 80ms, the delay is too short to correctly determine the headset type, the fail rate is nearly 99% when users plug the headset with the normal speed.
Other codecs set several hundred ms delay time, so here I change the delay time to 850ms for alc2x4 series, after this change, the fail rate is zero unless users plug the headset slowly on purpose.
--- sound/pci/hda/patch_realtek.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/hda/patch_realtek.c +1 -1
@@ -4870,7 +4870,7 @@ static void alc_determine_headset_type(scase 0x10ec0274 :case 0x10ec0294 :alc_process_coef_fw (codec, coef0274); -msleep (80 ); +msleep (850 ); val =alc_read_coef_idx (codec,0x46 ); is_ctia = (val &0x00f0 ) ==0x00f0 ;break ;
Greg Kroah-Hartman
maintainerPATCH 31/56 ALSA: hda/realtek: call alc_update_headset_mode() in hp_automute_hook
In reply to Greg Kroah-HartmanFrom: Hui Wang <[email protected]>
commit e54f30befa7990b897189b44a56c1138c6bfdbb5 upstream.
We found the alc_update_headset_mode() is not called on some machines when unplugging the headset, as a result, the mode of the ALC_HEADSET_MODE_UNPLUGGED can't be set, then the current_headset_type is not cleared, if users plug a differnt type of headset next time, the determine_headset_type() will not be called and the audio jack is set to the headset type of previous time.
On the Dell machines which connect the dmic to the PCH, if we open the gnome-sound-setting and unplug the headset, this issue will happen. Those machines disable the auto-mute by ucm and has no internal mic in the input source, so the update_headset_mode() will not be called by cap_sync_hook or automute_hook when unplugging, and because the gnome-sound-setting is opened, the codec will not enter the runtime_suspend state, so the update_headset_mode() will not be called by alc_resume when unplugging. In this case the hp_automute_hook is called when unplugging, so add update_headset_mode() calling to this function.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -5054,6 +5054,7 @@ static void alc_update_headset_jack_cb(sstruct alc_spec *spec = codec->spec; spec->current_headset_type =ALC_HEADSET_TYPE_UNKNOWN ;snd_hda_gen_hp_automute (codec, jack); +alc_update_headset_mode (codec); }static void alc_probe_headset_mode (struct hda_codec *codec)
Greg Kroah-Hartman
maintainerPATCH 32/56 PM: runtime: Fix race getting/putting suppliers at probe
In reply to Greg Kroah-HartmanFrom: Adrian Hunter <[email protected]>
commit 9dfacc54a8661bc8be6e08cffee59596ec59f263 upstream.
pm_runtime_put_suppliers() must not decrement rpm_active unless the consumer is suspended. That is because, otherwise, it could suspend suppliers for an active consumer.
That can happen as follows:
static int driver_probe_device(struct device_driver *drv, struct device *dev)
{
int ret = 0;
if (!device_is_registered(dev))
return -ENODEV;
dev->can_match = true;
pr_debug("bus: '%s': %s: matched device %s with driver %s\n",
drv->bus->name, __func__, dev_name(dev), drv->name);
pm_runtime_get_suppliers(dev);
if (dev->parent)
pm_runtime_get_sync(dev->parent); At this point, dev can runtime suspend so rpm_put_suppliers() can run, rpm_active becomes 1 (the lowest value).
pm_runtime_barrier(dev); if (initcall_debug) ret = really_probe_debug(dev, drv); else ret = really_probe(dev, drv);
Probe callback can have runtime resumed dev, and then runtime put so dev is awaiting autosuspend, but rpm_active is 2.
pm_request_idle(dev); if (dev->parent) pm_runtime_put(dev->parent); pm_runtime_put_suppliers(dev);
Now pm_runtime_put_suppliers() will put the supplier i.e. rpm_active 2 -> 1, but consumer can still be active.
return ret;
}
Fix by checking the runtime status. For any status other than RPM_SUSPENDED, rpm_active can be considered to be "owned" by rpm_[get/put]_suppliers() and pm_runtime_put_suppliers() need do nothing.
--- drivers/base/power/runtime.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/base/power/runtime.c +7 -1
@@ -1586,6 +1586,8 @@ void pm_runtime_get_suppliers(struct devvoid pm_runtime_put_suppliers (struct device *dev) {struct device_link *link; +unsigned long flags; +bool put;int idx; idx =device_links_read_lock ();
@@ -1593,7 +1595,11 @@ void pm_runtime_put_suppliers(struct devlist_for_each_entry_rcu (link, &dev->links.suppliers, c_node)if (link->supplier_preactivated) { link->supplier_preactivated = false; -if (refcount_dec_not_one (&link->rpm_active)) +spin_lock_irqsave (&dev->power.lock, flags); + put =pm_runtime_status_suspended (dev) && +refcount_dec_not_one (&link->rpm_active); +spin_unlock_irqrestore (&dev->power.lock, flags); +if (put)pm_runtime_put (link->supplier); }
Greg Kroah-Hartman
maintainerPATCH 33/56 PM: runtime: Fix ordering in pm_runtime_get_suppliers()
In reply to Greg Kroah-HartmanFrom: Adrian Hunter <[email protected]>
commit c0c33442f7203704aef345647e14c2fb86071001 upstream.
rpm_active indicates how many times the supplier usage_count has been incremented. Consequently it must be updated after pm_runtime_get_sync() of the supplier, not before.
--- drivers/base/power/runtime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/power/runtime.c +1 -1
@@ -1572,8 +1572,8 @@ void pm_runtime_get_suppliers(struct devlist_for_each_entry_rcu (link, &dev->links.suppliers, c_node)if (link->flags &DL_FLAG_PM_RUNTIME ) { link->supplier_preactivated = true; -refcount_inc (&link->rpm_active);pm_runtime_get_sync (link->supplier); +refcount_inc (&link->rpm_active); }device_links_read_unlock (idx);
Greg Kroah-Hartman
maintainerPATCH 34/56 tracing: Fix stack trace event size
In reply to Greg Kroah-HartmanFrom: Steven Rostedt (VMware) <[email protected]>
commit 9deb193af69d3fd6dd8e47f292b67c805a787010 upstream.
Commit cbc3b92ce037 fixed an issue to modify the macros of the stack trace event so that user space could parse it properly. Originally the stack trace format to user space showed that the called stack was a dynamic array. But it is not actually a dynamic array, in the way that other dynamic event arrays worked, and this broke user space parsing for it. The update was to make the array look to have 8 entries in it. Helper functions were added to make it parse it correctly, as the stack was dynamic, but was determined by the size of the event stored.
Although this fixed user space on how it read the event, it changed the internal structure used for the stack trace event. It changed the array size from [0] to [8] (added 8 entries). This increased the size of the stack trace event by 8 words. The size reserved on the ring buffer was the size of the stack trace event plus the number of stack entries found in the stack trace. That commit caused the amount to be 8 more than what was needed because it did not expect the caller field to have any size. This produced 8 entries of garbage (and reading random data) from the stack trace event:
<idle>-0 [002] d... 1976396.837549: <stack trace>
=> trace_event_raw_event_sched_switch
=> __traceiter_sched_switch
=> __schedule
=> schedule_idle
=> do_idle
=> cpu_startup_entry
=> secondary_startup_64_no_verify
=> 0xc8c5e150ffff93de
=> 0xffff93de
=> 0
=> 0
=> 0xc8c5e17800000000
=> 0x1f30affff93de
=> 0x00000004
=> 0x200000000
Instead, subtract the size of the caller field from the size of the event to make sure that only the amount needed to store the stack trace is reserved.
--- kernel/trace/trace.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/trace/trace.c +2 -1
@@ -2645,7 +2645,8 @@ static void __ftrace_trace_stack(struct size *=sizeof (unsigned long ); event =__trace_buffer_lock_reserve (buffer,TRACE_STACK , -sizeof (*entry) + size, flags, pc); + (sizeof (*entry) -sizeof (entry->caller)) + size, + flags, pc);if (!event) goto out; entry =ring_buffer_event_data (event);
Greg Kroah-Hartman
maintainerPATCH 35/56 mm: fix race by making init_zero_pfn() early_initcall
In reply to Greg Kroah-HartmanFrom: Ilya Lipnitskiy <[email protected]>
commit e720e7d0e983bf05de80b231bccc39f1487f0f16 upstream.
There are code paths that rely on zero_pfn to be fully initialized before core_initcall. For example, wq_sysfs_init() is a core_initcall function that eventually results in a call to kernel_execve, which causes a page fault with a subsequent mmput. If zero_pfn is not initialized by then it may not get cleaned up properly and result in an error:
BUG: Bad rss-counter state mm:(ptrval) type:MM_ANONPAGES val:1
Here is an analysis of the race as seen on a MIPS device. On this particular MT7621 device (Ubiquiti ER-X), zero_pfn is PFN 0 until initialized, at which point it becomes PFN 5120:
1. wq_sysfs_init calls into kobject_uevent_env at core_initcall:
kobject_uevent_env+0x7e4/0x7ec
kset_register+0x68/0x88
bus_register+0xdc/0x34c
subsys_virtual_register+0x34/0x78
wq_sysfs_init+0x1c/0x4c
do_one_initcall+0x50/0x1a8
kernel_init_freeable+0x230/0x2c8
kernel_init+0x10/0x100
ret_from_kernel_thread+0x14/0x1c 2. kobject_uevent_env() calls call_usermodehelper_exec() which executes kernel_execve asynchronously.
3. Memory allocations in kernel_execve cause a page fault, bumping the
MM reference counter:
add_mm_counter_fast+0xb4/0xc0
handle_mm_fault+0x6e4/0xea0
__get_user_pages.part.78+0x190/0x37c
__get_user_pages_remote+0x128/0x360
get_arg_page+0x34/0xa0
copy_string_kernel+0x194/0x2a4
kernel_execve+0x11c/0x298
call_usermodehelper_exec_async+0x114/0x194 4. In case zero_pfn has not been initialized yet, zap_pte_range does
not decrement the MM_ANONPAGES RSS counter and the BUG message is
triggered shortly afterwards when __mmdrop checks the ref counters:
__mmdrop+0x98/0x1d0
free_bprm+0x44/0x118
kernel_execve+0x160/0x1d8
call_usermodehelper_exec_async+0x114/0x194
ret_from_kernel_thread+0x14/0x1cTo avoid races such as described above, initialize init_zero_pfn at early_initcall level. Depending on the architecture, ZERO_PAGE is either constant or gets initialized even earlier, at paging_init, so there is no issue with initializing zero_pfn earlier.
--- mm/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/memory.c +1 -1
@@ -148,7 +148,7 @@ static int __init init_zero_pfn(void) zero_pfn =page_to_pfn (ZERO_PAGE (0 ));return 0 ; } -core_initcall (init_zero_pfn); +early_initcall (init_zero_pfn);#if defined(SPLIT_RSS_COUNTING )
Greg Kroah-Hartman
maintainerPATCH 36/56 drm/amdgpu: fix offset calculation in amdgpu_vm_bo_clear_mappings()
In reply to Greg Kroah-HartmanFrom: Nirmoy Das <[email protected]>
commit 5e61b84f9d3ddfba73091f9fbc940caae1c9eb22 upstream.
Offset calculation wasn't correct as start addresses are in pfn not in bytes.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -1
@@ -2286,7 +2286,7 @@ int amdgpu_vm_bo_clear_mappings(struct a after->start = eaddr +1 ; after->last = tmp->last; after->offset = tmp->offset; - after->offset += after->start - tmp->start; + after->offset += (after->start - tmp->start) <<PAGE_SHIFT ; after->flags = tmp->flags; after->bo_va = tmp->bo_va;list_add (&after->list, &tmp->bo_va->invalids);
Greg Kroah-Hartman
maintainerPATCH 37/56 drm/amdgpu: check alignment on CPU page for bo map
In reply to Greg Kroah-HartmanFrom: Xℹ Ruoyao <[email protected]>
commit e3512fb67093fabdf27af303066627b921ee9bd8 upstream.
The page table of AMDGPU requires an alignment to CPU page so we should check ioctl parameters for it. Return -EINVAL if some parameter is unaligned to CPU page, instead of corrupt the page table sliently.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +4 -4
@@ -2076,8 +2076,8 @@ int amdgpu_vm_bo_map(struct amdgpu_devicuint64_t eaddr;/* validate the parameters */ -if (saddr &AMDGPU_GPU_PAGE_MASK || offset &AMDGPU_GPU_PAGE_MASK || - size ==0 || size &AMDGPU_GPU_PAGE_MASK ) +if (saddr & ~PAGE_MASK || offset & ~PAGE_MASK || + size ==0 || size & ~PAGE_MASK )return -EINVAL ;/* make sure object fit at this offset */
@@ -2141,8 +2141,8 @@ int amdgpu_vm_bo_replace_map(struct amdgint r;/* validate the parameters */ -if (saddr &AMDGPU_GPU_PAGE_MASK || offset &AMDGPU_GPU_PAGE_MASK || - size ==0 || size &AMDGPU_GPU_PAGE_MASK ) +if (saddr & ~PAGE_MASK || offset & ~PAGE_MASK || + size ==0 || size & ~PAGE_MASK )return -EINVAL ;/* make sure object fit at this offset */
Greg Kroah-Hartman
maintainerPATCH 38/56 reiserfs: update reiserfs_xattrs_initialized() condition
In reply to Greg Kroah-HartmanFrom: Tetsuo Handa <[email protected]>
commit 5e46d1b78a03d52306f21f77a4e4a144b6d31486 upstream.
syzbot is reporting NULL pointer dereference at reiserfs_security_init() [1], for commit ab17c4f02156c4f7 ("reiserfs: fixup xattr_root caching") is assuming that REISERFS_SB(s)->xattr_root != NULL in reiserfs_xattr_jcreate_nblocks() despite that commit made REISERFS_SB(sb)->priv_root != NULL && REISERFS_SB(s)->xattr_root == NULL case possible.
I guess that commit 6cb4aff0a77cc0e6 ("reiserfs: fix oops while creating privroot with selinux enabled") wanted to check xattr_root != NULL before reiserfs_xattr_jcreate_nblocks(), for the changelog is talking about the xattr root.
The issue is that while creating the privroot during mount reiserfs_security_init calls reiserfs_xattr_jcreate_nblocks which dereferences the xattr root. The xattr root doesn't exist, so we get an oops.
Therefore, update reiserfs_xattrs_initialized() to check both the privroot and the xattr root.
--- fs/reiserfs/xattr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/reiserfs/xattr.h +1 -1
@@ -43,7 +43,7 @@ void reiserfs_security_free(struct reisestatic inline int reiserfs_xattrs_initialized (struct super_block *sb) { -return REISERFS_SB (sb)->priv_root !=NULL ; +return REISERFS_SB (sb)->priv_root &&REISERFS_SB (sb)->xattr_root; }#define xattr_size (size) ((size) + sizeof(struct reiserfs_xattr_header))
Greg Kroah-Hartman
maintainerPATCH 39/56 pinctrl: rockchip: fix restore error in resume
In reply to Greg Kroah-HartmanFrom: Wang Panzhenzhuan <[email protected]>
commit c971af25cda94afe71617790826a86253e88eab0 upstream.
The restore in resume should match to suspend which only set for RK3288 SoCs pinctrl.
--- drivers/pinctrl/pinctrl-rockchip.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/pinctrl/pinctrl-rockchip.c +8 -5
@@ -3353,12 +3353,15 @@ static int __maybe_unused rockchip_pinctstatic int __maybe_unused rockchip_pinctrl_resume (struct device *dev) {struct rockchip_pinctrl *info =dev_get_drvdata (dev); -int ret =regmap_write (info->regmap_base,RK3288_GRF_GPIO6C_IOMUX , - rk3288_grf_gpio6c_iomux | -GPIO6C6_SEL_WRITE_ENABLE ); +int ret; -if (ret) -return ret; +if (info->ctrl->type ==RK3288 ) { + ret =regmap_write (info->regmap_base,RK3288_GRF_GPIO6C_IOMUX , + rk3288_grf_gpio6c_iomux | +GPIO6C6_SEL_WRITE_ENABLE ); +if (ret) +return ret; + }return pinctrl_force_default (info->pctl_dev); }
Greg Kroah-Hartman
maintainerPATCH 40/56 extcon: Add stubs for extcon_register_notifier_all() functions
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit c9570d4a5efd04479b3cd09c39b571eb031d94f4 ]
Add stubs for extcon_register_notifier_all() function for !CONFIG_EXTCON case. This is useful for compile testing and for drivers which use EXTCON but do not require it (therefore do not depend on CONFIG_EXTCON).
--- include/linux/extcon.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
include/linux/extcon.h +23 -0
@@ -279,6 +279,29 @@ static inline void devm_extcon_unregister_notifier(struct device *dev, struct extcon_dev *edev, unsigned int id, struct notifier_block *nb) { } +static inline int extcon_register_notifier_all (struct extcon_dev *edev, +struct notifier_block *nb) +{ +return 0 ; +} + +static inline int extcon_unregister_notifier_all (struct extcon_dev *edev, +struct notifier_block *nb) +{ +return 0 ; +} + +static inline int devm_extcon_register_notifier_all (struct device *dev, +struct extcon_dev *edev, +struct notifier_block *nb) +{ +return 0 ; +} + +static inline void devm_extcon_unregister_notifier_all (struct device *dev, +struct extcon_dev *edev, +struct notifier_block *nb) { } +static inline struct extcon_dev *extcon_get_extcon_dev (const char *extcon_name) {return ERR_PTR (-ENODEV );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 41/56 extcon: Fix error handling in extcon_dev_register
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit d3bdd1c3140724967ca4136755538fa7c05c2b4e ]
When devm_kcalloc() fails, we should execute device_unregister() to unregister edev->dev from system.
--- drivers/extcon/extcon.c | 1 + 1 file changed, 1 insertion(+)
drivers/extcon/extcon.c +1 -0
@@ -1256,6 +1256,7 @@ int extcon_dev_register(struct extcon_dev *edev) sizeof(*edev->nh), GFP_KERNEL);if (!edev->nh) { ret = -ENOMEM ; +device_unregister (&edev->dev); goto err_dev; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 42/56 firewire: nosy: Fix a use-after-free bug in nosy_ioctl()
In reply to Greg Kroah-HartmanFrom: Zheyu Ma <[email protected]>
[ Upstream commit 829933ef05a951c8ff140e814656d73e74915faf ]
For each device, the nosy driver allocates a pcilynx structure. A use-after-free might happen in the following scenario:
1. Open nosy device for the first time and call ioctl with command NOSY_IOC_START, then a new client A will be malloced and added to doubly linked list.
2. Open nosy device for the second time and call ioctl with command NOSY_IOC_START, then a new client B will be malloced and added to doubly linked list.
3. Call ioctl with command NOSY_IOC_START for client A, then client A will be readded to the doubly linked list. Now the doubly linked list is messed up.
4. Close the first nosy device and nosy_release will be called. In nosy_release, client A will be unlinked and freed.
5. Close the second nosy device, and client A will be referenced, resulting in UAF.
The root cause of this bug is that the element in the doubly linked list is reentered into the list.
Fix this bug by adding a check before inserting a client. If a client is already in the linked list, don't insert it.
The following KASAN report reveals it:
BUG: KASAN: use-after-free in nosy_release+0x1ea/0x210
Write of size 8 at addr ffff888102ad7360 by task poc
CPU: 3 PID: 337 Comm: poc Not tainted 5.12.0-rc5+ #6
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.12.0-59-gc9ba5276e321-prebuilt.qemu.org 04/01/2014
Call Trace:
nosy_release+0x1ea/0x210
__fput+0x1e2/0x840
task_work_run+0xe8/0x180
exit_to_user_mode_prepare+0x114/0x120
syscall_exit_to_user_mode+0x1d/0x40
entry_SYSCALL_64_after_hwframe+0x44/0xae
Allocated by task 337:
nosy_open+0x154/0x4d0
misc_open+0x2ec/0x410
chrdev_open+0x20d/0x5a0
do_dentry_open+0x40f/0xe80
path_openat+0x1cf9/0x37b0
do_filp_open+0x16d/0x390
do_sys_openat2+0x11d/0x360
__x64_sys_open+0xfd/0x1a0
do_syscall_64+0x33/0x40
entry_SYSCALL_64_after_hwframe+0x44/0xae
Freed by task 337:
kfree+0x8f/0x210
nosy_release+0x158/0x210
__fput+0x1e2/0x840
task_work_run+0xe8/0x180
exit_to_user_mode_prepare+0x114/0x120
syscall_exit_to_user_mode+0x1d/0x40
entry_SYSCALL_64_after_hwframe+0x44/0xae
The buggy address belongs to the object at ffff888102ad7300 which belongs to the cache kmalloc-128 of size 128
The buggy address is located 96 bytes inside of 128-byte region [ffff888102ad7300, ffff888102ad7380)[ Modified to use 'list_empty()' inside proper lock - Linus ]
--- drivers/firewire/nosy.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/firewire/nosy.c +7 -2
@@ -359,6 +359,7 @@ nosy_ioctl(struct file *file, unsigned int cmd, unsigned long arg)struct client *client = file->private_data;spinlock_t *client_list_lock = &client->lynx->client_list_lock;struct nosy_stats stats; +int ret;switch (cmd) {case NOSY_IOC_GET_STATS :
@@ -373,11 +374,15 @@ nosy_ioctl(struct file *file, unsigned int cmd, unsigned long arg)return 0 ;case NOSY_IOC_START : + ret = -EBUSY ;spin_lock_irq (client_list_lock); -list_add_tail (&client->link, &client->lynx->client_list); +if (list_empty (&client->link)) { +list_add_tail (&client->link, &client->lynx->client_list); + ret =0 ; + }spin_unlock_irq (client_list_lock); -return 0 ; +return ret;case NOSY_IOC_STOP :spin_lock_irq (client_list_lock);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 43/56 usbip: vhci_hcd fix shift out-of-bounds in vhci_hub_control()
In reply to Greg Kroah-HartmanFrom: Shuah Khan <[email protected]>
commit 1cc5ed25bdade86de2650a82b2730108a76de20c upstream.
Fix shift out-of-bounds in vhci_hub_control() SetPortFeature handling.
UBSAN: shift-out-of-bounds in drivers/usb/usbip/vhci_hcd.c:605:42
shift exponent 768 is too large for 32-bit type 'int'
--- drivers/usb/usbip/vhci_hcd.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/usbip/vhci_hcd.c +2 -0
@@ -594,6 +594,8 @@ static int vhci_hub_control(struct usb_hpr_err ("invalid port number %d\n" , wIndex); goto error; } +if (wValue >=32 ) + goto error;if (hcd->speed ==HCD_USB3 ) {if ((vhci_hcd->port_status[rhport] &USB_SS_PORT_STAT_POWER ) !=0 ) {
Greg Kroah-Hartman
maintainerPATCH 44/56 USB: quirks: ignore remote wake-up on Fibocom L850-GL LTE modem
In reply to Greg Kroah-HartmanFrom: Vincent Palatin <[email protected]>
commit 0bd860493f81eb2a46173f6f5e44cc38331c8dbd upstream.
This LTE modem (M.2 card) has a bug in its power management:
there is some kind of race condition for U3 wake-up between the host and the device. The modem firmware sometimes crashes/locks when both events happen at the same time and the modem fully drops off the USB bus (and sometimes re-enumerates, sometimes just gets stuck until the next reboot).
Tested with the modem wired to the XHCI controller on an AMD 3015Ce platform. Without the patch, the modem dropped of the USB bus 5 times in 3 days. With the quirk, it stayed connected for a week while the 'runtime_suspended_time' counter incremented as excepted.
--- drivers/usb/core/quirks.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/usb/core/quirks.c +4 -0
@@ -498,6 +498,10 @@ static const struct usb_device_id usb_qu/* DJI CineSSD */ { USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM }, + /* Fibocom L850-GL LTE Modem */ + { USB_DEVICE(0x2cb7, 0x0007), .driver_info = + USB_QUIRK_IGNORE_REMOTE_WAKEUP }, + /* INTEL VALUE SSD */ { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME },
Greg Kroah-Hartman
maintainerPATCH 45/56 usb: musb: Fix suspend with devices connected for a64
In reply to Greg Kroah-HartmanFrom: Tony Lindgren <[email protected]>
commit 92af4fc6ec331228aca322ca37c8aea7b150a151 upstream.
Pinephone running on Allwinner A64 fails to suspend with USB devices connected as reported by Bhushan Shah <[email protected]>. Reverting commit 5fbf7a253470 ("usb: musb: fix idling for suspend after disconnect interrupt") fixes the issue.
Let's add suspend checks also for suspend after disconnect interrupt quirk handling like we already do elsewhere.
--- drivers/usb/musb/musb_core.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/usb/musb/musb_core.c +8 -4
@@ -1868,10 +1868,14 @@ static void musb_pm_runtime_check_sessioMUSB_DEVCTL_HR ;switch (devctl & ~s) {case MUSB_QUIRK_B_DISCONNECT_99 : -musb_dbg (musb,"Poll devctl in case of suspend after disconnect\n" ); -schedule_delayed_work (&musb->irq_work, -msecs_to_jiffies (1000 )); -break ; +if (musb->quirk_retries && !musb->flush_irq_work) { +musb_dbg (musb,"Poll devctl in case of suspend after disconnect\n" ); +schedule_delayed_work (&musb->irq_work, +msecs_to_jiffies (1000 )); + musb->quirk_retries--; +break ; + } +/* fall through */ case MUSB_QUIRK_B_INVALID_VBUS_91 :if (musb->quirk_retries && !musb->flush_irq_work) { musb_dbg(musb,
Greg Kroah-Hartman
maintainerPATCH 46/56 usb: xhci-mtk: fix broken streams issue on 0.96 xHCI
In reply to Greg Kroah-HartmanFrom: Chunfeng Yun <[email protected]>
commit 6f978a30c9bb12dab1302d0f06951ee290f5e600 upstream.
The MediaTek 0.96 xHCI controller on some platforms does not support bulk stream even HCCPARAMS says supporting, due to MaxPSASize is set a default value 1 by mistake, here use XHCI_BROKEN_STREAMS quirk to fix it.
--- drivers/usb/host/xhci-mtk.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-mtk.c +9 -1
@@ -395,6 +395,13 @@ static void xhci_mtk_quirks(struct devic xhci->quirks |=XHCI_SPURIOUS_SUCCESS ;if (mtk->lpm_support) xhci->quirks |=XHCI_LPM_SUPPORT ; + +/* +* MTK xHCI 0.96: PSA is 1 by default even if doesn't support stream, +* and it's 3 when support it. +*/ +if (xhci->hci_version <0x100 &&HCC_MAX_PSA (xhci->hcc_params) ==4 ) + xhci->quirks |=XHCI_BROKEN_STREAMS ; }/* called during probe() after chip reset completes */
@@ -551,7 +558,8 @@ static int xhci_mtk_probe(struct platforif (ret) goto put_usb3_hcd; -if (HCC_MAX_PSA (xhci->hcc_params) >=4 ) +if (HCC_MAX_PSA (xhci->hcc_params) >=4 && + !(xhci->quirks &XHCI_BROKEN_STREAMS )) xhci->shared_hcd->can_do_streams =1 ; ret =usb_add_hcd (xhci->shared_hcd, irq,IRQF_SHARED );
Greg Kroah-Hartman
maintainerPATCH 47/56 cdc-acm: fix BREAK rx code path adding necessary calls
In reply to Greg Kroah-HartmanFrom: Oliver Neukum <[email protected]>
commit 08dff274edda54310d6f1cf27b62fddf0f8d146e upstream.
Counting break events is nice but we should actually report them to the tty layer.
--- drivers/usb/class/cdc-acm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/class/cdc-acm.c +3 -1
@@ -312,8 +312,10 @@ static void acm_process_notification(str acm->iocount.dsr++;if (difference &ACM_CTRL_DCD ) acm->iocount.dcd++; -if (newctrl &ACM_CTRL_BRK ) +if (newctrl &ACM_CTRL_BRK ) { acm->iocount.brk++; +tty_insert_flip_char (&acm->port,0 ,TTY_BREAK ); + }if (newctrl &ACM_CTRL_RI ) acm->iocount.rng++;if (newctrl &ACM_CTRL_FRAMING )
Greg Kroah-Hartman
maintainerPATCH 48/56 USB: cdc-acm: untangle a circular dependency between callback and softint
In reply to Greg Kroah-HartmanFrom: Oliver Neukum <[email protected]>
commit 6069e3e927c8fb3a1947b07d1a561644ea960248 upstream.
We have a cycle of callbacks scheduling works which submit URBs with thos callbacks. This needs to be blocked, stopped and unblocked to untangle the circle.
The issue leads to faults like:
[ 55.068392] Unable to handle kernel paging request at virtual address 6b6b6c03 [ 55.075624] pgd = be866494 [ 55.078335] [6b6b6c03] *pgd=00000000 [ 55.081924] Internal error: Oops: 5 [#1] PREEMPT SMP ARM [ 55.087238] Modules linked in: ppp_async crc_ccitt ppp_generic slhc
xt_TCPMSS xt_tcpmss xt_hl nf_log_ipv6 nf_log_ipv4 nf_log_common xt_policy xt_limit xt_conntrack xt_tcpudp xt_pkttype ip6table_mangle iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 iptable_mangle ip6table_filter ip6_tables iptable_filter ip_tables des_generic md5 sch_fq_codel cdc_mbim cdc_wdm cdc_ncm usbnet mii cdc_acm usb_storage ip_tunnel xfrm_user xfrm6_tunnel tunnel6 xfrm4_tunnel tunnel4 esp6 esp4 ah6 ah4 xfrm_algo xt_LOG xt_LED xt_comment x_tables ipv6
[ 55.134954] CPU: 0 PID: 82 Comm: kworker/0:2 Tainted: G T 5.8.17 #1 [ 55.142526] Hardware name: Freescale i.MX7 Dual (Device Tree) [ 55.148304] Workqueue: events acm_softint [cdc_acm] [ 55.153196] PC is at kobject_get+0x10/0xa4 [ 55.157302] LR is at usb_get_dev+0x14/0x1c [ 55.161402] pc : [<8047c06c>] lr : [<80560448>] psr: 20000193 [ 55.167671] sp : bca39ea8 ip : 00007374 fp : bf6cbd80 [ 55.172899] r10: 00000000 r9 : bdd92284 r8 : bdd92008 [ 55.178128] r7 : 6b6b6b6b r6 : fffffffe r5 : 60000113 r4 : 6b6b6be3 [ 55.184658] r3 : 6b6b6b6b r2 : 00000111 r1 : 00000000 r0 : 6b6b6be3 [ 55.191191] Flags: nzCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment none [ 55.198417] Control: 10c5387d Table: bcf0c06a DAC: 00000051 [ 55.204168] Process kworker/0:2 (pid: 82, stack limit = 0x9bdd2a89) [ 55.210439] Stack: (0xbca39ea8 to 0xbca3a000) [ 55.214805] 9ea0: bf6cbd80 80769a50 6b6b6b6b 80560448 bdeb0500 8056bfe8 [ 55.222991] 9ec0: 00000002 b76da000 00000000 bdeb0500 bdd92448 bca38000 bdeb0510 8056d69c [ 55.231177] 9ee0: bca38000 00000000 80c050fc 00000000 bca39f44 09d42015 00000000 00000001 [ 55.239363] 9f00: bdd92448 bdd92438 bdd92000 7f1158c4 bdd92448 bca2ee00 bf6cbd80 bf6cef00 [ 55.247549] 9f20: 00000000 00000000 00000000 801412d8 bf6cbd98 80c03d00 bca2ee00 bf6cbd80 [ 55.255735] 9f40: bca2ee14 bf6cbd98 80c03d00 00000008 bca38000 80141568 00000000 80c446ae [ 55.263921] 9f60: 00000000 bc9ed880 bc9f0700 bca38000 bc117eb4 80141524 bca2ee00 bc9ed8a4 [ 55.272107] 9f80: 00000000 80147cc8 00000000 bc9f0700 80147b84 00000000 00000000 00000000 [ 55.280292] 9fa0: 00000000 00000000 00000000 80100148 00000000 00000000 00000000 00000000 [ 55.288477] 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 55.296662] 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000 [ 55.304860] [<8047c06c>] (kobject_get) from [<80560448>] (usb_get_dev+0x14/0x1c) [ 55.312271] [<80560448>] (usb_get_dev) from [<8056bfe8>] (usb_hcd_unlink_urb+0x50/0xd8) [ 55.320286] [<8056bfe8>] (usb_hcd_unlink_urb) from [<8056d69c>] (usb_kill_urb.part.0+0x44/0xd0) [ 55.329004] [<8056d69c>] (usb_kill_urb.part.0) from [<7f1158c4>] (acm_softint+0x4c/0x10c [cdc_acm]) [ 55.338082] [<7f1158c4>] (acm_softint [cdc_acm]) from [<801412d8>] (process_one_work+0x19c/0x3e8) [ 55.346969] [<801412d8>] (process_one_work) from [<80141568>] (worker_thread+0x44/0x4dc) [ 55.355072] [<80141568>] (worker_thread) from [<80147cc8>] (kthread+0x144/0x180) [ 55.362481] [<80147cc8>] (kthread) from [<80100148>] (ret_from_fork+0x14/0x2c) [ 55.369706] Exception stack(0xbca39fb0 to 0xbca39ff8)
--- drivers/usb/class/cdc-acm.c | 48 +++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 16 deletions(-)
drivers/usb/class/cdc-acm.c +32 -16
@@ -147,17 +147,29 @@ static inline int acm_set_control(struct#define acm_send_break (acm, ms) \ acm_ctrl_msg(acm, USB_CDC_REQ_SEND_BREAK, ms, NULL, 0) -static void acm_kill_urbs (struct acm *acm) +static void acm_poison_urbs (struct acm *acm) {int i; -usb_kill_urb (acm->ctrlurb); +usb_poison_urb (acm->ctrlurb);for (i =0 ; i <ACM_NW ; i++) -usb_kill_urb (acm->wb[i].urb); +usb_poison_urb (acm->wb[i].urb);for (i =0 ; i < acm->rx_buflimit; i++) -usb_kill_urb (acm->read_urbs[i]); +usb_poison_urb (acm->read_urbs[i]); +} + +static void acm_unpoison_urbs (struct acm *acm) +{ +int i; + +for (i =0 ; i < acm->rx_buflimit; i++) +usb_unpoison_urb (acm->read_urbs[i]); +for (i =0 ; i <ACM_NW ; i++) +usb_unpoison_urb (acm->wb[i].urb); +usb_unpoison_urb (acm->ctrlurb); } +/* * Write buffer management. * All of these assume proper locks taken by the caller.
@@ -225,9 +237,10 @@ static int acm_start_wb(struct acm *acm, rc =usb_submit_urb (wb->urb,GFP_ATOMIC );if (rc <0 ) { -dev_err (&acm->data->dev, -"%s - usb_submit_urb(write bulk) failed: %d\n" , - __func__, rc); +if (rc != -EPERM ) +dev_err (&acm->data->dev, +"%s - usb_submit_urb(write bulk) failed: %d\n" , + __func__, rc);acm_write_done (acm, wb); }return rc;
@@ -482,11 +495,6 @@ static void acm_read_bulk_callback(strucdev_vdbg (&acm->data->dev,"got urb %d, len %d, status %d\n" , rb->index, urb->actual_length, status); -if (!acm->dev) { -dev_dbg (&acm->data->dev,"%s - disconnected\n" , __func__); -return ; - } -switch (status) {case 0 :usb_mark_last_busy (acm->dev);
@@ -741,6 +749,7 @@ static void acm_port_shutdown(struct tty* Need to grab write_lock to prevent race with resume, but no need to * hold it due to the tty-port initialised flag. */ +acm_poison_urbs (acm);spin_lock_irq (&acm->write_lock);spin_unlock_irq (&acm->write_lock);
@@ -757,7 +766,8 @@ static void acm_port_shutdown(struct ttyusb_autopm_put_interface_async (acm->control); } -acm_kill_urbs (acm); +acm_unpoison_urbs (acm); + }static void acm_tty_cleanup (struct tty_struct *tty)
@@ -1587,8 +1597,14 @@ static void acm_disconnect(struct usb_inif (!acm)return ; -mutex_lock (&acm->mutex); acm->disconnected = true; +/* +* there is a circular dependency. acm_softint() can resubmit +* the URBs in error handling so we need to block any +* submission right away +*/ +acm_poison_urbs (acm); +mutex_lock (&acm->mutex);if (acm->country_codes) {device_remove_file (&acm->control->dev, &dev_attr_wCountryCodes);
@@ -1607,7 +1623,6 @@ static void acm_disconnect(struct usb_intty_kref_put (tty); } -acm_kill_urbs (acm);cancel_delayed_work_sync (&acm->dwork);tty_unregister_device (acm_tty_driver, acm->minor);
@@ -1649,7 +1664,7 @@ static int acm_suspend(struct usb_interfif (cnt)return 0 ; -acm_kill_urbs (acm); +acm_poison_urbs (acm);cancel_delayed_work_sync (&acm->dwork); acm->urbs_in_error_delay =0 ;
@@ -1662,6 +1677,7 @@ static int acm_resume(struct usb_interfastruct urb *urb;int rv =0 ; +acm_unpoison_urbs (acm);spin_lock_irq (&acm->write_lock);if (--acm->susp_count)
Greg Kroah-Hartman
maintainerPATCH 49/56 USB: cdc-acm: downgrade message to debug
In reply to Greg Kroah-HartmanFrom: Oliver Neukum <[email protected]>
commit e4c77070ad45fc940af1d7fb1e637c349e848951 upstream.
This failure is so common that logging an error here amounts to spamming log files.
--- drivers/usb/class/cdc-acm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/class/cdc-acm.c +2 -1
@@ -664,7 +664,8 @@ static void acm_port_dtr_rts(struct tty_ res =acm_set_control (acm, val);if (res && (acm->ctrl_caps &USB_CDC_CAP_LINE )) -dev_err (&acm->control->dev,"failed to set dtr/rts\n" ); +/* This is broken in too many devices to spam the logs */ +dev_dbg (&acm->control->dev,"failed to set dtr/rts\n" ); }static int acm_port_activate (struct tty_port *port,struct tty_struct *tty)
Greg Kroah-Hartman
maintainerPATCH 50/56 USB: cdc-acm: fix double free on probe failure
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 7180495cb3d0e2a2860d282a468b4146c21da78f upstream.
If tty-device registration fails the driver copy of any Country Selection functional descriptor would end up being freed twice; first explicitly in the error path and then again in the tty-port destructor.
Drop the first erroneous free that was left when fixing a tty-port resource leak.
--- drivers/usb/class/cdc-acm.c | 1 - 1 file changed, 1 deletion(-)
drivers/usb/class/cdc-acm.c +0 -1
@@ -1566,7 +1566,6 @@ alloc_fail6: &dev_attr_wCountryCodes);device_remove_file (&acm->control->dev, &dev_attr_iCountryCodeRelDate); -kfree (acm->country_codes); }device_remove_file (&acm->control->dev, &dev_attr_bmCapabilities); alloc_fail5:
Greg Kroah-Hartman
maintainerPATCH 51/56 USB: cdc-acm: fix use-after-free after probe failure
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 4e49bf376c0451ad2eae2592e093659cde12be9a upstream.
If tty-device registration fails the driver would fail to release the data interface. When the device is later disconnected, the disconnect callback would still be called for the data interface and would go about releasing already freed resources.
--- drivers/usb/class/cdc-acm.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/usb/class/cdc-acm.c +5 -0
@@ -1561,6 +1561,11 @@ skip_countries:return 0 ; alloc_fail6: +if (!acm->combined_interfaces) { +/* Clear driver data so that disconnect() returns early. */ +usb_set_intfdata (data_interface,NULL ); +usb_driver_release_interface (&acm_driver, data_interface); + }if (acm->country_codes) {device_remove_file (&acm->control->dev, &dev_attr_wCountryCodes);
Greg Kroah-Hartman
maintainerPATCH 52/56 usb: gadget: udc: amd5536udc_pci fix null-ptr-dereference
In reply to Greg Kroah-HartmanFrom: Tong Zhang <[email protected]>
commit 72035f4954f0bca2d8c47cf31b3629c42116f5b7 upstream.
init_dma_pools() calls dma_pool_create(...dev->dev) to create dma pool. however, dev->dev is actually set after calling init_dma_pools(), which effectively makes dma_pool_create(..NULL) and cause crash. To fix this issue, init dma only after dev->dev is set.
[ 1.317993] RIP: 0010:dma_pool_create+0x83/0x290 [ 1.323257] Call Trace: [ 1.323390] ? pci_write_config_word+0x27/0x30 [ 1.323626] init_dma_pools+0x41/0x1a0 [snps_udc_core] [ 1.323899] udc_pci_probe+0x202/0x2b1 [amd5536udc_pci]
--- drivers/usb/gadget/udc/amd5536udc_pci.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/usb/gadget/udc/amd5536udc_pci.c +5 -5
@@ -154,6 +154,11 @@ static int udc_pci_probe(pci_set_master (pdev);pci_try_set_mwi (pdev); + dev->phys_addr = resource; + dev->irq = pdev->irq; + dev->pdev = pdev; + dev->dev = &pdev->dev; +/* init dma pools */ if (use_dma) { retval =init_dma_pools (dev);
@@ -161,11 +166,6 @@ static int udc_pci_probe( goto err_dma; } - dev->phys_addr = resource; - dev->irq = pdev->irq; - dev->pdev = pdev; - dev->dev = &pdev->dev; -/* general probing */ if (udc_probe (dev)) { retval = -ENODEV ;
Greg Kroah-Hartman
maintainerPATCH 53/56 usb: dwc2: Fix HPRT0.PrtSusp bit setting for HiKey 960 board.
In reply to Greg Kroah-HartmanFrom: Artur Petrosyan <[email protected]>
commit 5e3bbae8ee3d677a0aa2919dc62b5c60ea01ba61 upstream.
Increased the waiting timeout for HPRT0.PrtSusp register field to be set, because on HiKey 960 board HPRT0.PrtSusp wasn't generated with the existing timeout.
--- drivers/usb/dwc2/hcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/dwc2/hcd.c +1 -1
@@ -5560,7 +5560,7 @@ int dwc2_host_enter_hibernation(struct ddwc2_writel (hsotg, hprt0,HPRT0 );/* Wait for the HPRT0.PrtSusp register field to be set */ -if (dwc2_hsotg_wait_bit_set (hsotg,HPRT0 ,HPRT0_SUSP ,3000 )) +if (dwc2_hsotg_wait_bit_set (hsotg,HPRT0 ,HPRT0_SUSP ,5000 ))dev_warn (hsotg->dev,"Suspend wasn't generated\n" );/*
Greg Kroah-Hartman
maintainerPATCH 54/56 staging: rtl8192e: Fix incorrect source in memcpy()
In reply to Greg Kroah-HartmanFrom: Atul Gopinathan <[email protected]>
commit 72ad25fbbb78930f892b191637359ab5b94b3190 upstream.
The variable "info_element" is of the following type:
struct rtllib_info_element *info_element
defined in drivers/staging/rtl8192e/rtllib.h:
struct rtllib_info_element {
u8 id;
u8 len;
u8 data[];
} __packed;The "len" field defines the size of the "data[]" array. The code is supposed to check if "info_element->len" is greater than 4 and later equal to 6. If this is satisfied then, the last two bytes (the 4th and 5th element of u8 "data[]" array) are copied into "network->CcxRmState".
Right now the code uses "memcpy()" with the source as "&info_element[4]" which would copy in wrong and unintended information. The struct "rtllib_info_element" has a size of 2 bytes for "id" and "len", therefore indexing will be done in interval of 2 bytes. So, "info_element[4]" would point to data which is beyond the memory allocated for this pointer (that is, at x+8, while "info_element" has been allocated only from x to x+7 (2 + 6 => 8 bytes)).
This patch rectifies this error by using "&info_element->data[4]" which correctly copies the last two bytes of "data[]".
NOTE: The faulty line of code came from the following commit:
commit ecdfa44610fa ("Staging: add Realtek 8192 PCI wireless driver")
The above commit created the file rtl8192e/ieee80211/ieee80211_rx.c which had the faulty line of code. This file has been deleted (or possibly renamed) with the contents copied in to a new file rtl8192e/rtllib_rx.c along with additional code in the commit 94a799425eee (tagged in Fixes).
--- drivers/staging/rtl8192e/rtllib_rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8192e/rtllib_rx.c +1 -1
@@ -1978,7 +1978,7 @@ static void rtllib_parse_mife_generic(st info_element->data[2] == 0x96 && info_element->data[3] == 0x01) {if (info_element->len ==6 ) { -memcpy (network->CcxRmState, &info_element[4 ],2 ); +memcpy (network->CcxRmState, &info_element->data[4 ],2 );if (network->CcxRmState[0 ] !=0 ) network->bCcxRmEnable = true;else
Greg Kroah-Hartman
maintainerPATCH 55/56 staging: rtl8192e: Change state information from u16 to u8
In reply to Greg Kroah-HartmanFrom: Atul Gopinathan <[email protected]>
commit e78836ae76d20f38eed8c8c67f21db97529949da upstream.
The "u16 CcxRmState[2];" array field in struct "rtllib_network" has 4 bytes in total while the operations performed on this array through-out the code base are only 2 bytes.
The "CcxRmState" field is fed only 2 bytes of data using memcpy():
(In rtllib_rx.c:1972)
memcpy(network->CcxRmState, &info_element->data[4], 2)
With "info_element->data[]" being a u8 array, if 2 bytes are written into "CcxRmState" (whose one element is u16 size), then the 2 u8 elements from "data[]" gets squashed and written into the first element ("CcxRmState[0]") while the second element ("CcxRmState[1]") is never fed with any data.
Same in file rtllib_rx.c:2522:
memcpy(dst->CcxRmState, src->CcxRmState, 2);
The above line duplicates "src" data to "dst" but only writes 2 bytes (and not 4, which is the actual size). Again, only 1st element gets the value while the 2nd element remains uninitialized.
This later makes operations done with CcxRmState unpredictable in the following lines as the 1st element is having a squashed number while the 2nd element is having an uninitialized random number.
rtllib_rx.c:1973: if (network->CcxRmState[0] != 0)
rtllib_rx.c:1977: network->MBssidMask = network->CcxRmState[1] & 0x07;
network->MBssidMask is also of type u8 and not u16.
Fix this by changing the type of "CcxRmState" from u16 to u8 so that the data written into this array and read from it make sense and are not random values.
NOTE: The wrong initialization of "CcxRmState" can be seen in the following commit:
commit ecdfa44610fa ("Staging: add Realtek 8192 PCI wireless driver")
The above commit created a file rtl8192e/ieee80211.h which used to have the faulty line. The file has been deleted (or possibly renamed) with the contents copied in to a new file rtl8192e/rtllib.h along with additional code in the commit 94a799425eee (tagged in Fixes).
--- drivers/staging/rtl8192e/rtllib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8192e/rtllib.h +1 -1
@@ -1110,7 +1110,7 @@ struct rtllib_network {bool bWithAironetIE;bool bCkipSupported;bool bCcxRmEnable; -u16 CcxRmState[2 ]; +u8 CcxRmState[2 ];bool bMBssidValid;u8 MBssidMask;u8 MBssid[ETH_ALEN ];
Greg Kroah-Hartman
maintainerPATCH 56/56 drivers: video: fbcon: fix NULL dereference in fbcon_cursor()
In reply to Greg Kroah-HartmanFrom: Du Cheng <[email protected]>
commit 01faae5193d6190b7b3aa93dae43f514e866d652 upstream.
add null-check on function pointer before dereference on ops->cursor
--- drivers/video/fbdev/core/fbcon.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/video/fbdev/core/fbcon.c +3 -0
@@ -1306,6 +1306,9 @@ static void fbcon_cursor(struct vc_data ops->cursor_flash = (mode ==CM_ERASE ) ?0 :1 ; +if (!ops->cursor) +return ; + ops->cursor (vc, info, mode,get_color (vc, info, c,1 ),get_color (vc, info, c,0 )); }
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.185 release. There are 56 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, 07 Apr 2021 08:50:09 +0000. Anything received after that time might be too late.
Build results:
total: 155 pass: 155 fail: 0 Qemu test results: total: 423 pass: 423 fail: 0
Guenter
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.185 release. There are 56 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, 07 Apr 2021 08:50:09 +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.19.185-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.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 4.19.185 release. There are 56 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, 07 Apr 2021 08:50:09 +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.19.185-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.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.19.185-rc1
* git: ['https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git', 'https://gitlab.com/Linaro/lkft/mirrors/stable/linux-stable-rc']
* git branch: linux-4.19.y
* git commit: e80ef2122d5c0531670cb281f5beea2cb469aee1
* git describe: v4.19.184-57-ge80ef2122d5c
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-4.19.y/build/v4.19.184-57-ge80ef2122d5c
## No regressions (compared to v4.19.184-40-gea7c9d15cb8d)
## No fixes (compared to v4.19.184-40-gea7c9d15cb8d)
## Test result summary
total: 69440, pass: 56308, fail: 1824, skip: 11083, xfail: 225,
## Build Summary
* arm: 97 total, 97 passed, 0 failed
* arm64: 25 total, 25 passed, 0 failed
* dragonboard-410c: 1 total, 1 passed, 0 failed
* hi6220-hikey: 1 total, 1 passed, 0 failed
* i386: 14 total, 14 passed, 0 failed
* juno-r2: 1 total, 1 passed, 0 failed
* mips: 39 total, 39 passed, 0 failed
* s390: 9 total, 9 passed, 0 failed
* sparc: 9 total, 9 passed, 0 failed
* x15: 1 total, 1 passed, 0 failed
* x86: 1 total, 1 passed, 0 failed
* x86_64: 15 total, 15 passed, 0 failed
## Test suites summary
* fwts
* igt-gpu-tools
* install-android-platform-tools-r2600
* kselftest-
* kselftest-android
* kselftest-bpf
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-efivarfs
* kselftest-filesystems
* 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-lkdtm
* kselftest-membarrier
* kselftest-memfd
* kselftest-memory-hotplug
* kselftest-mincore
* kselftest-mount
* kselftest-mqueue
* kselftest-net
* kselftest-netfilter
* kselftest-nsfs
* kselftest-openat2
* kselftest-pid_namespace
* kselftest-pidfd
* kselftest-proc
* kselftest-pstore
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* 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-vsyscall-mode-native-
* kselftest-vsyscall-mode-none-
* kselftest-x86
* kselftest-zram
* kvm-unit-tests
* libhugetlbfs
* linux-log-parser
* ltp-cap_bounds-tests
* ltp-commands-tests
* ltp-containers-tests
* ltp-controllers-tests
* ltp-cpuhotplug-tests
* ltp-crypto-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-open-posix-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* ltp-tracing-tests
* network-basic-tests
* perf
* rcutorture
* ssuite
* v4l2-compliance
--
Linaro LKFT
https://lkft.linaro.org
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.185 release. There are 56 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, 07 Apr 2021 08:50:09 +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.19.185-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
Tested on arm64 and x86 for 4.19.185-rc1,
Kernel repo:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
Branch: linux-4.19.y
Version: 4.19.185-rc1
Commit: e80ef2122d5c0531670cb281f5beea2cb469aee1
Compiler: gcc version 7.3.0 (GCC)
arm64:
--------------------------------------------------------------------
Testcase Result Summary:
total: 4679
passed: 4679
failed: 0
timeout: 0
--------------------------------------------------------------------
x86:
--------------------------------------------------------------------
Testcase Result Summary:
total: 4679
passed: 4679
failed: 0
timeout: 0
--------------------------------------------------------------------
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.185 release. There are 56 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, 07 Apr 2021 08:50:09 +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.19.185-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v4.19:
12 builds: 12 pass, 0 fail
22 boots: 22 pass, 0 fail
40 tests: 40 pass, 0 failLinux version: 4.19.185-rc1-ge80ef2122d5c
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra20-ventana,
tegra210-p2371-2180, tegra30-cardhu-a04Jon
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 4.19.185 release. There are 56 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 kernel problems here: (Siemens boards are unavailable)
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-4.19.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