scsi: iscsi: Fix multiple iSCSI session unbind events sent to userspace
Subsystems (11)
Sasha Levin
maintainerPATCH 1/24 scsi: iscsi: Fix multiple iSCSI session unbind events sent to userspace
From: Wenchao Hao <[email protected]>
[ Upstream commit a3be19b91ea7121d388084e8c07f5b1b982eb40c ]
It was observed that the kernel would potentially send ISCSI_KEVENT_UNBIND_SESSION multiple times. Introduce 'target_state' in iscsi_cls_session() to make sure session will send only one unbind session event.
This introduces a regression wrt. the issue fixed in commit 13e60d3ba287 ("scsi: iscsi: Report unbind session event when the target has been removed"). If iscsid dies for any reason after sending an unbind session to kernel, once iscsid is restarted, the kernel's ISCSI_KEVENT_UNBIND_SESSION event is lost and userspace is then unable to logout. However, the session is actually in invalid state (its target_id is INVALID) so iscsid should not sync this session during restart.
Consequently we need to check the session's target state during iscsid restart. If session is in unbound state, do not sync this session and perform session teardown. This is OK because once a session is unbound, we can not recover it any more (mainly because its target id is INVALID).
--- drivers/scsi/scsi_transport_iscsi.c | 50 ++++++++++++++++++++++++++--- include/scsi/scsi_transport_iscsi.h | 9 ++++++ 2 files changed, 54 insertions(+), 5 deletions(-)
drivers/scsi/scsi_transport_iscsi.c +45 -5
@@ -1679,6 +1679,13 @@ static const char *iscsi_session_state_name(int state)return name; } +static char *iscsi_session_target_state_name[] = { + [ISCSI_SESSION_TARGET_UNBOUND ] ="UNBOUND" , + [ISCSI_SESSION_TARGET_ALLOCATED ] ="ALLOCATED" , + [ISCSI_SESSION_TARGET_SCANNED ] ="SCANNED" , + [ISCSI_SESSION_TARGET_UNBINDING ] ="UNBINDING" , +}; +int iscsi_session_chkready (struct iscsi_cls_session *session) {int err;
@@ -1807,9 +1814,13 @@ static int iscsi_user_scan_session(struct device *dev, void *data)if ((scan_data->channel ==SCAN_WILD_CARD || scan_data->channel ==0 ) && (scan_data->id ==SCAN_WILD_CARD || - scan_data->id == id)) + scan_data->id == id)) {scsi_scan_target (&session->dev,0 , id, scan_data->lun, scan_data->rescan); +spin_lock_irqsave (&session->lock, flags); + session->target_state =ISCSI_SESSION_TARGET_SCANNED ; +spin_unlock_irqrestore (&session->lock, flags); + } } user_scan_exit:
@@ -1998,31 +2009,41 @@ static void __iscsi_unbind_session(struct work_struct *work)struct iscsi_cls_host *ihost = shost->shost_data;unsigned long flags;unsigned int target_id; +bool remove_target = true;ISCSI_DBG_TRANS_SESSION (session,"Unbinding session\n" );/* Prevent new scans and make sure scanning is not in progress */ mutex_lock (&ihost->mutex);spin_lock_irqsave (&session->lock, flags); -if (session->target_id ==ISCSI_MAX_TARGET ) { +if (session->target_state ==ISCSI_SESSION_TARGET_ALLOCATED ) { + remove_target = false; + }else if (session->target_state !=ISCSI_SESSION_TARGET_SCANNED ) {spin_unlock_irqrestore (&session->lock, flags);mutex_unlock (&ihost->mutex); - goto unbind_session_exit; +ISCSI_DBG_TRANS_SESSION (session, +"Skipping target unbinding: Session is unbound/unbinding.\n" ); +return ; } + session->target_state =ISCSI_SESSION_TARGET_UNBINDING ; target_id = session->target_id; session->target_id =ISCSI_MAX_TARGET ;spin_unlock_irqrestore (&session->lock, flags);mutex_unlock (&ihost->mutex); -scsi_remove_target (&session->dev); +if (remove_target) +scsi_remove_target (&session->dev);if (session->ida_used)ida_simple_remove (&iscsi_sess_ida, target_id); -unbind_session_exit:iscsi_session_event (session,ISCSI_KEVENT_UNBIND_SESSION );ISCSI_DBG_TRANS_SESSION (session,"Completed target removal\n" ); + +spin_lock_irqsave (&session->lock, flags); + session->target_state =ISCSI_SESSION_TARGET_UNBOUND ; +spin_unlock_irqrestore (&session->lock, flags); }static void __iscsi_destroy_session (struct work_struct *work)
@@ -2091,6 +2112,9 @@ int iscsi_add_session(struct iscsi_cls_session *session, unsigned int target_id) session->ida_used = true; }else session->target_id = target_id; +spin_lock_irqsave (&session->lock, flags); + session->target_state =ISCSI_SESSION_TARGET_ALLOCATED ; +spin_unlock_irqrestore (&session->lock, flags);dev_set_name (&session->dev,"session%u" , session->sid); err =device_add (&session->dev);
@@ -4391,6 +4415,19 @@ iscsi_session_attr(def_taskmgmt_tmo, ISCSI_PARAM_DEF_TASKMGMT_TMO, 0);iscsi_session_attr (discovery_parent_idx,ISCSI_PARAM_DISCOVERY_PARENT_IDX ,0 );iscsi_session_attr (discovery_parent_type,ISCSI_PARAM_DISCOVERY_PARENT_TYPE ,0 ); +static ssize_t +show_priv_session_target_state (struct device *dev,struct device_attribute *attr, +char *buf) +{ +struct iscsi_cls_session *session =iscsi_dev_to_session (dev->parent); + +return sysfs_emit (buf,"%s\n" , + iscsi_session_target_state_name[session->target_state]); +} + +static ISCSI_CLASS_ATTR(priv_sess, target_state, S_IRUGO, + show_priv_session_target_state, NULL); +static ssize_t show_priv_session_state (struct device *dev,struct device_attribute *attr,char *buf)
@@ -4493,6 +4530,7 @@ static struct attribute *iscsi_session_attrs[] = { &dev_attr_sess_boot_target.attr, &dev_attr_priv_sess_recovery_tmo.attr, &dev_attr_priv_sess_state.attr, + &dev_attr_priv_sess_target_state.attr, &dev_attr_priv_sess_creator.attr, &dev_attr_sess_chap_out_idx.attr, &dev_attr_sess_chap_in_idx.attr,
@@ -4606,6 +4644,8 @@ static umode_t iscsi_session_attr_is_visible(struct kobject *kobj,return S_IRUGO |S_IWUSR ; else if (attr == &dev_attr_priv_sess_state.attr)return S_IRUGO ; + else if (attr == &dev_attr_priv_sess_target_state.attr) +return S_IRUGO ; else if (attr == &dev_attr_priv_sess_creator.attr)return S_IRUGO ; else if (attr == &dev_attr_priv_sess_target_id.attr)
include/scsi/scsi_transport_iscsi.h +9 -0
@@ -236,6 +236,14 @@ enum { ISCSI_SESSION_FREE, }; +enum { +ISCSI_SESSION_TARGET_UNBOUND , +ISCSI_SESSION_TARGET_ALLOCATED , +ISCSI_SESSION_TARGET_SCANNED , +ISCSI_SESSION_TARGET_UNBINDING , +ISCSI_SESSION_TARGET_MAX , +}; +#define ISCSI_MAX_TARGET -1struct iscsi_cls_session {
@@ -262,6 +270,7 @@ struct iscsi_cls_session {*/ pid_t creator;int state; +int target_state;/* session target bind state */ int sid;/* session id */ void *dd_data;/* LLD private data */ struct device dev;/* sysfs transport/container device */
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 2/24 cpufreq: Add Tegra234 to cpufreq-dt-platdev blocklist
From: Sumit Gupta <[email protected]>
[ Upstream commit 01c5bb0cc2a39fbc56ff9a5ef28b79447f0c2351 ]
Tegra234 platform uses the tegra194-cpufreq driver, so add it to the blocklist in cpufreq-dt-platdev driver to avoid the cpufreq driver registration from there.
--- drivers/cpufreq/cpufreq-dt-platdev.c | 1 + 1 file changed, 1 insertion(+)
drivers/cpufreq/cpufreq-dt-platdev.c +1 -0
@@ -133,6 +133,7 @@ static const struct of_device_id blocklist[] __initconst = { { .compatible = "nvidia,tegra30", }, { .compatible = "nvidia,tegra124", }, { .compatible = "nvidia,tegra210", }, + { .compatible = "nvidia,tegra234", }, { .compatible = "qcom,apq8096", }, { .compatible = "qcom,msm8996", },
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 3/24 kcsan: test: don't put the expect array on the stack
In reply to Sasha LevinFrom: Max Filippov <[email protected]>
[ Upstream commit 5b24ac2dfd3eb3e36f794af3aa7f2828b19035bd ]
Size of the 'expect' array in the __report_matches is 1536 bytes, which is exactly the default frame size warning limit of the xtensa architecture.
As a result allmodconfig xtensa kernel builds with the gcc that does not support the compiler plugins (which otherwise would push the said warning limit to 2K) fail with the following message:
kernel/kcsan/kcsan_test.c:257:1: error: the frame size of 1680 bytes
is larger than 1536 bytes
Fix it by dynamically allocating the 'expect' array.
--- kernel/kcsan/kcsan_test.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
kernel/kcsan/kcsan_test.c +6 -1
@@ -151,7 +151,7 @@ static bool report_matches(const struct expect_report *r)const bool is_assert = (r->access[0 ].type | r->access[1 ].type) &KCSAN_ACCESS_ASSERT ;bool ret = false;unsigned long flags; - typeof(observed.lines) expect; +typeof (*observed.lines) *expect;const char *end;char *cur;int i;
@@ -160,6 +160,10 @@ static bool report_matches(const struct expect_report *r)if (!report_available ())return false; + expect =kmalloc (sizeof (observed.lines),GFP_KERNEL ); +if (WARN_ON (!expect)) +return false; +/* Generate expected report contents. */ /* Title */
@@ -243,6 +247,7 @@ static bool report_matches(const struct expect_report *r) strstr(observed.lines[2], expect[1]))); out:spin_unlock_irqrestore (&observed.lock, flags); +kfree (expect);return ret; }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 4/24 cpufreq: Add SM6375 to cpufreq-dt-platdev blocklist
In reply to Sasha LevinFrom: Konrad Dybcio <[email protected]>
[ Upstream commit faf28e240dd118d9521c68aeb9388b9b8f02d9d0 ]
The Qualcomm SM6375 platform uses the qcom-cpufreq-hw driver, so add it to the cpufreq-dt-platdev driver's blocklist.
--- drivers/cpufreq/cpufreq-dt-platdev.c | 1 + 1 file changed, 1 insertion(+)
drivers/cpufreq/cpufreq-dt-platdev.c +1 -0
@@ -144,6 +144,7 @@ static const struct of_device_id blocklist[] __initconst = { { .compatible = "qcom,sc8180x", }, { .compatible = "qcom,sdm845", }, { .compatible = "qcom,sm6350", }, + { .compatible = "qcom,sm6375", }, { .compatible = "qcom,sm8150", }, { .compatible = "qcom,sm8250", }, { .compatible = "qcom,sm8350", },
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 5/24 ASoC: fsl_micfil: Correct the number of steps on SX controls
In reply to Sasha LevinFrom: Chancel Liu <[email protected]>
[ Upstream commit cdfa92eb90f5770b26a79824ef213ebdbbd988b1 ]
The parameter "max" of SOC_SINGLE_SX_TLV() means the number of steps rather than maximum value. This patch corrects the minimum value to -8 and the number of steps to 15.
--- sound/soc/fsl/fsl_micfil.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
sound/soc/fsl/fsl_micfil.c +8 -8
@@ -88,21 +88,21 @@ static DECLARE_TLV_DB_SCALE(gain_tlv, 0, 100, 0);static const struct snd_kcontrol_new fsl_micfil_snd_controls[] = {SOC_SINGLE_SX_TLV ("CH0 Volume" ,REG_MICFIL_OUT_CTRL , -MICFIL_OUTGAIN_CHX_SHIFT (0 ),0xF ,0x7 , gain_tlv), +MICFIL_OUTGAIN_CHX_SHIFT (0 ),0x8 ,0xF , gain_tlv),SOC_SINGLE_SX_TLV ("CH1 Volume" ,REG_MICFIL_OUT_CTRL , -MICFIL_OUTGAIN_CHX_SHIFT (1 ),0xF ,0x7 , gain_tlv), +MICFIL_OUTGAIN_CHX_SHIFT (1 ),0x8 ,0xF , gain_tlv),SOC_SINGLE_SX_TLV ("CH2 Volume" ,REG_MICFIL_OUT_CTRL , -MICFIL_OUTGAIN_CHX_SHIFT (2 ),0xF ,0x7 , gain_tlv), +MICFIL_OUTGAIN_CHX_SHIFT (2 ),0x8 ,0xF , gain_tlv),SOC_SINGLE_SX_TLV ("CH3 Volume" ,REG_MICFIL_OUT_CTRL , -MICFIL_OUTGAIN_CHX_SHIFT (3 ),0xF ,0x7 , gain_tlv), +MICFIL_OUTGAIN_CHX_SHIFT (3 ),0x8 ,0xF , gain_tlv),SOC_SINGLE_SX_TLV ("CH4 Volume" ,REG_MICFIL_OUT_CTRL , -MICFIL_OUTGAIN_CHX_SHIFT (4 ),0xF ,0x7 , gain_tlv), +MICFIL_OUTGAIN_CHX_SHIFT (4 ),0x8 ,0xF , gain_tlv),SOC_SINGLE_SX_TLV ("CH5 Volume" ,REG_MICFIL_OUT_CTRL , -MICFIL_OUTGAIN_CHX_SHIFT (5 ),0xF ,0x7 , gain_tlv), +MICFIL_OUTGAIN_CHX_SHIFT (5 ),0x8 ,0xF , gain_tlv),SOC_SINGLE_SX_TLV ("CH6 Volume" ,REG_MICFIL_OUT_CTRL , -MICFIL_OUTGAIN_CHX_SHIFT (6 ),0xF ,0x7 , gain_tlv), +MICFIL_OUTGAIN_CHX_SHIFT (6 ),0x8 ,0xF , gain_tlv),SOC_SINGLE_SX_TLV ("CH7 Volume" ,REG_MICFIL_OUT_CTRL , -MICFIL_OUTGAIN_CHX_SHIFT (7 ),0xF ,0x7 , gain_tlv), +MICFIL_OUTGAIN_CHX_SHIFT (7 ),0x8 ,0xF , gain_tlv),SOC_ENUM_EXT ("MICFIL Quality Select" , fsl_micfil_quality_enum, snd_soc_get_enum_double, snd_soc_put_enum_double),
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 6/24 net: usb: cdc_ether: add support for Thales Cinterion PLS62-W modem
In reply to Sasha LevinFrom: Hui Wang <[email protected]>
[ Upstream commit eea8ce81fbb544e3caad1a1c876ba1af467b3d3c ]
This modem has 7 interfaces, 5 of them are serial interfaces and are driven by cdc_acm, while 2 of them are wwan interfaces and are driven by cdc_ether:
If 0: Abstract (modem)
If 1: Abstract (modem)
If 2: Abstract (modem)
If 3: Abstract (modem)
If 4: Abstract (modem)
If 5: Ethernet Networking
If 6: Ethernet Networking
Without this change, the 2 network interfaces will be named to usb0 and usb1, our QA think the names are confusing and filed a bug on it.
After applying this change, the name will be wwan0 and wwan1, and they could work well with modem manager.
--- drivers/net/usb/cdc_ether.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/usb/cdc_ether.c +6 -0
@@ -1000,6 +1000,12 @@ static const struct usb_device_id products[] = { USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), .driver_info = (unsigned long)&wwan_info, +}, { +/* Cinterion PLS62-W modem by GEMALTO/THALES */ +USB_DEVICE_AND_INTERFACE_INFO (0x1e2d ,0x005b ,USB_CLASS_COMM , +USB_CDC_SUBCLASS_ETHERNET , + USB_CDC_PROTO_NONE), + .driver_info = (unsigned long )&wwan_info, }, {/* Cinterion PLS83/PLS63 modem by GEMALTO/THALES */ USB_DEVICE_AND_INTERFACE_INFO(0x1e2d, 0x0069, USB_CLASS_COMM,
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 7/24 drm: Add orientation quirk for Lenovo ideapad D330-10IGL
In reply to Sasha LevinFrom: Patrick Thompson <[email protected]>
[ Upstream commit 0688773f0710528e1ab302c3d6317e269f2e2e6e ]
Panel is 800x1280 but mounted on a detachable form factor sideways.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +6 -0
@@ -272,6 +272,12 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo ideapad D330-10IGM"), }, .driver_data = (void *)&lcd1200x1920_rightside_up, + }, { /* Lenovo Ideapad D330-10IGL (HD) */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"LENOVO" ), + DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo ideapad D330-10IGL"), + }, + .driver_data = (void *)&lcd800x1280_rightside_up, }, { /* Lenovo Yoga Book X90F / X91F / X91L */ .matches = {/* Non exact match to match all versions */
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 8/24 s390/debug: add _ASM_S390_ prefix to header guard
In reply to Sasha LevinFrom: Niklas Schnelle <[email protected]>
[ Upstream commit 0d4d52361b6c29bf771acd4fa461f06d78fb2fac ]
Using DEBUG_H without a prefix is very generic and inconsistent with other header guards in arch/s390/include/asm. In fact it collides with the same name in the ath9k wireless driver though that depends on !S390 via disabled wireless support. Let's just use a consistent header guard name and prevent possible future trouble.
--- arch/s390/include/asm/debug.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/s390/include/asm/debug.h +3 -3
@@ -4,8 +4,8 @@* * Copyright IBM Corp. 1999, 2020 */ -#ifndef DEBUG_H -#define DEBUG_H +#ifndef _ASM_S390_DEBUG_H +#define _ASM_S390_DEBUG_H#include <linux/string.h> #include <linux/spinlock.h>
@@ -487,4 +487,4 @@ void debug_register_static(debug_info_t *id, int pages_per_area, int nr_areas);#endif /* MODULE */ -#endif /* DEBUG_H */ +#endif /* _ASM_S390_DEBUG_H */
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 9/24 s390: expicitly align _edata and _end symbols on page boundary
In reply to Sasha LevinFrom: Alexander Gordeev <[email protected]>
[ Upstream commit 45d619bdaf799196d702a9ae464b07066d6db2f9 ]
Symbols _edata and _end in the linker script are the only unaligned expicitly on page boundary. Although _end is aligned implicitly by BSS_SECTION macro that is still inconsistent and could lead to a bug if a tool or function would assume that _edata is as aligned as others.
For example, vmem_map_init() function does not align symbols _etext, _einittext etc. Should these symbols be unaligned as well, the size of ranges to update were short on one page.
Instead of fixing every occurrence of this kind in the code and external tools just force the alignment on these two symbols.
--- arch/s390/kernel/vmlinux.lds.S | 2 ++ 1 file changed, 2 insertions(+)
arch/s390/kernel/vmlinux.lds.S +2 -0
@@ -80,6 +80,7 @@ SECTIONS _end_amode31_refs = .; } + . = ALIGN(PAGE_SIZE); _edata = .; /* End of data section */ /* will be freed after init */
@@ -194,6 +195,7 @@ SECTIONS BSS_SECTION(PAGE_SIZE, 4 * PAGE_SIZE, PAGE_SIZE) + . = ALIGN(PAGE_SIZE); _end = . ; /*
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 10/24 perf/x86/msr: Add Emerald Rapids
In reply to Sasha LevinFrom: Kan Liang <[email protected]>
[ Upstream commit 69ced4160969025821f2999ff92163ed26568f1c ]
The same as Sapphire Rapids, the SMI_COUNT MSR is also supported on Emerald Rapids. Add Emerald Rapids model.
--- arch/x86/events/msr.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/events/msr.c +1 -0
@@ -69,6 +69,7 @@ static bool test_intel(int idx, void *data)case INTEL_FAM6_BROADWELL_G :case INTEL_FAM6_BROADWELL_X :case INTEL_FAM6_SAPPHIRERAPIDS_X : +case INTEL_FAM6_EMERALDRAPIDS_X :case INTEL_FAM6_ATOM_SILVERMONT :case INTEL_FAM6_ATOM_SILVERMONT_D :
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 11/24 perf/x86/intel/uncore: Add Emerald Rapids
In reply to Sasha LevinFrom: Kan Liang <[email protected]>
[ Upstream commit 5268a2842066c227e6ccd94bac562f1e1000244f ]
From the perspective of the uncore PMU, the new Emerald Rapids is the same as the Sapphire Rapids. The only difference is the event list, which will be supported in the perf tool later.
--- arch/x86/events/intel/uncore.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/events/intel/uncore.c +1 -0
@@ -1829,6 +1829,7 @@ static const struct x86_cpu_id intel_uncore_match[] __initconst = {X86_MATCH_INTEL_FAM6_MODEL (ALDERLAKE , &adl_uncore_init),X86_MATCH_INTEL_FAM6_MODEL (ALDERLAKE_L , &adl_uncore_init),X86_MATCH_INTEL_FAM6_MODEL (SAPPHIRERAPIDS_X , &spr_uncore_init), +X86_MATCH_INTEL_FAM6_MODEL (EMERALDRAPIDS_X , &spr_uncore_init), X86_MATCH_INTEL_FAM6_MODEL(ATOM_TREMONT_D, &snr_uncore_init), {}, };
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 12/24 arm64/mm: Define dummy pud_user_exec() when using 2-level page-table
In reply to Sasha LevinFrom: Will Deacon <[email protected]>
[ Upstream commit 4e4ff23a35ee3a145fbc8378ecfeaab2d235cddd ]
With only two levels of page-table, the generic 'pud_*' macros are implemented using dummy operations in pgtable-nopmd.h. Since commit 730a11f982e6 ("arm64/mm: add pud_user_exec() check in pud_user_accessible_page()"), pud_user_accessible_page() unconditionally calls pud_user_exec(), which is an arm64-specific helper and therefore isn't defined by pgtable-nopmd.h. This results in a build failure for configurations with only two levels of page table:
arch/arm64/include/asm/pgtable.h: In function 'pud_user_accessible_page':
Quoted 1 line
Quoted 1 line
arch/arm64/include/asm/pgtable.h:870:51: error: implicit declaration of function 'pud_user_exec'; did you mean 'pmd_user_exec'? [-Werror=implicit-function-declaration]
870 | return pud_leaf(pud) && (pud_user(pud) || pud_user_exec(pud));
| ^~~~~~~~~~~~~
| pmd_user_execFix the problem by defining pud_user_exec() as pud_user() in this case.
--- arch/arm64/include/asm/pgtable.h | 1 + 1 file changed, 1 insertion(+)
arch/arm64/include/asm/pgtable.h +1 -0
@@ -675,6 +675,7 @@ static inline pmd_t *pud_pgtable(pud_t pud)#else #define pud_page_paddr (pud) ({ BUILD_BUG(); 0; }) +#define pud_user_exec (pud) pud_user(pud)/* Always 0 with folding */ /* Match pmd_offset folding in <asm/generic/pgtable-nopmd.h> */ #define pmd_set_fixmap (addr) NULL
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 13/24 cpufreq: armada-37xx: stop using 0 as NULL pointer
In reply to Sasha LevinFrom: Miles Chen <[email protected]>
[ Upstream commit 08f0adb193c008de640fde34a2e00a666c01d77c ]
Use NULL for NULL pointer to fix the following sparse warning:drivers/cpufreq/armada-37xx-cpufreq.c:448:32: sparse: warning: Using plain integer as NULL pointer
--- drivers/cpufreq/armada-37xx-cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/armada-37xx-cpufreq.c +1 -1
@@ -445,7 +445,7 @@ static int __init armada37xx_cpufreq_driver_init(void)return -ENODEV ; } - clk =clk_get (cpu_dev,0 ); + clk =clk_get (cpu_dev,NULL );if (IS_ERR (clk)) {dev_err (cpu_dev,"Cannot get clock for CPU0\n" );return PTR_ERR (clk);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 14/24 ASoC: fsl_ssi: Rename AC'97 streams to avoid collisions with AC'97 CODEC
In reply to Sasha LevinFrom: Mark Brown <[email protected]>
[ Upstream commit 8c6a42b5b0ed6f96624f56954e93eeae107440a6 ]
The SSI driver calls the AC'97 playback and transmit streams "AC97 Playback" and "AC97 Capture" respectively. This is the same name used by the generic AC'97 CODEC driver in ASoC, creating confusion for the Freescale ASoC card when it attempts to use these widgets in routing. Add a "CPU" in the name like the regular DAIs registered by the driver to disambiguate.
--- sound/soc/fsl/fsl-asoc-card.c | 8 ++++---- sound/soc/fsl/fsl_ssi.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-)
sound/soc/fsl/fsl-asoc-card.c +4 -4
@@ -120,11 +120,11 @@ static const struct snd_soc_dapm_route audio_map[] = {static const struct snd_soc_dapm_route audio_map_ac97[] = {/* 1st half -- Normal DAPM routes */ - {"Playback" ,NULL ,"AC97 Playback" }, - {"AC97 Capture" ,NULL ,"Capture" }, + {"Playback" ,NULL ,"CPU AC97 Playback" }, + {"CPU AC97 Capture" ,NULL ,"Capture" },/* 2nd half -- ASRC DAPM routes */ - {"AC97 Playback" ,NULL ,"ASRC-Playback" }, - {"ASRC-Capture" ,NULL ,"AC97 Capture" }, + {"CPU AC97 Playback" ,NULL ,"ASRC-Playback" }, + {"ASRC-Capture" ,NULL ,"CPU AC97 Capture" }, };static const struct snd_soc_dapm_route audio_map_tx[] = {
sound/soc/fsl/fsl_ssi.c +2 -2
@@ -1160,14 +1160,14 @@ static struct snd_soc_dai_driver fsl_ssi_ac97_dai = { .symmetric_channels = 1, .probe = fsl_ssi_dai_probe, .playback = { - .stream_name = "AC97 Playback", + .stream_name = "CPU AC97 Playback", .channels_min = 2, .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_48000, .formats = SNDRV_PCM_FMTBIT_S16 | SNDRV_PCM_FMTBIT_S20, }, .capture = { - .stream_name = "AC97 Capture", + .stream_name = "CPU AC97 Capture", .channels_min = 2, .channels_max = 2, .rates = SNDRV_PCM_RATE_48000,
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 15/24 ASoC: fsl-asoc-card: Fix naming of AC'97 CODEC widgets
In reply to Sasha LevinFrom: Mark Brown <[email protected]>
[ Upstream commit 242fc66ae6e1e2b8519daacc7590a73cd0e8a6e4 ]
The fsl-asoc-card AC'97 support currently tries to route to Playback and Capture widgets provided by the AC'97 CODEC. This doesn't work since the generic AC'97 driver registers with an "AC97" at the front of the stream and hence widget names, update to reflect reality. It's not clear to me if or how this ever worked.
--- sound/soc/fsl/fsl-asoc-card.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/fsl/fsl-asoc-card.c +2 -2
@@ -120,8 +120,8 @@ static const struct snd_soc_dapm_route audio_map[] = {static const struct snd_soc_dapm_route audio_map_ac97[] = {/* 1st half -- Normal DAPM routes */ - {"Playback" ,NULL ,"CPU AC97 Playback" }, - {"CPU AC97 Capture" ,NULL ,"Capture" }, + {"AC97 Playback" ,NULL ,"CPU AC97 Playback" }, + {"CPU AC97 Capture" ,NULL ,"AC97 Capture" },/* 2nd half -- ASRC DAPM routes */ {"CPU AC97 Playback" ,NULL ,"ASRC-Playback" }, {"ASRC-Capture" ,NULL ,"CPU AC97 Capture" },
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 16/24 spi: spidev: fix a race condition when accessing spidev->spi
In reply to Sasha LevinFrom: Bartosz Golaszewski <[email protected]>
[ Upstream commit a720416d94634068951773cb9e9d6f1b73769e5b ]
There's a spinlock in place that is taken in file_operations callbacks whenever we check if spidev->spi is still alive (not null). It's also taken when spidev->spi is set to NULL in remove().
This however doesn't protect the code against driver unbind event while one of the syscalls is still in progress. To that end we need a lock taken continuously as long as we may still access spidev->spi. As both the file ops and the remove callback are never called from interrupt context, we can replace the spinlock with a mutex.
--- drivers/spi/spidev.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-)
drivers/spi/spidev.c +18 -16
@@ -67,7 +67,7 @@ static DECLARE_BITMAP(minors, N_SPI_MINORS);struct spidev_data {dev_t devt; -spinlock_t spi_lock; +struct mutex spi_lock;struct spi_device *spi;struct list_head device_entry;
@@ -94,9 +94,8 @@ spidev_sync(struct spidev_data *spidev, struct spi_message *message)int status;struct spi_device *spi; -spin_lock_irq (&spidev->spi_lock); +mutex_lock (&spidev->spi_lock); spi = spidev->spi; -spin_unlock_irq (&spidev->spi_lock);if (spi ==NULL ) status = -ESHUTDOWN ;
@@ -106,6 +105,7 @@ spidev_sync(struct spidev_data *spidev, struct spi_message *message)if (status ==0 ) status = message->actual_length; +mutex_unlock (&spidev->spi_lock);return status; }
@@ -358,12 +358,12 @@ spidev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)* we issue this ioctl. */ spidev = filp->private_data; -spin_lock_irq (&spidev->spi_lock); +mutex_lock (&spidev->spi_lock); spi =spi_dev_get (spidev->spi); -spin_unlock_irq (&spidev->spi_lock); - -if (spi ==NULL ) +if (spi ==NULL ) { +mutex_unlock (&spidev->spi_lock);return -ESHUTDOWN ; + }/* use the buffer lock here for triple duty: * - prevent I/O (from us) so calling spi_setup() is safe;
@@ -500,6 +500,7 @@ spidev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)mutex_unlock (&spidev->buf_lock);spi_dev_put (spi); +mutex_unlock (&spidev->spi_lock);return retval; }
@@ -521,12 +522,12 @@ spidev_compat_ioc_message(struct file *filp, unsigned int cmd,* we issue this ioctl. */ spidev = filp->private_data; -spin_lock_irq (&spidev->spi_lock); +mutex_lock (&spidev->spi_lock); spi =spi_dev_get (spidev->spi); -spin_unlock_irq (&spidev->spi_lock); - -if (spi ==NULL ) +if (spi ==NULL ) { +mutex_unlock (&spidev->spi_lock);return -ESHUTDOWN ; + }/* SPI_IOC_MESSAGE needs the buffer locked "normally" */ mutex_lock (&spidev->buf_lock);
@@ -553,6 +554,7 @@ spidev_compat_ioc_message(struct file *filp, unsigned int cmd, done:mutex_unlock (&spidev->buf_lock);spi_dev_put (spi); +mutex_unlock (&spidev->spi_lock);return retval; }
@@ -631,10 +633,10 @@ static int spidev_release(struct inode *inode, struct file *filp) spidev = filp->private_data; filp->private_data =NULL ; -spin_lock_irq (&spidev->spi_lock); +mutex_lock (&spidev->spi_lock);/* ... after we unbound from the underlying device? */ dofree = (spidev->spi ==NULL ); -spin_unlock_irq (&spidev->spi_lock); +mutex_unlock (&spidev->spi_lock);/* last close? */ spidev->users--;
@@ -775,7 +777,7 @@ static int spidev_probe(struct spi_device *spi)/* Initialize the driver data */ spidev->spi = spi; -spin_lock_init (&spidev->spi_lock); +mutex_init (&spidev->spi_lock);mutex_init (&spidev->buf_lock);INIT_LIST_HEAD (&spidev->device_entry);
@@ -820,9 +822,9 @@ static int spidev_remove(struct spi_device *spi)/* prevent new opens */ mutex_lock (&device_list_lock);/* make sure ops on existing fds can abort cleanly */ -spin_lock_irq (&spidev->spi_lock); +mutex_lock (&spidev->spi_lock); spidev->spi =NULL ; -spin_unlock_irq (&spidev->spi_lock); +mutex_unlock (&spidev->spi_lock);list_del (&spidev->device_entry);device_destroy (spidev_class, spidev->devt);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 17/24 spi: spidev: remove debug messages that access spidev->spi without locking
In reply to Sasha LevinFrom: Bartosz Golaszewski <[email protected]>
[ Upstream commit 6b35b173dbc1711f8d272e3f322d2ad697015919 ]
The two debug messages in spidev_open() dereference spidev->spi without taking the lock and without checking if it's not null. This can lead to a crash. Drop the messages as they're not needed - the user-space will get informed about ENOMEM with the syscall return value.
--- drivers/spi/spidev.c | 2 -- 1 file changed, 2 deletions(-)
drivers/spi/spidev.c +0 -2
@@ -594,7 +594,6 @@ static int spidev_open(struct inode *inode, struct file *filp)if (!spidev->tx_buffer) { spidev->tx_buffer =kmalloc (bufsiz,GFP_KERNEL );if (!spidev->tx_buffer) { -dev_dbg (&spidev->spi->dev,"open/ENOMEM\n" ); status = -ENOMEM ; goto err_find_dev; }
@@ -603,7 +602,6 @@ static int spidev_open(struct inode *inode, struct file *filp)if (!spidev->rx_buffer) { spidev->rx_buffer =kmalloc (bufsiz,GFP_KERNEL );if (!spidev->rx_buffer) { -dev_dbg (&spidev->spi->dev,"open/ENOMEM\n" ); status = -ENOMEM ; goto err_alloc_rx_buf; }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 18/24 KVM: s390: interrupt: use READ_ONCE() before cmpxchg()
In reply to Sasha LevinFrom: Heiko Carstens <[email protected]>
[ Upstream commit 42400d99e9f0728c17240edb9645637ead40f6b9 ]
Use READ_ONCE() before cmpxchg() to prevent that the compiler generates code that fetches the to be compared old value several times from memory.
--- arch/s390/kvm/interrupt.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
arch/s390/kvm/interrupt.c +8 -4
@@ -81,8 +81,9 @@ static int sca_inject_ext_call(struct kvm_vcpu *vcpu, int src_id)struct esca_block *sca = vcpu->kvm->arch.sca;union esca_sigp_ctrl *sigp_ctrl = &(sca->cpu[vcpu->vcpu_id].sigp_ctrl); -union esca_sigp_ctrl new_val = {0 }, old_val = *sigp_ctrl; +union esca_sigp_ctrl new_val = {0 }, old_val; + old_val =READ_ONCE (*sigp_ctrl); new_val.scn = src_id; new_val.c =1 ; old_val.c =0 ;
@@ -93,8 +94,9 @@ static int sca_inject_ext_call(struct kvm_vcpu *vcpu, int src_id)struct bsca_block *sca = vcpu->kvm->arch.sca;union bsca_sigp_ctrl *sigp_ctrl = &(sca->cpu[vcpu->vcpu_id].sigp_ctrl); -union bsca_sigp_ctrl new_val = {0 }, old_val = *sigp_ctrl; +union bsca_sigp_ctrl new_val = {0 }, old_val; + old_val =READ_ONCE (*sigp_ctrl); new_val.scn = src_id; new_val.c =1 ; old_val.c =0 ;
@@ -124,16 +126,18 @@ static void sca_clear_ext_call(struct kvm_vcpu *vcpu)struct esca_block *sca = vcpu->kvm->arch.sca;union esca_sigp_ctrl *sigp_ctrl = &(sca->cpu[vcpu->vcpu_id].sigp_ctrl); -union esca_sigp_ctrl old = *sigp_ctrl; +union esca_sigp_ctrl old; + old =READ_ONCE (*sigp_ctrl); expect = old.value; rc =cmpxchg (&sigp_ctrl->value, old.value,0 ); }else {struct bsca_block *sca = vcpu->kvm->arch.sca;union bsca_sigp_ctrl *sigp_ctrl = &(sca->cpu[vcpu->vcpu_id].sigp_ctrl); -union bsca_sigp_ctrl old = *sigp_ctrl; +union bsca_sigp_ctrl old; + old =READ_ONCE (*sigp_ctrl); expect = old.value; rc =cmpxchg (&sigp_ctrl->value, old.value,0 ); }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 19/24 scsi: hisi_sas: Set a port invalid only if there are no devices attached when refreshing port id
In reply to Sasha LevinFrom: Yihang Li <[email protected]>
[ Upstream commit f58c89700630da6554b24fd3df293a24874c10c1 ]
Currently the driver sets the port invalid if one phy in the port is not enabled, which may cause issues in expander situation. In directly attached situation, if phy up doesn't occur in time when refreshing port id, the port is incorrectly set to invalid which will also cause disk lost.
Therefore set a port invalid only if there are no devices attached to the port.
--- drivers/scsi/hisi_sas/hisi_sas_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/hisi_sas/hisi_sas_main.c +1 -1
@@ -1414,7 +1414,7 @@ static void hisi_sas_refresh_port_id(struct hisi_hba *hisi_hba) device->linkrate = phy->sas_phy.linkrate; hisi_hba->hw->setup_itct (hisi_hba, sas_dev); - }else + }else if (!port->port_attached) port->id =0xff ; } }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 20/24 r8152: add vendor/device ID pair for Microsoft Devkit
In reply to Sasha LevinFrom: Andre Przywara <[email protected]>
[ Upstream commit be53771c87f4e322a9835d3faa9cd73a4ecdec5b ]
The Microsoft Devkit 2023 is a an ARM64 based machine featuring a Realtek 8153 USB3.0-to-GBit Ethernet adapter. As in their other machines, Microsoft uses a custom USB device ID.
Add the respective ID values to the driver. This makes Ethernet work on the MS Devkit device. The chip has been visually confirmed to be a RTL8153.
--- drivers/net/usb/r8152.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/usb/r8152.c +1 -0
@@ -9809,6 +9809,7 @@ static const struct usb_device_id rtl8152_table[] = {REALTEK_USB_DEVICE (VENDOR_ID_MICROSOFT ,0x07ab ),REALTEK_USB_DEVICE (VENDOR_ID_MICROSOFT ,0x07c6 ),REALTEK_USB_DEVICE (VENDOR_ID_MICROSOFT ,0x0927 ), +REALTEK_USB_DEVICE (VENDOR_ID_MICROSOFT ,0x0c5e ),REALTEK_USB_DEVICE (VENDOR_ID_SAMSUNG ,0xa101 ),REALTEK_USB_DEVICE (VENDOR_ID_LENOVO ,0x304f ), REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x3054),
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 21/24 platform/x86: touchscreen_dmi: Add info for the CSL Panther Tab HD
In reply to Sasha LevinFrom: Michael Klein <[email protected]>
[ Upstream commit 36c2b9d6710427f802494ba070621cb415198293 ]
Add touchscreen info for the CSL Panther Tab HD.
--- drivers/platform/x86/touchscreen_dmi.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
drivers/platform/x86/touchscreen_dmi.c +25 -0
@@ -255,6 +255,23 @@ static const struct ts_dmi_data connect_tablet9_data = { .properties = connect_tablet9_props, }; +static const struct property_entry csl_panther_tab_hd_props[] = { +PROPERTY_ENTRY_U32 ("touchscreen-min-x" ,1 ), +PROPERTY_ENTRY_U32 ("touchscreen-min-y" ,20 ), +PROPERTY_ENTRY_U32 ("touchscreen-size-x" ,1980 ), +PROPERTY_ENTRY_U32 ("touchscreen-size-y" ,1526 ), +PROPERTY_ENTRY_BOOL ("touchscreen-inverted-y" ), +PROPERTY_ENTRY_BOOL ("touchscreen-swapped-x-y" ), +PROPERTY_ENTRY_STRING ("firmware-name" ,"gsl1680-csl-panther-tab-hd.fw" ), +PROPERTY_ENTRY_U32 ("silead,max-fingers" ,10 ), + { } +}; + +static const struct ts_dmi_data csl_panther_tab_hd_data = { + .acpi_name ="MSSL1680:00" , + .properties = csl_panther_tab_hd_props, +}; +static const struct property_entry cube_iwork8_air_props[] = {PROPERTY_ENTRY_U32 ("touchscreen-min-x" ,1 ),PROPERTY_ENTRY_U32 ("touchscreen-min-y" ,3 ),
@@ -1100,6 +1117,14 @@ const struct dmi_system_id touchscreen_dmi_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "Tablet 9"), }, }, + { +/* CSL Panther Tab HD */ + .driver_data = (void *)&csl_panther_tab_hd_data, + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"CSL Computer GmbH & Co. KG" ), + DMI_MATCH(DMI_PRODUCT_NAME, "CSL Panther Tab HD"), + }, + }, {/* CUBE iwork8 Air */ .driver_data = (void *)&cube_iwork8_air_data,
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 22/24 platform/x86: asus-nb-wmi: Add alternate mapping for KEY_SCREENLOCK
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit db9494895b405bf318dc7e563dee6daa51b3b6ed ]
The 0x33 keycode is emitted by Fn + F6 on a ASUS FX705GE laptop.
--- drivers/platform/x86/asus-nb-wmi.c | 1 + 1 file changed, 1 insertion(+)
drivers/platform/x86/asus-nb-wmi.c +1 -0
@@ -521,6 +521,7 @@ static const struct key_entry asus_nb_wmi_keymap[] = { { KE_KEY, 0x30, { KEY_VOLUMEUP } }, { KE_KEY, 0x31, { KEY_VOLUMEDOWN } }, { KE_KEY, 0x32, { KEY_MUTE } }, + { KE_KEY, 0x33, { KEY_SCREENLOCK } }, { KE_KEY, 0x35, { KEY_SCREENLOCK } }, { KE_KEY, 0x40, { KEY_PREVIOUSSONG } }, { KE_KEY, 0x41, { KEY_NEXTSONG } },
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 23/24 lockref: stop doing cpu_relax in the cmpxchg loop
In reply to Sasha LevinFrom: Mateusz Guzik <[email protected]>
[ Upstream commit f5fe24ef17b5fbe6db49534163e77499fb10ae8c ]
On the x86-64 architecture even a failing cmpxchg grants exclusive access to the cacheline, making it preferable to retry the failed op immediately instead of stalling with the pause instruction.
To illustrate the impact, below are benchmark results obtained by running various will-it-scale tests on top of the 6.2-rc3 kernel and Cascade Lake (2 sockets * 24 cores * 2 threads) CPU.
All results in ops/s. Note there is some variance in re-runs, but the code is consistently faster when contention is present.
open3 ("Same file open/close"):
proc stock no-pause
1 805603 814942 (+%1)
2 1054980 1054781 (-0%)
8 1544802 1822858 (+18%)
24 1191064 2199665 (+84%)
48 851582 1469860 (+72%)
96 609481 1427170 (+134%) fstat2 ("Same file fstat"):
proc stock no-pause
1 3013872 3047636 (+1%)
2 4284687 4400421 (+2%)
8 3257721 5530156 (+69%)
24 2239819 5466127 (+144%)
48 1701072 5256609 (+209%)
96 1269157 6649326 (+423%)Additionally, a kernel with a private patch to help access() scalability:
access2 ("Same file access"):
proc stock patched patched
+nopause
24 2378041 2005501 5370335 (-15% / +125%)That is, fixing the problems in access itself *reduces* scalability after the cacheline ping-pong only happens in lockref with the pause instruction.
Note that fstat and access benchmarks are not currently integrated into will-it-scale, but interested parties can find them in pull requests to said project.
Code at hand has a rather tortured history. First modification showed up in commit d472d9d98b46 ("lockref: Relax in cmpxchg loop"), written with Itanium in mind. Later it got patched up to use an arch-dependent macro to stop doing it on s390 where it caused a significant regression. Said macro had undergone revisions and was ultimately eliminated later, going back to cpu_relax.
While I intended to only remove cpu_relax for x86-64, I got the following comment from Linus:
I would actually prefer just removing it entirely and see if somebody else hollers. You have the numbers to prove it hurts on real hardware, and I don't think we have any numbers to the contrary.
So I think it's better to trust the numbers and remove it as a failure, than say "let's just remove it on x86-64 and leave everybody else with the potentially broken code"
Additionally, Will Deacon (maintainer of the arm64 port, one of the architectures previously benchmarked):
So, from the arm64 side of the fence, I'm perfectly happy just removing the cpu_relax() calls from lockref.
As such, come back full circle in history and whack it altogether.
--- lib/lockref.c | 1 - 1 file changed, 1 deletion(-)
lib/lockref.c +0 -1
@@ -24,7 +24,6 @@ } \if (!--retry) \break ; \ -cpu_relax (); \ } \ }while (0 )
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 24/24 firmware: coreboot: Check size of table entry and use flex-array
In reply to Sasha LevinFrom: Kees Cook <[email protected]>
[ Upstream commit 3b293487b8752cc42c1cbf8a0447bc6076c075fa ]
The memcpy() of the data following a coreboot_table_entry couldn't be evaluated by the compiler under CONFIG_FORTIFY_SOURCE. To make it easier to reason about, add an explicit flexible array member to struct coreboot_device so the entire entry can be copied at once. Additionally, validate the sizes before copying. Avoids this run-time false positive warning:
memcpy: detected field-spanning write (size 168) of single field "&device->entry" at drivers/firmware/google/coreboot_table.c:103 (size 8)
--- drivers/firmware/google/coreboot_table.c | 9 +++++++-- drivers/firmware/google/coreboot_table.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/firmware/google/coreboot_table.c +7 -2
@@ -93,7 +93,12 @@ static int coreboot_table_populate(struct device *dev, void *ptr)for (i =0 ; i < header->table_entries; i++) { entry = ptr_entry; - device =kzalloc (sizeof (struct device ) + entry->size,GFP_KERNEL ); +if (entry->size <sizeof (*entry)) { +dev_warn (dev,"coreboot table entry too small!\n" ); +return -EINVAL ; + } + + device =kzalloc (sizeof (device->dev) + entry->size,GFP_KERNEL );if (!device)return -ENOMEM ;
@@ -101,7 +106,7 @@ static int coreboot_table_populate(struct device *dev, void *ptr) device->dev.parent = dev; device->dev.bus = &coreboot_bus_type; device->dev.release = coreboot_device_release; -memcpy (&device->entry, ptr_entry, entry->size); +memcpy (device->raw, ptr_entry, entry->size); ret =device_register (&device->dev);if (ret) {
drivers/firmware/google/coreboot_table.h +1 -0
@@ -66,6 +66,7 @@ struct coreboot_device {struct coreboot_table_entry entry;struct lb_cbmem_ref cbmem_ref;struct lb_framebuffer framebuffer; +DECLARE_FLEX_ARRAY (u8, raw); }; };
Signature · 1 line
2.35.1