dma-buf: WARN on dmabuf release with pending attachments
Subsystems (14)
Sasha Levin
maintainerPATCH 1/101 dma-buf: WARN on dmabuf release with pending attachments
From: Charan Teja Reddy <[email protected]>
[ Upstream commit f492283b157053e9555787262f058ae33096f568 ]
It is expected from the clients to follow the below steps on an imported dmabuf fd:
a) dmabuf = dma_buf_get(fd) // Get the dmabuf from fd
b) dma_buf_attach(dmabuf); // Clients attach to the dmabuf
o Here the kernel does some slab allocations, say fordma_buf_attachment and may be some other slab allocation in the dmabuf->ops->attach().
c) Client may need to do dma_buf_map_attachment().
d) Accordingly dma_buf_unmap_attachment() should be called.
e) dma_buf_detach () // Clients detach to the dmabuf.
o Here the slab allocations made in b) are freed.
f) dma_buf_put(dmabuf) // Can free the dmabuf if it is the last reference.
Now say an erroneous client failed at step c) above thus it directly called dma_buf_put(), step f) above. Considering that it may be the last reference to the dmabuf, buffer will be freed with pending attachments left to the dmabuf which can show up as the 'memory leak'. This should at least be reported as the WARN().
--- drivers/dma-buf/dma-buf.c | 1 + 1 file changed, 1 insertion(+)
drivers/dma-buf/dma-buf.c +1 -0
@@ -79,6 +79,7 @@ static void dma_buf_release(struct dentry *dentry)if (dmabuf->resv == (struct dma_resv *)&dmabuf[1 ])dma_resv_fini (dmabuf->resv); +WARN_ON (!list_empty (&dmabuf->attachments));module_put (dmabuf->owner);kfree (dmabuf->name);kfree (dmabuf);
Signature · 1 line
2.33.0
Sasha Levin
maintainerPATCH 2/101 drm: panel-orientation-quirks: Update the Lenovo Ideapad D330 quirk (v2)
From: Hans de Goede <[email protected]>
[ Upstream commit 820a2ab23d5eab4ccfb82581eda8ad4acf18458f ]
2 improvements to the Lenovo Ideapad D330 panel-orientation quirks:
1. Some versions of the Lenovo Ideapad D330 have a DMI_PRODUCT_NAME of "81H3" and others have "81MD". Testing has shown that the "81MD" also has a 90 degree mounted panel. Drop the DMI_PRODUCT_NAME from the existing quirk so that the existing quirk matches both variants.
2. Some of the Lenovo Ideapad D330 models have a HD (800x1280) screen instead of a FHD (1200x1920) screen (both are mounted right-side-up) add a second Lenovo Ideapad D330 quirk for the HD version.
Changes in v2:
- Add a new quirk for Lenovo Ideapad D330 models with a HD screen instead of a FHD screen
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_panel_orientation_quirks.c +7 -2
@@ -211,10 +211,15 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"), }, .driver_data = (void *)&lcd800x1280_rightside_up, - }, { /* Lenovo Ideapad D330 */ + }, { /* Lenovo Ideapad D330-10IGM (HD) */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"LENOVO" ), + DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo ideapad D330-10IGM"), + }, + .driver_data = (void *)&lcd800x1280_rightside_up, + }, { /* Lenovo Ideapad D330-10IGM (FHD) */ .matches = {DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"LENOVO" ), -DMI_EXACT_MATCH (DMI_PRODUCT_NAME ,"81H3" ), DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo ideapad D330-10IGM"), }, .driver_data = (void *)&lcd1200x1920_rightside_up,
Signature · 1 line
2.33.0
Sasha Levin
maintainerPATCH 3/101 drm: panel-orientation-quirks: Add quirk for KD Kurio Smart C15200 2-in-1
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit a53f1dd3ab9fec715c6c2e8e01bf4d3c07eef8e5 ]
The KD Kurio Smart C15200 2-in-1 uses a panel which has been mounted 90 degrees rotated. Add a quirk for this.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +7 -0
@@ -193,6 +193,13 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_BOARD_NAME, "TW891"), }, .driver_data = (void *)&itworks_tw891, + }, { /* KD Kurio Smart C15200 2-in-1 */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"KD Interactive" ), +DMI_EXACT_MATCH (DMI_PRODUCT_NAME ,"Kurio Smart" ), + DMI_EXACT_MATCH(DMI_BOARD_NAME, "KDM960BCP"), + }, + .driver_data = (void *)&lcd800x1280_rightside_up, }, { /** Lenovo Ideapad Miix 310 laptop, only some production batches * have a portrait screen, the resolution checks makes the quirk
Signature · 1 line
2.33.0
Sasha Levin
maintainerPATCH 4/101 drm: panel-orientation-quirks: Add quirk for the Samsung Galaxy Book 10.6
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit 88fa1fde918951c175ae5ea0f31efc4bb1736ab9 ]
The Samsung Galaxy Book 10.6 uses a panel which has been mounted 90 degrees rotated. Add a quirk for this.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +12 -0
@@ -109,6 +109,12 @@ static const struct drm_dmi_panel_orientation_data lcd1200x1920_rightside_up = { .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, }; +static const struct drm_dmi_panel_orientation_data lcd1280x1920_rightside_up = { + .width =1280 , + .height =1920 , + .orientation =DRM_MODE_PANEL_ORIENTATION_RIGHT_UP , +}; +static const struct dmi_system_id orientation_data[] = { {/* Acer One 10 (S1003) */ .matches = {
@@ -237,6 +243,12 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Default string"), }, .driver_data = (void *)&onegx1_pro, + }, { /* Samsung GalaxyBook 10.6 */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"SAMSUNG ELECTRONICS CO., LTD." ), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Galaxy Book 10.6"), + }, + .driver_data = (void *)&lcd1280x1920_rightside_up, }, { /* VIOS LTH17 */ .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "VIOS"),
Signature · 1 line
2.33.0
Sasha Levin
maintainerPATCH 5/101 Bluetooth: sco: Fix lock_sock() blockage by memcpy_from_msg()
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit 99c23da0eed4fd20cae8243f2b51e10e66aa0951 ]
The sco_send_frame() also takes lock_sock() during memcpy_from_msg() call that may be endlessly blocked by a task with userfaultd technique, and this will result in a hung task watchdog trigger.
Just like the similar fix for hci_sock_sendmsg() in commit 92c685dc5de0 ("Bluetooth: reorganize functions..."), this patch moves the memcpy_from_msg() out of lock_sock() for addressing the hang.
This should be the last piece for fixing CVE-2021-3640 after a few already queued fixes.
--- net/bluetooth/sco.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
net/bluetooth/sco.c +16 -8
@@ -281,7 +281,8 @@ static int sco_connect(struct hci_dev *hdev, struct sock *sk)return err; } -static int sco_send_frame (struct sock *sk,struct msghdr *msg,int len) +static int sco_send_frame (struct sock *sk,void *buf,int len, +unsigned int msg_flags) {struct sco_conn *conn =sco_pi (sk)->conn;struct sk_buff *skb;
@@ -293,15 +294,11 @@ static int sco_send_frame(struct sock *sk, struct msghdr *msg, int len)BT_DBG ("sk %p len %d" , sk, len); - skb =bt_skb_send_alloc (sk, len, msg->msg_flags &MSG_DONTWAIT , &err); + skb =bt_skb_send_alloc (sk, len, msg_flags &MSG_DONTWAIT , &err);if (!skb)return err; -if (memcpy_from_msg (skb_put (skb, len), msg, len)) { -kfree_skb (skb); -return -EFAULT ; - } - +memcpy (skb_put (skb, len), buf, len);hci_send_sco (conn->hcon, skb);return len;
@@ -726,6 +723,7 @@ static int sco_sock_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) {struct sock *sk = sock->sk; +void *buf;int err;BT_DBG ("sock %p, sk %p" , sock, sk);
@@ -737,14 +735,24 @@ static int sco_sock_sendmsg(struct socket *sock, struct msghdr *msg,if (msg->msg_flags &MSG_OOB )return -EOPNOTSUPP ; + buf =kmalloc (len,GFP_KERNEL ); +if (!buf) +return -ENOMEM ; + +if (memcpy_from_msg (buf, msg, len)) { +kfree (buf); +return -EFAULT ; + } +lock_sock (sk);if (sk->sk_state ==BT_CONNECTED ) - err =sco_send_frame (sk, msg, len); + err =sco_send_frame (sk, buf, len, msg->msg_flags);else err = -ENOTCONN ;release_sock (sk); +kfree (buf);return err; }
Signature · 1 line
2.33.0
Sasha Levin
maintainerPATCH 6/101 Bluetooth: fix use-after-free error in lock_sock_nested()
In reply to Sasha LevinFrom: Wang ShaoBo <[email protected]>
[ Upstream commit 1bff51ea59a9afb67d2dd78518ab0582a54a472c ]
use-after-free error in lock_sock_nested is reported:
[ 179.140137][ T3731] ===================================================== [ 179.142675][ T3731] BUG: KMSAN: use-after-free in lock_sock_nested+0x280/0x2c0 [ 179.145494][ T3731] CPU: 4 PID: 3731 Comm: kworker/4:2 Not tainted 5.12.0-rc6+ #54 [ 179.148432][ T3731] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014 [ 179.151806][ T3731] Workqueue: events l2cap_chan_timeout [ 179.152730][ T3731] Call Trace: [ 179.153301][ T3731] dump_stack+0x24c/0x2e0 [ 179.154063][ T3731] kmsan_report+0xfb/0x1e0 [ 179.154855][ T3731] __msan_warning+0x5c/0xa0 [ 179.155579][ T3731] lock_sock_nested+0x280/0x2c0 [ 179.156436][ T3731] ? kmsan_get_metadata+0x116/0x180 [ 179.157257][ T3731] l2cap_sock_teardown_cb+0xb8/0x890 [ 179.158154][ T3731] ? __msan_metadata_ptr_for_load_8+0x10/0x20 [ 179.159141][ T3731] ? kmsan_get_metadata+0x116/0x180 [ 179.159994][ T3731] ? kmsan_get_shadow_origin_ptr+0x84/0xb0 [ 179.160959][ T3731] ? l2cap_sock_recv_cb+0x420/0x420 [ 179.161834][ T3731] l2cap_chan_del+0x3e1/0x1d50 [ 179.162608][ T3731] ? kmsan_get_metadata+0x116/0x180 [ 179.163435][ T3731] ? kmsan_get_shadow_origin_ptr+0x84/0xb0 [ 179.164406][ T3731] l2cap_chan_close+0xeea/0x1050 [ 179.165189][ T3731] ? kmsan_internal_unpoison_shadow+0x42/0x70 [ 179.166180][ T3731] l2cap_chan_timeout+0x1da/0x590 [ 179.167066][ T3731] ? __msan_metadata_ptr_for_load_8+0x10/0x20 [ 179.168023][ T3731] ? l2cap_chan_create+0x560/0x560 [ 179.168818][ T3731] process_one_work+0x121d/0x1ff0 [ 179.169598][ T3731] worker_thread+0x121b/0x2370 [ 179.170346][ T3731] kthread+0x4ef/0x610 [ 179.171010][ T3731] ? process_one_work+0x1ff0/0x1ff0 [ 179.171828][ T3731] ? kthread_blkcg+0x110/0x110 [ 179.172587][ T3731] ret_from_fork+0x1f/0x30 [ 179.173348][ T3731] [ 179.173752][ T3731] Uninit was created at: [ 179.174409][ T3731] kmsan_internal_poison_shadow+0x5c/0xf0 [ 179.175373][ T3731] kmsan_slab_free+0x76/0xc0 [ 179.176060][ T3731] kfree+0x3a5/0x1180 [ 179.176664][ T3731] __sk_destruct+0x8af/0xb80 [ 179.177375][ T3731] __sk_free+0x812/0x8c0 [ 179.178032][ T3731] sk_free+0x97/0x130 [ 179.178686][ T3731] l2cap_sock_release+0x3d5/0x4d0 [ 179.179457][ T3731] sock_close+0x150/0x450 [ 179.180117][ T3731] __fput+0x6bd/0xf00 [ 179.180787][ T3731] ____fput+0x37/0x40 [ 179.181481][ T3731] task_work_run+0x140/0x280 [ 179.182219][ T3731] do_exit+0xe51/0x3e60 [ 179.182930][ T3731] do_group_exit+0x20e/0x450 [ 179.183656][ T3731] get_signal+0x2dfb/0x38f0 [ 179.184344][ T3731] arch_do_signal_or_restart+0xaa/0xe10 [ 179.185266][ T3731] exit_to_user_mode_prepare+0x2d2/0x560 [ 179.186136][ T3731] syscall_exit_to_user_mode+0x35/0x60 [ 179.186984][ T3731] do_syscall_64+0xc5/0x140 [ 179.187681][ T3731] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 179.188604][ T3731] =====================================================
In our case, there are two Thread A and B:
Context: Thread A: Context: Thread B:
l2cap_chan_timeout() __se_sys_shutdown()
l2cap_chan_close() l2cap_sock_shutdown()
l2cap_chan_del() l2cap_chan_close()
l2cap_sock_teardown_cb() l2cap_sock_teardown_cb()
Once l2cap_sock_teardown_cb() excuted, this sock will be marked as SOCK_ZAPPED, and can be treated as killable in l2cap_sock_kill() if sock_orphan() has excuted, at this time we close sock through sock_close() which end to call l2cap_sock_kill() like Thread C:
Context: Thread C:
sock_close()
l2cap_sock_release()
sock_orphan()
l2cap_sock_kill() #free sock if refcnt is 1
If C completed, Once A or B reaches l2cap_sock_teardown_cb() again, use-after-free happened.
We should set chan->data to NULL if sock is destructed, for telling teardown operation is not allowed in l2cap_sock_teardown_cb(), and also we should avoid killing an already killed socket in l2cap_sock_close_cb().
--- net/bluetooth/l2cap_sock.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
net/bluetooth/l2cap_sock.c +9 -1
@@ -1508,6 +1508,9 @@ static void l2cap_sock_close_cb(struct l2cap_chan *chan) {struct sock *sk = chan->data; +if (!sk) +return ; +l2cap_sock_kill (sk); }
@@ -1516,6 +1519,9 @@ static void l2cap_sock_teardown_cb(struct l2cap_chan *chan, int err)struct sock *sk = chan->data;struct sock *parent; +if (!sk) +return ; +BT_DBG ("chan %p state %s" , chan,state_to_string (chan->state));/* This callback can be called both for server (BT_LISTEN)
@@ -1707,8 +1713,10 @@ static void l2cap_sock_destruct(struct sock *sk) {BT_DBG ("sk %p" , sk); -if (l2cap_pi (sk)->chan) +if (l2cap_pi (sk)->chan) { +l2cap_pi (sk)->chan->data =NULL ;l2cap_chan_put (l2cap_pi (sk)->chan); + }if (l2cap_pi (sk)->rx_busy_skb) {kfree_skb (l2cap_pi (sk)->rx_busy_skb);
Signature · 1 line
2.33.0
Sasha Levin
maintainerPATCH 7/101 drm/panel-orientation-quirks: add Valve Steam Deck
In reply to Sasha LevinFrom: Simon Ser <[email protected]>
[ Upstream commit 9eeb7b4e40bfd69d8aaa920c7e9df751c9e11dce ]
Valve's Steam Deck has a 800x1280 LCD screen.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +7 -0
@@ -249,6 +249,13 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Galaxy Book 10.6"), }, .driver_data = (void *)&lcd1280x1920_rightside_up, + }, { /* Valve Steam Deck */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"Valve" ), +DMI_EXACT_MATCH (DMI_PRODUCT_NAME ,"Jupiter" ), + DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "1"), + }, + .driver_data = (void *)&lcd800x1280_rightside_up, }, { /* VIOS LTH17 */ .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "VIOS"),
Signature · 1 line
2.33.0
Sasha Levin
maintainerPATCH 8/101 rcutorture: Avoid problematic critical section nesting on PREEMPT_RT
In reply to Sasha LevinFrom: Scott Wood <[email protected]>
[ Upstream commit 71921a9606ddbcc1d98c00eca7ae82c373d1fecd ]
rcutorture is generating some nesting scenarios that are not compatible on PREEMPT_RT. For example:
preempt_disable(); rcu_read_lock_bh(); preempt_enable(); rcu_read_unlock_bh();
The problem here is that on PREEMPT_RT the bottom halves have to be disabled and enabled in preemptible context.
Reorder locking: start with BH locking and continue with then with disabling preemption or interrupts. In the unlocking do it reverse by first enabling interrupts and preemption and BH at the very end. Ensure that on PREEMPT_RT BH locking remains unchanged if in non-preemptible context.
[bigeasy: Drop ATOM_BH, make it only about changing BH in atomic context. Allow enabling RCU in IRQ-off section. Reword commit message.]
--- kernel/rcu/rcutorture.c | 48 ++++++++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 12 deletions(-)
kernel/rcu/rcutorture.c +36 -12
@@ -1238,28 +1238,34 @@ static void rcutorture_one_extend(int *readstate, int newstate,/* First, put new protection in place to avoid critical-section gap. */ if (statesnew &RCUTORTURE_RDR_BH )local_bh_disable (); +if (statesnew &RCUTORTURE_RDR_RBH ) +rcu_read_lock_bh ();if (statesnew &RCUTORTURE_RDR_IRQ )local_irq_disable ();if (statesnew &RCUTORTURE_RDR_PREEMPT )preempt_disable (); -if (statesnew &RCUTORTURE_RDR_RBH ) -rcu_read_lock_bh ();if (statesnew &RCUTORTURE_RDR_SCHED )rcu_read_lock_sched ();if (statesnew &RCUTORTURE_RDR_RCU ) idxnew = cur_ops->readlock () <<RCUTORTURE_RDR_SHIFT ; -/* Next, remove old protection, irq first due to bh conflict. */ +/* +* Next, remove old protection, in decreasing order of strength +* to avoid unlock paths that aren't safe in the stronger +* context. Namely: BH can not be enabled with disabled interrupts. +* Additionally PREEMPT_RT requires that BH is enabled in preemptible +* context. +*/ if (statesold &RCUTORTURE_RDR_IRQ )local_irq_enable (); -if (statesold &RCUTORTURE_RDR_BH ) -local_bh_enable ();if (statesold &RCUTORTURE_RDR_PREEMPT )preempt_enable (); -if (statesold &RCUTORTURE_RDR_RBH ) -rcu_read_unlock_bh ();if (statesold &RCUTORTURE_RDR_SCHED )rcu_read_unlock_sched (); +if (statesold &RCUTORTURE_RDR_BH ) +local_bh_enable (); +if (statesold &RCUTORTURE_RDR_RBH ) +rcu_read_unlock_bh ();if (statesold &RCUTORTURE_RDR_RCU ) {bool lockit = !statesnew && !(torture_random (trsp) &0xffff );
@@ -1302,6 +1308,9 @@ rcutorture_extend_mask(int oldmask, struct torture_random_state *trsp)int mask =rcutorture_extend_mask_max ();unsigned long randmask1 =torture_random (trsp) >>8 ;unsigned long randmask2 = randmask1 >>3 ; +unsigned long preempts =RCUTORTURE_RDR_PREEMPT |RCUTORTURE_RDR_SCHED ; +unsigned long preempts_irq = preempts |RCUTORTURE_RDR_IRQ ; +unsigned long bhs =RCUTORTURE_RDR_BH |RCUTORTURE_RDR_RBH ;WARN_ON_ONCE (mask >>RCUTORTURE_RDR_SHIFT );/* Mostly only one bit (need preemption!), sometimes lots of bits. */
@@ -1309,11 +1318,26 @@ rcutorture_extend_mask(int oldmask, struct torture_random_state *trsp) mask = mask & randmask2; else mask = mask & (1 << (randmask2 %RCUTORTURE_RDR_NBITS )); -/* Can't enable bh w/irq disabled. */ -if ((mask &RCUTORTURE_RDR_IRQ ) && - ((!(mask &RCUTORTURE_RDR_BH ) && (oldmask &RCUTORTURE_RDR_BH )) || - (!(mask &RCUTORTURE_RDR_RBH ) && (oldmask &RCUTORTURE_RDR_RBH )))) - mask |=RCUTORTURE_RDR_BH |RCUTORTURE_RDR_RBH ; + +/* +* Can't enable bh w/irq disabled. +*/ +if (mask &RCUTORTURE_RDR_IRQ ) + mask |= oldmask & bhs; + +/* +* Ideally these sequences would be detected in debug builds +* (regardless of RT), but until then don't stop testing +* them on non-RT. +*/ +if (IS_ENABLED (CONFIG_PREEMPT_RT )) { +/* Can't modify BH in atomic context */ +if (oldmask & preempts_irq) + mask &= ~bhs; +if ((oldmask | mask) & preempts_irq) + mask |= oldmask & bhs; + } +return mask ?:RCUTORTURE_RDR_RCU ; }
Signature · 1 line
2.33.0
Sasha Levin
maintainerPATCH 9/101 platform/x86: wmi: do not fail if disabling fails
In reply to Sasha LevinFrom: Barnabás Pőcze <[email protected]>
[ Upstream commit 1975718c488a39128f1f515b23ae61a5a214cc3d ]
Previously, __query_block() would fail if the second WCxx method call failed. However, the WQxx method might have succeeded, and potentially allocated memory for the result. Instead of throwing away the result and potentially leaking memory, ignore the result of
the second WCxx call.
--- drivers/platform/x86/wmi.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/platform/x86/wmi.c +8 -1
@@ -354,7 +354,14 @@ static acpi_status __query_block(struct wmi_block *wblock, u8 instance,* the WQxx method failed - we should disable collection anyway. */ if ((block->flags &ACPI_WMI_EXPENSIVE ) &&ACPI_SUCCESS (wc_status)) { - status =acpi_execute_simple_method (handle, wc_method,0 ); +/* +* Ignore whether this WCxx call succeeds or not since +* the previously executed WQxx method call might have +* succeeded, and returning the failing status code +* of this call would throw away the result of the WQxx +* call, potentially leaking memory. +*/ +acpi_execute_simple_method (handle, wc_method,0 ); }return status;
Signature · 1 line
2.33.0
Sasha Levin
maintainerPATCH 10/101 MIPS: lantiq: dma: add small delay after reset
In reply to Sasha LevinFrom: Aleksander Jan Bajkowski <[email protected]>
[ Upstream commit c12aa581f6d5e80c3c3675ab26a52c2b3b62f76e ]
Reading the DMA registers immediately after the reset causes Data Bus Error. Adding a small delay fixes this issue.
--- arch/mips/lantiq/xway/dma.c | 3 +++ 1 file changed, 3 insertions(+)
arch/mips/lantiq/xway/dma.c +3 -0
@@ -11,6 +11,7 @@#include <linux/export.h> #include <linux/spinlock.h> #include <linux/clk.h> +#include <linux/delay.h> #include <linux/err.h> #include <lantiq_soc.h>
@@ -221,6 +222,8 @@ ltq_dma_init(struct platform_device *pdev)clk_enable (clk);ltq_dma_w32_mask (0 ,DMA_RESET ,LTQ_DMA_CTRL ); +usleep_range (1 ,10 ); +/* disable all interrupts */ ltq_dma_w32 (0 ,LTQ_DMA_IRNEN );
Signature · 1 line
2.33.0
Sasha Levin
maintainerPATCH 11/101 MIPS: lantiq: dma: reset correct number of channel
In reply to Sasha LevinFrom: Aleksander Jan Bajkowski <[email protected]>
[ Upstream commit 5ca9ce2ba4d5884cd94d1a856c675ab1242cd242 ]
Different SoCs have a different number of channels, e.g .:
* amazon-se has 10 channels,
* danube+ar9 have 20 channels,
* vr9 has 28 channels,
* ar10 has 24 channels.
We can read the ID register and, depending on the reported number of channels, reset the appropriate number of channels.
--- arch/mips/lantiq/xway/dma.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
arch/mips/lantiq/xway/dma.c +6 -5
@@ -30,6 +30,7 @@#define LTQ_DMA_PCTRL 0x44#define LTQ_DMA_IRNEN 0xf4 +#define DMA_ID_CHNR GENMASK(26, 20)/* channel number */ #define DMA_DESCPT BIT(3)/* descriptor complete irq */ #define DMA_TX BIT(8)/* TX channel direction */ #define DMA_CHAN_ON BIT(0)/* channel on / off bit */
@@ -40,7 +41,6 @@#define DMA_POLL BIT(31)/* turn on channel polling */ #define DMA_CLK_DIV4 BIT(6)/* polling clock divider */ #define DMA_2W_BURST BIT(1)/* 2 word burst length */ -#define DMA_MAX_CHANNEL 20/* the soc has 20 channels */ #define DMA_ETOP_ENDIANNESS (0xf << 8)/* endianness swap etop channels */ #define DMA_WEIGHT (BIT(17) | BIT(16))/* default channel wheight */
@@ -206,7 +206,7 @@ ltq_dma_init(struct platform_device *pdev) {struct clk *clk;struct resource *res; -unsigned id; +unsigned int id, nchannels;int i; res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );
@@ -228,17 +228,18 @@ ltq_dma_init(struct platform_device *pdev)ltq_dma_w32 (0 ,LTQ_DMA_IRNEN );/* reset/configure each channel */ -for (i =0 ; i <DMA_MAX_CHANNEL ; i++) { + id =ltq_dma_r32 (LTQ_DMA_ID ); + nchannels = ((id &DMA_ID_CHNR ) >>20 ); +for (i =0 ; i < nchannels; i++) {ltq_dma_w32 (i,LTQ_DMA_CS );ltq_dma_w32 (DMA_CHAN_RST ,LTQ_DMA_CCTRL );ltq_dma_w32 (DMA_POLL |DMA_CLK_DIV4 ,LTQ_DMA_CPOLL );ltq_dma_w32_mask (DMA_CHAN_ON ,0 ,LTQ_DMA_CCTRL ); } - id =ltq_dma_r32 (LTQ_DMA_ID );dev_info (&pdev->dev,"Init done - hw rev: %X, ports: %d, channels: %d\n" , - id &0x1f , (id >>16 ) &0xf , id >>20 ); + id &0x1f , (id >>16 ) &0xf , nchannels);return 0 ; }
Signature · 1 line
2.33.0
Sasha Levin
maintainerPATCH 12/101 locking/lockdep: Avoid RCU-induced noinstr fail
In reply to Sasha LevinFrom: Peter Zijlstra <[email protected]>
[ Upstream commit ce0b9c805dd66d5e49fd53ec5415ae398f4c56e6 ]
vmlinux.o: warning: objtool: look_up_lock_class()+0xc7: call to rcu_read_lock_any_held() leaves .noinstr.text section
--- kernel/locking/lockdep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/locking/lockdep.c +1 -1
@@ -887,7 +887,7 @@ look_up_lock_class(const struct lockdep_map *lock, unsigned int subclass)if (DEBUG_LOCKS_WARN_ON (!irqs_disabled ()))return NULL ; -hlist_for_each_entry_rcu (class, hash_head, hash_entry) { +hlist_for_each_entry_rcu_notrace (class, hash_head, hash_entry) {if (class->key == key) {/* * Huh! same key, different name? Did someone trample
Signature · 1 line
2.33.0
Sasha Levin
maintainerPATCH 13/101 net: sched: update default qdisc visibility after Tx queue cnt changes
In reply to Sasha LevinFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 1e080f17750d1083e8a32f7b350584ae1cd7ff20 ]
mq / mqprio make the default child qdiscs visible. They only do so for the qdiscs which are within real_num_tx_queues when the device is registered. Depending on order of calls in the driver, or if user space changes config via ethtool -L the number of qdiscs visible under tc qdisc show will differ from the number of queues. This is confusing to users and potentially to system configuration scripts which try to make sure qdiscs have the right parameters.
Add a new Qdisc_ops callback and make relevant qdiscs TTRT.
Note that this uncovers the "shortcut" created by
commit 1f27cde313d7 ("net: sched: use pfifo_fast for non real queues") The default child qdiscs beyond initial real_num_tx are always pfifo_fast, no matter what the sysfs setting is. Fixing this gets a little tricky because we'd need to keep a reference on whatever the default qdisc was at the time of creation. In practice this is likely an non-issue the qdiscs likely have to be configured to non-default settings, so whatever user space is doing such configuration can replace the pfifos... now that it will see them.
--- include/net/sch_generic.h | 4 ++++ net/core/dev.c | 2 ++ net/sched/sch_generic.c | 9 +++++++++ net/sched/sch_mq.c | 24 ++++++++++++++++++++++++ net/sched/sch_mqprio.c | 23 +++++++++++++++++++++++ 5 files changed, 62 insertions(+)
include/net/sch_generic.h +4 -0
@@ -302,6 +302,8 @@ struct Qdisc_ops { struct netlink_ext_ack *extack);void (*attach)(struct Qdisc *sch);int (*change_tx_queue_len)(struct Qdisc *,unsigned int ); +void (*change_real_num_tx)(struct Qdisc *sch, +unsigned int new_real_tx);int (*dump)(struct Qdisc *,struct sk_buff *);int (*dump_stats)(struct Qdisc *,struct gnet_dump *);
@@ -683,6 +685,8 @@ void qdisc_class_hash_grow(struct Qdisc *, struct Qdisc_class_hash *);void qdisc_class_hash_destroy (struct Qdisc_class_hash *);int dev_qdisc_change_tx_queue_len (struct net_device *dev); +void dev_qdisc_change_real_num_tx (struct net_device *dev, +unsigned int new_real_tx);void dev_init_scheduler (struct net_device *dev);void dev_shutdown (struct net_device *dev);void dev_activate (struct net_device *dev);
net/core/dev.c +2 -0
@@ -2973,6 +2973,8 @@ int netif_set_real_num_tx_queues(struct net_device *dev, unsigned int txq)if (dev->num_tc)netif_setup_tc (dev, txq); +dev_qdisc_change_real_num_tx (dev, txq); + dev->real_num_tx_queues = txq;if (disabling) {
net/sched/sch_generic.c +9 -0
@@ -1303,6 +1303,15 @@ static int qdisc_change_tx_queue_len(struct net_device *dev,return 0 ; } +void dev_qdisc_change_real_num_tx (struct net_device *dev, +unsigned int new_real_tx) +{ +struct Qdisc *qdisc = dev->qdisc; + +if (qdisc->ops->change_real_num_tx) + qdisc->ops->change_real_num_tx (qdisc, new_real_tx); +} +int dev_qdisc_change_tx_queue_len (struct net_device *dev) {bool up = dev->flags &IFF_UP ;
net/sched/sch_mq.c +24 -0
@@ -125,6 +125,29 @@ static void mq_attach(struct Qdisc *sch) priv->qdiscs =NULL ; } +static void mq_change_real_num_tx (struct Qdisc *sch,unsigned int new_real_tx) +{ +#ifdef CONFIG_NET_SCHED +struct net_device *dev =qdisc_dev (sch); +struct Qdisc *qdisc; +unsigned int i; + +for (i = new_real_tx; i < dev->real_num_tx_queues; i++) { + qdisc =netdev_get_tx_queue (dev, i)->qdisc_sleeping; +/* Only update the default qdiscs we created, +* qdiscs with handles are always hashed. +*/ +if (qdisc != &noop_qdisc && !qdisc->handle) +qdisc_hash_del (qdisc); + } +for (i = dev->real_num_tx_queues; i < new_real_tx; i++) { + qdisc =netdev_get_tx_queue (dev, i)->qdisc_sleeping; +if (qdisc != &noop_qdisc && !qdisc->handle) +qdisc_hash_add (qdisc, false); + } +#endif +} +static int mq_dump (struct Qdisc *sch,struct sk_buff *skb) {struct net_device *dev =qdisc_dev (sch);
@@ -288,6 +311,7 @@ struct Qdisc_ops mq_qdisc_ops __read_mostly = { .init = mq_init, .destroy = mq_destroy, .attach = mq_attach, + .change_real_num_tx = mq_change_real_num_tx, .dump = mq_dump, .owner = THIS_MODULE, };
net/sched/sch_mqprio.c +23 -0
@@ -306,6 +306,28 @@ static void mqprio_attach(struct Qdisc *sch) priv->qdiscs =NULL ; } +static void mqprio_change_real_num_tx (struct Qdisc *sch, +unsigned int new_real_tx) +{ +struct net_device *dev =qdisc_dev (sch); +struct Qdisc *qdisc; +unsigned int i; + +for (i = new_real_tx; i < dev->real_num_tx_queues; i++) { + qdisc =netdev_get_tx_queue (dev, i)->qdisc_sleeping; +/* Only update the default qdiscs we created, +* qdiscs with handles are always hashed. +*/ +if (qdisc != &noop_qdisc && !qdisc->handle) +qdisc_hash_del (qdisc); + } +for (i = dev->real_num_tx_queues; i < new_real_tx; i++) { + qdisc =netdev_get_tx_queue (dev, i)->qdisc_sleeping; +if (qdisc != &noop_qdisc && !qdisc->handle) +qdisc_hash_add (qdisc, false); + } +} +static struct netdev_queue *mqprio_queue_get (struct Qdisc *sch,unsigned long cl) {
@@ -629,6 +651,7 @@ static struct Qdisc_ops mqprio_qdisc_ops __read_mostly = { .init = mqprio_init, .destroy = mqprio_destroy, .attach = mqprio_attach, + .change_real_num_tx = mqprio_change_real_num_tx, .dump = mqprio_dump, .owner = THIS_MODULE, };
Signature · 1 line
2.33.0
Sasha Levin
maintainerPATCH 14/101 rcu-tasks: Move RTGS_WAIT_CBS to beginning of rcu_tasks_kthread() loop
In reply to Sasha LevinFrom: "Paul E. McKenney" <[email protected]>
[ Upstream commit 0db7c32ad3160ae06f497d48a74bd46a2a35e6bf ]
Early in debugging, it made some sense to differentiate the first iteration from subsequent iterations, but now this just causes confusion. This commit therefore moves the "set_tasks_gp_state(rtp, RTGS_WAIT_CBS)" statement to the beginning of the "for" loop in rcu_tasks_kthread().
--- kernel/rcu/tasks.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/rcu/tasks.h +1 -2
@@ -197,6 +197,7 @@ static int __noreturn rcu_tasks_kthread(void *arg)* This loop is terminated by the system going down. ;-) */ for (;;) { +set_tasks_gp_state (rtp,RTGS_WAIT_CBS );/* Pick up any new callbacks. */ raw_spin_lock_irqsave (&rtp->cbs_lock, flags);
@@ -236,8 +237,6 @@ static int __noreturn rcu_tasks_kthread(void *arg) }/* Paranoid sleep to keep this from entering a tight loop */ schedule_timeout_idle (rtp->gp_sleep); - -set_tasks_gp_state (rtp,RTGS_WAIT_CBS ); } }
Signature · 1 line
2.33.0
Sasha Levin
maintainerPATCH 15/101 smackfs: Fix use-after-free in netlbl_catmap_walk()
In reply to Sasha LevinFrom: Pawan Gupta <[email protected]>
[ Upstream commit 0817534ff9ea809fac1322c5c8c574be8483ea57 ]
Syzkaller reported use-after-free bug as described in [1]. The bug is triggered when smk_set_cipso() tries to free stale category bitmaps while there are concurrent reader(s) using the same bitmaps.
Wait for RCU grace period to finish before freeing the category bitmaps in smk_set_cipso(). This makes sure that there are no more readers using the stale bitmaps and freeing them should be safe.
[1] https://lore.kernel.org/netdev/[email protected]/
--- security/smack/smackfs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
security/smack/smackfs.c +4 -1
@@ -831,6 +831,7 @@ static int smk_open_cipso(struct inode *inode, struct file *file)static ssize_t smk_set_cipso (struct file *file,const char __user *buf,size_t count,loff_t *ppos,int format) { +struct netlbl_lsm_catmap *old_cat;struct smack_known *skp;struct netlbl_lsm_secattr ncats;char mapcatset[SMK_CIPSOLEN ];
@@ -920,9 +921,11 @@ static ssize_t smk_set_cipso(struct file *file, const char __user *buf, rc =smk_netlbl_mls (maplevel, mapcatset, &ncats,SMK_CIPSOLEN );if (rc >=0 ) { -netlbl_catmap_free (skp->smk_netlabel.attr.mls.cat); + old_cat = skp->smk_netlabel.attr.mls.cat; skp->smk_netlabel.attr.mls.cat = ncats.attr.mls.cat; skp->smk_netlabel.attr.mls.lvl = ncats.attr.mls.lvl; +synchronize_rcu (); +netlbl_catmap_free (old_cat); rc = count;/* * This mapping may have been cached, so clear the cache.
Signature · 1 line
2.33.0
Sasha Levin
maintainerPATCH 16/101 ath11k: Align bss_chan_info structure with firmware
In reply to Sasha LevinFrom: Seevalamuthu Mariappan <[email protected]>
[ Upstream commit feab5bb8f1d4621025dceae7eef62d5f92de34ac ]
pdev_id in structure 'wmi_pdev_bss_chan_info_event' is wrongly placed at the beginning. This causes invalid values in survey dump. Hence, align the structure with the firmware.
Note: The firmware releases follow this order since the feature was implemented. Also, it is not changing across the branches including QCA6390.
Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.1.0.1-01228-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath11k/wmi.c | 1 + drivers/net/wireless/ath/ath11k/wmi.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath11k/wmi.c +1 -0
@@ -1333,6 +1333,7 @@ int ath11k_wmi_pdev_bss_chan_info_request(struct ath11k *ar, WMI_TAG_PDEV_BSS_CHAN_INFO_REQUEST) |FIELD_PREP (WMI_TLV_LEN ,sizeof (*cmd) -TLV_HDR_SIZE ); cmd->req_type = type; + cmd->pdev_id = ar->pdev->pdev_id;ath11k_dbg (ar->ab,ATH11K_DBG_WMI ,"WMI bss chan info req type %d\n" , type);
drivers/net/wireless/ath/ath11k/wmi.h +2 -1
@@ -2935,6 +2935,7 @@ struct wmi_pdev_bss_chan_info_req_cmd {u32 tlv_header;/* ref wmi_bss_chan_info_req_type */ u32 req_type; +u32 pdev_id; } __packed;struct wmi_ap_ps_peer_cmd {
@@ -4028,7 +4029,6 @@ struct wmi_vdev_stopped_event { } __packed;struct wmi_pdev_bss_chan_info_event { -u32 pdev_id;u32 freq;/* Units in MHz */ u32 noise_floor;/* units are dBm */ /* rx clear - how often the channel was unused */
@@ -4046,6 +4046,7 @@ struct wmi_pdev_bss_chan_info_event {/*rx_cycle cnt for my bss in 64bits format */ u32 rx_bss_cycle_count_low;u32 rx_bss_cycle_count_high; +u32 pdev_id; } __packed;#define WMI_VDEV_INSTALL_KEY_COMPL_STATUS_SUCCESS 0
Signature · 1 line
2.33.0
Sasha Levin
maintainerPATCH 17/101 NET: IPV4: fix error "do not initialise globals to 0"
In reply to Sasha LevinFrom: wangzhitong <[email protected]>
[ Upstream commit db9c8e2b1e246fc2dc20828932949437793146cc ]
this patch fixes below Errors reported by checkpatch
ERROR: do not initialise globals to 0 +int cipso_v4_rbm_optfmt = 0;
--- net/ipv4/cipso_ipv4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/cipso_ipv4.c +1 -1
@@ -73,7 +73,7 @@ struct cipso_v4_map_cache_entry {static struct cipso_v4_map_cache_bkt *cipso_v4_cache;/* Restricted bitmap (tag #1) flags */ -int cipso_v4_rbm_optfmt =0 ; +int cipso_v4_rbm_optfmt;int cipso_v4_rbm_strictvalid =1 ;/*
Signature · 1 line
2.33.0
Sasha Levin
maintainerPATCH 18/101 x86: Increase exception stack sizes
In reply to Sasha LevinFrom: Peter Zijlstra <[email protected]>
[ Upstream commit 7fae4c24a2b84a66c7be399727aca11e7a888462 ]
It turns out that a single page of stack is trivial to overflow with all the tracing gunk enabled. Raise the exception stacks to 2 pages, which is still half the interrupt stacks, which are at 4 pages.
--- arch/x86/include/asm/page_64_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/page_64_types.h +1 -1
@@ -15,7 +15,7 @@#define THREAD_SIZE_ORDER (2 + KASAN_STACK_ORDER)#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER) -#define EXCEPTION_STACK_ORDER (0 + KASAN_STACK_ORDER) +#define EXCEPTION_STACK_ORDER (1 + KASAN_STACK_ORDER)#define EXCEPTION_STKSZ (PAGE_SIZE << EXCEPTION_STACK_ORDER)#define IRQ_STACK_ORDER (2 + KASAN_STACK_ORDER)
Signature · 1 line
2.33.0
Sasha Levin
maintainerPATCH 19/101 mwifiex: Run SET_BSS_MODE when changing from P2P to STATION vif-type
In reply to Sasha LevinFrom: Jonas Dreßler <[email protected]>
[ Upstream commit c2e9666cdffd347460a2b17988db4cfaf2a68fb9 ]
We currently handle changing from the P2P to the STATION virtual interface type slightly different than changing from P2P to ADHOC: When changing to STATION, we don't send the SET_BSS_MODE command. We do send that command on all other type-changes though, and it probably makes sense to send the command since after all we just changed our BSS_MODE. Looking at prior changes to this part of the code, it seems that this is simply a leftover from old refactorings.
Since sending the SET_BSS_MODE command is the only difference between mwifiex_change_vif_to_sta_adhoc() and the current code, we can now use mwifiex_change_vif_to_sta_adhoc() for both switching to ADHOC and STATION interface type.
This does not fix any particular bug and just "looked right", so there's a small chance it might be a regression.
--- .../net/wireless/marvell/mwifiex/cfg80211.c | 22 ++++--------------- 1 file changed, 4 insertions(+), 18 deletions(-)
drivers/net/wireless/marvell/mwifiex/cfg80211.c +4 -18
@@ -1229,29 +1229,15 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy,break ;case NL80211_IFTYPE_P2P_CLIENT :case NL80211_IFTYPE_P2P_GO : +if (mwifiex_cfg80211_deinit_p2p (priv)) +return -EFAULT ; +switch (type) { -case NL80211_IFTYPE_STATION : -if (mwifiex_cfg80211_deinit_p2p (priv)) -return -EFAULT ; - priv->adapter->curr_iface_comb.p2p_intf--; - priv->adapter->curr_iface_comb.sta_intf++; - dev->ieee80211_ptr->iftype = type; -if (mwifiex_deinit_priv_params (priv)) -return -1 ; -if (mwifiex_init_new_priv_params (priv, dev, type)) -return -1 ; -if (mwifiex_sta_init_cmd (priv, false, false)) -return -1 ; -break ;case NL80211_IFTYPE_ADHOC : -if (mwifiex_cfg80211_deinit_p2p (priv)) -return -EFAULT ; +case NL80211_IFTYPE_STATION :return mwifiex_change_vif_to_sta_adhoc (dev, curr_iftype, type, params); -break ;case NL80211_IFTYPE_AP : -if (mwifiex_cfg80211_deinit_p2p (priv)) -return -EFAULT ;return mwifiex_change_vif_to_ap (dev, curr_iftype, type, params);case NL80211_IFTYPE_UNSPECIFIED :
Signature · 1 line
2.33.0
Sasha Levin
maintainerPATCH 20/101 mwifiex: Properly initialize private structure on interface type changes
In reply to Sasha LevinFrom: Jonas Dreßler <[email protected]>
[ Upstream commit c606008b70627a2fc485732a53cc22f0f66d0981 ]
When creating a new virtual interface in mwifiex_add_virtual_intf(), we update our internal driver states like bss_type, bss_priority, bss_role and bss_mode to reflect the mode the firmware will be set to.
When switching virtual interface mode using mwifiex_init_new_priv_params() though, we currently only update bss_mode and bss_role. In order for the interface mode switch to actually work, we also need to update bss_type to its proper value, so do that.
This fixes a crash of the firmware (because the driver tries to execute commands that are invalid in AP mode) when switching from station mode to AP mode.
--- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/wireless/marvell/mwifiex/cfg80211.c +7 -3
@@ -908,16 +908,20 @@ mwifiex_init_new_priv_params(struct mwifiex_private *priv,switch (type) {case NL80211_IFTYPE_STATION :case NL80211_IFTYPE_ADHOC : - priv->bss_role =MWIFIEX_BSS_ROLE_STA ; + priv->bss_role =MWIFIEX_BSS_ROLE_STA ; + priv->bss_type =MWIFIEX_BSS_TYPE_STA ;break ;case NL80211_IFTYPE_P2P_CLIENT : - priv->bss_role =MWIFIEX_BSS_ROLE_STA ; + priv->bss_role =MWIFIEX_BSS_ROLE_STA ; + priv->bss_type =MWIFIEX_BSS_TYPE_P2P ;break ;case NL80211_IFTYPE_P2P_GO : - priv->bss_role =MWIFIEX_BSS_ROLE_UAP ; + priv->bss_role =MWIFIEX_BSS_ROLE_UAP ; + priv->bss_type =MWIFIEX_BSS_TYPE_P2P ;break ;case NL80211_IFTYPE_AP : priv->bss_role =MWIFIEX_BSS_ROLE_UAP ; + priv->bss_type =MWIFIEX_BSS_TYPE_UAP ;break ;default : mwifiex_dbg(adapter, ERROR,
Signature · 1 line
2.33.0
Sasha Levin
maintainerPATCH 21/101 fscrypt: allow 256-bit master keys with AES-256-XTS
In reply to Sasha LevinFrom: Eric Biggers <[email protected]>
[ Upstream commit 7f595d6a6cdc336834552069a2e0a4f6d4756ddf ]
fscrypt currently requires a 512-bit master key when AES-256-XTS is used, since AES-256-XTS keys are 512-bit and fscrypt requires that the master key be at least as long any key that will be derived from it.
However, this is overly strict because AES-256-XTS doesn't actually have a 512-bit security strength, but rather 256-bit. The fact that XTS takes twice the expected key size is a quirk of the XTS mode. It is sufficient to use 256 bits of entropy for AES-256-XTS, provided that it is first properly expanded into a 512-bit key, which HKDF-SHA512 does.
Therefore, relax the check of the master key size to use the security strength of the derived key rather than the size of the derived key (except for v1 encryption policies, which don't use HKDF).
Besides making things more flexible for userspace, this is needed in order for the use of a KDF which only takes a 256-bit key to be introduced into the fscrypt key hierarchy. This will happen with hardware-wrapped keys support, as all known hardware which supports that feature uses an SP800-108 KDF using AES-256-CMAC, so the wrapped keys are wrapped 256-bit AES keys. Moreover, there is interest in fscrypt supporting the same type of AES-256-CMAC based KDF in software as an alternative to HKDF-SHA512. There is no security problem with such features, so fix the key length check to work properly with them.
--- Documentation/filesystems/fscrypt.rst | 10 ++--- fs/crypto/fscrypt_private.h | 5 ++- fs/crypto/hkdf.c | 11 ++++-- fs/crypto/keysetup.c | 57 +++++++++++++++++++++------ 4 files changed, 61 insertions(+), 22 deletions(-)
Documentation/filesystems/fscrypt.rst +5 -5
@@ -176,11 +176,11 @@ Master Keys Each encrypted directory tree is protected by a *master key*. Master keys can be up to 64 bytes long, and must be at least as long as the -greater of the key length needed by the contents and filenames -encryption modes being used. For example, if AES-256-XTS is used for -contents encryption, the master key must be 64 bytes (512 bits). Note -that the XTS mode is defined to require a key twice as long as that -required by the underlying block cipher. +greater of the security strength of the contents and filenames +encryption modes being used. For example, if any AES-256 mode is +used, the master key must be at least 256 bits, i.e. 32 bytes. A +stricter requirement applies if the key is used by a v1 encryption +policy and AES-256-XTS is used; such keys must be 64 bytes. To "unlock" an encrypted directory tree, userspace must provide the appropriate master key. There can be any number of master keys, each
fs/crypto/fscrypt_private.h +3 -2
@@ -557,8 +557,9 @@ int __init fscrypt_init_keyring(void);struct fscrypt_mode {const char *friendly_name;const char *cipher_str; -int keysize; -int ivsize; +int keysize;/* key size in bytes */ +int security_strength;/* security strength in bytes */ +int ivsize;/* IV size in bytes */ int logged_impl_name;enum blk_crypto_mode_num blk_crypto_mode; };
fs/crypto/hkdf.c +8 -3
@@ -16,9 +16,14 @@/* * HKDF supports any unkeyed cryptographic hash algorithm, but fscrypt uses -* SHA-512 because it is reasonably secure and efficient; and since it produces -* a 64-byte digest, deriving an AES-256-XTS key preserves all 64 bytes of -* entropy from the master key and requires only one iteration of HKDF-Expand. +* SHA-512 because it is well-established, secure, and reasonably efficient. +* +* HKDF-SHA256 was also considered, as its 256-bit security strength would be +* sufficient here. A 512-bit security strength is "nice to have", though. +* Also, on 64-bit CPUs, SHA-512 is usually just as fast as SHA-256. In the +* common case of deriving an AES-256-XTS key (512 bits), that can result in +* HKDF-SHA512 being much faster than HKDF-SHA256, as the longer digest size of +* SHA-512 causes HKDF-Expand to only need to do one iteration rather than two. */ #define HKDF_HMAC_ALG "hmac(sha512)"#define HKDF_HASHLEN SHA512_DIGEST_SIZE
fs/crypto/keysetup.c +45 -12
99 lines not on this page · raw message
Signature · 1 line
2.33.0
Eric Biggers
maintainerRe: [PATCH AUTOSEL 5.10 021/101] fscrypt: allow 256-bit master keys with AES-256-XTS
Quoted 28 lines · Sasha Levin
From: Eric Biggers <[email protected]>
[ Upstream commit
7f595d6a6cdc336834552069a2e0a4f6d4756ddf]fscrypt currently requires a 512-bit master key when AES-256-XTS is used, since AES-256-XTS keys are 512-bit and fscrypt requires that the master key be at least as long any key that will be derived from it.
However, this is overly strict because AES-256-XTS doesn't actually have a 512-bit security strength, but rather 256-bit. The fact that XTS takes twice the expected key size is a quirk of the XTS mode. It is sufficient to use 256 bits of entropy for AES-256-XTS, provided that it is first properly expanded into a 512-bit key, which HKDF-SHA512 does.
Therefore, relax the check of the master key size to use the security strength of the derived key rather than the size of the derived key (except for v1 encryption policies, which don't use HKDF).
Besides making things more flexible for userspace, this is needed in order for the use of a KDF which only takes a 256-bit key to be introduced into the fscrypt key hierarchy. This will happen with hardware-wrapped keys support, as all known hardware which supports that feature uses an SP800-108 KDF using AES-256-CMAC, so the wrapped keys are wrapped 256-bit AES keys. Moreover, there is interest in fscrypt supporting the same type of AES-256-CMAC based KDF in software as an alternative to HKDF-SHA512. There is no security problem with such features, so fix the key length check to work properly with them.
Quoted 4 lines
Reviewed-by Paul Crowley <[email protected]>Signed-off-by Eric Biggers <[email protected]>Signed-off-by Sasha Levin <[email protected]>
I don't expect any problem with backporting this, but I don't see how this follows the stable kernel rules (Documentation/process/stable-kernel-rules.rst). I don't see what distinguishes this patch from ones that don't get picked up by AUTOSEL; it seems pretty arbitrary to me.
- Eric
Sasha Levin
maintainerRe: [PATCH AUTOSEL 5.10 021/101] fscrypt: allow 256-bit master keys with AES-256-XTS
Quoted 34 lines · Eric Biggers
Quoted 28 lines · Sasha Levin
From: Eric Biggers <[email protected]>
[ Upstream commit
7f595d6a6cdc336834552069a2e0a4f6d4756ddf]fscrypt currently requires a 512-bit master key when AES-256-XTS is used, since AES-256-XTS keys are 512-bit and fscrypt requires that the master key be at least as long any key that will be derived from it.
However, this is overly strict because AES-256-XTS doesn't actually have a 512-bit security strength, but rather 256-bit. The fact that XTS takes twice the expected key size is a quirk of the XTS mode. It is sufficient to use 256 bits of entropy for AES-256-XTS, provided that it is first properly expanded into a 512-bit key, which HKDF-SHA512 does.
Therefore, relax the check of the master key size to use the security strength of the derived key rather than the size of the derived key (except for v1 encryption policies, which don't use HKDF).
Besides making things more flexible for userspace, this is needed in order for the use of a KDF which only takes a 256-bit key to be introduced into the fscrypt key hierarchy. This will happen with hardware-wrapped keys support, as all known hardware which supports that feature uses an SP800-108 KDF using AES-256-CMAC, so the wrapped keys are wrapped 256-bit AES keys. Moreover, there is interest in fscrypt supporting the same type of AES-256-CMAC based KDF in software as an alternative to HKDF-SHA512. There is no security problem with such features, so fix the key length check to work properly with them.
Quoted 4 lines
Reviewed-by Paul Crowley <[email protected]>Signed-off-by Eric Biggers <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Quoted 4 lines
I don't expect any problem with backporting this, but I don't see how this follows the stable kernel rules (
Documentation/process/stable-kernel-rules.rst). I don't see what distinguishes this patch from ones that don't get picked up by AUTOSEL; it seems pretty arbitrary to me.
It is, to some extent. My understanding was that this is a minor fix to make something that should have worked, work.
Signature · 2 lines
Thanks, Sasha
Sasha Levin
maintainerPATCH 22/101 drm/amdgpu: Fix MMIO access page fault
In reply to Sasha LevinFrom: Andrey Grodzovsky <[email protected]>
[ Upstream commit c03509cbc01559549700e14c4a6239f2572ab4ba ]
Add more guards to MMIO access post device
unbind/unplug
--- drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c | 8 ++++++-- drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c | 17 +++++++++++------ 2 files changed, 17 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +6 -2
@@ -22,6 +22,7 @@*/ #include <linux/firmware.h> +#include <drm/drm_drv.h> #include "amdgpu.h" #include "amdgpu_vcn.h"
@@ -192,11 +193,14 @@ static int vcn_v2_0_sw_init(void *handle)*/ static int vcn_v2_0_sw_fini (void *handle) { -int r; +int r, idx;struct amdgpu_device *adev = (struct amdgpu_device *)handle;volatile struct amdgpu_fw_shared *fw_shared = adev->vcn.inst->fw_shared_cpu_addr; - fw_shared->present_flag_0 =0 ; +if (drm_dev_enter (&adev->ddev, &idx)) { + fw_shared->present_flag_0 =0 ; +drm_dev_exit (idx); + }amdgpu_virt_free_mm_table (adev);
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +11 -6
@@ -22,6 +22,7 @@*/ #include <linux/firmware.h> +#include <drm/drm_drv.h> #include "amdgpu.h" #include "amdgpu_vcn.h"
@@ -233,17 +234,21 @@ static int vcn_v2_5_sw_init(void *handle)*/ static int vcn_v2_5_sw_fini (void *handle) { -int i, r; +int i, r, idx;struct amdgpu_device *adev = (struct amdgpu_device *)handle;volatile struct amdgpu_fw_shared *fw_shared; -for (i =0 ; i < adev->vcn.num_vcn_inst; i++) { -if (adev->vcn.harvest_config & (1 << i)) -continue ; - fw_shared = adev->vcn.inst[i].fw_shared_cpu_addr; - fw_shared->present_flag_0 =0 ; +if (drm_dev_enter (&adev->ddev, &idx)) { +for (i =0 ; i < adev->vcn.num_vcn_inst; i++) { +if (adev->vcn.harvest_config & (1 << i)) +continue ; + fw_shared = adev->vcn.inst[i].fw_shared_cpu_addr; + fw_shared->present_flag_0 =0 ; + } +drm_dev_exit (idx); } +if (amdgpu_sriov_vf (adev))amdgpu_virt_free_mm_table (adev);
Signature · 1 line
2.33.0
Sasha Levin
maintainerPATCH 23/101 ath11k: Avoid reg rules update during firmware recovery
In reply to Sasha LevinFrom: Sriram R <[email protected]>
[ Upstream commit 69a0fcf8a9f2273040d03e5ee77c9689c09e9d3a ]
During firmware recovery, the default reg rules which are received via WMI_REG_CHAN_LIST_CC_EVENT can overwrite the currently configured user regd.
See below snap for example,
root@OpenWrt:/# iw reg get | grep country country FR: DFS-ETSI country FR: DFS-ETSI country FR: DFS-ETSI country FR: DFS-ETSI
root@OpenWrt:/# echo assert > /sys/kernel/debug/ath11k/ipq8074\ hw2.0/simulate_f w_crash <snip> [ 5290.471696] ath11k c000000.wifi1: pdev 1 successfully recovered
root@OpenWrt:/# iw reg get | grep country country FR: DFS-ETSI country US: DFS-FCC country US: DFS-FCC country US: DFS-FCC
In the above, the user configured country 'FR' is overwritten when the rules of default country 'US' are received and updated during recovery. Hence avoid processing of these rules in general during firmware recovery as they have been already applied during driver registration or after last set user country is configured.
This scenario applies for both AP and STA devices basically because cfg80211 is not aware of the recovery and only the driver recovers, but changing or resetting of the reg domain during recovery is not needed so as to continue with the configured regdomain currently in use.
Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-01460-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath11k/wmi.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/net/wireless/ath/ath11k/wmi.c +11 -0
@@ -5362,6 +5362,17 @@ static int ath11k_reg_chan_list_event(struct ath11k_base *ab, struct sk_buff *sk pdev_idx = reg_info->phy_id; +/* Avoid default reg rule updates sent during FW recovery if +* it is already available +*/ +spin_lock (&ab->base_lock); +if (test_bit (ATH11K_FLAG_RECOVERY , &ab->dev_flags) && + ab->default_regd[pdev_idx]) { +spin_unlock (&ab->base_lock); + goto mem_free; + } +spin_unlock (&ab->base_lock); +if (pdev_idx >= ab->num_radios) {/* Process the event for phy0 only if single_pdev_only * is true. If pdev_idx is valid but not 0, discard the
Signature · 1 line
2.33.0
Sasha Levin
maintainerPATCH 24/101 ath11k: add handler for scan event WMI_SCAN_EVENT_DEQUEUED
In reply to Sasha LevinFrom: Wen Gong <[email protected]>
[ Upstream commit 441b3b5911f8ead7f2fe2336587b340a33044d58 ]
When wlan interface is up, 11d scan is sent to the firmware, and the firmware needs to spend couple of seconds to complete the 11d scan. If immediately a normal scan from user space arrives to ath11k, then the normal scan request is also sent to the firmware, but the scan started event will be reported to ath11k until the 11d scan complete. When timed out for the scan started in ath11k, ath11k stops the normal scan and the firmware reports WMI_SCAN_EVENT_DEQUEUED to ath11k for the normal scan. ath11k has no handler for the event and then timed out for the scan completed in ath11k_scan_stop(), and ath11k prints the following error message.
[ 1491.604750] ath11k_pci 0000:02:00.0: failed to receive scan abort comple: timed out [ 1491.604756] ath11k_pci 0000:02:00.0: failed to stop scan: -110 [ 1491.604758] ath11k_pci 0000:02:00.0: failed to start hw scan: -110
Add a handler for WMI_SCAN_EVENT_DEQUEUED and then complete the scan to get rid of the above error message.
Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1
--- drivers/net/wireless/ath/ath11k/wmi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/ath/ath11k/wmi.c +2 -0
@@ -5856,6 +5856,8 @@ static void ath11k_scan_event(struct ath11k_base *ab, struct sk_buff *skb)ath11k_wmi_event_scan_start_failed (ar);break ;case WMI_SCAN_EVENT_DEQUEUED : +__ath11k_mac_scan_finish (ar); +break ;case WMI_SCAN_EVENT_PREEMPTED :case WMI_SCAN_EVENT_RESTARTED :case WMI_SCAN_EVENT_FOREIGN_CHAN_EXIT :
Signature · 1 line
2.33.0
Sasha Levin
maintainerPATCH 25/101 ath11k: Change DMA_FROM_DEVICE to DMA_TO_DEVICE when map reinjected packets
In reply to Sasha LevinFrom: Baochen Qiang <[email protected]>
[ Upstream commit 86a03dad0f5ad8182ed5fcf7bf3eec71cd96577c ]
For fragmented packets, ath11k reassembles each fragment as a normal packet and then reinjects it into HW ring. In this case, the DMA direction should be DMA_TO_DEVICE, not DMA_FROM_DEVICE, otherwise invalid payload will be reinjected to HW and then delivered to host. What is more, since arbitrary memory could be allocated to the frame, we don't know what kind of data is contained in the buffer reinjected. Thus, as a bad result, private info may be leaked.
Note that this issue is only found on Intel platform.
Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1
--- drivers/net/wireless/ath/ath11k/dp_rx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath11k/dp_rx.c +2 -2
@@ -3273,7 +3273,7 @@ static int ath11k_dp_rx_h_defrag_reo_reinject(struct ath11k *ar, struct dp_rx_ti paddr =dma_map_single (ab->dev, defrag_skb->data, defrag_skb->len +skb_tailroom (defrag_skb), -DMA_FROM_DEVICE ); +DMA_TO_DEVICE );if (dma_mapping_error (ab->dev, paddr))return -ENOMEM ;
@@ -3338,7 +3338,7 @@ static int ath11k_dp_rx_h_defrag_reo_reinject(struct ath11k *ar, struct dp_rx_tispin_unlock_bh (&rx_refill_ring->idr_lock); err_unmap_dma:dma_unmap_single (ab->dev, paddr, defrag_skb->len +skb_tailroom (defrag_skb), -DMA_FROM_DEVICE ); +DMA_TO_DEVICE );return ret; }
Signature · 1 line
2.33.0
Sasha Levin
maintainerPATCH 26/101 ath10k: high latency fixes for beacon buffer
In reply to Sasha LevinFrom: Alagu Sankar <[email protected]>
[ Upstream commit e263bdab9c0e8025fb7f41f153709a9cda51f6b6 ]
Beacon buffer for high latency devices does not use DMA. other similar buffer allocation methods in the driver have already been modified for high latency path. Fix the beacon buffer allocation left out in the earlier high latency changes.
--- drivers/net/wireless/ath/ath10k/mac.c | 31 ++++++++++++++++++++------- 1 file changed, 23 insertions(+), 8 deletions(-)
drivers/net/wireless/ath/ath10k/mac.c +23 -8
@@ -982,8 +982,12 @@ static void ath10k_mac_vif_beacon_cleanup(struct ath10k_vif *arvif)ath10k_mac_vif_beacon_free (arvif);if (arvif->beacon_buf) { -dma_free_coherent (ar->dev,IEEE80211_MAX_FRAME_LEN , - arvif->beacon_buf, arvif->beacon_paddr); +if (ar->bus_param.dev_type ==ATH10K_DEV_TYPE_HL ) +kfree (arvif->beacon_buf); +else +dma_free_coherent (ar->dev,IEEE80211_MAX_FRAME_LEN , + arvif->beacon_buf, + arvif->beacon_paddr); arvif->beacon_buf =NULL ; } }
@@ -5466,10 +5470,17 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,if (vif->type ==NL80211_IFTYPE_ADHOC || vif->type ==NL80211_IFTYPE_MESH_POINT || vif->type ==NL80211_IFTYPE_AP ) { - arvif->beacon_buf =dma_alloc_coherent (ar->dev, -IEEE80211_MAX_FRAME_LEN , - &arvif->beacon_paddr, -GFP_ATOMIC ); +if (ar->bus_param.dev_type ==ATH10K_DEV_TYPE_HL ) { + arvif->beacon_buf =kmalloc (IEEE80211_MAX_FRAME_LEN , +GFP_KERNEL ); + arvif->beacon_paddr = (dma_addr_t )arvif->beacon_buf; + }else { + arvif->beacon_buf = +dma_alloc_coherent (ar->dev, +IEEE80211_MAX_FRAME_LEN , + &arvif->beacon_paddr, +GFP_ATOMIC ); + }if (!arvif->beacon_buf) { ret = -ENOMEM ; ath10k_warn(ar, "failed to allocate beacon buffer: %d\n",
@@ -5684,8 +5695,12 @@ static int ath10k_add_interface(struct ieee80211_hw *hw, err:if (arvif->beacon_buf) { -dma_free_coherent (ar->dev,IEEE80211_MAX_FRAME_LEN , - arvif->beacon_buf, arvif->beacon_paddr); +if (ar->bus_param.dev_type ==ATH10K_DEV_TYPE_HL ) +kfree (arvif->beacon_buf); +else +dma_free_coherent (ar->dev,IEEE80211_MAX_FRAME_LEN , + arvif->beacon_buf, + arvif->beacon_paddr); arvif->beacon_buf =NULL ; }
Signature · 1 line
2.33.0
Sasha Levin
maintainerPATCH 27/101 media: mt9p031: Fix corrupted frame after restarting stream
In reply to Sasha LevinFrom: Dirk Bender <[email protected]>
[ Upstream commit 0961ba6dd211a4a52d1dd4c2d59be60ac2dc08c7 ]
To prevent corrupted frames after starting and stopping the sensor its datasheet specifies a specific pause sequence to follow:
Stopping:
Set Pause_Restart Bit -> Set Restart Bit -> Set Chip_Enable Off
Restarting:
Set Chip_Enable On -> Clear Pause_Restart Bit
The Restart Bit is cleared automatically and must not be cleared manually as this would cause undefined behavior.
--- drivers/media/i2c/mt9p031.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-)
drivers/media/i2c/mt9p031.c +27 -1
@@ -78,7 +78,9 @@#define MT9P031_PIXEL_CLOCK_INVERT (1 << 15)#define MT9P031_PIXEL_CLOCK_SHIFT (n) ((n) << 8)#define MT9P031_PIXEL_CLOCK_DIVIDE (n) ((n) << 0) -#define MT9P031_FRAME_RESTART 0x0b +#define MT9P031_RESTART 0x0b +#define MT9P031_FRAME_PAUSE_RESTART (1 << 1) +#define MT9P031_FRAME_RESTART (1 << 0)#define MT9P031_SHUTTER_DELAY 0x0c#define MT9P031_RST 0x0d#define MT9P031_RST_ENABLE 1
@@ -445,9 +447,23 @@ static int mt9p031_set_params(struct mt9p031 *mt9p031)static int mt9p031_s_stream (struct v4l2_subdev *subdev,int enable) {struct mt9p031 *mt9p031 =to_mt9p031 (subdev); +struct i2c_client *client =v4l2_get_subdevdata (subdev); +int val;int ret;if (!enable) { +/* enable pause restart */ + val =MT9P031_FRAME_PAUSE_RESTART ; + ret =mt9p031_write (client,MT9P031_RESTART , val); +if (ret <0 ) +return ret; + +/* enable restart + keep pause restart set */ + val |=MT9P031_FRAME_RESTART ; + ret =mt9p031_write (client,MT9P031_RESTART , val); +if (ret <0 ) +return ret; +/* Stop sensor readout */ ret =mt9p031_set_output_control (mt9p031,MT9P031_OUTPUT_CONTROL_CEN ,0 );
@@ -467,6 +483,16 @@ static int mt9p031_s_stream(struct v4l2_subdev *subdev, int enable)if (ret <0 )return ret; +/* +* - clear pause restart +* - don't clear restart as clearing restart manually can cause +* undefined behavior +*/ + val =MT9P031_FRAME_RESTART ; + ret =mt9p031_write (client,MT9P031_RESTART , val); +if (ret <0 ) +return ret; +return mt9p031_pll_enable (mt9p031); }
Signature · 1 line
2.33.0
Sasha Levin
maintainerPATCH 28/101 media: netup_unidvb: handle interrupt properly according to the firmware
In reply to Sasha LevinFrom: Zheyu Ma <[email protected]>
[ Upstream commit dbb4cfea6efe979ed153bd59a6a527a90d3d0ab3 ]
The interrupt handling should be related to the firmware version. If the driver matches an old firmware, then the driver should not handle interrupt such as i2c or dma, otherwise it will cause some errors.
This log reveals it:
[ 27.708641] INFO: trying to register non-static key. [ 27.710851] The code is fine but needs lockdep annotation, or maybe [ 27.712010] you didn't initialize this object before use? [ 27.712396] turning off the locking correctness validator. [ 27.712787] CPU: 2 PID: 0 Comm: swapper/2 Not tainted 5.12.4-g70e7f0549188-dirty #169 [ 27.713349] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.12.0-59-gc9ba5276e321-prebuilt.qemu.org 04/01/2014 [ 27.714149] Call Trace: [ 27.714329] <IRQ> [ 27.714480] dump_stack+0xba/0xf5 [ 27.714737] register_lock_class+0x873/0x8f0 [ 27.715052] ? __lock_acquire+0x323/0x1930 [ 27.715353] __lock_acquire+0x75/0x1930 [ 27.715636] lock_acquire+0x1dd/0x3e0 [ 27.715905] ? netup_i2c_interrupt+0x19/0x310 [ 27.716226] _raw_spin_lock_irqsave+0x4b/0x60 [ 27.716544] ? netup_i2c_interrupt+0x19/0x310 [ 27.716863] netup_i2c_interrupt+0x19/0x310 [ 27.717178] netup_unidvb_isr+0xd3/0x160 [ 27.717467] __handle_irq_event_percpu+0x53/0x3e0 [ 27.717808] handle_irq_event_percpu+0x35/0x90 [ 27.718129] handle_irq_event+0x39/0x60 [ 27.718409] handle_fasteoi_irq+0xc2/0x1d0 [ 27.718707] __common_interrupt+0x7f/0x150 [ 27.719008] common_interrupt+0xb4/0xd0 [ 27.719289] </IRQ> [ 27.719446] asm_common_interrupt+0x1e/0x40 [ 27.719747] RIP: 0010:native_safe_halt+0x17/0x20 [ 27.720084] Code: 07 0f 00 2d 8b ee 4c 00 f4 5d c3 0f 1f 84 00 00 00 00 00 8b 05 72 95 17 02 55 48 89 e5 85 c0 7e 07 0f 00 2d 6b ee 4c 00 fb f4 <5d> c3 cc cc cc cc cc cc cc 55 48 89 e5 e8 67 53 ff ff 8b 0d 29 f6 [ 27.721386] RSP: 0018:ffffc9000008fe90 EFLAGS: 00000246 [ 27.721758] RAX: 0000000000000000 RBX: 0000000000000002 RCX: 0000000000000000 [ 27.722262] RDX: 0000000000000000 RSI: ffffffff85f7c054 RDI: ffffffff85ded4e6 [ 27.722770] RBP: ffffc9000008fe90 R08: 0000000000000001 R09: 0000000000000001 [ 27.723277] R10: 0000000000000000 R11: 0000000000000001 R12: ffffffff86a75408 [ 27.723781] R13: 0000000000000000 R14: 0000000000000000 R15: ffff888100260000 [ 27.724289] default_idle+0x9/0x10 [ 27.724537] arch_cpu_idle+0xa/0x10 [ 27.724791] default_idle_call+0x6e/0x250 [ 27.725082] do_idle+0x1f0/0x2d0 [ 27.725326] cpu_startup_entry+0x18/0x20 [ 27.725613] start_secondary+0x11f/0x160 [ 27.725902] secondary_startup_64_no_verify+0xb0/0xbb [ 27.726272] BUG: kernel NULL pointer dereference, address: 0000000000000002 [ 27.726768] #PF: supervisor read access in kernel mode [ 27.727138] #PF: error_code(0x0000) - not-present page [ 27.727507] PGD 8000000118688067 P4D 8000000118688067 PUD 10feab067 PMD 0 [ 27.727999] Oops: 0000 [#1] PREEMPT SMP PTI [ 27.728302] CPU: 2 PID: 0 Comm: swapper/2 Not tainted 5.12.4-g70e7f0549188-dirty #169 [ 27.728861] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.12.0-59-gc9ba5276e321-prebuilt.qemu.org 04/01/2014 [ 27.729660] RIP: 0010:netup_i2c_interrupt+0x23/0x310 [ 27.730019] Code: 0f 1f 80 00 00 00 00 55 48 89 e5 41 55 41 54 53 48 89 fb e8 af 6e 95 fd 48 89 df e8 e7 9f 1c 01 49 89 c5 48 8b 83 48 08 00 00 <66> 44 8b 60 02 44 89 e0 48 8b 93 48 08 00 00 83 e0 f8 66 89 42 02 [ 27.731339] RSP: 0018:ffffc90000118e90 EFLAGS: 00010046 [ 27.731716] RAX: 0000000000000000 RBX: ffff88810803c4d8 RCX: 0000000000000000 [ 27.732223] RDX: 0000000000000001 RSI: ffffffff85d37b94 RDI: ffff88810803c4d8 [ 27.732727] RBP: ffffc90000118ea8 R08: 0000000000000000 R09: 0000000000000001 [ 27.733239] R10: ffff88810803c4f0 R11: 61646e6f63657320 R12: 0000000000000000 [ 27.733745] R13: 0000000000000046 R14: ffff888101041000 R15: ffff8881081b2400 [ 27.734251] FS: 0000000000000000(0000) GS:ffff88817bc80000(0000) knlGS:0000000000000000 [ 27.734821] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 27.735228] CR2: 0000000000000002 CR3: 0000000108194000 CR4: 00000000000006e0 [ 27.735735] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 27.736241] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 27.736744] Call Trace: [ 27.736924] <IRQ> [ 27.737074] netup_unidvb_isr+0xd3/0x160 [ 27.737363] __handle_irq_event_percpu+0x53/0x3e0 [ 27.737706] handle_irq_event_percpu+0x35/0x90 [ 27.738028] handle_irq_event+0x39/0x60 [ 27.738306] handle_fasteoi_irq+0xc2/0x1d0 [ 27.738602] __common_interrupt+0x7f/0x150 [ 27.738899] common_interrupt+0xb4/0xd0 [ 27.739176] </IRQ> [ 27.739331] asm_common_interrupt+0x1e/0x40 [ 27.739633] RIP: 0010:native_safe_halt+0x17/0x20 [ 27.739967] Code: 07 0f 00 2d 8b ee 4c 00 f4 5d c3 0f 1f 84 00 00 00 00 00 8b 05 72 95 17 02 55 48 89 e5 85 c0 7e 07 0f 00 2d 6b ee 4c 00 fb f4 <5d> c3 cc cc cc cc cc cc cc 55 48 89 e5 e8 67 53 ff ff 8b 0d 29 f6 [ 27.741275] RSP: 0018:ffffc9000008fe90 EFLAGS: 00000246 [ 27.741647] RAX: 0000000000000000 RBX: 0000000000000002 RCX: 0000000000000000 [ 27.742148] RDX: 0000000000000000 RSI: ffffffff85f7c054 RDI: ffffffff85ded4e6 [ 27.742652] RBP: ffffc9000008fe90 R08: 0000000000000001 R09: 0000000000000001 [ 27.743154] R10: 0000000000000000 R11: 0000000000000001 R12: ffffffff86a75408 [ 27.743652] R13: 0000000000000000 R14: 0000000000000000 R15: ffff888100260000 [ 27.744157] default_idle+0x9/0x10 [ 27.744405] arch_cpu_idle+0xa/0x10 [ 27.744658] default_idle_call+0x6e/0x250 [ 27.744948] do_idle+0x1f0/0x2d0 [ 27.745190] cpu_startup_entry+0x18/0x20 [ 27.745475] start_secondary+0x11f/0x160 [ 27.745761] secondary_startup_64_no_verify+0xb0/0xbb [ 27.746123] Modules linked in: [ 27.746348] Dumping ftrace buffer: [ 27.746596] (ftrace buffer empty) [ 27.746852] CR2: 0000000000000002 [ 27.747094] ---[ end trace ebafd46f83ab946d ]--- [ 27.747424] RIP: 0010:netup_i2c_interrupt+0x23/0x310 [ 27.747778] Code: 0f 1f 80 00 00 00 00 55 48 89 e5 41 55 41 54 53 48 89 fb e8 af 6e 95 fd 48 89 df e8 e7 9f 1c 01 49 89 c5 48 8b 83 48 08 00 00 <66> 44 8b 60 02 44 89 e0 48 8b 93 48 08 00 00 83 e0 f8 66 89 42 02 [ 27.749082] RSP: 0018:ffffc90000118e90 EFLAGS: 00010046 [ 27.749461] RAX: 0000000000000000 RBX: ffff88810803c4d8 RCX: 0000000000000000 [ 27.749966] RDX: 0000000000000001 RSI: ffffffff85d37b94 RDI: ffff88810803c4d8 [ 27.750471] RBP: ffffc90000118ea8 R08: 0000000000000000 R09: 0000000000000001 [ 27.750976] R10: ffff88810803c4f0 R11: 61646e6f63657320 R12: 0000000000000000 [ 27.751480] R13: 0000000000000046 R14: ffff888101041000 R15: ffff8881081b2400 [ 27.751986] FS: 0000000000000000(0000) GS:ffff88817bc80000(0000) knlGS:0000000000000000 [ 27.752560] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 27.752970] CR2: 0000000000000002 CR3: 0000000108194000 CR4: 00000000000006e0 [ 27.753481] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 27.753984] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 27.754487] Kernel panic - not syncing: Fatal exception in interrupt [ 27.755033] Dumping ftrace buffer: [ 27.755279] (ftrace buffer empty) [ 27.755534] Kernel Offset: disabled [ 27.755785] Rebooting in 1 seconds..
--- .../pci/netup_unidvb/netup_unidvb_core.c | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-)
drivers/media/pci/netup_unidvb/netup_unidvb_core.c +16 -11
@@ -258,19 +258,24 @@ static irqreturn_t netup_unidvb_isr(int irq, void *dev_id)if ((reg40 &AVL_IRQ_ASSERTED ) !=0 ) {/* IRQ is being signaled */ reg_isr =readw (ndev->bmmio0 +REG_ISR ); -if (reg_isr &NETUP_UNIDVB_IRQ_I2C0 ) { - iret =netup_i2c_interrupt (&ndev->i2c[0 ]); - }else if (reg_isr &NETUP_UNIDVB_IRQ_I2C1 ) { - iret =netup_i2c_interrupt (&ndev->i2c[1 ]); - }else if (reg_isr &NETUP_UNIDVB_IRQ_SPI ) { +if (reg_isr &NETUP_UNIDVB_IRQ_SPI ) iret =netup_spi_interrupt (ndev->spi); - }else if (reg_isr &NETUP_UNIDVB_IRQ_DMA1 ) { - iret =netup_dma_interrupt (&ndev->dma[0 ]); - }else if (reg_isr &NETUP_UNIDVB_IRQ_DMA2 ) { - iret =netup_dma_interrupt (&ndev->dma[1 ]); - }else if (reg_isr &NETUP_UNIDVB_IRQ_CI ) { - iret =netup_ci_interrupt (ndev); +else if (!ndev->old_fw) { +if (reg_isr &NETUP_UNIDVB_IRQ_I2C0 ) { + iret =netup_i2c_interrupt (&ndev->i2c[0 ]); + }else if (reg_isr &NETUP_UNIDVB_IRQ_I2C1 ) { + iret =netup_i2c_interrupt (&ndev->i2c[1 ]); + }else if (reg_isr &NETUP_UNIDVB_IRQ_DMA1 ) { + iret =netup_dma_interrupt (&ndev->dma[0 ]); + }else if (reg_isr &NETUP_UNIDVB_IRQ_DMA2 ) { + iret =netup_dma_interrupt (&ndev->dma[1 ]); + }else if (reg_isr &NETUP_UNIDVB_IRQ_CI ) { + iret =netup_ci_interrupt (ndev); + }else { + goto err; + } }else { +err:dev_err (&pci_dev->dev,"%s(): unknown interrupt 0x%x\n" , __func__, reg_isr);
Signature · 1 line
2.33.0
Sasha Levin
maintainerPATCH 29/101 media: atomisp: Fix error handling in probe
In reply to Sasha LevinFrom: Evgeny Novikov <[email protected]>
[ Upstream commit e16f5e39acd6d10cc63ae39bc0a77188ed828f22 ]
There were several issues with handling errors in lm3554_probe():
- Probe did not set the error code when v4l2_ctrl_handler_init() failed.
- It intermixed gotos for handling errors of v4l2_ctrl_handler_init() and media_entity_pads_init().
- It did not set the error code for failures of v4l2_ctrl_new_custom().
- Probe did not free resources in case of failures of atomisp_register_i2c_module().
The patch fixes all these issues.
Found by Linux Driver Verification project (linuxtesting.org).
--- .../media/atomisp/i2c/atomisp-lm3554.c | 37 ++++++++++++------- 1 file changed, 24 insertions(+), 13 deletions(-)
drivers/staging/media/atomisp/i2c/atomisp-lm3554.c +24 -13
@@ -836,7 +836,6 @@ static int lm3554_probe(struct i2c_client *client)int err =0 ;struct lm3554 *flash;unsigned int i; -int ret; flash =kzalloc (sizeof (*flash),GFP_KERNEL );if (!flash)
@@ -845,7 +844,7 @@ static int lm3554_probe(struct i2c_client *client) flash->pdata =lm3554_platform_data_func (client);if (IS_ERR (flash->pdata)) { err =PTR_ERR (flash->pdata); - goto fail1; + goto free_flash; }v4l2_i2c_subdev_init (&flash->sd, client, &lm3554_ops);
@@ -853,12 +852,12 @@ static int lm3554_probe(struct i2c_client *client) flash->sd.flags |=V4L2_SUBDEV_FL_HAS_DEVNODE ; flash->mode =ATOMISP_FLASH_MODE_OFF ; flash->timeout =LM3554_MAX_TIMEOUT /LM3554_TIMEOUT_STEPSIZE -1 ; - ret = + err =v4l2_ctrl_handler_init (&flash->ctrl_handler,ARRAY_SIZE (lm3554_controls)); -if (ret) { +if (err) {dev_err (&client->dev,"error initialize a ctrl_handler.\n" ); - goto fail3; + goto unregister_subdev; }for (i =0 ; i <ARRAY_SIZE (lm3554_controls); i++)
@@ -867,14 +866,15 @@ static int lm3554_probe(struct i2c_client *client)if (flash->ctrl_handler.error) {dev_err (&client->dev,"ctrl_handler error.\n" ); - goto fail3; + err = flash->ctrl_handler.error; + goto free_handler; } flash->sd.ctrl_handler = &flash->ctrl_handler; err =media_entity_pads_init (&flash->sd.entity,0 ,NULL );if (err) {dev_err (&client->dev,"error initialize a media entity.\n" ); - goto fail2; + goto free_handler; } flash->sd.entity.function =MEDIA_ENT_F_FLASH ;
@@ -885,16 +885,27 @@ static int lm3554_probe(struct i2c_client *client) err =lm3554_gpio_init (client);if (err) { -dev_err (&client->dev,"gpio request/direction_output fail" ); - goto fail3; +dev_err (&client->dev,"gpio request/direction_output fail.\n" ); + goto cleanup_media; + } + + err =atomisp_register_i2c_module (&flash->sd,NULL ,LED_FLASH ); +if (err) { +dev_err (&client->dev,"fail to register atomisp i2c module.\n" ); + goto uninit_gpio; } -return atomisp_register_i2c_module (&flash->sd,NULL ,LED_FLASH ); -fail3: + +return 0 ; + +uninit_gpio: +lm3554_gpio_uninit (client); +cleanup_media:media_entity_cleanup (&flash->sd.entity); +free_handler:v4l2_ctrl_handler_free (&flash->ctrl_handler); -fail2: +unregister_subdev:v4l2_device_unregister_subdev (&flash->sd); -fail1: +free_flash:kfree (flash);return err;
Signature · 1 line
2.33.0
Sasha Levin
maintainerPATCH 30/101 media: stm32: Potential NULL pointer dereference in dcmi_irq_thread()
In reply to Sasha LevinFrom: Dmitriy Ulitin <[email protected]>
[ Upstream commit 548fa43a58696450c15b8f5564e99589c5144664 ]
At the moment of enabling irq handling:
1922 ret = devm_request_threaded_irq(&pdev->dev, irq, dcmi_irq_callback,
1923 dcmi_irq_thread, IRQF_ONESHOT,
1924 dev_name(&pdev->dev), dcmi);
there is still uninitialized field sd_format of struct stm32_dcmi *dcmi. If an interrupt occurs in the interval between the installation of the interrupt handler and the initialization of this field, NULL pointer dereference happens.
This field is dereferenced in the handler function without any check:
457 if (dcmi->sd_format->fourcc == V4L2_PIX_FMT_JPEG &&
458 dcmi->misr & IT_FRAME) {
The patch moves interrupt handler installation after initialization of the sd_format field that happens in dcmi_graph_notify_complete() via dcmi_set_default_fmt().
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/media/platform/stm32/stm32-dcmi.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
drivers/media/platform/stm32/stm32-dcmi.c +11 -8
@@ -135,6 +135,7 @@ struct stm32_dcmi {int sequence;struct list_head buffers;struct dcmi_buf *active; +int irq;struct v4l2_device v4l2_dev;struct video_device *vdev;
@@ -1720,6 +1721,14 @@ static int dcmi_graph_notify_complete(struct v4l2_async_notifier *notifier)return ret; } + ret =devm_request_threaded_irq (dcmi->dev, dcmi->irq, dcmi_irq_callback, + dcmi_irq_thread,IRQF_ONESHOT , +dev_name (dcmi->dev), dcmi); +if (ret) { +dev_err (dcmi->dev,"Unable to request irq %d\n" , dcmi->irq); +return ret; + } +return 0 ; }
@@ -1881,6 +1890,8 @@ static int dcmi_probe(struct platform_device *pdev)if (irq <=0 )return irq ? irq : -ENXIO ; + dcmi->irq = irq; + dcmi->res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );if (!dcmi->res) {dev_err (&pdev->dev,"Could not get resource\n" );
@@ -1893,14 +1904,6 @@ static int dcmi_probe(struct platform_device *pdev)return PTR_ERR (dcmi->regs); } - ret =devm_request_threaded_irq (&pdev->dev, irq, dcmi_irq_callback, - dcmi_irq_thread,IRQF_ONESHOT , -dev_name (&pdev->dev), dcmi); -if (ret) { -dev_err (&pdev->dev,"Unable to request irq %d\n" , irq); -return ret; - } - mclk =devm_clk_get (&pdev->dev,"mclk" );if (IS_ERR (mclk)) {if (PTR_ERR (mclk) != -EPROBE_DEFER )
Signature · 1 line
2.33.0
Sasha Levin
maintainerPATCH 31/101 media: uvcvideo: Set capability in s_param
In reply to Sasha LevinFrom: Ricardo Ribalda <[email protected]>
[ Upstream commit 97a2777a96070afb7da5d587834086c0b586c8cc ]
Fixes v4l2-compliance:
Format ioctls (Input 0):
warn: v4l2-test-formats.cpp(1339): S_PARM is supported but doesn't report V4L2_CAP_TIMEPERFRAME
fail: v4l2-test-formats.cpp(1241): node->has_frmintervals && !cap->capability
--- drivers/media/usb/uvc/uvc_v4l2.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/media/usb/uvc/uvc_v4l2.c +5 -2
@@ -471,10 +471,13 @@ static int uvc_v4l2_set_streamparm(struct uvc_streaming *stream,uvc_simplify_fraction (&timeperframe.numerator, &timeperframe.denominator,8 ,333 ); -if (parm->type ==V4L2_BUF_TYPE_VIDEO_CAPTURE ) +if (parm->type ==V4L2_BUF_TYPE_VIDEO_CAPTURE ) { parm->parm.capture.timeperframe = timeperframe; -else + parm->parm.capture.capability =V4L2_CAP_TIMEPERFRAME ; + }else { parm->parm.output.timeperframe = timeperframe; + parm->parm.output.capability =V4L2_CAP_TIMEPERFRAME ; + }return 0 ; }
Signature · 1 line
2.33.0
Sasha Levin
maintainerPATCH 32/101 media: uvcvideo: Return -EIO for control errors
In reply to Sasha LevinFrom: Ricardo Ribalda <[email protected]>
[ Upstream commit ffccdde5f0e17d2f0d788a9d831a027187890eaa ]
The device is doing something unexpected with the control. Either because the protocol is not properly implemented or there has been a HW error.
Fixes v4l2-compliance:
Control ioctls (Input 0):
fail: v4l2-test-controls.cpp(448): s_ctrl returned an error (22)
test VIDIOC_G/S_CTRL: FAIL
fail: v4l2-test-controls.cpp(698): s_ext_ctrls returned an error (22)
test VIDIOC_G/S/TRY_EXT_CTRLS: FAIL
--- drivers/media/usb/uvc/uvc_video.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/media/usb/uvc/uvc_video.c +5 -0
@@ -112,6 +112,11 @@ int uvc_query_ctrl(struct uvc_device *dev, u8 query, u8 unit,case 5 :/* Invalid unit */ case 6 :/* Invalid control */ case 7 :/* Invalid Request */ +/* +* The firmware has not properly implemented +* the control or there has been a HW error. +*/ +return -EIO ;case 8 :/* Invalid value within range */ return -EINVAL ;default :/* reserved or unknown */
Signature · 1 line
2.33.0
Sasha Levin
maintainerPATCH 33/101 media: uvcvideo: Set unique vdev name based in type
In reply to Sasha LevinFrom: Ricardo Ribalda <[email protected]>
[ Upstream commit e3f60e7e1a2b451f538f9926763432249bcf39c4 ]
All the entities must have a unique name. We can have a descriptive and unique name by appending the function and the entity->id.
This is even resilent to multi chain devices.
Fixes v4l2-compliance:
Media Controller ioctls:
fail: v4l2-test-media.cpp(205): v2_entity_names_set.find(key) != v2_entity_names_set.end()
test MEDIA_IOC_G_TOPOLOGY: FAIL
fail: v4l2-test-media.cpp(394): num_data_links != num_links
test MEDIA_IOC_ENUM_ENTITIES/LINKS: FAIL
--- drivers/media/usb/uvc/uvc_driver.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/media/usb/uvc/uvc_driver.c +6 -1
@@ -2065,6 +2065,7 @@ int uvc_register_video_device(struct uvc_device *dev,const struct v4l2_file_operations *fops, const struct v4l2_ioctl_ops *ioctl_ops) { + const char *name;int ret;/* Initialize the video buffers queue. */
@@ -2093,16 +2094,20 @@ int uvc_register_video_device(struct uvc_device *dev,case V4L2_BUF_TYPE_VIDEO_CAPTURE :default : vdev->device_caps =V4L2_CAP_VIDEO_CAPTURE |V4L2_CAP_STREAMING ; + name ="Video Capture" ;break ;case V4L2_BUF_TYPE_VIDEO_OUTPUT : vdev->device_caps =V4L2_CAP_VIDEO_OUTPUT |V4L2_CAP_STREAMING ; + name ="Video Output" ;break ;case V4L2_BUF_TYPE_META_CAPTURE : vdev->device_caps =V4L2_CAP_META_CAPTURE |V4L2_CAP_STREAMING ; + name ="Metadata" ;break ; } -strscpy (vdev->name, dev->name,sizeof (vdev->name)); +snprintf (vdev->name,sizeof (vdev->name),"%s %u" , name, + stream->header.bTerminalLink);/* * Set the driver data before calling video_register_device, otherwise
Signature · 1 line
2.33.0
Sasha Levin
maintainerPATCH 34/101 media: s5p-mfc: fix possible null-pointer dereference in s5p_mfc_probe()
In reply to Sasha LevinFrom: Tuo Li <[email protected]>
[ Upstream commit 8515965e5e33f4feb56134348c95953f3eadfb26 ]
The variable pdev is assigned to dev->plat_dev, and dev->plat_dev is checked in:
if (!dev->plat_dev)
This indicates both dev->plat_dev and pdev can be NULL. If so, the function dev_err() is called to print error information.
dev_err(&pdev->dev, "No platform data specified\n");
However, &pdev->dev is an illegal address, and it is dereferenced in dev_err().
To fix this possible null-pointer dereference, replace dev_err() with mfc_err().
--- drivers/media/platform/s5p-mfc/s5p_mfc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/s5p-mfc/s5p_mfc.c +1 -1
@@ -1283,7 +1283,7 @@ static int s5p_mfc_probe(struct platform_device *pdev)spin_lock_init (&dev->condlock); dev->plat_dev = pdev;if (!dev->plat_dev) { -dev_err (&pdev->dev,"No platform data specified\n" ); +mfc_err ("No platform data specified\n" );return -ENODEV ; }
Signature · 1 line
2.33.0
Sasha Levin
maintainerPATCH 35/101 media: s5p-mfc: Add checking to s5p_mfc_probe().
In reply to Sasha LevinFrom: Nadezda Lutovinova <[email protected]>
[ Upstream commit cdfaf4752e6915a4b455ad4400133e540e4dc965 ]
If of_device_get_match_data() return NULL,
then null pointer dereference occurs in s5p_mfc_init_pm(). The patch adds checking if dev->variant is NULL.
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/media/platform/s5p-mfc/s5p_mfc.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/media/platform/s5p-mfc/s5p_mfc.c +4 -0
@@ -1288,6 +1288,10 @@ static int s5p_mfc_probe(struct platform_device *pdev) } dev->variant =of_device_get_match_data (&pdev->dev); +if (!dev->variant) { +dev_err (&pdev->dev,"Failed to get device MFC hardware variant information\n" ); +return -ENOENT ; + } res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); dev->regs_base =devm_ioremap_resource (&pdev->dev, res);
Signature · 1 line
2.33.0