nvme-pci: add NVME_QUIRK_BOGUS_NID for HS-SSD-FUTURE 2048G
Subsystems (13)
Sasha Levin
maintainerPATCH 6/43 xfrm: Check if_id in inbound policy/secpath match
In reply to Sasha LevinFrom: Benedict Wong <[email protected]>
[ Upstream commit 8680407b6f8f5fba59e8f1d63c869abc280f04df ]
This change ensures that if configured in the policy, the if_id set in the policy and secpath states match during the inbound policy check. Without this, there is potential for ambiguity where entries in the secpath differing by only the if_id could be mismatched.
Notably, this is checked in the outbound direction when resolving templates to SAs, but not on the inbound path when matching SAs and policies.
Test: Tested against Android kernel unit tests & CTS
--- net/xfrm/xfrm_policy.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
net/xfrm/xfrm_policy.c +6 -5
@@ -3238,7 +3238,7 @@ xfrm_secpath_reject(int idx, struct sk_buff *skb, const struct flowi *fl)static inline int xfrm_state_ok (const struct xfrm_tmpl *tmpl,const struct xfrm_state *x, -unsigned short family) +unsigned short family,u32 if_id) {if (xfrm_state_kern (x))return tmpl->optional && !xfrm_state_addr_cmp (tmpl, x, tmpl->encap_family);
@@ -3249,7 +3249,8 @@ xfrm_state_ok(const struct xfrm_tmpl *tmpl, const struct xfrm_state *x, (tmpl->allalgs || (tmpl->aalgos & (1 <<x->props.aalgo)) || !(xfrm_id_proto_match (tmpl->id.proto,IPSEC_PROTO_ANY ))) && !(x->props.mode !=XFRM_MODE_TRANSPORT && -xfrm_state_addr_cmp (tmpl, x, family)); +xfrm_state_addr_cmp (tmpl, x, family)) && + (if_id ==0 || if_id == x->if_id); }/*
@@ -3261,7 +3262,7 @@ xfrm_state_ok(const struct xfrm_tmpl *tmpl, const struct xfrm_state *x,*/ static inline int xfrm_policy_ok (const struct xfrm_tmpl *tmpl,const struct sec_path *sp,int start, -unsigned short family) +unsigned short family,u32 if_id) {int idx = start;
@@ -3271,7 +3272,7 @@ xfrm_policy_ok(const struct xfrm_tmpl *tmpl, const struct sec_path *sp, int star }else start =-1 ;for (; idx < sp->len; idx++) { -if (xfrm_state_ok (tmpl, sp->xvec[idx], family)) +if (xfrm_state_ok (tmpl, sp->xvec[idx], family, if_id))return ++idx;if (sp->xvec[idx]->props.mode !=XFRM_MODE_TRANSPORT ) {if (start ==-1 )
@@ -3654,7 +3655,7 @@ int __xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb,* are implied between each two transformations. */ for (i = xfrm_nr-1 , k =0 ; i >=0 ; i--) { - k =xfrm_policy_ok (tpp[i], sp, k, family); + k =xfrm_policy_ok (tpp[i], sp, k, family, if_id);if (k <0 ) {if (k <-1 )/* "-2 - errored_index" returned */
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 5/43 um: harddog: fix modular build
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit 73a23d7710331a530e972903318528b75e5a5f58 ]
Since we no longer (want to) export any libc symbols the _user portions of any drivers need to be built into image rather than the module. I missed this for the watchdog. Fix the watchdog accordingly.
--- arch/um/drivers/Makefile | 4 +++- arch/um/drivers/harddog.h | 9 +++++++++ arch/um/drivers/harddog_kern.c | 7 +------ arch/um/drivers/harddog_user.c | 1 + arch/um/drivers/harddog_user_exp.c | 9 +++++++++ 5 files changed, 23 insertions(+), 7 deletions(-) create mode 100644 arch/um/drivers/harddog.h create mode 100644 arch/um/drivers/harddog_user_exp.c
arch/um/drivers/Makefile +3 -1
@@ -16,7 +16,8 @@ mconsole-objs := mconsole_kern.o mconsole_user.o hostaudio-objs := hostaudio_kern.o ubd-objs := ubd_kern.o ubd_user.o port-objs := port_kern.o port_user.o -harddog-objs := harddog_kern.o harddog_user.o +harddog-objs := harddog_kern.o +harddog-builtin-$(CONFIG_UML_WATCHDOG) := harddog_user.o harddog_user_exp.o rtc-objs := rtc_kern.o rtc_user.o LDFLAGS_pcap.o = $(shell $(CC) $(KBUILD_CFLAGS) -print-file-name=libpcap.a)
@@ -60,6 +61,7 @@ obj-$(CONFIG_PTY_CHAN) += pty.o obj-$(CONFIG_TTY_CHAN) += tty.o obj-$(CONFIG_XTERM_CHAN) += xterm.o xterm_kern.o obj-$(CONFIG_UML_WATCHDOG) += harddog.o +obj-y += $(harddog-builtin-y) $(harddog-builtin-m) obj-$(CONFIG_BLK_DEV_COW_COMMON) += cow_user.o obj-$(CONFIG_UML_RANDOM) += random.o obj-$(CONFIG_VIRTIO_UML) += virtio_uml.o
arch/um/drivers/harddog.h new file +9 -0
@@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef UM_WATCHDOG_H +#define UM_WATCHDOG_H + +int start_watchdog (int *in_fd_ret,int *out_fd_ret,char *sock); +void stop_watchdog (int in_fd,int out_fd); +int ping_watchdog (int fd); + +#endif /* UM_WATCHDOG_H */
arch/um/drivers/harddog_kern.c +1 -6
@@ -47,6 +47,7 @@#include <linux/spinlock.h> #include <linux/uaccess.h> #include "mconsole.h" +#include "harddog.h" MODULE_LICENSE ("GPL" );
@@ -60,8 +61,6 @@ static int harddog_out_fd = -1;* Allow only one person to hold it open */ -extern int start_watchdog (int *in_fd_ret,int *out_fd_ret,char *sock); -static int harddog_open (struct inode *inode,struct file *file) {int err = -EBUSY ;
@@ -92,8 +91,6 @@ static int harddog_open(struct inode *inode, struct file *file)return err; } -extern void stop_watchdog (int in_fd,int out_fd); -static int harddog_release (struct inode *inode,struct file *file) {/*
@@ -112,8 +109,6 @@ static int harddog_release(struct inode *inode, struct file *file)return 0 ; } -extern int ping_watchdog (int fd); -static ssize_t harddog_write (struct file *file,const char __user *data,size_t len,loff_t *ppos) {
arch/um/drivers/harddog_user.c +1 -0
@@ -7,6 +7,7 @@#include <unistd.h> #include <errno.h> #include <os.h> +#include "harddog.h" struct dog_data {int stdin_fd;
arch/um/drivers/harddog_user_exp.c new file +9 -0
@@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0 +#include <linux/export.h> +#include "harddog.h" + +#if IS_MODULE (CONFIG_UML_WATCHDOG ) +EXPORT_SYMBOL (start_watchdog); +EXPORT_SYMBOL (stop_watchdog); +EXPORT_SYMBOL (ping_watchdog); +#endif
Signature · 7 lines
2.39.2 _______________________________________________ linux-um mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-um
Sasha Levin
maintainerPATCH 24/43 tipc: add tipc_bearer_min_mtu to calculate min mtu
In reply to Sasha LevinFrom: Xin Long <[email protected]>
[ Upstream commit 3ae6d66b605be604644d4bb5708a7ffd9cf1abe8 ]
As different media may requires different min mtu, and even the same media with different net family requires different min mtu, add tipc_bearer_min_mtu() to calculate min mtu accordingly.
This API will be used to check the new mtu when doing the link mtu negotiation in the next patch.
--- net/tipc/bearer.c | 13 +++++++++++++ net/tipc/bearer.h | 3 +++ net/tipc/udp_media.c | 5 +++-- 3 files changed, 19 insertions(+), 2 deletions(-)
net/tipc/bearer.c +13 -0
@@ -541,6 +541,19 @@ int tipc_bearer_mtu(struct net *net, u32 bearer_id)return mtu; } +int tipc_bearer_min_mtu (struct net *net,u32 bearer_id) +{ +int mtu =TIPC_MIN_BEARER_MTU ; +struct tipc_bearer *b; + +rcu_read_lock (); + b =bearer_get (net, bearer_id); +if (b) + mtu += b->encap_hlen; +rcu_read_unlock (); +return mtu; +} +/* tipc_bearer_xmit_skb - sends buffer to destination over bearer */ void tipc_bearer_xmit_skb(struct net *net, u32 bearer_id,
net/tipc/bearer.h +3 -0
@@ -146,6 +146,7 @@ struct tipc_media {* @identity: array index of this bearer within TIPC bearer array * @disc: ptr to link setup request * @net_plane: network plane ('A' through 'H') currently associated with bearer +* @encap_hlen: encap headers length * @up: bearer up flag (bit 0) * @refcnt: tipc_bearer reference counter *
@@ -170,6 +171,7 @@ struct tipc_bearer {u32 identity;struct tipc_discoverer *disc;char net_plane; +u16 encap_hlen;unsigned long up;refcount_t refcnt; };
@@ -232,6 +234,7 @@ int tipc_bearer_setup(void);void tipc_bearer_cleanup (void );void tipc_bearer_stop (struct net *net);int tipc_bearer_mtu (struct net *net,u32 bearer_id); +int tipc_bearer_min_mtu (struct net *net,u32 bearer_id);bool tipc_bearer_bcast_support (struct net *net,u32 bearer_id); void tipc_bearer_xmit_skb(struct net *net, u32 bearer_id, struct sk_buff *skb,
net/tipc/udp_media.c +3 -2
@@ -738,8 +738,8 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b, udp_conf.local_ip.s_addr = local.ipv4.s_addr; udp_conf.use_udp_checksums = false; ub->ifindex = dev->ifindex; -if (tipc_mtu_bad (dev,sizeof (struct iphdr ) + -sizeof (struct udphdr ))) { + b->encap_hlen =sizeof (struct iphdr ) +sizeof (struct udphdr ); +if (tipc_mtu_bad (dev, b->encap_hlen)) { err = -EINVAL ; goto err; }
@@ -760,6 +760,7 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b, else udp_conf.local_ip6 = local.ipv6; ub->ifindex = dev->ifindex; + b->encap_hlen =sizeof (struct ipv6hdr ) +sizeof (struct udphdr ); b->mtu =1280 ;#endif }else {
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 3/43 ASoC: dwc: limit the number of overrun messages
In reply to Sasha LevinFrom: Maxim Kochetkov <[email protected]>
[ Upstream commit ab6ecfbf40fccf74b6ec2ba7ed6dd2fc024c3af2 ]
On slow CPU (FPGA/QEMU emulated) printing overrun messages from interrupt handler to uart console may leads to more overrun errors. So use dev_err_ratelimited to limit the number of error messages.
--- sound/soc/dwc/dwc-i2s.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/dwc/dwc-i2s.c +2 -2
@@ -132,13 +132,13 @@ static irqreturn_t i2s_irq_handler(int irq, void *dev_id)/* Error Handling: TX */ if (isr[i] &ISR_TXFO ) { -dev_err (dev->dev,"TX overrun (ch_id=%d)\n" , i); +dev_err_ratelimited (dev->dev,"TX overrun (ch_id=%d)\n" , i); irq_valid = true; }/* Error Handling: TX */ if (isr[i] &ISR_RXFO ) { -dev_err (dev->dev,"RX overrun (ch_id=%d)\n" , i); +dev_err_ratelimited (dev->dev,"RX overrun (ch_id=%d)\n" , i); irq_valid = true; } }
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 33/43 wifi: mac80211: simplify chanctx allocation
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit 860e1b43da94551cd1e73adc36b3c64cc3e5dc01 ]
There's no need to call ieee80211_recalc_chanctx_min_def() since it cannot and won't call the driver anyway; just use _ieee80211_recalc_chanctx_min_def() instead.
--- net/mac80211/chan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/chan.c +1 -1
@@ -563,7 +563,7 @@ ieee80211_alloc_chanctx(struct ieee80211_local *local, ctx->conf.rx_chains_dynamic =1 ; ctx->mode = mode; ctx->conf.radar_enabled = false; -ieee80211_recalc_chanctx_min_def (local, ctx); +_ieee80211_recalc_chanctx_min_def (local, ctx);return ctx; }
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 35/43 wifi: b43: fix incorrect __packed annotation
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 212457ccbd60dba34f965e4ffbe62f0e4f970538 ]
clang warns about an unpacked structure inside of a packed one:
drivers/net/wireless/broadcom/b43/b43.h:654:4: error: field data within 'struct b43_iv' is less aligned than 'union (unnamed union at /home/arnd/arm-soc/drivers/net/wireless/broadcom/b43/b43.h:651:2)' and is usually due to 'struct b43_iv' being packed, which can lead to unaligned accesses [-Werror,-Wunaligned-access]
The problem here is that the anonymous union has the default alignment from its members, apparently because the original author mixed up the placement of the __packed attribute by placing it next to the struct member rather than the union definition. As the struct itself is also marked as __packed, there is no need to mark its members, so just move the annotation to the inner type instead.
As Michael noted, the same problem is present in b43legacy, so change both at the same time.
--- drivers/net/wireless/broadcom/b43/b43.h | 2 +- drivers/net/wireless/broadcom/b43legacy/b43legacy.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/broadcom/b43/b43.h +1 -1
@@ -651,7 +651,7 @@ struct b43_iv {union {__be16 d16;__be32 d32; - } data __packed; + } __packed data; } __packed;
drivers/net/wireless/broadcom/b43legacy/b43legacy.h +1 -1
@@ -379,7 +379,7 @@ struct b43legacy_iv {union {__be16 d16;__be32 d32; - } data __packed; + } __packed data; } __packed;#define B43legacy_PHYMODE (phytype) (1 << (phytype))
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 36/43 netfilter: conntrack: define variables exp_nat_nla_policy and any_addr with CONFIG_NF_NAT
In reply to Sasha LevinFrom: Tom Rix <[email protected]>
[ Upstream commit 224a876e37543eee111bf9b6aa4935080e619335 ]
gcc with W=1 and ! CONFIG_NF_NAT net/netfilter/nf_conntrack_netlink.c:3463:32: error:
‘exp_nat_nla_policy’ defined but not used [-Werror=unused-const-variable=]
3463 | static const struct nla_policy exp_nat_nla_policy[CTA_EXPECT_NAT_MAX+1] = {
| ^~~~~~~~~~~~~~~~~~net/netfilter/nf_conntrack_netlink.c:2979:33: error:
‘any_addr’ defined but not used [-Werror=unused-const-variable=]
2979 | static const union nf_inet_addr any_addr;
| ^~~~~~~~
These variables use is controlled by CONFIG_NF_NAT, so should their definitions.
--- net/netfilter/nf_conntrack_netlink.c | 4 ++++ 1 file changed, 4 insertions(+)
net/netfilter/nf_conntrack_netlink.c +4 -0
@@ -3000,7 +3000,9 @@ static int ctnetlink_exp_dump_mask(struct sk_buff *skb,return -1 ; } +#if IS_ENABLED (CONFIG_NF_NAT )static const union nf_inet_addr any_addr; +#endif static __be32 nf_expect_get_id (const struct nf_conntrack_expect *exp) {
@@ -3479,10 +3481,12 @@ ctnetlink_change_expect(struct nf_conntrack_expect *x,return 0 ; } +#if IS_ENABLED (CONFIG_NF_NAT )static const struct nla_policy exp_nat_nla_policy[CTA_EXPECT_NAT_MAX +1 ] = { [CTA_EXPECT_NAT_DIR ] = { .type =NLA_U32 }, [CTA_EXPECT_NAT_TUPLE ] = { .type =NLA_NESTED }, }; +#endif static int ctnetlink_parse_expect_nat(const struct nlattr *attr,
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 7/43 ASoC: dt-bindings: Adjust #sound-dai-cells on TI's single-DAI codecs
In reply to Sasha LevinFrom: Martin Povišer <[email protected]>
[ Upstream commit efb2bfd7b3d210c479b9361c176d7426e5eb8663 ]
A bunch of TI's codecs have binding schemas which force #sound-dai-cells to one despite those codecs only having a single DAI. Allow for bindings with zero DAI cells and deprecate the former non-zero value.
--- Documentation/devicetree/bindings/sound/tas2562.yaml | 6 ++++-- Documentation/devicetree/bindings/sound/tas2764.yaml | 6 ++++-- Documentation/devicetree/bindings/sound/tas2770.yaml | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-)
Documentation/devicetree/bindings/sound/tas2562.yaml +4 -2
@@ -52,7 +52,9 @@ properties: description: TDM TX current sense time slot. '#sound-dai-cells': - const: 1 + # The codec has a single DAI, the #sound-dai-cells=<1>; case is left in for backward + # compatibility but is deprecated. + enum: [0, 1] required: - compatible
@@ -69,7 +71,7 @@ examples: codec: codec@4c { compatible = "ti,tas2562"; reg = <0x4c>; - #sound-dai-cells = <1>; + #sound-dai-cells = <0>; interrupt-parent = <&gpio1>; interrupts = <14>; shutdown-gpios = <&gpio1 15 0>;
Documentation/devicetree/bindings/sound/tas2764.yaml +4 -2
@@ -46,7 +46,9 @@ properties: description: TDM TX voltage sense time slot. '#sound-dai-cells': - const: 1 + # The codec has a single DAI, the #sound-dai-cells=<1>; case is left in for backward + # compatibility but is deprecated. + enum: [0, 1] required: - compatible
@@ -63,7 +65,7 @@ examples: codec: codec@38 { compatible = "ti,tas2764"; reg = <0x38>; - #sound-dai-cells = <1>; + #sound-dai-cells = <0>; interrupt-parent = <&gpio1>; interrupts = <14>; reset-gpios = <&gpio1 15 0>;
Documentation/devicetree/bindings/sound/tas2770.yaml +4 -2
@@ -54,7 +54,9 @@ properties: - 1 # Falling edge '#sound-dai-cells': - const: 1 + # The codec has a single DAI, the #sound-dai-cells=<1>; case is left in for backward + # compatibility but is deprecated. + enum: [0, 1] required: - compatible
@@ -71,7 +73,7 @@ examples: codec: codec@41 { compatible = "ti,tas2770"; reg = <0x41>; - #sound-dai-cells = <1>; + #sound-dai-cells = <0>; interrupt-parent = <&gpio1>; interrupts = <14>; reset-gpio = <&gpio1 15 0>;
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 39/43 drm/msm: Be more shouty if per-process pgtables aren't working
In reply to Sasha LevinFrom: Rob Clark <[email protected]>
[ Upstream commit 5c054db54c43a5fcb5cc81012361f5e3fac37637 ]
Otherwise it is not always obvious if a dt or iommu change is causing us to fall back to global pgtable.
Patchwork: https://patchwork.freedesktop.org/patch/537359/
--- drivers/gpu/drm/msm/msm_iommu.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/msm_iommu.c +6 -1
@@ -157,7 +157,12 @@ struct msm_mmu *msm_iommu_pagetable_create(struct msm_mmu *parent)/* Get the pagetable configuration from the domain */ if (adreno_smmu->cookie) ttbr1_cfg = adreno_smmu->get_ttbr1_cfg (adreno_smmu->cookie); -if (!ttbr1_cfg) + +/* +* If you hit this WARN_ONCE() you are probably missing an entry in +* qcom_smmu_impl_of_match[] in arm-smmu-qcom.c +*/ +if (WARN_ONCE (!ttbr1_cfg,"No per-process page tables" ))return ERR_PTR (-ENODEV );/*
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 40/43 atm: hide unused procfs functions
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit fb1b7be9b16c1f4626969ba4e95a97da2a452b41 ]
When CONFIG_PROC_FS is disabled, the function declarations for some procfs functions are hidden, but the definitions are still build, as shown by this compiler warning:
net/atm/resources.c:403:7: error: no previous prototype for 'atm_dev_seq_start' [-Werror=missing-prototypes] net/atm/resources.c:409:6: error: no previous prototype for 'atm_dev_seq_stop' [-Werror=missing-prototypes] net/atm/resources.c:414:7: error: no previous prototype for 'atm_dev_seq_next' [-Werror=missing-prototypes]
Add another #ifdef to leave these out of the build.
--- net/atm/resources.c | 2 ++ 1 file changed, 2 insertions(+)
net/atm/resources.c +2 -0
@@ -400,6 +400,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *buf, int __user *sioc_len,return error; } +#ifdef CONFIG_PROC_FS void *atm_dev_seq_start (struct seq_file *seq,loff_t *pos) {mutex_lock (&atm_dev_mutex);
@@ -415,3 +416,4 @@ void *atm_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos) {return seq_list_next (v, &atm_devs, pos); } +#endif
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 37/43 nvme-multipath: don't call blk_mark_disk_dead in nvme_mpath_remove_disk
In reply to Sasha LevinFrom: Christoph Hellwig <[email protected]>
[ Upstream commit 1743e5f6000901a11f4e1cd741bfa9136f3ec9b1 ]
nvme_mpath_remove_disk is called after del_gendisk, at which point a blk_mark_disk_dead call doesn't make any sense.
--- drivers/nvme/host/multipath.c | 1 - 1 file changed, 1 deletion(-)
drivers/nvme/host/multipath.c +0 -1
@@ -821,7 +821,6 @@ void nvme_mpath_remove_disk(struct nvme_ns_head *head) {if (!head->disk)return ; -blk_mark_disk_dead (head->disk);/* make sure all pending bios are cleaned up */ kblockd_schedule_work (&head->requeue_work);flush_work (&head->requeue_work);
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 41/43 mdio_bus: unhide mdio_bus_init prototype
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 2e9f8ab68f42b059e80db71266c1675c07c664bd ]
mdio_bus_init() is either used as a local module_init() entry, or it gets called in phy_device.c. In the former case, there is no declaration, which causes a warning:
drivers/net/phy/mdio_bus.c:1371:12: error: no previous prototype for 'mdio_bus_init' [-Werror=missing-prototypes]
Remove the #ifdef around the declaration to avoid the warning..
--- include/linux/phy.h | 2 -- 1 file changed, 2 deletions(-)
include/linux/phy.h +0 -2
@@ -1677,10 +1677,8 @@ void phy_package_leave(struct phy_device *phydev);int devm_phy_package_join (struct device *dev,struct phy_device *phydev,int addr,size_t priv_size); -#if IS_ENABLED (CONFIG_PHYLIB )int __init mdio_bus_init (void );void mdio_bus_exit (void ); -#endif int phy_ethtool_get_strings (struct phy_device *phydev,u8 *data);int phy_ethtool_get_sset_count (struct phy_device *phydev);
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 29/43 ARM: dts: stm32: add pin map for CAN controller on stm32f7
In reply to Sasha LevinFrom: Dario Binacchi <[email protected]>
[ Upstream commit 011644249686f2675e142519cd59e81e04cfc231 ]
Add pin configurations for using CAN controller on stm32f7.
--- arch/arm/boot/dts/stm32f7-pinctrl.dtsi | 82 ++++++++++++++++++++++++++ 1 file changed, 82 insertions(+)
arch/arm/boot/dts/stm32f7-pinctrl.dtsi +82 -0
@@ -284,6 +284,88 @@ pins2 { slew-rate = <2>; }; }; + + can1_pins_a: can1-0 { + pins1 { + pinmux = <STM32_PINMUX('A', 12, AF9)>; /* CAN1_TX */ + }; + pins2 { + pinmux = <STM32_PINMUX('A', 11, AF9)>; /* CAN1_RX */ + bias-pull-up; + }; + }; + + can1_pins_b: can1-1 { + pins1 { + pinmux = <STM32_PINMUX('B', 9, AF9)>; /* CAN1_TX */ + }; + pins2 { + pinmux = <STM32_PINMUX('B', 8, AF9)>; /* CAN1_RX */ + bias-pull-up; + }; + }; + + can1_pins_c: can1-2 { + pins1 { + pinmux = <STM32_PINMUX('D', 1, AF9)>; /* CAN1_TX */ + }; + pins2 { + pinmux = <STM32_PINMUX('D', 0, AF9)>; /* CAN1_RX */ + bias-pull-up; + + }; + }; + + can1_pins_d: can1-3 { + pins1 { + pinmux = <STM32_PINMUX('H', 13, AF9)>; /* CAN1_TX */ + }; + pins2 { + pinmux = <STM32_PINMUX('H', 14, AF9)>; /* CAN1_RX */ + bias-pull-up; + + }; + }; + + can2_pins_a: can2-0 { + pins1 { + pinmux = <STM32_PINMUX('B', 6, AF9)>; /* CAN2_TX */ + }; + pins2 { + pinmux = <STM32_PINMUX('B', 5, AF9)>; /* CAN2_RX */ + bias-pull-up; + }; + }; + + can2_pins_b: can2-1 { + pins1 { + pinmux = <STM32_PINMUX('B', 13, AF9)>; /* CAN2_TX */ + }; + pins2 { + pinmux = <STM32_PINMUX('B', 12, AF9)>; /* CAN2_RX */ + bias-pull-up; + }; + }; + + can3_pins_a: can3-0 { + pins1 { + pinmux = <STM32_PINMUX('A', 15, AF11)>; /* CAN3_TX */ + }; + pins2 { + pinmux = <STM32_PINMUX('A', 8, AF11)>; /* CAN3_RX */ + bias-pull-up; + }; + }; + + can3_pins_b: can3-1 { + pins1 { + pinmux = <STM32_PINMUX('B', 4, AF11)>; /* CAN3_TX */ + }; + pins2 { + pinmux = <STM32_PINMUX('B', 3, AF11)>; /* CAN3_RX */ + bias-pull-up; + }; + }; }; }; };
Signature · 7 lines
2.39.2 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 42/43 drm/amdgpu: skip disabling fence driver src_irqs when device is unplugged
In reply to Sasha LevinFrom: Guchun Chen <[email protected]>
[ Upstream commit c1a322a7a4a96cd0a3dde32ce37af437a78bf8cd ]
When performing device unbind or halt, we have disabled all irqs at the very begining like amdgpu_pci_remove or amdgpu_device_halt. So amdgpu_irq_put for irqs stored in fence driver should not be called any more, otherwise, below calltrace will arrive.
[ 139.114088] WARNING: CPU: 2 PID: 1550 at drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c:616 amdgpu_irq_put+0xf6/0x110 [amdgpu] [ 139.114655] Call Trace: [ 139.114655] <TASK> [ 139.114657] amdgpu_fence_driver_hw_fini+0x93/0x130 [amdgpu] [ 139.114836] amdgpu_device_fini_hw+0xb6/0x350 [amdgpu] [ 139.114955] amdgpu_driver_unload_kms+0x51/0x70 [amdgpu] [ 139.115075] amdgpu_pci_remove+0x63/0x160 [amdgpu] [ 139.115193] ? __pm_runtime_resume+0x64/0x90 [ 139.115195] pci_device_remove+0x3a/0xb0 [ 139.115197] device_remove+0x43/0x70 [ 139.115198] device_release_driver_internal+0xbd/0x140
--- drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +2 -1
@@ -561,7 +561,8 @@ void amdgpu_fence_driver_hw_fini(struct amdgpu_device *adev)if (r)amdgpu_fence_driver_force_completion (ring); -if (ring->fence_drv.irq_src) +if (!drm_dev_is_unplugged (adev_to_drm (adev)) && + ring->fence_drv.irq_src)amdgpu_irq_put (adev, ring->fence_drv.irq_src, ring->fence_drv.irq_type);
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 8/43 ASoC: ssm2602: Add workaround for playback distortions
In reply to Sasha LevinFrom: Paweł Anikiel <[email protected]>
[ Upstream commit f63550e2b165208a2f382afcaf5551df9569e1d4 ]
Apply a workaround for what appears to be a hardware quirk.
The problem seems to happen when enabling "whole chip power" (bit D7 register R6) for the very first time after the chip receives power. If either "output" (D4) or "DAC" (D3) aren't powered on at that time, playback becomes very distorted later on.
This happens on the Google Chameleon v3, as well as on a ZYBO Z7-10:
https://ez.analog.com/audio/f/q-a/543726/solved-ssm2603-right-output-offset-issue/480229
I suspect this happens only when using an external MCLK signal (which is the case for both of these boards).
Here are some experiments run on a Google Chameleon v3. These were run in userspace using a wrapper around the i2cset utility:
ssmset() {
i2cset -y 0 0x1a $(($1*2)) $2
}For each of the following sequences, we apply power to the ssm2603 chip, set the configuration registers R0-R5 and R7-R8, run the selected sequence, and check for distortions on playback.
ssmset 0x09 0x01 # core
ssmset 0x06 0x07 # chip, out, dac
OK
ssmset 0x09 0x01 # core
ssmset 0x06 0x87 # out, dac
ssmset 0x06 0x07 # chip
OK
(disable MCLK)
ssmset 0x09 0x01 # core
ssmset 0x06 0x1f # chip
ssmset 0x06 0x07 # out, dac
(enable MCLK)
OK
ssmset 0x09 0x01 # core
ssmset 0x06 0x1f # chip
ssmset 0x06 0x07 # out, dac
NOT OK
ssmset 0x06 0x1f # chip
ssmset 0x09 0x01 # core
ssmset 0x06 0x07 # out, dac
NOT OK
ssmset 0x09 0x01 # core
ssmset 0x06 0x0f # chip, out
ssmset 0x06 0x07 # dac
NOT OK
ssmset 0x09 0x01 # core
ssmset 0x06 0x17 # chip, dac
ssmset 0x06 0x07 # out
NOT OK
For each of the following sequences, we apply power to the ssm2603 chip, run the selected sequence, issue a reset with R15, configure R0-R5 and R7-R8, run one of the NOT OK sequences from above, and check for distortions.
ssmset 0x09 0x01 # core
ssmset 0x06 0x07 # chip, out, dac
OK
(disable MCLK)
ssmset 0x09 0x01 # core
ssmset 0x06 0x07 # chip, out, dac
(enable MCLK after reset)
NOT OK
ssmset 0x09 0x01 # core
ssmset 0x06 0x17 # chip, dac
NOT OK
ssmset 0x09 0x01 # core
ssmset 0x06 0x0f # chip, out
NOT OK
ssmset 0x06 0x07 # chip, out, dac
NOT OK
--- sound/soc/codecs/ssm2602.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
sound/soc/codecs/ssm2602.c +15 -0
@@ -53,6 +53,18 @@ static const struct reg_default ssm2602_reg[SSM2602_CACHEREGNUM] = { { .reg = 0x09, .def = 0x0000 } }; +/* +* ssm2602 register patch +* Workaround for playback distortions after power up: activates digital +* core, and then powers on output, DAC, and whole chip at the same time +*/ + +static const struct reg_sequence ssm2602_patch[] = { + {SSM2602_ACTIVE ,0x01 }, + {SSM2602_PWR ,0x07 }, + {SSM2602_RESET ,0x00 }, +}; +/*Appending several "None"s just for OSS mixer use*/ static const char *ssm2602_input_select[] = {
@@ -589,6 +601,9 @@ static int ssm260x_component_probe(struct snd_soc_component *component)return ret; } +regmap_register_patch (ssm2602->regmap, ssm2602_patch, +ARRAY_SIZE (ssm2602_patch)); +/* set the update bits */ regmap_update_bits (ssm2602->regmap,SSM2602_LINVOL ,LINVOL_LRIN_BOTH ,LINVOL_LRIN_BOTH );
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 31/43 arm64/mm: mark private VM_FAULT_X defines as vm_fault_t
In reply to Sasha LevinFrom: Min-Hua Chen <[email protected]>
[ Upstream commit d91d580878064b880f3574ac35b98d8b70ee8620 ]
This patch fixes several sparse warnings for fault.c:
arch/arm64/mm/fault.c:493:24: sparse: warning: incorrect type in return expression (different base types)arch/arm64/mm/fault.c:493:24: sparse: expected restricted vm_fault_tarch/arm64/mm/fault.c:493:24: sparse: got intarch/arm64/mm/fault.c:501:32: sparse: warning: incorrect type in return expression (different base types)arch/arm64/mm/fault.c:501:32: sparse: expected restricted vm_fault_tarch/arm64/mm/fault.c:501:32: sparse: got intarch/arm64/mm/fault.c:503:32: sparse: warning: incorrect type in return expression (different base types)arch/arm64/mm/fault.c:503:32: sparse: expected restricted vm_fault_tarch/arm64/mm/fault.c:503:32: sparse: got intarch/arm64/mm/fault.c:511:24: sparse: warning: incorrect type in return expression (different base types)arch/arm64/mm/fault.c:511:24: sparse: expected restricted vm_fault_tarch/arm64/mm/fault.c:511:24: sparse: got intarch/arm64/mm/fault.c:670:13: sparse: warning: restricted vm_fault_t degrades to integer arch/arm64/mm/fault.c:670:13: sparse: warning: restricted vm_fault_t degrades to integer arch/arm64/mm/fault.c:713:39: sparse: warning: restricted vm_fault_t degrades to integer
--- arch/arm64/mm/fault.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/mm/fault.c +2 -2
@@ -473,8 +473,8 @@ static void do_bad_area(unsigned long far, unsigned long esr, } } -#define VM_FAULT_BADMAP 0x010000 -#define VM_FAULT_BADACCESS 0x020000 +#define VM_FAULT_BADMAP ((__force vm_fault_t)0x010000) +#define VM_FAULT_BADACCESS ((__force vm_fault_t)0x020000) static vm_fault_t __do_page_fault(struct mm_struct *mm, unsigned long addr, unsigned int mm_flags, unsigned long vm_flags,
Signature · 7 lines
2.39.2 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 30/43 ARM: dts: stm32: add CAN support on stm32f746
In reply to Sasha LevinFrom: Dario Binacchi <[email protected]>
[ Upstream commit 0920ccdf41e3078a4dd2567eb905ea154bc826e6 ]
Add support for bxcan (Basic eXtended CAN controller) to STM32F746. The chip contains three CAN peripherals, CAN1 and CAN2 in dual peripheral configuration and CAN3 in single peripheral configuration:
- Dual CAN peripheral configuration:
* CAN1: Primary bxCAN for managing the communication between a secondary bxCAN and the 512-byte SRAM memory.
* CAN2: Secondary bxCAN with no direct access to the SRAM memory. This means that the two bxCAN cells share the 512-byte SRAM memory and CAN2 can't be used without enabling CAN1.
- Single CAN peripheral configuration:
* CAN3: Primary bxCAN with dedicated Memory Access Controller unit and 512-byte SRAM memory.
-------------------------------------------------------------------------
| features | CAN1 | CAN2 | CAN 3 |
-------------------------------------------------------------------------
| SRAM | 512-byte shared between CAN1 & CAN2 | 512-byte |
-------------------------------------------------------------------------
| Filters | 26 filters shared between CAN1 & CAN2 | 14 filters |
-------------------------------------------------------------------------
--- arch/arm/boot/dts/stm32f746.dtsi | 47 ++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+)
arch/arm/boot/dts/stm32f746.dtsi +47 -0
@@ -304,6 +304,23 @@ rtc: rtc@40002800 { status = "disabled"; }; + can3: can@40003400 { + compatible = "st,stm32f4-bxcan"; + reg = <0x40003400 0x200>; + interrupts = <104>, <105>, <106>, <107>; + interrupt-names = "tx", "rx0", "rx1", "sce"; + resets = <&rcc STM32F7_APB1_RESET(CAN3)>; + clocks = <&rcc 0 STM32F7_APB1_CLOCK(CAN3)>; + st,gcan = <&gcan3>; + status = "disabled"; + }; + + gcan3: gcan@40003600 { + compatible = "st,stm32f4-gcan", "syscon"; + reg = <0x40003600 0x200>; + clocks = <&rcc 0 STM32F7_APB1_CLOCK(CAN3)>; + }; + usart2: serial@40004400 { compatible = "st,stm32f7-uart"; reg = <0x40004400 0x400>;
@@ -384,6 +401,36 @@ i2c4: i2c@40006000 { status = "disabled"; }; + can1: can@40006400 { + compatible = "st,stm32f4-bxcan"; + reg = <0x40006400 0x200>; + interrupts = <19>, <20>, <21>, <22>; + interrupt-names = "tx", "rx0", "rx1", "sce"; + resets = <&rcc STM32F7_APB1_RESET(CAN1)>; + clocks = <&rcc 0 STM32F7_APB1_CLOCK(CAN1)>; + st,can-primary; + st,gcan = <&gcan1>; + status = "disabled"; + }; + + gcan1: gcan@40006600 { + compatible = "st,stm32f4-gcan", "syscon"; + reg = <0x40006600 0x200>; + clocks = <&rcc 0 STM32F7_APB1_CLOCK(CAN1)>; + }; + + can2: can@40006800 { + compatible = "st,stm32f4-bxcan"; + reg = <0x40006800 0x200>; + interrupts = <63>, <64>, <65>, <66>; + interrupt-names = "tx", "rx0", "rx1", "sce"; + resets = <&rcc STM32F7_APB1_RESET(CAN2)>; + clocks = <&rcc 0 STM32F7_APB1_CLOCK(CAN2)>; + st,can-secondary; + st,gcan = <&gcan1>; + status = "disabled"; + }; + cec: cec@40006c00 { compatible = "st,stm32-cec"; reg = <0x40006C00 0x400>;
Signature · 7 lines
2.39.2 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 43/43 nvme-pci: Add quirk for Teamgroup MP33 SSD
In reply to Sasha LevinFrom: Daniel Smith <[email protected]>
[ Upstream commit 0649728123cf6a5518e154b4e1735fc85ea4f55c ]
Add a quirk for Teamgroup MP33 that reports duplicate ids for disk.
--- drivers/nvme/host/pci.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/nvme/host/pci.c +2 -0
@@ -3407,6 +3407,8 @@ static const struct pci_device_id nvme_id_table[] = { .driver_data = NVME_QUIRK_BOGUS_NID, }, { PCI_DEVICE(0x1e4b, 0x1602), /* HS-SSD-FUTURE 2048G */ .driver_data = NVME_QUIRK_BOGUS_NID, }, + { PCI_DEVICE(0x10ec, 0x5765), /* TEAMGROUP MP33 2TB SSD */ + .driver_data = NVME_QUIRK_BOGUS_NID, }, { PCI_DEVICE(PCI_VENDOR_ID_AMAZON, 0x0061), .driver_data = NVME_QUIRK_DMA_ADDRESS_BITS_48, }, { PCI_DEVICE(PCI_VENDOR_ID_AMAZON, 0x0065),
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 32/43 arm64: vdso: Pass (void *) to virt_to_page()
In reply to Sasha LevinFrom: Linus Walleij <[email protected]>
[ Upstream commit b0abde80620f42d1ceb3de5e4c1a49cdd5628229 ]
Like the other calls in this function virt_to_page() expects a pointer, not an integer.
However since many architectures implement virt_to_pfn() as a macro, this function becomes polymorphic and accepts both a (unsigned long) and a (void *).
Fix this up with an explicit cast.
--- arch/arm64/kernel/vdso.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/vdso.c +1 -1
@@ -314,7 +314,7 @@ static int aarch32_alloc_kuser_vdso_page(void)memcpy ((void *)(vdso_page +0x1000 - kuser_sz), __kuser_helper_start, kuser_sz); - aarch32_vectors_page =virt_to_page (vdso_page); + aarch32_vectors_page =virt_to_page ((void *)vdso_page);return 0 ; }
Signature · 7 lines
2.39.2 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 38/43 ALSA: oss: avoid missing-prototype warnings
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 040b5a046a9e18098580d3ccd029e2318fca7859 ]
Two functions are defined and used in pcm_oss.c but also optionally used from io.c, with an optional prototype. If CONFIG_SND_PCM_OSS_PLUGINS is disabled, this causes a warning as the functions are not static and have no prototype:
sound/core/oss/pcm_oss.c:1235:19: error: no previous prototype for 'snd_pcm_oss_write3' [-Werror=missing-prototypes] sound/core/oss/pcm_oss.c:1266:19: error: no previous prototype for 'snd_pcm_oss_read3' [-Werror=missing-prototypes]
Avoid this by making the prototypes unconditional.
--- sound/core/oss/pcm_plugin.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
sound/core/oss/pcm_plugin.h +8 -8
@@ -141,6 +141,14 @@ int snd_pcm_area_copy(const struct snd_pcm_channel_area *src_channel,void *snd_pcm_plug_buf_alloc (struct snd_pcm_substream *plug,snd_pcm_uframes_t size);void snd_pcm_plug_buf_unlock (struct snd_pcm_substream *plug,void *ptr); +#else + +static inline snd_pcm_sframes_t snd_pcm_plug_client_size (struct snd_pcm_substream *handle,snd_pcm_uframes_t drv_size) {return drv_size; } +static inline snd_pcm_sframes_t snd_pcm_plug_slave_size (struct snd_pcm_substream *handle,snd_pcm_uframes_t clt_size) {return clt_size; } +static inline int snd_pcm_plug_slave_format (int format,const struct snd_mask *format_mask) {return format; } + +#endif +snd_pcm_sframes_t snd_pcm_oss_write3 (struct snd_pcm_substream *substream,const char *ptr,snd_pcm_uframes_t size,int in_kernel);
@@ -151,14 +159,6 @@ snd_pcm_sframes_t snd_pcm_oss_writev3(struct snd_pcm_substream *substream,snd_pcm_sframes_t snd_pcm_oss_readv3 (struct snd_pcm_substream *substream,void **bufs,snd_pcm_uframes_t frames); -#else - -static inline snd_pcm_sframes_t snd_pcm_plug_client_size (struct snd_pcm_substream *handle,snd_pcm_uframes_t drv_size) {return drv_size; } -static inline snd_pcm_sframes_t snd_pcm_plug_slave_size (struct snd_pcm_substream *handle,snd_pcm_uframes_t clt_size) {return clt_size; } -static inline int snd_pcm_plug_slave_format (int format,const struct snd_mask *format_mask) {return format; } - -#endif -#ifdef PLUGIN_DEBUG #define pdprintf(fmt, args...) printk(KERN_DEBUG "plugin: " fmt, ##args)#else
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 1/43 nvme-pci: add NVME_QUIRK_BOGUS_NID for HS-SSD-FUTURE 2048G
From: Sagi Grimberg <[email protected]>
[ Upstream commit 1616d6c3717bae9041a4240d381ec56ccdaafedc ]
Add a quirk to fix HS-SSD-FUTURE 2048G SSD drives reporting duplicate nsids.
--- drivers/nvme/host/pci.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/nvme/host/pci.c +2 -0
@@ -3403,6 +3403,8 @@ static const struct pci_device_id nvme_id_table[] = { NVME_QUIRK_IGNORE_DEV_SUBNQN, }, { PCI_DEVICE(0x10ec, 0x5763), /* TEAMGROUP T-FORCE CARDEA ZERO Z330 SSD */ .driver_data = NVME_QUIRK_BOGUS_NID, }, + { PCI_DEVICE(0x1e4b, 0x1602), /* HS-SSD-FUTURE 2048G */ + .driver_data = NVME_QUIRK_BOGUS_NID, }, { PCI_DEVICE(PCI_VENDOR_ID_AMAZON, 0x0061), .driver_data = NVME_QUIRK_DMA_ADDRESS_BITS_48, }, { PCI_DEVICE(PCI_VENDOR_ID_AMAZON, 0x0065),
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 2/43 nvme-pci: add quirk for missing secondary temperature thresholds
From: Hristo Venev <[email protected]>
[ Upstream commit bd375feeaf3408ed00e08c3bc918d6be15f691ad ]
On Kingston KC3000 and Kingston FURY Renegade (both have the same PCI IDs) accessing temp3_{min,max} fails with an invalid field error (note that there is no problem setting the thresholds for temp1).
This contradicts the NVM Express Base Specification 2.0b, page 292:
The over temperature threshold and under temperature threshold features shall be implemented for all implemented temperature sensors (i.e., all Temperature Sensor fields that report a non-zero value).
Define NVME_QUIRK_NO_SECONDARY_TEMP_THRESH that disables the thresholds for all but the composite temperature and set it for this device.
--- drivers/nvme/host/hwmon.c | 4 +++- drivers/nvme/host/nvme.h | 5 +++++ drivers/nvme/host/pci.c | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-)
drivers/nvme/host/hwmon.c +3 -1
@@ -163,7 +163,9 @@ static umode_t nvme_hwmon_is_visible(const void *_data,case hwmon_temp_max:case hwmon_temp_min:if ((!channel && data->ctrl->wctemp) || - (channel && data->log->temp_sensor[channel -1 ])) { + (channel && data->log->temp_sensor[channel -1 ] && + !(data->ctrl->quirks & +NVME_QUIRK_NO_SECONDARY_TEMP_THRESH ))) {if (data->ctrl->quirks &NVME_QUIRK_NO_TEMP_THRESH_CHANGE )return 0444 ;
drivers/nvme/host/nvme.h +5 -0
@@ -149,6 +149,11 @@ enum nvme_quirks {* Reports garbage in the namespace identifiers (eui64, nguid, uuid). */ NVME_QUIRK_BOGUS_NID = (1 <<18 ), + +/* +* No temperature thresholds for channels other than 0 (Composite). +*/ + NVME_QUIRK_NO_SECONDARY_TEMP_THRESH = (1 << 19), };/*
drivers/nvme/host/pci.c +2 -0
@@ -3368,6 +3368,8 @@ static const struct pci_device_id nvme_id_table[] = { .driver_data = NVME_QUIRK_NO_DEEPEST_PS, }, { PCI_DEVICE(0x2646, 0x2263), /* KINGSTON A2000 NVMe SSD */ .driver_data = NVME_QUIRK_NO_DEEPEST_PS, }, + { PCI_DEVICE(0x2646, 0x5013), /* Kingston KC3000, Kingston FURY Renegade */ + .driver_data = NVME_QUIRK_NO_SECONDARY_TEMP_THRESH, }, { PCI_DEVICE(0x2646, 0x5018), /* KINGSTON OM8SFP4xxxxP OS21012 NVMe SSD */ .driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, }, { PCI_DEVICE(0x2646, 0x5016), /* KINGSTON OM3PGP4xxxxP OS21011 NVMe SSD */
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 4/43 selftests/ftrace: Improve integration with kselftest runner
In reply to Sasha LevinFrom: Mark Brown <[email protected]>
[ Upstream commit dbcf76390eb9a65d5d0c37b0cd57335218564e37 ]
The ftrace selftests do not currently produce KTAP output, they produce a custom format much nicer for human consumption. This means that when run in automated test systems we just get a single result for the suite as a whole rather than recording results for individual test cases, making it harder to look at the test data and masking things like inappropriate skips.
Address this by adding support for KTAP output to the ftracetest script and providing a trivial wrapper which will be invoked by the kselftest runner to generate output in this format by default, users using ftracetest directly will continue to get the existing output.
This is not the most elegant solution but it is simple and effective. I did consider implementing this by post processing the existing output format but that felt more complex and likely to result in all output being lost if something goes seriously wrong during the run which would not be helpful. I did also consider just writing a separate runner script but there's enough going on with things like the signal handling for that to seem like it would be duplicating too much.
--- tools/testing/selftests/ftrace/Makefile | 3 +- tools/testing/selftests/ftrace/ftracetest | 63 ++++++++++++++++++- .../testing/selftests/ftrace/ftracetest-ktap | 8 +++ 3 files changed, 70 insertions(+), 4 deletions(-) create mode 100755 tools/testing/selftests/ftrace/ftracetest-ktap
tools/testing/selftests/ftrace/Makefile +2 -1
@@ -1,7 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 all: -TEST_PROGS := ftracetest +TEST_PROGS_EXTENDED := ftracetest +TEST_PROGS := ftracetest-ktap TEST_FILES := test.d settings EXTRA_CLEAN := $(OUTPUT)/logs/*
tools/testing/selftests/ftrace/ftracetest +60 -3
154 lines not on this page · raw message
tools/testing/selftests/ftrace/ftracetest-ktap new file +8 -0
@@ -0,0 +1,8 @@ +#!/bin/sh -e +# SPDX-License-Identifier: GPL-2.0-only +# +# ftracetest-ktap: Wrapper to integrate ftracetest with the kselftest runner +# +# Copyright (C) Arm Ltd., 2023 + +./ftracetest -K
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 11/43 media: dvb-usb-v2: ec168: fix null-ptr-deref in ec168_i2c_xfer()
In reply to Sasha LevinFrom: Wei Chen <[email protected]>
[ Upstream commit a6dcefcc08eca1bf4e3d213c97c3cfb75f377935 ]
In ec168_i2c_xfer, msg is controlled by user. When msg[i].buf is null and msg[i].len is zero, former checks on msg[i].buf would be passed. If accessing msg[i].buf[0] without sanity check, null pointer deref would happen. We add check on msg[i].len to prevent crash.
Similar commit:
commit 0ed554fd769a ("media: dvb-usb: az6027: fix null-ptr-deref in az6027_i2c_xfer()")
--- drivers/media/usb/dvb-usb-v2/ec168.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/media/usb/dvb-usb-v2/ec168.c +12 -0
@@ -115,6 +115,10 @@ static int ec168_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],while (i < num) {if (num > i +1 && (msg[i+1 ].flags &I2C_M_RD )) {if (msg[i].addr == ec168_ec100_config.demod_address) { +if (msg[i].len <1 ) { + i = -EOPNOTSUPP ; +break ; + } req.cmd =READ_DEMOD ; req.value =0 ; req.index =0xff00 + msg[i].buf[0 ];/* reg */
@@ -131,6 +135,10 @@ static int ec168_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], } }else {if (msg[i].addr == ec168_ec100_config.demod_address) { +if (msg[i].len <1 ) { + i = -EOPNOTSUPP ; +break ; + } req.cmd =WRITE_DEMOD ; req.value = msg[i].buf[1 ];/* val */ req.index =0xff00 + msg[i].buf[0 ];/* reg */
@@ -139,6 +147,10 @@ static int ec168_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], ret =ec168_ctrl_msg (d, &req); i +=1 ; }else { +if (msg[i].len <1 ) { + i = -EOPNOTSUPP ; +break ; + } req.cmd =WRITE_I2C ; req.value = msg[i].buf[0 ];/* val */ req.index =0x0100 + msg[i].addr;/* I2C addr */
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 26/43 s390/topology: honour nr_cpu_ids when adding CPUs
In reply to Sasha LevinFrom: Alexander Gordeev <[email protected]>
[ Upstream commit a33239be2d38ff5a44427db1707c08787508d34a ]
When SMT thread CPUs are added to CPU masks the nr_cpu_ids limit is not checked and could be exceeded. This leads to a warning for example if CONFIG_DEBUG_PER_CPU_MAPS is set and the command line parameter nr_cpus is set to 1.
--- arch/s390/kernel/topology.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-)
arch/s390/kernel/topology.c +17 -15
@@ -96,7 +96,7 @@ static void cpu_group_map(cpumask_t *dst, struct mask_info *info, unsigned int cstatic void cpu_thread_map (cpumask_t *dst,unsigned int cpu) {static cpumask_t mask; -int i; +unsigned int max_cpu;cpumask_clear (&mask);if (!cpumask_test_cpu (cpu, &cpu_setup_mask))
@@ -105,9 +105,10 @@ static void cpu_thread_map(cpumask_t *dst, unsigned int cpu)if (topology_mode !=TOPOLOGY_MODE_HW ) goto out; cpu -= cpu % (smp_cpu_mtid +1 ); -for (i =0 ; i <= smp_cpu_mtid; i++) { -if (cpumask_test_cpu (cpu + i, &cpu_setup_mask)) -cpumask_set_cpu (cpu + i, &mask); + max_cpu =min (cpu + smp_cpu_mtid, nr_cpu_ids -1 ); +for (; cpu <= max_cpu; cpu++) { +if (cpumask_test_cpu (cpu, &cpu_setup_mask)) +cpumask_set_cpu (cpu, &mask); } out:cpumask_copy (dst, &mask);
@@ -124,25 +125,26 @@ static void add_cpus_to_mask(struct topology_core *tl_core,unsigned int core;for_each_set_bit (core, &tl_core->mask,TOPOLOGY_CORE_BITS ) { -unsigned int rcore; -int lcpu, i; +unsigned int max_cpu, rcore; +int cpu; rcore =TOPOLOGY_CORE_BITS -1 - core + tl_core->origin; - lcpu =smp_find_processor_id (rcore << smp_cpu_mt_shift); -if (lcpu <0 ) + cpu =smp_find_processor_id (rcore << smp_cpu_mt_shift); +if (cpu <0 )continue ; -for (i =0 ; i <= smp_cpu_mtid; i++) { - topo = &cpu_topology[lcpu + i]; + max_cpu =min (cpu + smp_cpu_mtid, nr_cpu_ids -1 ); +for (; cpu <= max_cpu; cpu++) { + topo = &cpu_topology[cpu]; topo->drawer_id = drawer->id; topo->book_id = book->id; topo->socket_id = socket->id; topo->core_id = rcore; - topo->thread_id = lcpu + i; + topo->thread_id = cpu; topo->dedicated = tl_core->d; -cpumask_set_cpu (lcpu + i, &drawer->mask); -cpumask_set_cpu (lcpu + i, &book->mask); -cpumask_set_cpu (lcpu + i, &socket->mask); -smp_cpu_set_polarization (lcpu + i, tl_core->pp); +cpumask_set_cpu (cpu, &drawer->mask); +cpumask_set_cpu (cpu, &book->mask); +cpumask_set_cpu (cpu, &socket->mask); +smp_cpu_set_polarization (cpu, tl_core->pp); } } }
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 25/43 s390/pkey: zeroize key blobs
In reply to Sasha LevinFrom: Holger Dengler <[email protected]>
[ Upstream commit 844cf829e5f33e00b279230470c8c93b58b8c16f ]
Key blobs for the IOCTLs PKEY_KBLOB2PROTK[23] may contain clear key material. Zeroize the copies of these keys in kernel memory after creating the protected key.
--- drivers/s390/crypto/pkey_api.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/s390/crypto/pkey_api.c +3 -0
@@ -1286,6 +1286,7 @@ static long pkey_unlocked_ioctl(struct file *filp, unsigned int cmd,return PTR_ERR (kkey); rc =pkey_keyblob2pkey (kkey, ktp.keylen, &ktp.protkey);DEBUG_DBG ("%s pkey_keyblob2pkey()=%d\n" , __func__, rc); +memzero_explicit (kkey, ktp.keylen);kfree (kkey);if (rc)break ;
@@ -1419,6 +1420,7 @@ static long pkey_unlocked_ioctl(struct file *filp, unsigned int cmd, kkey, ktp.keylen, &ktp.protkey);DEBUG_DBG ("%s pkey_keyblob2pkey2()=%d\n" , __func__, rc);kfree (apqns); +memzero_explicit (kkey, ktp.keylen);kfree (kkey);if (rc)break ;
@@ -1545,6 +1547,7 @@ static long pkey_unlocked_ioctl(struct file *filp, unsigned int cmd, protkey, &protkeylen);DEBUG_DBG ("%s pkey_keyblob2pkey3()=%d\n" , __func__, rc);kfree (apqns); +memzero_explicit (kkey, ktp.keylen);kfree (kkey);if (rc) {kfree (protkey);
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 9/43 media: dvb_demux: fix a bug for the continuity counter
In reply to Sasha LevinFrom: YongSu Yoo <[email protected]>
[ Upstream commit 7efb10d8dc70ea3000cc70dca53407c52488acd1 ]
In dvb_demux.c, some logics exist which compare the expected continuity counter and the real continuity counter. If they are not matched each other, both of the expected continuity counter and the real continuity counter should be printed. But there exists a bug that the expected continuity counter is not correctly printed. The expected continuity counter is replaced with the real countinuity counter + 1 so that the epected continuity counter is not correclty printed. This is wrong. This bug is fixed.
--- drivers/media/dvb-core/dvb_demux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/dvb-core/dvb_demux.c +2 -2
@@ -125,12 +125,12 @@ static inline int dvb_dmx_swfilter_payload(struct dvb_demux_feed *feed, cc = buf[3 ] &0x0f ; ccok = ((feed->cc +1 ) &0x0f ) == cc; - feed->cc = cc;if (!ccok) {set_buf_flags (feed,DMX_BUFFER_FLAG_DISCONTINUITY_DETECTED );dprintk_sect_loss ("missed packet: %d instead of %d!\n" , cc, (feed->cc +1 ) &0x0f ); } + feed->cc = cc;if (buf[1 ] &0x40 )// PUSI ? feed->peslen =0xfffa ;
@@ -310,7 +310,6 @@ static int dvb_dmx_swfilter_section_packet(struct dvb_demux_feed *feed, cc = buf[3 ] &0x0f ; ccok = ((feed->cc +1 ) &0x0f ) == cc; - feed->cc = cc;if (buf[3 ] &0x20 ) {/* adaption field present, check for discontinuity_indicator */
@@ -346,6 +345,7 @@ static int dvb_dmx_swfilter_section_packet(struct dvb_demux_feed *feed, feed->pusi_seen = false;dvb_dmx_swfilter_section_new (feed); } + feed->cc = cc;if (buf[1 ] &0x40 ) {/* PUSI=1 (is set), section boundary is here */
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 10/43 media: dvb-usb: az6027: fix three null-ptr-deref in az6027_i2c_xfer()
In reply to Sasha LevinFrom: Wei Chen <[email protected]>
[ Upstream commit 858e97d7956d17a2cb56a9413468704a4d5abfe1 ]
In az6027_i2c_xfer, msg is controlled by user. When msg[i].buf is null, commit 0ed554fd769a ("media: dvb-usb: az6027: fix null-ptr-deref in az6027_i2c_xfer()") fix the null-ptr-deref bug when msg[i].addr is 0x99. However, null-ptr-deref also happens when msg[i].addr is 0xd0 and 0xc0. We add check on msg[i].len to prevent null-ptr-deref.
--- drivers/media/usb/dvb-usb/az6027.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/media/usb/dvb-usb/az6027.c +12 -0
@@ -988,6 +988,10 @@ static int az6027_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int n/* write/read request */ if (i +1 < num && (msg[i +1 ].flags &I2C_M_RD )) { req =0xB9 ; +if (msg[i].len <1 ) { + i = -EOPNOTSUPP ; +break ; + } index = (((msg[i].buf[0 ] <<8 ) &0xff00 ) | (msg[i].buf[1 ] &0x00ff )); value = msg[i].addr + (msg[i].len <<8 ); length = msg[i +1 ].len +6 ;
@@ -1001,6 +1005,10 @@ static int az6027_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int n/* demod 16bit addr */ req =0xBD ; +if (msg[i].len <1 ) { + i = -EOPNOTSUPP ; +break ; + } index = (((msg[i].buf[0 ] <<8 ) &0xff00 ) | (msg[i].buf[1 ] &0x00ff )); value = msg[i].addr + (2 <<8 ); length = msg[i].len -2 ;
@@ -1026,6 +1034,10 @@ static int az6027_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int n }else { req =0xBD ; +if (msg[i].len <1 ) { + i = -EOPNOTSUPP ; +break ; + } index = msg[i].buf[0 ] &0x00FF ; value = msg[i].addr + (1 <<8 ); length = msg[i].len -1 ;
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 13/43 media: dvb-usb-v2: rtl28xxu: fix null-ptr-deref in rtl28xxu_i2c_xfer
In reply to Sasha LevinFrom: Zhang Shurong <[email protected]>
[ Upstream commit aa4a447b81b84f69c1a89ad899df157f386d7636 ]
In rtl28xxu_i2c_xfer, msg is controlled by user. When msg[i].buf is null and msg[i].len is zero, former checks on msg[i].buf would be passed. Malicious data finally reach rtl28xxu_i2c_xfer. If accessing msg[i].buf[0] without sanity check, null ptr deref would happen. We add check on msg[i].len to prevent crash.
Similar commit:
commit 0ed554fd769a
("media: dvb-usb: az6027: fix null-ptr-deref in az6027_i2c_xfer()")
--- drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
drivers/media/usb/dvb-usb-v2/rtl28xxu.c +20 -0
@@ -176,6 +176,10 @@ static int rtl28xxu_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], ret = -EOPNOTSUPP ; goto err_mutex_unlock; }else if (msg[0 ].addr ==0x10 ) { +if (msg[0 ].len <1 || msg[1 ].len <1 ) { + ret = -EOPNOTSUPP ; + goto err_mutex_unlock; + }/* method 1 - integrated demod */ if (msg[0 ].buf[0 ] ==0x00 ) {/* return demod page from driver cache */
@@ -189,6 +193,10 @@ static int rtl28xxu_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], ret =rtl28xxu_ctrl_msg (d, &req); } }else if (msg[0 ].len <2 ) { +if (msg[0 ].len <1 ) { + ret = -EOPNOTSUPP ; + goto err_mutex_unlock; + }/* method 2 - old I2C */ req.value = (msg[0 ].buf[0 ] <<8 ) | (msg[0 ].addr <<1 ); req.index =CMD_I2C_RD ;
@@ -217,8 +225,16 @@ static int rtl28xxu_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], ret = -EOPNOTSUPP ; goto err_mutex_unlock; }else if (msg[0 ].addr ==0x10 ) { +if (msg[0 ].len <1 ) { + ret = -EOPNOTSUPP ; + goto err_mutex_unlock; + }/* method 1 - integrated demod */ if (msg[0 ].buf[0 ] ==0x00 ) { +if (msg[0 ].len <2 ) { + ret = -EOPNOTSUPP ; + goto err_mutex_unlock; + }/* save demod page for later demod access */ dev->page = msg[0 ].buf[1 ]; ret =0 ;
@@ -231,6 +247,10 @@ static int rtl28xxu_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], ret =rtl28xxu_ctrl_msg (d, &req); } }else if ((msg[0 ].len <23 ) && (!dev->new_i2c_write)) { +if (msg[0 ].len <1 ) { + ret = -EOPNOTSUPP ; + goto err_mutex_unlock; + }/* method 2 - old I2C */ req.value = (msg[0 ].buf[0 ] <<8 ) | (msg[0 ].addr <<1 ); req.index =CMD_I2C_WR ;
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 12/43 media: dvb-usb-v2: ce6230: fix null-ptr-deref in ce6230_i2c_master_xfer()
In reply to Sasha LevinFrom: Wei Chen <[email protected]>
[ Upstream commit dff919090155fb22679869e8469168f270dcd97f ]
In ce6230_i2c_master_xfer, msg is controlled by user. When msg[i].buf is null and msg[i].len is zero, former checks on msg[i].buf would be passed. Malicious data finally reach ce6230_i2c_master_xfer. If accessing msg[i].buf[0] without sanity check, null ptr deref would happen. We add check on msg[i].len to prevent crash.
Similar commit:
commit 0ed554fd769a ("media: dvb-usb: az6027: fix null-ptr-deref in az6027_i2c_xfer()")
--- drivers/media/usb/dvb-usb-v2/ce6230.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/media/usb/dvb-usb-v2/ce6230.c +8 -0
@@ -101,6 +101,10 @@ static int ce6230_i2c_master_xfer(struct i2c_adapter *adap,if (num > i +1 && (msg[i+1 ].flags &I2C_M_RD )) {if (msg[i].addr == ce6230_zl10353_config.demod_address) { +if (msg[i].len <1 ) { + i = -EOPNOTSUPP ; +break ; + } req.cmd =DEMOD_READ ; req.value = msg[i].addr >>1 ; req.index = msg[i].buf[0 ];
@@ -117,6 +121,10 @@ static int ce6230_i2c_master_xfer(struct i2c_adapter *adap, }else {if (msg[i].addr == ce6230_zl10353_config.demod_address) { +if (msg[i].len <1 ) { + i = -EOPNOTSUPP ; +break ; + } req.cmd =DEMOD_WRITE ; req.value = msg[i].addr >>1 ; req.index = msg[i].buf[0 ];
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 14/43 media: dvb-usb: digitv: fix null-ptr-deref in digitv_i2c_xfer()
In reply to Sasha LevinFrom: Wei Chen <[email protected]>
[ Upstream commit 9ded5bd2a49ce3015b7c936743eec0a0e6e11f0c ]
In digitv_i2c_xfer, msg is controlled by user. When msg[i].buf is null and msg[i].len is zero, former checks on msg[i].buf would be passed. Malicious data finally reach digitv_i2c_xfer. If accessing msg[i].buf[0] without sanity check, null ptr deref would happen. We add check on msg[i].len to prevent crash.
Similar commit:
commit 0ed554fd769a ("media: dvb-usb: az6027: fix null-ptr-deref in az6027_i2c_xfer()")
--- drivers/media/usb/dvb-usb/digitv.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/media/usb/dvb-usb/digitv.c +4 -0
@@ -63,6 +63,10 @@ static int digitv_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int numwarn ("more than 2 i2c messages at a time is not handled yet. TODO." );for (i =0 ; i < num; i++) { +if (msg[i].len <1 ) { + i = -EOPNOTSUPP ; +break ; + }/* write/read request */ if (i+1 < num && (msg[i+1 ].flags &I2C_M_RD )) { if (digitv_ctrl_msg(d, USB_READ_COFDM, msg[i].buf[0], NULL, 0,
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 15/43 media: dvb-usb: dw2102: fix uninit-value in su3000_read_mac_address
In reply to Sasha LevinFrom: Wei Chen <[email protected]>
[ Upstream commit a3fd1ef27aa686d871cefe207bd6168c4b0cd29e ]
In su3000_read_mac_address, if i2c_transfer fails to execute two messages, array mac address will not be initialized. Without handling such error, later in function dvb_usb_adapter_dvb_init, proposed_mac is accessed before initialization.
Fix this error by returning a negative value if message execution fails.
--- drivers/media/usb/dvb-usb/dw2102.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/dvb-usb/dw2102.c +1 -1
@@ -946,7 +946,7 @@ static int su3000_read_mac_address(struct dvb_usb_device *d, u8 mac[6])for (i =0 ; i <6 ; i++) { obuf[1 ] =0xf0 + i;if (i2c_transfer (&d->i2c_adap, msg,2 ) !=2 ) -break ; +return -1 ;else mac[i] = ibuf[0 ]; }
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 22/43 media: dvb-core: Fix kernel WARNING for blocking operation in wait_event*()
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit b8c75e4a1b325ea0a9433fa8834be97b5836b946 ]
Using a semaphore in the wait_event*() condition is no good idea. It hits a kernel WARN_ON() at prepare_to_wait_event() like:
do not call blocking ops when !TASK_RUNNING; state=1 set at prepare_to_wait_event+0x6d/0x690
For avoiding the potential deadlock, rewrite to an open-coded loop instead. Unlike the loop in wait_event*(), this uses wait_woken() after the condition check, hence the task state stays consistent.
CVE-2023-31084 was assigned to this bug.
--- drivers/media/dvb-core/dvb_frontend.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/media/dvb-core/dvb_frontend.c +12 -4
@@ -293,14 +293,22 @@ static int dvb_frontend_get_event(struct dvb_frontend *fe, }if (events->eventw == events->eventr) { -int ret; +struct wait_queue_entry wait; +int ret =0 ;if (flags &O_NONBLOCK )return -EWOULDBLOCK ; - ret =wait_event_interruptible (events->wait_queue, -dvb_frontend_test_event (fepriv, events)); - +init_waitqueue_entry (&wait, current); +add_wait_queue (&events->wait_queue, &wait); +while (!dvb_frontend_test_event (fepriv, events)) { +wait_woken (&wait,TASK_INTERRUPTIBLE ,0 ); +if (signal_pending (current)) { + ret = -ERESTARTSYS ; +break ; + } + } +remove_wait_queue (&events->wait_queue, &wait);if (ret <0 )return ret; }
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 28/43 wifi: rtl8xxxu: fix authentication timeout due to incorrect RCR value
In reply to Sasha LevinFrom: Yun Lu <[email protected]>
[ Upstream commit 20429444e653ee8242dfbf815c0c37866beb371b ]
When using rtl8192cu with rtl8xxxu driver to connect wifi, there is a probability of failure, which shows "authentication with ... timed out". Through debugging, it was found that the RCR register has been inexplicably modified to an incorrect value, resulting in the nic not being able to receive authenticated frames.
To fix this problem, add regrcr in rtl8xxxu_priv struct, and store the RCR value every time the register is written, and use it the next time the register need to be modified.
--- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 1 + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +1 -0
@@ -1346,6 +1346,7 @@ struct rtl8xxxu_priv {u32 rege9c;u32 regeb4;u32 regebc; +u32 regrcr;int next_mbox;int nr_out_eps;
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +3 -1
@@ -4045,6 +4045,7 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw)RCR_ACCEPT_MGMT_FRAME |RCR_HTC_LOC_CTRL |RCR_APPEND_PHYSTAT |RCR_APPEND_ICV |RCR_APPEND_MIC ;rtl8xxxu_write32 (priv,REG_RCR , val32); + priv->regrcr = val32;/* * Accept all multicast
@@ -6000,7 +6001,7 @@ static void rtl8xxxu_configure_filter(struct ieee80211_hw *hw, unsigned int *total_flags, u64 multicast) {struct rtl8xxxu_priv *priv = hw->priv; -u32 rcr =rtl8xxxu_read32 (priv,REG_RCR ); +u32 rcr = priv->regrcr;dev_dbg (&priv->udev->dev,"%s: changed_flags %08x, total_flags %08x\n" , __func__, changed_flags, *total_flags);
@@ -6046,6 +6047,7 @@ static void rtl8xxxu_configure_filter(struct ieee80211_hw *hw,*/ rtl8xxxu_write32 (priv,REG_RCR , rcr); + priv->regrcr = rcr; *total_flags &= (FIF_ALLMULTI | FIF_FCSFAIL | FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL | FIF_OTHER_BSS | FIF_PSPOLL |
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 17/43 media: dvb_ca_en50221: fix a size write bug
In reply to Sasha LevinFrom: YongSu Yoo <[email protected]>
[ Upstream commit a4315e5be7020aac9b24a8151caf4bb85224cd0e ]
The function of "dvb_ca_en50221_write_data" at source/drivers/media /dvb-core/dvb_ca_en50221.c is used for two cases.
The first case is for writing APDU data in the function of "dvb_ca_en50221_io_write" at source/drivers/media/dvb-core/ dvb_ca_en50221.c.
The second case is for writing the host link buf size on the Command Register in the function of "dvb_ca_en50221_link_init" at source/drivers/media/dvb-core/dvb_ca_en50221.c.
In the second case, there exists a bug like following. In the function of the "dvb_ca_en50221_link_init",
after a TV host calculates the host link buf_size,
the TV host writes the calculated host link buf_size on the Size Register.
Accroding to the en50221 Spec (the page 60 of
https://dvb.org/wp-content/uploads/2020/02/En50221.V1.pdf),
before this writing operation, the "SW(CMDREG_SW)" flag in the Command Register should be set. We can see this setting operation in the function of the "dvb_ca_en50221_link_init" like below.
...
if ((ret = ca->pub->write_cam_control(ca->pub, slot, CTRLIF_COMMAND, IRQEN | CMDREG_SW)) != 0) return ret;
...
But, after that, the real writing operation is implemented using the function of the "dvb_ca_en50221_write_data" in the function of "dvb_ca_en50221_link_init", and the "dvb_ca_en50221_write_data" includes the function of "ca->pub->write_cam_control", and the function of the "ca->pub->write_cam_control" in the function of the "dvb_ca_en50221_wrte_data" does not include "CMDREG_SW" flag like below.
...
if ((status = ca->pub->write_cam_control(ca->pub, slot,
CTRLIF_COMMAND, IRQEN | CMDREG_HC)) != 0)
...
In the above source code, we can see only the "IRQEN | CMDREG_HC", but we cannot see the "CMDREG_SW".
The "CMDREG_SW" flag which was set in the function of the "dvb_ca_en50221_link_init" was rollbacked by the follwoing function of the "dvb_ca_en50221_write_data".
This is a bug. and this bug causes that the calculated host link buf_size is not properly written in the CI module.
Through this patch, we fix this bug.
--- drivers/media/dvb-core/dvb_ca_en50221.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/media/dvb-core/dvb_ca_en50221.c +7 -5
@@ -187,7 +187,7 @@ static void dvb_ca_en50221_thread_wakeup(struct dvb_ca_private *ca);static int dvb_ca_en50221_read_data (struct dvb_ca_private *ca,int slot,u8 *ebuf,int ecount);static int dvb_ca_en50221_write_data (struct dvb_ca_private *ca,int slot, -u8 *ebuf,int ecount); +u8 *ebuf,int ecount,int size_write_flag);/** * findstr - Safely find needle in haystack.
@@ -370,7 +370,7 @@ static int dvb_ca_en50221_link_init(struct dvb_ca_private *ca, int slot) ret =dvb_ca_en50221_wait_if_status (ca, slot,STATUSREG_FR ,HZ /10 );if (ret)return ret; - ret =dvb_ca_en50221_write_data (ca, slot, buf,2 ); + ret =dvb_ca_en50221_write_data (ca, slot, buf,2 ,CMDREG_SW );if (ret !=2 )return -EIO ; ret = ca->pub->write_cam_control (ca->pub, slot,CTRLIF_COMMAND ,IRQEN );
@@ -778,11 +778,13 @@ static int dvb_ca_en50221_read_data(struct dvb_ca_private *ca, int slot,* @buf: The data in this buffer is treated as a complete link-level packet to * be written. * @bytes_write: Size of ebuf. +* @size_write_flag: A flag on Command Register which says whether the link size +* information will be writen or not. * * return: Number of bytes written, or < 0 on error. */ static int dvb_ca_en50221_write_data (struct dvb_ca_private *ca,int slot, -u8 *buf,int bytes_write) +u8 *buf,int bytes_write,int size_write_flag) {struct dvb_ca_slot *sl = &ca->slot_info[slot];int status;
@@ -817,7 +819,7 @@ static int dvb_ca_en50221_write_data(struct dvb_ca_private *ca, int slot,/* OK, set HC bit */ status = ca->pub->write_cam_control (ca->pub, slot,CTRLIF_COMMAND , -IRQEN |CMDREG_HC ); +IRQEN |CMDREG_HC | size_write_flag);if (status) goto exit;
@@ -1508,7 +1510,7 @@ static ssize_t dvb_ca_en50221_io_write(struct file *file,mutex_lock (&sl->slot_lock); status =dvb_ca_en50221_write_data (ca, slot, fragbuf, - fraglen +2 ); + fraglen +2 ,0 );mutex_unlock (&sl->slot_lock);if (status == (fraglen +2 )) { written =1 ;
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 18/43 media: ttusb-dec: fix memory leak in ttusb_dec_exit_dvb()
In reply to Sasha LevinFrom: Hyunwoo Kim <[email protected]>
[ Upstream commit 517a281338322ff8293f988771c98aaa7205e457 ]
Since dvb_frontend_detach() is not called in ttusb_dec_exit_dvb(), which is called when the device is disconnected, dvb_frontend_free() is not finally called.
This causes a memory leak just by repeatedly plugging and unplugging the device.
Fix this issue by adding dvb_frontend_detach() to ttusb_dec_exit_dvb().
--- drivers/media/usb/ttusb-dec/ttusb_dec.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/usb/ttusb-dec/ttusb_dec.c +1 -2
@@ -1544,8 +1544,7 @@ static void ttusb_dec_exit_dvb(struct ttusb_dec *dec)dvb_dmx_release (&dec->demux);if (dec->fe) {dvb_unregister_frontend (dec->fe); -if (dec->fe->ops.release) - dec->fe->ops.release (dec->fe); +dvb_frontend_detach (dec->fe); }dvb_unregister_adapter (&dec->adapter); }
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 20/43 media: dvb-core: Fix use-after-free due on race condition at dvb_net
In reply to Sasha LevinFrom: Hyunwoo Kim <[email protected]>
[ Upstream commit 4172385b0c9ac366dcab78eda48c26814b87ed1a ]
A race condition may occur between the .disconnect function, which is called when the device is disconnected, and the dvb_device_open() function, which is called when the device node is open()ed. This results in several types of UAFs.
The root cause of this is that you use the dvb_device_open() function, which does not implement a conditional statement
that checks 'dvbnet->exit'.
So, add 'remove_mutex` to protect 'dvbnet->exit' and use locked_dvb_net_open() function to check 'dvbnet->exit'.
[mchehab: fix a checkpatch warning]
--- drivers/media/dvb-core/dvb_net.c | 38 +++++++++++++++++++++++++++++--- include/media/dvb_net.h | 4 ++++ 2 files changed, 39 insertions(+), 3 deletions(-)
drivers/media/dvb-core/dvb_net.c +35 -3
@@ -1564,15 +1564,43 @@ static long dvb_net_ioctl(struct file *file,return dvb_usercopy (file, cmd, arg, dvb_net_do_ioctl); } +static int locked_dvb_net_open (struct inode *inode,struct file *file) +{ +struct dvb_device *dvbdev = file->private_data; +struct dvb_net *dvbnet = dvbdev->priv; +int ret; + +if (mutex_lock_interruptible (&dvbnet->remove_mutex)) +return -ERESTARTSYS ; + +if (dvbnet->exit) { +mutex_unlock (&dvbnet->remove_mutex); +return -ENODEV ; + } + + ret =dvb_generic_open (inode, file); + +mutex_unlock (&dvbnet->remove_mutex); + +return ret; +} +static int dvb_net_close (struct inode *inode,struct file *file) {struct dvb_device *dvbdev = file->private_data;struct dvb_net *dvbnet = dvbdev->priv; +mutex_lock (&dvbnet->remove_mutex); +dvb_generic_release (inode, file); -if (dvbdev->users ==1 && dvbnet->exit ==1 ) +if (dvbdev->users ==1 && dvbnet->exit ==1 ) { +mutex_unlock (&dvbnet->remove_mutex);wake_up (&dvbdev->wait_queue); + }else { +mutex_unlock (&dvbnet->remove_mutex); + } +return 0 ; }
@@ -1580,7 +1608,7 @@ static int dvb_net_close(struct inode *inode, struct file *file)static const struct file_operations dvb_net_fops = { .owner =THIS_MODULE , .unlocked_ioctl = dvb_net_ioctl, - .open = dvb_generic_open, + .open = locked_dvb_net_open, .release = dvb_net_close, .llseek = noop_llseek, };
@@ -1599,10 +1627,13 @@ void dvb_net_release (struct dvb_net *dvbnet) {int i; +mutex_lock (&dvbnet->remove_mutex); dvbnet->exit =1 ; +mutex_unlock (&dvbnet->remove_mutex); +if (dvbnet->dvbdev->users <1 )wait_event (dvbnet->dvbdev->wait_queue, - dvbnet->dvbdev->users==1 ); + dvbnet->dvbdev->users ==1 );dvb_unregister_device (dvbnet->dvbdev);
@@ -1621,6 +1652,7 @@ int dvb_net_init (struct dvb_adapter *adap, struct dvb_net *dvbnet,int i;mutex_init (&dvbnet->ioctl_mutex); +mutex_init (&dvbnet->remove_mutex); dvbnet->demux = dmx;for (i=0 ; i<DVB_NET_DEVICES_MAX ; i++)
include/media/dvb_net.h +4 -0
@@ -41,6 +41,9 @@* @exit: flag to indicate when the device is being removed. * @demux: pointer to &struct dmx_demux. * @ioctl_mutex: protect access to this struct. +* @remove_mutex: mutex that avoids a race condition between a callback +* called when the hardware is disconnected and the +* file_operations of dvb_net. * * Currently, the core supports up to %DVB_NET_DEVICES_MAX (10) network * devices.
@@ -53,6 +56,7 @@ struct dvb_net { unsigned int exit:1;struct dmx_demux *demux;struct mutex ioctl_mutex; +struct mutex remove_mutex; };/**
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 19/43 media: mn88443x: fix !CONFIG_OF error by drop of_match_ptr from ID table
In reply to Sasha LevinFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit ae11c0efaec32fb45130ee9886689f467232eebc ]
The driver will match mostly by DT table (even thought there is regular ID table) so there is little benefit in of_match_ptr (this also allows ACPI matching via PRP0001, even though it might not be relevant here). This also fixes !CONFIG_OF error:
drivers/media/dvb-frontends/mn88443x.c:782:34: error: ‘mn88443x_of_match’ defined but not used [-Werror=unused-const-variable=]
--- drivers/media/dvb-frontends/mn88443x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/dvb-frontends/mn88443x.c +1 -1
@@ -800,7 +800,7 @@ MODULE_DEVICE_TABLE(i2c, mn88443x_i2c_id);static struct i2c_driver mn88443x_driver = { .driver = { .name ="mn88443x" , - .of_match_table =of_match_ptr (mn88443x_of_match), + .of_match_table = mn88443x_of_match, }, .probe = mn88443x_probe, .remove = mn88443x_remove,
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 21/43 media: dvb-core: Fix use-after-free due to race at dvb_register_device()
In reply to Sasha LevinFrom: Hyunwoo Kim <[email protected]>
[ Upstream commit 627bb528b086b4136315c25d6a447a98ea9448d3 ]
dvb_register_device() dynamically allocates fops with kmemdup() to set the fops->owner.
And these fops are registered in 'file->f_ops' using replace_fops() in the dvb_device_open() process, and kfree()d in dvb_free_device().
However, it is not common to use dynamically allocated fops instead of 'static const' fops as an argument of replace_fops(), and UAF may occur.
These UAFs can occur on any dvb type using dvb_register_device(), such as dvb_dvr, dvb_demux, dvb_frontend, dvb_net, etc.
So, instead of kfree() the fops dynamically allocated in dvb_register_device() in dvb_free_device() called during the .disconnect() process, kfree() it collectively in exit_dvbdev() called when the dvbdev.c module is removed.
--- drivers/media/dvb-core/dvbdev.c | 84 ++++++++++++++++++++++++--------- include/media/dvbdev.h | 15 ++++++ 2 files changed, 78 insertions(+), 21 deletions(-)
drivers/media/dvb-core/dvbdev.c +63 -21
@@ -37,6 +37,7 @@#include <media/tuner.h> static DEFINE_MUTEX (dvbdev_mutex); +static LIST_HEAD (dvbdevfops_list);static int dvbdev_debug;module_param (dvbdev_debug, int,0644 );
@@ -462,14 +463,15 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, enum dvb_device_type type, int demux_sink_pads) {struct dvb_device *dvbdev; -struct file_operations *dvbdevfops; +struct file_operations *dvbdevfops =NULL ; +struct dvbdevfops_node *node =NULL , *new_node =NULL ;struct device *clsdev;int minor;int id, ret;mutex_lock (&dvbdev_register_lock); -if ((id =dvbdev_get_free_id (adap, type)) <0 ){ +if ((id =dvbdev_get_free_id (adap, type)) <0 ) {mutex_unlock (&dvbdev_register_lock); *pdvbdev =NULL ;pr_err ("%s: couldn't find free device id\n" , __func__);
@@ -477,18 +479,45 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, } *pdvbdev = dvbdev =kzalloc (sizeof (*dvbdev),GFP_KERNEL ); -if (!dvbdev){mutex_unlock (&dvbdev_register_lock);return -ENOMEM ; } - dvbdevfops =kmemdup (template->fops,sizeof (*dvbdevfops),GFP_KERNEL ); +/* +* When a device of the same type is probe()d more than once, +* the first allocated fops are used. This prevents memory leaks +* that can occur when the same device is probe()d repeatedly. +*/ +list_for_each_entry (node, &dvbdevfops_list, list_head) { +if (node->fops->owner == adap->module && + node->type == type && + node->template == template) { + dvbdevfops = node->fops; +break ; + } + } -if (!dvbdevfops){ -kfree (dvbdev); -mutex_unlock (&dvbdev_register_lock); -return -ENOMEM ; +if (dvbdevfops ==NULL ) { + dvbdevfops =kmemdup (template->fops,sizeof (*dvbdevfops),GFP_KERNEL ); +if (!dvbdevfops) { +kfree (dvbdev); +mutex_unlock (&dvbdev_register_lock); +return -ENOMEM ; + } + + new_node =kzalloc (sizeof (struct dvbdevfops_node ),GFP_KERNEL ); +if (!new_node) { +kfree (dvbdevfops); +kfree (dvbdev); +mutex_unlock (&dvbdev_register_lock); +return -ENOMEM ; + } + + new_node->fops = dvbdevfops; + new_node->type = type; + new_node->template = template; +list_add_tail (&new_node->list_head, &dvbdevfops_list); }memcpy (dvbdev, template,sizeof (struct dvb_device ));
@@ -499,20 +528,20 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, dvbdev->priv = priv; dvbdev->fops = dvbdevfops;init_waitqueue_head (&dvbdev->wait_queue); - dvbdevfops->owner = adap->module; -list_add_tail (&dvbdev->list_head, &adap->device_list); -down_write (&minor_rwsem);#ifdef CONFIG_DVB_DYNAMIC_MINORS for (minor =0 ; minor <MAX_DVB_MINORS ; minor++)if (dvb_minors[minor] ==NULL )break ; -if (minor ==MAX_DVB_MINORS ) { +if (new_node) { +list_del (&new_node->list_head); +kfree (dvbdevfops); +kfree (new_node); + }list_del (&dvbdev->list_head); -kfree (dvbdevfops);kfree (dvbdev);up_write (&minor_rwsem);mutex_unlock (&dvbdev_register_lock);
@@ -521,41 +550,47 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,#else minor =nums2minor (adap->num, type, id);#endif - dvbdev->minor = minor; dvb_minors[minor] =dvb_device_get (dvbdev);up_write (&minor_rwsem); - ret =dvb_register_media_device (dvbdev, type, minor, demux_sink_pads);if (ret) {pr_err ("%s: dvb_register_media_device failed to create the mediagraph\n" , __func__); - +if (new_node) { +list_del (&new_node->list_head); +kfree (dvbdevfops); +kfree (new_node); + }dvb_media_device_free (dvbdev);list_del (&dvbdev->list_head); -kfree (dvbdevfops);kfree (dvbdev);mutex_unlock (&dvbdev_register_lock);return ret; } -mutex_unlock (&dvbdev_register_lock); - clsdev =device_create (dvb_class, adap->device,MKDEV (DVB_MAJOR , minor), dvbdev,"dvb%d.%s%d" , adap->num, dnames[type], id);if (IS_ERR (clsdev)) {pr_err ("%s: failed to create device dvb%d.%s%d (%ld)\n" , __func__, adap->num, dnames[type], id,PTR_ERR (clsdev)); +if (new_node) { +list_del (&new_node->list_head); +kfree (dvbdevfops); +kfree (new_node); + }dvb_media_device_free (dvbdev);list_del (&dvbdev->list_head); -kfree (dvbdevfops);kfree (dvbdev); +mutex_unlock (&dvbdev_register_lock);return PTR_ERR (clsdev); } +dprintk ("DVB: register adapter%d/%s%d @ minor: %i (0x%02x)\n" , adap->num, dnames[type], id, minor, minor); +mutex_unlock (&dvbdev_register_lock);return 0 ; }EXPORT_SYMBOL (dvb_register_device);
@@ -584,7 +619,6 @@ static void dvb_free_device(struct kref *ref) { struct dvb_device *dvbdev = container_of(ref, struct dvb_device, ref); -kfree (dvbdev->fops);kfree (dvbdev); }
@@ -1090,9 +1124,17 @@ static int __init init_dvbdev(void) static void __exit exit_dvbdev(void) { +struct dvbdevfops_node *node, *next; +class_destroy (dvb_class);cdev_del (&dvb_device_cdev);unregister_chrdev_region (MKDEV (DVB_MAJOR ,0 ),MAX_DVB_MINORS ); + +list_for_each_entry_safe (node, next, &dvbdevfops_list, list_head) { +list_del (&node->list_head); +kfree (node->fops); +kfree (node); + } }subsys_initcall (init_dvbdev);
include/media/dvbdev.h +15 -0
@@ -189,6 +189,21 @@ struct dvb_device {void *priv; }; +/** +* struct dvbdevfops_node - fops nodes registered in dvbdevfops_list +* +* @fops: Dynamically allocated fops for ->owner registration +* @type: type of dvb_device +* @template: dvb_device used for registration +* @list_head: list_head for dvbdevfops_list +*/ +struct dvbdevfops_node { +struct file_operations *fops; +enum dvb_device_type type; +const struct dvb_device *template; +struct list_head list_head; +}; +/** * dvb_device_get - Increase dvb_device reference *
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 34/43 scsi: core: Decrease scsi_device's iorequest_cnt if dispatch failed
In reply to Sasha LevinFrom: Wenchao Hao <[email protected]>
[ Upstream commit 09e797c8641f6ad435c33ae24c223351197ea29a ]
If scsi_dispatch_cmd() failed, the SCSI command was not sent to the target, scsi_queue_rq() would return BLK_STS_RESOURCE and the related request would be requeued. The timeout of this request would not fire, no one would increase iodone_cnt.
The above flow would result the iodone_cnt smaller than iorequest_cnt. So decrease the iorequest_cnt if dispatch failed to workaround the issue.
--- drivers/scsi/scsi_lib.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/scsi/scsi_lib.c +2 -0
@@ -1476,6 +1476,7 @@ static int scsi_dispatch_cmd(struct scsi_cmnd *cmd)*/ SCSI_LOG_MLQUEUE (3 ,scmd_printk (KERN_INFO , cmd,"queuecommand : device blocked\n" )); +atomic_dec (&cmd->device->iorequest_cnt);return SCSI_MLQUEUE_DEVICE_BUSY ; }
@@ -1508,6 +1509,7 @@ static int scsi_dispatch_cmd(struct scsi_cmnd *cmd)trace_scsi_dispatch_cmd_start (cmd); rtn = host->hostt->queuecommand (host, cmd);if (rtn) { +atomic_dec (&cmd->device->iorequest_cnt);trace_scsi_dispatch_cmd_error (cmd, rtn);if (rtn !=SCSI_MLQUEUE_DEVICE_BUSY && rtn !=SCSI_MLQUEUE_TARGET_BUSY )
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 23/43 media: dvb-core: Fix use-after-free due to race condition at dvb_ca_en50221
In reply to Sasha LevinFrom: Hyunwoo Kim <[email protected]>
[ Upstream commit 280a8ab81733da8bc442253c700a52c4c0886ffd ]
If the device node of dvb_ca_en50221 is open() and the device is disconnected, a UAF may occur when calling close() on the device node.
The root cause is that wake_up() and wait_event() for dvbdev->wait_queue are not implemented.
So implement wait_event() function in dvb_ca_en50221_release() and add 'remove_mutex' which prevents race condition for 'ca->exit'.
[mchehab: fix a checkpatch warning]
--- drivers/media/dvb-core/dvb_ca_en50221.c | 37 ++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-)
drivers/media/dvb-core/dvb_ca_en50221.c +36 -1
@@ -151,6 +151,12 @@ struct dvb_ca_private {/* mutex serializing ioctls */ struct mutex ioctl_mutex; + +/* A mutex used when a device is disconnected */ +struct mutex remove_mutex; + +/* Whether the device is disconnected */ +int exit; };static void dvb_ca_private_free (struct dvb_ca_private *ca)
@@ -1711,12 +1717,22 @@ static int dvb_ca_en50221_io_open(struct inode *inode, struct file *file)dprintk ("%s\n" , __func__); -if (!try_module_get (ca->pub->owner)) +mutex_lock (&ca->remove_mutex); + +if (ca->exit) { +mutex_unlock (&ca->remove_mutex); +return -ENODEV ; + } + +if (!try_module_get (ca->pub->owner)) { +mutex_unlock (&ca->remove_mutex);return -EIO ; + } err =dvb_generic_open (inode, file);if (err <0 ) {module_put (ca->pub->owner); +mutex_unlock (&ca->remove_mutex);return err; }
@@ -1741,6 +1757,7 @@ static int dvb_ca_en50221_io_open(struct inode *inode, struct file *file)dvb_ca_private_get (ca); +mutex_unlock (&ca->remove_mutex);return 0 ; }
@@ -1760,6 +1777,8 @@ static int dvb_ca_en50221_io_release(struct inode *inode, struct file *file)dprintk ("%s\n" , __func__); +mutex_lock (&ca->remove_mutex); +/* mark the CA device as closed */ ca->open =0 ;dvb_ca_en50221_thread_update_delay (ca);
@@ -1770,6 +1789,13 @@ static int dvb_ca_en50221_io_release(struct inode *inode, struct file *file)dvb_ca_private_put (ca); +if (dvbdev->users ==1 && ca->exit ==1 ) { +mutex_unlock (&ca->remove_mutex); +wake_up (&dvbdev->wait_queue); + }else { +mutex_unlock (&ca->remove_mutex); + } +return err; }
@@ -1893,6 +1919,7 @@ int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter, }mutex_init (&ca->ioctl_mutex); +mutex_init (&ca->remove_mutex);if (signal_pending (current)) { ret = -EINTR ;
@@ -1935,6 +1962,14 @@ void dvb_ca_en50221_release(struct dvb_ca_en50221 *pubca)dprintk ("%s\n" , __func__); +mutex_lock (&ca->remove_mutex); + ca->exit =1 ; +mutex_unlock (&ca->remove_mutex); + +if (ca->dvbdev->users <1 ) +wait_event (ca->dvbdev->wait_queue, + ca->dvbdev->users ==1 ); +/* shutdown the thread if there was one */ kthread_stop (ca->thread);
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 27/43 ACPI: resource: Add IRQ override quirk for LG UltraPC 17U70P
In reply to Sasha LevinFrom: Rubén Gómez <[email protected]>
[ Upstream commit 71a485624c4cbb144169852d7bb8ca8c0667d7a3 ]
Add an ACPI IRQ override quirk for LG UltraPC 17U70P to address the internal keyboard problem on it.
--- drivers/acpi/resource.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/acpi/resource.c +12 -0
@@ -470,6 +470,17 @@ static const struct dmi_system_id maingear_laptop[] = { { } }; +static const struct dmi_system_id lg_laptop[] = { + { + .ident ="LG Electronics 17U70P" , + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"LG Electronics" ), +DMI_MATCH (DMI_BOARD_NAME ,"17U70P" ), + }, + }, + { } +}; +struct irq_override_cmp {const struct dmi_system_id *system;unsigned char irq;
@@ -486,6 +497,7 @@ static const struct irq_override_cmp override_table[] = { { lenovo_laptop, 10, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0, true }, { tongfang_gm_rg, 1, ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_LOW, 1, true }, { maingear_laptop, 1, ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_LOW, 1, true }, + { lg_laptop, 1, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0, false }, }; static bool acpi_dev_irq_override(u32 gsi, u8 triggering, u8 polarity,
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 16/43 media: netup_unidvb: fix irq init by register it at the end of probe
In reply to Sasha LevinFrom: Wei Chen <[email protected]>
[ Upstream commit e6ad6233592593079db5c8fa592c298e51bc1356 ]
IRQ handler netup_spi_interrupt() takes spinlock spi->lock. The lock is initialized in netup_spi_init(). However, irq handler is registered before initializing the lock.
Spinlock dma->lock and i2c->lock suffer from the same problem.
Fix this by registering the irq at the end of probe.
--- .../media/pci/netup_unidvb/netup_unidvb_core.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/media/pci/netup_unidvb/netup_unidvb_core.c +9 -8
@@ -887,12 +887,7 @@ static int netup_unidvb_initdev(struct pci_dev *pci_dev, ndev->lmmio0, (u32 )pci_resource_len (pci_dev,0 ), ndev->lmmio1, (u32 )pci_resource_len (pci_dev,1 ), pci_dev->irq); -if (request_irq (pci_dev->irq, netup_unidvb_isr,IRQF_SHARED , -"netup_unidvb" , pci_dev) <0 ) { -dev_err (&pci_dev->dev, -"%s(): can't get IRQ %d\n" , __func__, pci_dev->irq); - goto irq_request_err; - } + ndev->dma_size =2 *188 *NETUP_DMA_BLOCKS_COUNT *NETUP_DMA_PACKETS_COUNT ; ndev->dma_virt = dma_alloc_coherent(&pci_dev->dev,
@@ -933,6 +928,14 @@ static int netup_unidvb_initdev(struct pci_dev *pci_dev,dev_err (&pci_dev->dev,"netup_unidvb: DMA setup failed\n" ); goto dma_setup_err; } + +if (request_irq (pci_dev->irq, netup_unidvb_isr,IRQF_SHARED , +"netup_unidvb" , pci_dev) <0 ) { +dev_err (&pci_dev->dev, +"%s(): can't get IRQ %d\n" , __func__, pci_dev->irq); + goto dma_setup_err; + } +dev_info (&pci_dev->dev,"netup_unidvb: device has been initialized\n" );return 0 ;
@@ -951,8 +954,6 @@ static int netup_unidvb_initdev(struct pci_dev *pci_dev,dma_free_coherent (&pci_dev->dev, ndev->dma_size, ndev->dma_virt, ndev->dma_phys); dma_alloc_err: -free_irq (pci_dev->irq, pci_dev); -irq_request_err:iounmap (ndev->lmmio1); pci_bar1_error:iounmap (ndev->lmmio0);
Signature · 1 line
2.39.2