ARC: u-boot args: check that magic number is correct
Subsystems (13)
Sasha Levin
maintainerPATCH 1/52 ARC: u-boot args: check that magic number is correct
From: Eugeniy Paltsev <[email protected]>
[ Upstream commit edb64bca50cd736c6894cc6081d5263c007ce005 ]
In case of devboards we really often disable bootloader and load Linux image in memory via JTAG. Even if kernel tries to verify uboot_tag and uboot_arg there is sill a chance that we treat some garbage in registers as valid u-boot arguments in JTAG case. E.g. it is enough to have '1' in r0 to treat any value in r2 as a boot command line.
So check that magic number passed from u-boot is correct and drop u-boot arguments otherwise. That helps to reduce the possibility of using garbage as u-boot arguments in JTAG case.
We can safely check U-boot magic value (0x0) in linux passed via r1 register as U-boot pass it from the beginning. So there is no backward-compatibility issues.
--- arch/arc/kernel/head.S | 1 + arch/arc/kernel/setup.c | 8 ++++++++ 2 files changed, 9 insertions(+)
arch/arc/kernel/head.S +1 -0
@@ -107,6 +107,7 @@ ENTRY(stext) ; r2 = pointer to uboot provided cmdline or external DTB in mem ; These are handled later in handle_uboot_args() st r0, [@uboot_tag] + st r1, [@uboot_magic] st r2, [@uboot_arg] #endif
arch/arc/kernel/setup.c +8 -0
@@ -35,6 +35,7 @@ unsigned int intr_to_DE_cnt;/* Part of U-boot ABI: see head.S */ int __initdata uboot_tag; +int __initdata uboot_magic;char __initdata *uboot_arg;const struct machine_desc *machine_desc;
@@ -484,6 +485,8 @@ static inline bool uboot_arg_invalid(unsigned long addr)#define UBOOT_TAG_NONE 0#define UBOOT_TAG_CMDLINE 1#define UBOOT_TAG_DTB 2 +/* We always pass 0 as magic from U-boot */ +#define UBOOT_MAGIC_VALUE 0void __init handle_uboot_args (void ) {
@@ -499,6 +502,11 @@ void __init handle_uboot_args(void) goto ignore_uboot_args; } +if (uboot_magic !=UBOOT_MAGIC_VALUE ) { +pr_warn (IGNORE_ARGS "non zero uboot magic\n" ); + goto ignore_uboot_args; + } +if (uboot_tag !=UBOOT_TAG_NONE &&uboot_arg_invalid ((unsigned long )uboot_arg)) {pr_warn (IGNORE_ARGS "invalid uboot arg: '%px'\n" , uboot_arg);
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 2/52 arc: hsdk_defconfig: Enable CONFIG_BLK_DEV_RAM
From: Corentin Labbe <[email protected]>
[ Upstream commit 0728aeb7ead99a9b0dac2f3c92b3752b4e02ff97 ]
We have now a HSDK device in our kernelci lab, but kernel builded via the hsdk_defconfig lacks ramfs supports, so it cannot boot kernelci jobs yet.
So this patch enable CONFIG_BLK_DEV_RAM in hsdk_defconfig.
--- arch/arc/configs/hsdk_defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arc/configs/hsdk_defconfig +1 -0
@@ -8,6 +8,7 @@ CONFIG_NAMESPACES=y # CONFIG_UTS_NS is not set # CONFIG_PID_NS is not set CONFIG_BLK_DEV_INITRD=y +CONFIG_BLK_DEV_RAM=y CONFIG_EMBEDDED=y CONFIG_PERF_EVENTS=y # CONFIG_VM_EVENT_COUNTERS is not set
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 13/52 IB/mlx4: Fix race condition between catas error reset and aliasguid flows
In reply to Sasha LevinFrom: Jack Morgenstein <[email protected]>
[ Upstream commit 587443e7773e150ae29e643ee8f41a1eed226565 ]
Code review revealed a race condition which could allow the catas error flow to interrupt the alias guid query post mechanism at random points. Thiis is fixed by doing cancel_delayed_work_sync() instead of cancel_delayed_work() during the alias guid mechanism destroy flow.
--- drivers/infiniband/hw/mlx4/alias_GUID.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/mlx4/alias_GUID.c +1 -1
@@ -804,8 +804,8 @@ void mlx4_ib_destroy_alias_guid_service(struct mlx4_ib_dev *dev)unsigned long flags;for (i =0 ; i < dev->num_ports; i++) { -cancel_delayed_work (&dev->sriov.alias_guid.ports_guid[i].alias_guid_work); det = &sriov->alias_guid.ports_guid[i]; +cancel_delayed_work_sync (&det->alias_guid_work);spin_lock_irqsave (&sriov->alias_guid.ag_work_lock, flags);while (!list_empty (&det->cb_list)) { cb_ctx = list_entry(det->cb_list.next,
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 14/52 i40iw: Avoid panic when handling the inetdev event
In reply to Sasha LevinFrom: Feng Tang <[email protected]>
[ Upstream commit ec4fe4bcc584b55e24e8d1768f5510a62c0fd619 ]
There is a panic reported that on a system with x722 ethernet, when doing the operations like:
# ip link add br0 type bridge # ip link set eno1 master br0 # systemctl restart systemd-networkd
The system will panic "BUG: unable to handle kernel null pointer dereference at 0000000000000034", with call chain:
i40iw_inetaddr_event notifier_call_chain blocking_notifier_call_chain notifier_call_chain __inet_del_ifa inet_rtm_deladdr rtnetlink_rcv_msg netlink_rcv_skb rtnetlink_rcv netlink_unicast netlink_sendmsg sock_sendmsg __sys_sendto
It is caused by "local_ipaddr = ntohl(in->ifa_list->ifa_address)", while the in->ifa_list is NULL.
So add a check for the "in->ifa_list == NULL" case, and skip the ARP operation accordingly.
--- drivers/infiniband/hw/i40iw/i40iw_utils.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/infiniband/hw/i40iw/i40iw_utils.c +11 -1
@@ -173,7 +173,12 @@ int i40iw_inetaddr_event(struct notifier_block *notifier,rcu_read_lock (); in =__in_dev_get_rcu (upper_dev); - local_ipaddr =ntohl (in->ifa_list->ifa_address); + +if (!in->ifa_list) + local_ipaddr =0 ; +else + local_ipaddr =ntohl (in->ifa_list->ifa_address); +rcu_read_unlock (); }else { local_ipaddr =ntohl (ifa->ifa_address);
@@ -185,6 +190,11 @@ int i40iw_inetaddr_event(struct notifier_block *notifier,case NETDEV_UP :/* Fall through */ case NETDEV_CHANGEADDR : + +/* Just skip if no need to handle ARP cache */ +if (!local_ipaddr) +break ; + i40iw_manage_arp_cache(iwdev, netdev->dev_addr, &local_ipaddr,
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 15/52 mmc: davinci: remove extraneous __init annotation
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 9ce58dd7d9da3ca0d7cb8c9568f1c6f4746da65a ]
Building with clang finds a mistaken __init tag:
WARNING: vmlinux.o(.text+0x5e4250): Section mismatch in reference from the function davinci_mmcsd_probe() to the function .init.text:init_mmcsd_host() The function davinci_mmcsd_probe() references
the function __init init_mmcsd_host().
This is often because davinci_mmcsd_probe lacks a __init
annotation or the annotation of init_mmcsd_host is wrong.
--- drivers/mmc/host/davinci_mmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/davinci_mmc.c +1 -1
@@ -1117,7 +1117,7 @@ static inline void mmc_davinci_cpufreq_deregister(struct mmc_davinci_host *host) { }#endif -static void __init init_mmcsd_host (struct mmc_davinci_host *host) +static void init_mmcsd_host (struct mmc_davinci_host *host) {mmc_davinci_reset_ctrl (host,1 );
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 17/52 thermal/intel_powerclamp: fix __percpu declaration of worker_data
In reply to Sasha LevinFrom: Luc Van Oostenryck <[email protected]>
[ Upstream commit aa36e3616532f82a920b5ebf4e059fbafae63d88 ]
This variable is declared as:
static struct powerclamp_worker_data * __percpu worker_data;
In other words, a percpu pointer to struct ...
But this variable not used like so but as a pointer to a percpu struct powerclamp_worker_data.
So fix the declaration as:
static struct powerclamp_worker_data __percpu *worker_data;
This also quiets Sparse's warnings from __verify_pcpu_ptr(), like:
494:49: warning: incorrect type in initializer (different address spaces)
494:49: expected void const [noderef] <asn:3> *__vpp_verify
494:49: got struct powerclamp_worker_data *
--- drivers/thermal/intel_powerclamp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/intel_powerclamp.c +1 -1
@@ -101,7 +101,7 @@ struct powerclamp_worker_data {bool clamping; }; -static struct powerclamp_worker_data *__percpu worker_data; +static struct powerclamp_worker_data __percpu *worker_data;static struct thermal_cooling_device *cooling_dev;static unsigned long *cpu_clamping_mask;/* bit map for tracking per cpu * clamping kthread worker
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 18/52 thermal: samsung: Fix incorrect check after code merge
In reply to Sasha LevinFrom: Marek Szyprowski <[email protected]>
[ Upstream commit 3b5236cc5d086dd3ddd01113ee9255421aab9fab ]
Merge commit 19785cf93b6c ("Merge branch 'linus' ofgit://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal")
broke the code introduced by commit ffe6e16f14fa ("thermal: exynos: Reduce severity of too early temperature read"). Restore the original code from the mentioned commit to finally fix the warning message during boot:
thermal thermal_zone0: failed to read out thermal zone (-22)
--- drivers/thermal/samsung/exynos_tmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/samsung/exynos_tmu.c +1 -1
@@ -666,7 +666,7 @@ static int exynos_get_temp(void *p, int *temp)struct exynos_tmu_data *data = p;int value, ret =0 ; -if (!data || !data->tmu_read || !data->enabled) +if (!data || !data->tmu_read)return -EINVAL ;else if (!data->enabled)/*
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 19/52 thermal: bcm2835: Fix crash in bcm2835_thermal_debugfs
In reply to Sasha LevinFrom: Phil Elwell <[email protected]>
[ Upstream commit 35122495a8c6683e863acf7b05a7036b2be64c7a ]
"cat /sys/kernel/debug/bcm2835_thermal/regset" causes a NULL pointer dereference in bcm2835_thermal_debugfs. The driver makes use of the implementation details of the thermal framework to retrieve a pointer to its private data from a struct thermal_zone_device, and gets it wrong - leading to the crash. Instead, store its private data as the drvdata and retrieve the thermal_zone_device pointer from it.
--- drivers/thermal/broadcom/bcm2835_thermal.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/thermal/broadcom/bcm2835_thermal.c +4 -5
@@ -128,8 +128,7 @@ static const struct debugfs_reg32 bcm2835_thermal_regs[] = {static void bcm2835_thermal_debugfs (struct platform_device *pdev) { -struct thermal_zone_device *tz =platform_get_drvdata (pdev); -struct bcm2835_thermal_data *data = tz->devdata; +struct bcm2835_thermal_data *data =platform_get_drvdata (pdev);struct debugfs_regset32 *regset; data->debugfsdir =debugfs_create_dir ("bcm2835_thermal" ,NULL );
@@ -275,7 +274,7 @@ static int bcm2835_thermal_probe(struct platform_device *pdev) data->tz = tz; -platform_set_drvdata (pdev, tz); +platform_set_drvdata (pdev, data);/* * Thermal_zone doesn't enable hwmon as default,
@@ -299,8 +298,8 @@ static int bcm2835_thermal_probe(struct platform_device *pdev)static int bcm2835_thermal_remove (struct platform_device *pdev) { -struct thermal_zone_device *tz =platform_get_drvdata (pdev); -struct bcm2835_thermal_data *data = tz->devdata; +struct bcm2835_thermal_data *data =platform_get_drvdata (pdev); +struct thermal_zone_device *tz = data->tz;debugfs_remove_recursive (data->debugfsdir);thermal_zone_of_sensor_unregister (&pdev->dev, tz);
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 20/52 thermal/int340x_thermal: Add additional UUIDs
In reply to Sasha LevinFrom: Matthew Garrett <[email protected]>
[ Upstream commit 16fc8eca1975358111dbd7ce65e4ce42d1a848fb ]
Add more supported DPTF policies than the driver currently exposes.
--- drivers/thermal/int340x_thermal/int3400_thermal.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/thermal/int340x_thermal/int3400_thermal.c +14 -0
@@ -22,6 +22,13 @@ enum int3400_thermal_uuid {INT3400_THERMAL_PASSIVE_1 ,INT3400_THERMAL_ACTIVE ,INT3400_THERMAL_CRITICAL , +INT3400_THERMAL_ADAPTIVE_PERFORMANCE , +INT3400_THERMAL_EMERGENCY_CALL_MODE , +INT3400_THERMAL_PASSIVE_2 , +INT3400_THERMAL_POWER_BOSS , +INT3400_THERMAL_VIRTUAL_SENSOR , +INT3400_THERMAL_COOLING_MODE , +INT3400_THERMAL_HARDWARE_DUTY_CYCLING , INT3400_THERMAL_MAXIMUM_UUID, };
@@ -29,6 +36,13 @@ static char *int3400_thermal_uuids[INT3400_THERMAL_MAXIMUM_UUID] = {"42A441D6-AE6A-462b-A84B-4A8CE79027D3" ,"3A95C389-E4B8-4629-A526-C52C88626BAE" ,"97C68AE7-15FA-499c-B8C9-5DA81D606E0A" , +"63BE270F-1C11-48FD-A6F7-3AF253FF3E2D" , +"5349962F-71E6-431D-9AE8-0A635B710AEE" , +"9E04115A-AE87-4D1C-9500-0F3E340BFE75" , +"F5A35014-C209-46A4-993A-EB56DE7530A1" , +"6ED722A7-9240-48A5-B479-31EEF723D7CF" , +"16CAF1B7-DD38-40ED-B1C1-1B8A1913D531" , + "BE84BABF-C4D4-403D-B495-3128FD44dAC1", }; struct int3400_thermal_priv {
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 21/52 thermal/int340x_thermal: fix mode setting
In reply to Sasha LevinFrom: Matthew Garrett <[email protected]>
[ Upstream commit 396ee4d0cd52c13b3f6421b8d324d65da5e7e409 ]
int3400 only pushes the UUID into the firmware when the mode is flipped to "enable". The current code only exposes the mode flag if the firmware supports the PASSIVE_1 UUID, which not all machines do. Remove the restriction.
--- drivers/thermal/int340x_thermal/int3400_thermal.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/thermal/int340x_thermal/int3400_thermal.c +3 -4
@@ -316,10 +316,9 @@ static int int3400_thermal_probe(struct platform_device *pdev)platform_set_drvdata (pdev, priv); -if (priv->uuid_bitmap &1 <<INT3400_THERMAL_PASSIVE_1 ) { - int3400_thermal_ops.get_mode = int3400_thermal_get_mode; - int3400_thermal_ops.set_mode = int3400_thermal_set_mode; - } + int3400_thermal_ops.get_mode = int3400_thermal_get_mode; + int3400_thermal_ops.set_mode = int3400_thermal_set_mode; + priv->thermal =thermal_zone_device_register ("INT3400 Thermal" ,0 ,0 , priv, &int3400_thermal_ops, &int3400_thermal_params,0 ,0 );
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 22/52 thermal/intel_powerclamp: fix truncated kthread name
In reply to Sasha LevinFrom: Zhang Rui <[email protected]>
[ Upstream commit e925b5be5751f6a7286bbd9a4cbbc4ac90cc5fa6 ]
kthread name only allows 15 characters (TASK_COMMON_LEN is 16). Thus rename the kthreads created by intel_powerclamp driver from "kidle_inject/ + decimal cpuid" to "kidle_inj/ + decimal cpuid" to avoid truncated kthead name for cpu 100 and later.
--- drivers/thermal/intel_powerclamp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/intel_powerclamp.c +1 -1
@@ -494,7 +494,7 @@ static void start_power_clamp_worker(unsigned long cpu)struct powerclamp_worker_data *w_data =per_cpu_ptr (worker_data, cpu);struct kthread_worker *worker; - worker =kthread_create_worker_on_cpu (cpu,0 ,"kidle_inject/%ld" , cpu); + worker =kthread_create_worker_on_cpu (cpu,0 ,"kidle_inj/%ld" , cpu);if (IS_ERR (worker))return ;
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 23/52 scsi: iscsi: flush running unbind operations when removing a session
In reply to Sasha LevinFrom: Maurizio Lombardi <[email protected]>
[ Upstream commit 165aa2bfb42904b1bec4bf2fa257c8c603c14a06 ]
In some cases, the iscsi_remove_session() function is called while an unbind_work operation is still running. This may cause a situation where sysfs objects are removed in an incorrect order, triggering a kernel warning.
[ 605.249442] ------------[ cut here ]------------ [ 605.259180] sysfs group 'power' not found for kobject 'target2:0:0' [ 605.321371] WARNING: CPU: 1 PID: 26794 at fs/sysfs/group.c:235 sysfs_remove_group+0x76/0x80 [ 605.341266] Modules linked in: dm_service_time target_core_user target_core_pscsi target_core_file target_core_iblock iscsi_target_mod target_core_mod nls_utf8 isofs ppdev bochs_drm nfit ttm libnvdimm drm_kms_helper syscopyarea sysfillrect sysimgblt joydev pcspkr fb_sys_fops drm i2c_piix4 sg parport_pc parport xfs libcrc32c dm_multipath sr_mod sd_mod cdrom ata_generic 8021q garp mrp ata_piix stp crct10dif_pclmul crc32_pclmul llc libata crc32c_intel virtio_net net_failover ghash_clmulni_intel serio_raw failover sunrpc dm_mirror dm_region_hash dm_log dm_mod be2iscsi bnx2i cnic uio cxgb4i cxgb4 libcxgbi libcxgb qla4xxx iscsi_boot_sysfs iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi [ 605.627479] CPU: 1 PID: 26794 Comm: kworker/u32:2 Not tainted 4.18.0-60.el8.x86_64 #1 [ 605.721401] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ?-20180724_192412-buildhw-07.phx2.fedoraproject.org-1.fc29 04/01/2014 [ 605.823651] Workqueue: scsi_wq_2 __iscsi_unbind_session [scsi_transport_iscsi] [ 605.830940] RIP: 0010:sysfs_remove_group+0x76/0x80 [ 605.922907] Code: 48 89 df 5b 5d 41 5c e9 38 c4 ff ff 48 89 df e8 e0 bf ff ff eb cb 49 8b 14 24 48 8b 75 00 48 c7 c7 38 73 cb a7 e8 24 77 d7 ff <0f> 0b 5b 5d 41 5c c3 0f 1f 00 0f 1f 44 00 00 41 56 41 55 41 54 55 [ 606.122304] RSP: 0018:ffffbadcc8d1bda8 EFLAGS: 00010286 [ 606.218492] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000 [ 606.326381] RDX: ffff98bdfe85eb40 RSI: ffff98bdfe856818 RDI: ffff98bdfe856818 [ 606.514498] RBP: ffffffffa7ab73e0 R08: 0000000000000268 R09: 0000000000000007 [ 606.529469] R10: 0000000000000000 R11: ffffffffa860d9ad R12: ffff98bdf978e838 [ 606.630535] R13: ffff98bdc2cd4010 R14: ffff98bdc2cd3ff0 R15: ffff98bdc2cd4000 [ 606.824707] FS: 0000000000000000(0000) GS:ffff98bdfe840000(0000) knlGS:0000000000000000 [ 607.018333] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 607.117844] CR2: 00007f84b78ac024 CR3: 000000002c00a003 CR4: 00000000003606e0 [ 607.117844] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 607.420926] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 607.524236] Call Trace: [ 607.530591] device_del+0x56/0x350 [ 607.624393] ? ata_tlink_match+0x30/0x30 [libata] [ 607.727805] ? attribute_container_device_trigger+0xb4/0xf0 [ 607.829911] scsi_target_reap_ref_release+0x39/0x50 [ 607.928572] scsi_remove_target+0x1a2/0x1d0 [ 608.017350] __iscsi_unbind_session+0xb3/0x160 [scsi_transport_iscsi] [ 608.117435] process_one_work+0x1a7/0x360 [ 608.132917] worker_thread+0x30/0x390 [ 608.222900] ? pwq_unbound_release_workfn+0xd0/0xd0 [ 608.323989] kthread+0x112/0x130 [ 608.418318] ? kthread_bind+0x30/0x30 [ 608.513821] ret_from_fork+0x35/0x40 [ 608.613909] ---[ end trace 0b98c310c8a6138c ]---
--- drivers/scsi/scsi_transport_iscsi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/scsi/scsi_transport_iscsi.c +2 -0
@@ -2185,6 +2185,8 @@ void iscsi_remove_session(struct iscsi_cls_session *session)scsi_target_unblock (&session->dev,SDEV_TRANSPORT_OFFLINE );/* flush running scans then delete devices */ flush_work (&session->scan_work); +/* flush running unbind operations */ +flush_work (&session->unbind_work);__iscsi_unbind_session (&session->unbind_work);/* hw iscsi may not have removed all connections from session */
Signature · 8 lines
2.19.1 -- You received this message because you are subscribed to the Google Groups "open-iscsi" group. To unsubscribe from this group and stop receiving emails from it, send an email to open-iscsi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] To post to this group, send email to open-iscsi-/JYPxA39Uh5TLH3MbocFF+G/[email protected] Visit this group at https://groups.google.com/group/open-iscsi. For more options, visit https://groups.google.com/d/optout.
Sasha Levin
maintainerPATCH 27/52 tools/power turbostat: return the exit status of a command
In reply to Sasha LevinFrom: David Arcari <[email protected]>
[ Upstream commit 2a95496634a017c19641f26f00907af75b962f01 ]
turbostat failed to return a non-zero exit status even though the supplied command (turbostat <command>) failed. Currently when turbostat forks a command it returns zero instead of the actual exit status of the command. Modify the code to return the exit status.
--- tools/power/x86/turbostat/turbostat.c | 3 +++ 1 file changed, 3 insertions(+)
tools/power/x86/turbostat/turbostat.c +3 -0
@@ -5054,6 +5054,9 @@ int fork_it(char **argv)signal (SIGQUIT ,SIG_IGN );if (waitpid (child_pid, &status,0 ) ==-1 )err (status,"waitpid" ); + +if (WIFEXITED (status)) + status =WEXITSTATUS (status); }/* * n.b. fork_it() does not check for errors from for_all_cpus()
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 38/52 ACPI / utils: Drop reference in test for device presence
In reply to Sasha LevinFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 54e3aca84e571559915998aa6cc05e5ac37c043b ]
When commit 8661423eea1a ("ACPI / utils: Add new acpi_dev_present helper") introduced acpi_dev_present(), it missed the fact that bus_find_device() took a reference on the device found by it and the callers of acpi_dev_present() don't drop that reference.
Drop the reference on the device in acpi_dev_present().
--- drivers/acpi/utils.c | 1 + 1 file changed, 1 insertion(+)
drivers/acpi/utils.c +1 -0
@@ -800,6 +800,7 @@ bool acpi_dev_present(const char *hid, const char *uid, s64 hrv) match.hrv = hrv; dev =bus_find_device (&acpi_bus_type,NULL , &match, acpi_dev_match_cb); +put_device (dev);return !!dev; }EXPORT_SYMBOL (acpi_dev_present);
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 39/52 PM / Domains: Avoid a potential deadlock
In reply to Sasha LevinFrom: Jiada Wang <[email protected]>
[ Upstream commit 2071ac985d37efe496782c34318dbead93beb02f ]
Lockdep warns that prepare_lock and genpd->mlock can cause a deadlock the deadlock scenario is like following:
First thread is probing cs2000cs2000_probe()
clk_register()
__clk_core_init()
clk_prepare_lock() ----> acquires prepare_lock
cs2000_recalc_rate()
i2c_smbus_read_byte_data()
rcar_i2c_master_xfer()
dma_request_chan()
rcar_dmac_of_xlate()
rcar_dmac_alloc_chan_resources()
pm_runtime_get_sync()
__pm_runtime_resume()
rpm_resume()
rpm_callback()
genpd_runtime_resume() ----> acquires genpd->mlockSecond thread is attaching any device to the same PM domain genpd_add_device()
genpd_lock() ----> acquires genpd->mlock
cpg_mssr_attach_dev()
of_clk_get_from_provider()
__of_clk_get_from_provider()
__clk_create_clk()
clk_prepare_lock() ----> acquires prepare_lockSince currently no PM provider access genpd's critical section
in .attach_dev, and .detach_dev callbacks, so there is no need to protect these two callbacks with genpd->mlock.
This patch avoids a potential deadlock by moving out .attach_dev and .detach_dev from genpd->mlock, so that genpd->mlock won't be held when prepare_lock is acquired in .attach_dev and .detach_dev
--- drivers/base/power/domain.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/base/power/domain.c +6 -7
@@ -1388,12 +1388,12 @@ static int genpd_add_device(struct generic_pm_domain *genpd, struct device *dev,if (IS_ERR (gpd_data))return PTR_ERR (gpd_data); -genpd_lock (genpd); - ret = genpd->attach_dev ? genpd->attach_dev (genpd, dev) :0 ;if (ret) goto out; +genpd_lock (genpd); +dev_pm_domain_set (dev, &genpd->domain); genpd->device_count++;
@@ -1401,9 +1401,8 @@ static int genpd_add_device(struct generic_pm_domain *genpd, struct device *dev,list_add_tail (&gpd_data->base.list_node, &genpd->dev_list); - out:genpd_unlock (genpd); - + out:if (ret)genpd_free_dev_data (dev, gpd_data);else
@@ -1452,15 +1451,15 @@ static int genpd_remove_device(struct generic_pm_domain *genpd, genpd->device_count--; genpd->max_off_time_changed = true; -if (genpd->detach_dev) - genpd->detach_dev (genpd, dev); -dev_pm_domain_set (dev,NULL );list_del_init (&pdd->list_node);genpd_unlock (genpd); +if (genpd->detach_dev) + genpd->detach_dev (genpd, dev); +genpd_free_dev_data (dev, gpd_data);return 0 ;
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 47/52 drm/nouveau/debugfs: Fix check of pm_runtime_get_sync failure
In reply to Sasha LevinFrom: YueHaibing <[email protected]>
[ Upstream commit 909e9c9c428376e2a43d178ed4b0a2d5ba9cb7d3 ]
pm_runtime_get_sync returns negative on failure.
--- drivers/gpu/drm/nouveau/nouveau_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_debugfs.c +1 -1
@@ -161,7 +161,7 @@ nouveau_debugfs_pstate_set(struct file *file, const char __user *ubuf, } ret =pm_runtime_get_sync (drm->dev); -if (IS_ERR_VALUE (ret) && ret != -EACCES ) +if (ret <0 && ret != -EACCES )return ret; ret =nvif_mthd (ctrl,NVIF_CONTROL_PSTATE_USER , &args,sizeof (args));pm_runtime_put_autosuspend (drm->dev);
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 48/52 iommu/vt-d: Check capability before disabling protected memory
In reply to Sasha LevinFrom: Lu Baolu <baolu.lu-VuQAYsv1563Yd54FQh9/[email protected]>
[ Upstream commit 5bb71fc790a88d063507dc5d445ab8b14e845591 ]
The spec states in 10.4.16 that the Protected Memory Enable Register should be treated as read-only for implementations not supporting protected memory regions (PLMR and PHMR fields reported as Clear in the Capability register).
--- drivers/iommu/intel-iommu.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/iommu/intel-iommu.c +3 -0
@@ -1624,6 +1624,9 @@ static void iommu_disable_protect_mem_regions(struct intel_iommu *iommu)u32 pmen;unsigned long flags; +if (!cap_plmr (iommu->cap) && !cap_phmr (iommu->cap)) +return ; +raw_spin_lock_irqsave (&iommu->register_lock, flags); pmen =readl (iommu->reg +DMAR_PMEN_REG ); pmen &= ~DMA_PMEN_EPM ;
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 3/52 inotify: Fix fsnotify_mark refcount leak in inotify_update_existing_watch()
In reply to Sasha LevinFrom: ZhangXiaoxu <[email protected]>
[ Upstream commit 62c9d2674b31d4c8a674bee86b7edc6da2803aea ]
Commit 4d97f7d53da7dc83 ("inotify: Add flag IN_MASK_CREATE for inotify_add_watch()") forgot to call fsnotify_put_mark() with IN_MASK_CREATE after fsnotify_find_mark()
--- fs/notify/inotify/inotify_user.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
fs/notify/inotify/inotify_user.c +5 -2
@@ -519,8 +519,10 @@ static int inotify_update_existing_watch(struct fsnotify_group *group, fsn_mark =fsnotify_find_mark (&inode->i_fsnotify_marks, group);if (!fsn_mark)return -ENOENT ; -else if (create) -return -EEXIST ; +else if (create) { + ret = -EEXIST ; + goto out; + } i_mark = container_of(fsn_mark, struct inotify_inode_mark, fsn_mark);
@@ -548,6 +550,7 @@ static int inotify_update_existing_watch(struct fsnotify_group *group,/* return the wd */ ret = i_mark->wd; +out:/* match the get from fsnotify_find_mark() */ fsnotify_put_mark (fsn_mark);
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 6/52 ext4: avoid panic during forced reboot
In reply to Sasha LevinFrom: Jan Kara <[email protected]>
[ Upstream commit 1dc1097ff60e4105216da7cd0aa99032b039a994 ]
When admin calls "reboot -f" - i.e., does a hard system reboot by directly calling reboot(2) - ext4 filesystem mounted with errors=panic can panic the system. This happens because the underlying device gets disabled without unmounting the filesystem and thus some syscall running in parallel to reboot(2) can result in the filesystem getting IO errors.
This is somewhat surprising to the users so try improve the behavior by switching to errors=remount-ro behavior when the system is running reboot(2).
--- fs/ext4/super.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
fs/ext4/super.c +13 -3
@@ -430,6 +430,12 @@ static void ext4_journal_commit_callback(journal_t *journal, transaction_t *txn)spin_unlock (&sbi->s_md_lock); } +static bool system_going_down (void ) +{ +return system_state ==SYSTEM_HALT || system_state ==SYSTEM_POWER_OFF + || system_state ==SYSTEM_RESTART ; +} +/* Deal with the reporting of failure conditions on a filesystem such as * inconsistencies detected or read IO failures. *
@@ -460,7 +466,12 @@ static void ext4_handle_error(struct super_block *sb)if (journal)jbd2_journal_abort (journal, -EIO ); } -if (test_opt (sb,ERRORS_RO )) { +/* +* We force ERRORS_RO behavior when system is rebooting. Otherwise we +* could panic during 'reboot -f' as the underlying device got already +* disabled. +*/ +if (test_opt (sb,ERRORS_RO ) ||system_going_down ()) {ext4_msg (sb,KERN_CRIT ,"Remounting filesystem read-only" );/* * Make sure updated value of ->s_mount_flags will be visible
@@ -468,8 +479,7 @@ static void ext4_handle_error(struct super_block *sb)*/ smp_wmb (); sb->s_flags |=SB_RDONLY ; - } -if (test_opt (sb,ERRORS_PANIC )) { + }else if (test_opt (sb,ERRORS_PANIC )) {if (EXT4_SB (sb)->s_journal && !(EXT4_SB (sb)->s_journal->j_flags &JBD2_REC_ERR ))return ;
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 9/52 ALSA: echoaudio: add a check for ioremap_nocache
In reply to Sasha LevinFrom: Kangjie Lu <[email protected]>
[ Upstream commit 6ade657d6125ec3ec07f95fa51e28138aef6208f ]
In case ioremap_nocache fails, the fix releases chip and returns an error code upstream to avoid NULL pointer dereference.
--- sound/pci/echoaudio/echoaudio.c | 5 +++++ 1 file changed, 5 insertions(+)
sound/pci/echoaudio/echoaudio.c +5 -0
@@ -1954,6 +1954,11 @@ static int snd_echo_create(struct snd_card *card, } chip->dsp_registers = (volatile u32 __iomem *)ioremap_nocache (chip->dsp_registers_phys, sz); +if (!chip->dsp_registers) { +dev_err (chip->card->dev,"ioremap failed\n" ); +snd_echo_free (chip); +return -ENOMEM ; + }if (request_irq (pci->irq, snd_echo_interrupt,IRQF_SHARED ,KBUILD_MODNAME , chip)) {
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 12/52 drm/udl: use drm_gem_object_put_unlocked.
In reply to Sasha LevinFrom: Dave Airlie <[email protected]>
[ Upstream commit 8f3b487685b2acf71b42bb30d68fd9271bec8695 ]
When Daniel removed struct_mutex he didn't fix this call to the unlocked variant which is required since we no longer use struct mutex.
This fixes a bunch of:
WARNING: CPU: 4 PID: 1370 at drivers/gpu/drm/drm_gem.c:931 drm_gem_object_put+0x2b/0x30 [drm] Modules linked in: udl xt_CHECKSUM ipt_MASQUERADE tun bridge stp llc nf_conntrack_netbios_ns nf_conntrack_broadcast xt_CT ip6t> CPU: 4 PID: 1370 Comm: Xorg Not tainted 5.0.0+ #2
backtraces when you plug in a udl device.
--- drivers/gpu/drm/udl/udl_gem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/udl/udl_gem.c +1 -1
@@ -224,7 +224,7 @@ int udl_gem_mmap(struct drm_file *file, struct drm_device *dev, *offset =drm_vma_node_offset_addr (&gobj->base.vma_node); out: -drm_gem_object_put (&gobj->base); +drm_gem_object_put_unlocked (&gobj->base); unlock:mutex_unlock (&udl->gem_lock);return ret;
Signature · 6 lines
2.19.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 11/52 auxdisplay: hd44780: Fix memory leak on ->remove()
In reply to Sasha LevinFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 41c8d0adf3c4df1867d98cee4a2c4531352a33ad ]
We have to free on ->remove() the allocated resources on ->probe().
--- drivers/auxdisplay/hd44780.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/auxdisplay/hd44780.c +2 -0
@@ -299,6 +299,8 @@ static int hd44780_remove(struct platform_device *pdev)struct charlcd *lcd =platform_get_drvdata (pdev);charlcd_unregister (lcd); + +kfree (lcd);return 0 ; }
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 16/52 ALSA: opl3: fix mismatch between snd_opl3_drum_switch definition and declaration
In reply to Sasha LevinFrom: Colin Ian King <[email protected]>
[ Upstream commit b4748e7ab731e436cf5db4786358ada5dd2db6dd ]
The function snd_opl3_drum_switch declaration in the header file has the order of the two arguments on_off and vel swapped when compared to the definition arguments of vel and on_off. Fix this by swapping them around to match the definition.
This error predates the git history, so no idea when this error was introduced.
--- sound/drivers/opl3/opl3_voice.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/drivers/opl3/opl3_voice.h +1 -1
@@ -41,7 +41,7 @@ void snd_opl3_timer_func(struct timer_list *t);/* Prototypes for opl3_drums.c */ void snd_opl3_load_drums (struct snd_opl3 *opl3); -void snd_opl3_drum_switch (struct snd_opl3 *opl3,int note,int on_off,int vel,struct snd_midi_channel *chan); +void snd_opl3_drum_switch (struct snd_opl3 *opl3,int note,int vel,int on_off,struct snd_midi_channel *chan);/* Prototypes for opl3_oss.c */ #if IS_ENABLED (CONFIG_SND_SEQUENCER_OSS )
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 25/52 sched/core: Fix buffer overflow in cgroup2 property cpu.max
In reply to Sasha LevinFrom: Konstantin Khlebnikov <[email protected]>
[ Upstream commit 4c47acd824aaaa8fc6dc519fb4e08d1522105b7a ]
Add limit into sscanf format string for on-stack buffer.
--- kernel/sched/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
@@ -6929,7 +6929,7 @@ static int __maybe_unused cpu_period_quota_parse(char *buf, {char tok[21 ];/* U64_MAX */ -if (!sscanf (buf,"%s %llu" , tok, periodp)) +if (sscanf (buf,"%20s %llu" , tok, periodp) <1 )return -EINVAL ; *periodp *=NSEC_PER_USEC ;
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 28/52 perf list: Don't forget to drop the reference to the allocated thread_map
In reply to Sasha LevinFrom: Changbin Du <[email protected]>
[ Upstream commit 39df730b09774bd860e39ea208a48d15078236cb ]
Detected via gcc's ASan:
Direct leak of 2048 byte(s) in 64 object(s) allocated from:
6 #0 0x7f606512e370 in __interceptor_realloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xee370)
7 #1 0x556b0f1d7ddd in thread_map__realloc util/thread_map.c:43
8 #2 0x556b0f1d84c7 in thread_map__new_by_tid util/thread_map.c:85
9 #3 0x556b0f0e045e in is_event_supported util/parse-events.c:2250
10 #4 0x556b0f0e1aa1 in print_hwcache_events util/parse-events.c:2382
11 #5 0x556b0f0e3231 in print_events util/parse-events.c:2514
12 #6 0x556b0ee0a66e in cmd_list /home/changbin/work/linux/tools/perf/builtin-list.c:58
13 #7 0x556b0f01e0ae in run_builtin /home/changbin/work/linux/tools/perf/perf.c:302
14 #8 0x556b0f01e859 in handle_internal_command /home/changbin/work/linux/tools/perf/perf.c:354
15 #9 0x556b0f01edc8 in run_argv /home/changbin/work/linux/tools/perf/perf.c:398
16 #10 0x556b0f01f71f in main /home/changbin/work/linux/tools/perf/perf.c:520
17 #11 0x7f6062ccf09a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)--- tools/perf/util/parse-events.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/util/parse-events.c +1 -0
@@ -2263,6 +2263,7 @@ static bool is_event_supported(u8 type, unsigned config)perf_evsel__delete (evsel); } +thread_map__put (tmap);return ret; }
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 29/52 perf config: Fix an error in the config template documentation
In reply to Sasha LevinFrom: Changbin Du <[email protected]>
[ Upstream commit 9b40dff7ba3caaf0d1919f98e136fa3400bd34aa ]
The option 'sort-order' should be 'sort_order'.
--- tools/perf/Documentation/perf-config.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/Documentation/perf-config.txt +1 -1
@@ -114,7 +114,7 @@ Given a $HOME/.perfconfig like this: [report] # Defaults - sort-order = comm,dso,symbol + sort_order = comm,dso,symbol percent-limit = 0 queue-size = 0 children = true
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 30/52 perf config: Fix a memory leak in collect_config()
In reply to Sasha LevinFrom: Changbin Du <[email protected]>
[ Upstream commit 54569ba4b06d5baedae4614bde33a25a191473ba ]
Detected with gcc's ASan:
Direct leak of 66 byte(s) in 5 object(s) allocated from:
#0 0x7ff3b1f32070 in __interceptor_strdup (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x3b070)
#1 0x560c8761034d in collect_config util/config.c:597
#2 0x560c8760d9cb in get_value util/config.c:169
#3 0x560c8760dfd7 in perf_parse_file util/config.c:285
#4 0x560c8760e0d2 in perf_config_from_file util/config.c:476
#5 0x560c876108fd in perf_config_set__init util/config.c:661
#6 0x560c87610c72 in perf_config_set__new util/config.c:709
#7 0x560c87610d2f in perf_config__init util/config.c:718
#8 0x560c87610e5d in perf_config util/config.c:730
#9 0x560c875ddea0 in main /home/changbin/work/linux/tools/perf/perf.c:442
#10 0x7ff3afb8609a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)--- tools/perf/util/config.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
tools/perf/util/config.c +1 -2
@@ -628,11 +628,10 @@ static int collect_config(const char *var, const char *value, } ret =set_value (item, value); -return ret; out_free:free (key); -return -1 ; +return ret; } int perf_config_set__collect(struct perf_config_set *set, const char *file_name,
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 32/52 perf top: Fix error handling in cmd_top()
In reply to Sasha LevinFrom: Changbin Du <[email protected]>
[ Upstream commit 70c819e4bf1c5f492768b399d898d458ccdad2b6 ]
We should go to the cleanup path, to avoid leaks, detected using gcc's ASan.
--- tools/perf/builtin-top.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/perf/builtin-top.c +3 -2
@@ -1491,8 +1491,9 @@ int cmd_top(int argc, const char **argv)annotation_config__init (); symbol_conf.try_vmlinux_path = (symbol_conf.vmlinux_name ==NULL ); -if (symbol__init (NULL ) <0 ) -return -1 ; + status =symbol__init (NULL ); +if (status <0 ) + goto out_delete_evlist;sort__setup_elide (stdout);
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 31/52 perf build-id: Fix memory leak in print_sdt_events()
In reply to Sasha LevinFrom: Changbin Du <[email protected]>
[ Upstream commit 8bde8516893da5a5fdf06121f74d11b52ab92df5 ]
Detected with gcc's ASan:
Direct leak of 4356 byte(s) in 120 object(s) allocated from:
#0 0x7ff1a2b5a070 in __interceptor_strdup (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x3b070)
#1 0x55719aef4814 in build_id_cache__origname util/build-id.c:215
#2 0x55719af649b6 in print_sdt_events util/parse-events.c:2339
#3 0x55719af66272 in print_events util/parse-events.c:2542
#4 0x55719ad1ecaa in cmd_list /home/changbin/work/linux/tools/perf/builtin-list.c:58
#5 0x55719aec745d in run_builtin /home/changbin/work/linux/tools/perf/perf.c:302
#6 0x55719aec7d1a in handle_internal_command /home/changbin/work/linux/tools/perf/perf.c:354
#7 0x55719aec8184 in run_argv /home/changbin/work/linux/tools/perf/perf.c:398
#8 0x55719aeca41a in main /home/changbin/work/linux/tools/perf/perf.c:520
#9 0x7ff1a07ae09a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)--- tools/perf/util/build-id.c | 1 + tools/perf/util/parse-events.c | 1 + 2 files changed, 2 insertions(+)
tools/perf/util/build-id.c +1 -0
@@ -183,6 +183,7 @@ char *build_id_cache__linkname(const char *sbuild_id, char *bf, size_t size)return bf; } +/* The caller is responsible to free the returned buffer. */ char *build_id_cache__origname (const char *sbuild_id) {char *linkname;
tools/perf/util/parse-events.c +1 -0
@@ -2334,6 +2334,7 @@ void print_sdt_events(const char *subsys_glob, const char *event_glob,printf (" %-50s [%s]\n" , buf,"SDT event" );free (buf); } +free (path); }else printf (" %-50s [%s]\n" , nd->s,"SDT event" );if (nd2) {
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 33/52 perf hist: Add missing map__put() in error case
In reply to Sasha LevinFrom: Changbin Du <[email protected]>
[ Upstream commit cb6186aeffda4d27e56066c79e9579e7831541d3 ]
We need to map__put() before returning from failure of sample__resolve_callchain().
Detected with gcc's ASan.
--- tools/perf/util/hist.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/perf/util/hist.c +3 -1
@@ -1048,8 +1048,10 @@ int hist_entry_iter__add(struct hist_entry_iter *iter, struct addr_location *al, err =sample__resolve_callchain (iter->sample, &callchain_cursor, &iter->parent, iter->evsel, al, max_stack_depth); -if (err) +if (err) { +map__put (alm);return err; + } err = iter->ops->prepare_entry (iter, al);if (err)
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 34/52 perf evsel: Free evsel->counts in perf_evsel__exit()
In reply to Sasha LevinFrom: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 42dfa451d825a2ad15793c476f73e7bbc0f9d312 ]
Using gcc's ASan, Changbin reports:
=================================================================
==7494==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 48 byte(s) in 1 object(s) allocated from:
#0 0x7f0333a89138 in calloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xee138)
#1 0x5625e5330a5e in zalloc util/util.h:23
#2 0x5625e5330a9b in perf_counts__new util/counts.c:10
#3 0x5625e5330ca0 in perf_evsel__alloc_counts util/counts.c:47
#4 0x5625e520d8e5 in __perf_evsel__read_on_cpu util/evsel.c:1505
#5 0x5625e517a985 in perf_evsel__read_on_cpu /home/work/linux/tools/perf/util/evsel.h:347
#6 0x5625e517ad1a in test__openat_syscall_event tests/openat-syscall.c:47
#7 0x5625e51528e6 in run_test tests/builtin-test.c:358
#8 0x5625e5152baf in test_and_print tests/builtin-test.c:388
#9 0x5625e51543fe in __cmd_test tests/builtin-test.c:583
#10 0x5625e515572f in cmd_test tests/builtin-test.c:722
#11 0x5625e51c3fb8 in run_builtin /home/changbin/work/linux/tools/perf/perf.c:302
#12 0x5625e51c44f7 in handle_internal_command /home/changbin/work/linux/tools/perf/perf.c:354
#13 0x5625e51c48fb in run_argv /home/changbin/work/linux/tools/perf/perf.c:398
#14 0x5625e51c5069 in main /home/changbin/work/linux/tools/perf/perf.c:520
#15 0x7f033214d09a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)Indirect leak of 72 byte(s) in 1 object(s) allocated from:
#0 0x7f0333a89138 in calloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xee138)
#1 0x5625e532560d in zalloc util/util.h:23
#2 0x5625e532566b in xyarray__new util/xyarray.c:10
#3 0x5625e5330aba in perf_counts__new util/counts.c:15
#4 0x5625e5330ca0 in perf_evsel__alloc_counts util/counts.c:47
#5 0x5625e520d8e5 in __perf_evsel__read_on_cpu util/evsel.c:1505
#6 0x5625e517a985 in perf_evsel__read_on_cpu /home/work/linux/tools/perf/util/evsel.h:347
#7 0x5625e517ad1a in test__openat_syscall_event tests/openat-syscall.c:47
#8 0x5625e51528e6 in run_test tests/builtin-test.c:358
#9 0x5625e5152baf in test_and_print tests/builtin-test.c:388
#10 0x5625e51543fe in __cmd_test tests/builtin-test.c:583
#11 0x5625e515572f in cmd_test tests/builtin-test.c:722
#12 0x5625e51c3fb8 in run_builtin /home/changbin/work/linux/tools/perf/perf.c:302
#13 0x5625e51c44f7 in handle_internal_command /home/changbin/work/linux/tools/perf/perf.c:354
#14 0x5625e51c48fb in run_argv /home/changbin/work/linux/tools/perf/perf.c:398
#15 0x5625e51c5069 in main /home/changbin/work/linux/tools/perf/perf.c:520
#16 0x7f033214d09a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)His patch took care of evsel->prev_raw_counts, but the above backtraces are about evsel->counts, so fix that instead.
--- tools/perf/util/evsel.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/util/evsel.c +1 -0
@@ -1274,6 +1274,7 @@ void perf_evsel__exit(struct perf_evsel *evsel) {assert (list_empty (&evsel->node));assert (evsel->evlist ==NULL ); +perf_evsel__free_counts (evsel);perf_evsel__free_fd (evsel);perf_evsel__free_id (evsel);perf_evsel__free_config_terms (evsel);
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 35/52 perf tests: Fix a memory leak of cpu_map object in the openat_syscall_event_on_all_cpus test
In reply to Sasha LevinFrom: Changbin Du <[email protected]>
[ Upstream commit 93faa52e8371f0291ee1ff4994edae2b336b6233 ]
=================================================================
==7497==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 40 byte(s) in 1 object(s) allocated from:
#0 0x7f0333a88f30 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xedf30)
#1 0x5625e5326213 in cpu_map__trim_new util/cpumap.c:45
#2 0x5625e5326703 in cpu_map__read util/cpumap.c:103
#3 0x5625e53267ef in cpu_map__read_all_cpu_map util/cpumap.c:120
#4 0x5625e5326915 in cpu_map__new util/cpumap.c:135
#5 0x5625e517b355 in test__openat_syscall_event_on_all_cpus tests/openat-syscall-all-cpus.c:36
#6 0x5625e51528e6 in run_test tests/builtin-test.c:358
#7 0x5625e5152baf in test_and_print tests/builtin-test.c:388
#8 0x5625e51543fe in __cmd_test tests/builtin-test.c:583
#9 0x5625e515572f in cmd_test tests/builtin-test.c:722
#10 0x5625e51c3fb8 in run_builtin /home/changbin/work/linux/tools/perf/perf.c:302
#11 0x5625e51c44f7 in handle_internal_command /home/changbin/work/linux/tools/perf/perf.c:354
#12 0x5625e51c48fb in run_argv /home/changbin/work/linux/tools/perf/perf.c:398
#13 0x5625e51c5069 in main /home/changbin/work/linux/tools/perf/perf.c:520
#14 0x7f033214d09a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)--- tools/perf/tests/openat-syscall-all-cpus.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/perf/tests/openat-syscall-all-cpus.c +3 -1
@@ -45,7 +45,7 @@ int test__openat_syscall_event_on_all_cpus(struct test *test __maybe_unused, intif (IS_ERR (evsel)) {tracing_path__strerror_open_tp (errno, errbuf,sizeof (errbuf),"syscalls" ,"sys_enter_openat" );pr_debug ("%s\n" , errbuf); - goto out_thread_map_delete; + goto out_cpu_map_delete; }if (perf_evsel__open (evsel, cpus, threads) <0 ) {
@@ -119,6 +119,8 @@ int test__openat_syscall_event_on_all_cpus(struct test *test __maybe_unused, intperf_evsel__close_fd (evsel); out_evsel_delete:perf_evsel__delete (evsel); +out_cpu_map_delete: +cpu_map__put (cpus); out_thread_map_delete:thread_map__put (threads);return err;
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 36/52 perf tests: Fix memory leak by expr__find_other() in test__expr()
In reply to Sasha LevinFrom: Changbin Du <[email protected]>
[ Upstream commit f97a8991d3b998e518f56794d879f645964de649 ]
=================================================================
==7506==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 13 byte(s) in 3 object(s) allocated from:
#0 0x7f03339d6070 in __interceptor_strdup (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x3b070)
#1 0x5625e53aaef0 in expr__find_other util/expr.y:221
#2 0x5625e51bcd3f in test__expr tests/expr.c:52
#3 0x5625e51528e6 in run_test tests/builtin-test.c:358
#4 0x5625e5152baf in test_and_print tests/builtin-test.c:388
#5 0x5625e51543fe in __cmd_test tests/builtin-test.c:583
#6 0x5625e515572f in cmd_test tests/builtin-test.c:722
#7 0x5625e51c3fb8 in run_builtin /home/changbin/work/linux/tools/perf/perf.c:302
#8 0x5625e51c44f7 in handle_internal_command /home/changbin/work/linux/tools/perf/perf.c:354
#9 0x5625e51c48fb in run_argv /home/changbin/work/linux/tools/perf/perf.c:398
#10 0x5625e51c5069 in main /home/changbin/work/linux/tools/perf/perf.c:520
#11 0x7f033214d09a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)--- tools/perf/tests/expr.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
tools/perf/tests/expr.c +4 -1
@@ -19,7 +19,7 @@ int test__expr(struct test *t __maybe_unused, int subtest __maybe_unused)const char *p;const char **other;double val; -int ret; +int i, ret;struct parse_ctx ctx;int num_other;
@@ -56,6 +56,9 @@ int test__expr(struct test *t __maybe_unused, int subtest __maybe_unused)TEST_ASSERT_VAL ("find other" , !strcmp (other[1 ],"BAZ" ));TEST_ASSERT_VAL ("find other" , !strcmp (other[2 ],"BOZO" ));TEST_ASSERT_VAL ("find other" , other[3 ] ==NULL ); + +for (i =0 ; i < num_other; i++) +free ((void *)other[i]);free ((void *)other);return 0 ;
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 41/52 drm/exynos/mixer: fix MIXER shadow registry synchronisation code
In reply to Sasha LevinFrom: Andrzej Hajda <[email protected]>
[ Upstream commit 6a3b45ada960ac475ec2b4103d43e57943b2b8d3 ]
MIXER on Exynos5 SoCs uses different synchronisation method than Exynos4 to update internal state (shadow registers).
Apparently the driver implements it incorrectly. The rule should be as follows:
- do not request updating registers until previous request was finished, ie. MXR_CFG_LAYER_UPDATE_COUNT must be 0.
- before setting registers synchronisation on VSYNC should be turned off, ie. MXR_STATUS_SYNC_ENABLE should be reset,
- after finishing MXR_STATUS_SYNC_ENABLE should be set again. The patch hopefully implements it correctly.
Below sample kernel log from page fault caused by the bug:
[ 25.670038] exynos-sysmmu 14650000.sysmmu: 14450000.mixer: PAGE FAULT occurred at 0x2247b800 [ 25.677888] ------------[ cut here ]------------ [ 25.682164] kernel BUG at ../drivers/iommu/exynos-iommu.c:450! [ 25.687971] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM [ 25.693778] Modules linked in: [ 25.696816] CPU: 5 PID: 1553 Comm: fb-release_test Not tainted 5.0.0-rc7-01157-g5f86b1566bdd #136 [ 25.705646] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [ 25.711710] PC is at exynos_sysmmu_irq+0x1c0/0x264 [ 25.716470] LR is at lock_is_held_type+0x44/0x64
v2: added missing MXR_CFG_LAYER_UPDATE bit setting in mixer_enable_sync
--- drivers/gpu/drm/exynos/exynos_mixer.c | 110 +++++++++++++++----------- 1 file changed, 66 insertions(+), 44 deletions(-)
drivers/gpu/drm/exynos/exynos_mixer.c +66 -44
@@ -20,6 +20,7 @@#include "regs-vp.h" #include <linux/kernel.h> +#include <linux/ktime.h> #include <linux/spinlock.h> #include <linux/wait.h> #include <linux/i2c.h>
@@ -337,15 +338,62 @@ static void mixer_cfg_vp_blend(struct mixer_context *ctx)mixer_reg_write (ctx,MXR_VIDEO_CFG , val); } -static void mixer_vsync_set_update (struct mixer_context *ctx,bool enable) +static bool mixer_is_synced (struct mixer_context *ctx) { -/* block update on vsync */ -mixer_reg_writemask (ctx,MXR_STATUS , enable ? -MXR_STATUS_SYNC_ENABLE :0 ,MXR_STATUS_SYNC_ENABLE ); +u32 base, shadow; +if (ctx->mxr_ver ==MXR_VER_16_0_33_0 || + ctx->mxr_ver ==MXR_VER_128_0_0_184 ) +return !(mixer_reg_read (ctx,MXR_CFG ) & +MXR_CFG_LAYER_UPDATE_COUNT_MASK ); + +if (test_bit (MXR_BIT_VP_ENABLED , &ctx->flags) && +vp_reg_read (ctx,VP_SHADOW_UPDATE )) +return false; + + base =mixer_reg_read (ctx,MXR_CFG ); + shadow =mixer_reg_read (ctx,MXR_CFG_S ); +if (base != shadow) +return false; + + base =mixer_reg_read (ctx,MXR_GRAPHIC_BASE (0 )); + shadow =mixer_reg_read (ctx,MXR_GRAPHIC_BASE_S (0 )); +if (base != shadow) +return false; + + base =mixer_reg_read (ctx,MXR_GRAPHIC_BASE (1 )); + shadow =mixer_reg_read (ctx,MXR_GRAPHIC_BASE_S (1 )); +if (base != shadow) +return false; + +return true; +} + +static int mixer_wait_for_sync (struct mixer_context *ctx) +{ +ktime_t timeout =ktime_add_us (ktime_get (),100000 ); + +while (!mixer_is_synced (ctx)) { +usleep_range (1000 ,2000 ); +if (ktime_compare (ktime_get (), timeout) >0 ) +return -ETIMEDOUT ; + } +return 0 ; +} + +static void mixer_disable_sync (struct mixer_context *ctx) +{ +mixer_reg_writemask (ctx,MXR_STATUS ,0 ,MXR_STATUS_SYNC_ENABLE ); +} + +static void mixer_enable_sync (struct mixer_context *ctx) +{ +if (ctx->mxr_ver ==MXR_VER_16_0_33_0 || + ctx->mxr_ver ==MXR_VER_128_0_0_184 ) +mixer_reg_writemask (ctx,MXR_CFG , ~0 ,MXR_CFG_LAYER_UPDATE ); +mixer_reg_writemask (ctx,MXR_STATUS , ~0 ,MXR_STATUS_SYNC_ENABLE );if (test_bit (MXR_BIT_VP_ENABLED , &ctx->flags)) -vp_reg_write (ctx,VP_SHADOW_UPDATE , enable ? -VP_SHADOW_UPDATE_ENABLE :0 ); +vp_reg_write (ctx,VP_SHADOW_UPDATE ,VP_SHADOW_UPDATE_ENABLE ); }static void mixer_cfg_scan (struct mixer_context *ctx,int width,int height)
@@ -482,7 +530,6 @@ static void vp_video_buffer(struct mixer_context *ctx,spin_lock_irqsave (&ctx->reg_slock, flags); -vp_reg_write (ctx,VP_SHADOW_UPDATE ,1 );/* interlace or progressive scan mode */ val = (test_bit (MXR_BIT_INTERLACE , &ctx->flags) ? ~0 :0 );vp_reg_writemask (ctx,VP_MODE , val,VP_MODE_LINE_SKIP );
@@ -537,11 +584,6 @@ static void vp_video_buffer(struct mixer_context *ctx,vp_regs_dump (ctx); } -static void mixer_layer_update (struct mixer_context *ctx) -{ -mixer_reg_writemask (ctx,MXR_CFG , ~0 ,MXR_CFG_LAYER_UPDATE ); -} -static void mixer_graph_buffer (struct mixer_context *ctx,struct exynos_drm_plane *plane) {
@@ -618,11 +660,6 @@ static void mixer_graph_buffer(struct mixer_context *ctx,mixer_cfg_layer (ctx, win, priority, true);mixer_cfg_gfx_blend (ctx, win, fb->format->has_alpha); -/* layer update mandatory for mixer 16.0.33.0 */ -if (ctx->mxr_ver ==MXR_VER_16_0_33_0 || - ctx->mxr_ver ==MXR_VER_128_0_0_184 ) -mixer_layer_update (ctx); -spin_unlock_irqrestore (&ctx->reg_slock, flags);mixer_regs_dump (ctx);
@@ -687,7 +724,7 @@ static void mixer_win_reset(struct mixer_context *ctx)static irqreturn_t mixer_irq_handler (int irq,void *arg) {struct mixer_context *ctx = arg; -u32 val, base, shadow; +u32 val;spin_lock (&ctx->reg_slock);
@@ -701,26 +738,9 @@ static irqreturn_t mixer_irq_handler(int irq, void *arg) val &= ~MXR_INT_STATUS_VSYNC ;/* interlace scan need to check shadow register */ -if (test_bit (MXR_BIT_INTERLACE , &ctx->flags)) { -if (test_bit (MXR_BIT_VP_ENABLED , &ctx->flags) && -vp_reg_read (ctx,VP_SHADOW_UPDATE )) - goto out; - - base =mixer_reg_read (ctx,MXR_CFG ); - shadow =mixer_reg_read (ctx,MXR_CFG_S ); -if (base != shadow) - goto out; - - base =mixer_reg_read (ctx,MXR_GRAPHIC_BASE (0 )); - shadow =mixer_reg_read (ctx,MXR_GRAPHIC_BASE_S (0 )); -if (base != shadow) - goto out; - - base =mixer_reg_read (ctx,MXR_GRAPHIC_BASE (1 )); - shadow =mixer_reg_read (ctx,MXR_GRAPHIC_BASE_S (1 )); -if (base != shadow) - goto out; - } +if (test_bit (MXR_BIT_INTERLACE , &ctx->flags) + && !mixer_is_synced (ctx)) + goto out;drm_crtc_handle_vblank (&ctx->crtc->base); }
@@ -895,12 +915,14 @@ static void mixer_disable_vblank(struct exynos_drm_crtc *crtc)static void mixer_atomic_begin (struct exynos_drm_crtc *crtc) { -struct mixer_context *mixer_ctx = crtc->ctx; +struct mixer_context *ctx = crtc->ctx; -if (!test_bit (MXR_BIT_POWERED , &mixer_ctx->flags)) +if (!test_bit (MXR_BIT_POWERED , &ctx->flags))return ; -mixer_vsync_set_update (mixer_ctx, false); +if (mixer_wait_for_sync (ctx)) +dev_err (ctx->dev,"timeout waiting for VSYNC\n" ); +mixer_disable_sync (ctx); } static void mixer_update_plane(struct exynos_drm_crtc *crtc,
@@ -942,7 +964,7 @@ static void mixer_atomic_flush(struct exynos_drm_crtc *crtc)if (!test_bit (MXR_BIT_POWERED , &mixer_ctx->flags))return ; -mixer_vsync_set_update (mixer_ctx, true); +mixer_enable_sync (mixer_ctx);exynos_crtc_handle_event (crtc); }
@@ -957,7 +979,7 @@ static void mixer_enable(struct exynos_drm_crtc *crtc)exynos_drm_pipe_clk_enable (crtc, true); -mixer_vsync_set_update (ctx, false); +mixer_disable_sync (ctx);mixer_reg_writemask (ctx,MXR_STATUS , ~0 ,MXR_STATUS_SOFT_RESET );
@@ -970,7 +992,7 @@ static void mixer_enable(struct exynos_drm_crtc *crtc)mixer_commit (ctx); -mixer_vsync_set_update (ctx, true); +mixer_enable_sync (ctx);set_bit (MXR_BIT_POWERED , &ctx->flags); }
Signature · 6 lines
2.19.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 42/52 irqchip/stm32: Don't clear rising/falling config registers at init
In reply to Sasha LevinFrom: Fabien Dessenne <[email protected]>
[ Upstream commit 0dda09666f50eae9c5b794dd89b1fd8a8d89d714 ]
Falling and rising configuration and status registers are not banked. As they are shared with M4 co-processor, they should not be cleared at probe time, else M4 co-processor configuration will be lost.
--- drivers/irqchip/irq-stm32-exti.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/irqchip/irq-stm32-exti.c +0 -5
@@ -650,11 +650,6 @@ stm32_exti_chip_data *stm32_exti_chip_init(struct stm32_exti_host_data *h_data,*/ writel_relaxed (0 , base + stm32_bank->imr_ofst);writel_relaxed (0 , base + stm32_bank->emr_ofst); -writel_relaxed (0 , base + stm32_bank->rtsr_ofst); -writel_relaxed (0 , base + stm32_bank->ftsr_ofst); -writel_relaxed (~0UL , base + stm32_bank->rpr_ofst); -if (stm32_bank->fpr_ofst !=UNDEF_REG ) -writel_relaxed (~0UL , base + stm32_bank->fpr_ofst);pr_info ("%s: bank%d, External IRQs available:%#x\n" , node->full_name, bank_idx, irqs_mask);
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 45/52 x86/hyperv: Prevent potential NULL pointer dereference
In reply to Sasha LevinFrom: Kangjie Lu <[email protected]>
[ Upstream commit 534c89c22e26b183d838294f0937ee092c82ad3a ]
The page allocation in hv_cpu_init() can fail, but the code does not have a check for that.
Add a check and return -ENOMEM when the allocation fails.
[ tglx: Massaged changelog ]
--- arch/x86/hyperv/hv_init.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/x86/hyperv/hv_init.c +5 -1
@@ -101,9 +101,13 @@ static int hv_cpu_init(unsigned int cpu)u64 msr_vp_index;struct hv_vp_assist_page **hvp = &hv_vp_assist_page[smp_processor_id ()];void **input_arg; +struct page *pg; input_arg = (void **)this_cpu_ptr (hyperv_pcpu_input_arg); - *input_arg =page_address (alloc_page (GFP_KERNEL )); + pg =alloc_page (GFP_KERNEL ); +if (unlikely (!pg)) +return -ENOMEM ; + *input_arg =page_address (pg);hv_get_vp_index (msr_vp_index);
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 49/52 x86/hw_breakpoints: Make default case in hw_breakpoint_arch_parse() return an error
In reply to Sasha LevinFrom: Nathan Chancellor <[email protected]>
[ Upstream commit e898e69d6b9475bf123f99b3c5d1a67bb7cb2361 ]
When building with -Wsometimes-uninitialized, Clang warns:
arch/x86/kernel/hw_breakpoint.c:355:2: warning: variable 'align' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
The default cannot be reached because arch_build_bp_info() initializes hw->len to one of the specified cases. Nevertheless the warning is valid and returning -EINVAL makes sure that this cannot be broken by future modifications.
--- arch/x86/kernel/hw_breakpoint.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/kernel/hw_breakpoint.c +1 -0
@@ -357,6 +357,7 @@ int hw_breakpoint_arch_parse(struct perf_event *bp,#endif default :WARN_ON_ONCE (1 ); +return -EINVAL ; }/*
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 50/52 fix incorrect error code mapping for OBJECTID_NOT_FOUND
In reply to Sasha LevinFrom: Steve French <[email protected]>
[ Upstream commit 85f9987b236cf46e06ffdb5c225cf1f3c0acb789 ]
It was mapped to EIO which can be confusing when user space queries for an object GUID for an object for which the server file system doesn't support (or hasn't saved one).
As Amir Goldstein suggested this is similar to ENOATTR (equivalently ENODATA in Linux errno definitions) so changing NT STATUS code mapping for OBJECTID_NOT_FOUND to ENODATA.
--- fs/cifs/smb2maperror.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/cifs/smb2maperror.c +2 -1
@@ -1036,7 +1036,8 @@ static const struct status_to_posix_error smb2_error_map_table[] = { {STATUS_UNFINISHED_CONTEXT_DELETED , -EIO , "STATUS_UNFINISHED_CONTEXT_DELETED"}, {STATUS_NO_TGT_REPLY, -EIO, "STATUS_NO_TGT_REPLY"}, - {STATUS_OBJECTID_NOT_FOUND, -EIO, "STATUS_OBJECTID_NOT_FOUND"}, +/* Note that ENOATTTR and ENODATA are the same errno */ + {STATUS_OBJECTID_NOT_FOUND, -ENODATA, "STATUS_OBJECTID_NOT_FOUND"}, {STATUS_NO_IP_ADDRESSES, -EIO, "STATUS_NO_IP_ADDRESSES"}, {STATUS_WRONG_CREDENTIAL_HANDLE, -EIO, "STATUS_WRONG_CREDENTIAL_HANDLE"},
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 51/52 x86/gart: Exclude GART aperture from kcore
In reply to Sasha LevinFrom: Kairui Song <[email protected]>
[ Upstream commit ffc8599aa9763f39f6736a79da4d1575e7006f9a ]
On machines where the GART aperture is mapped over physical RAM, /proc/kcore contains the GART aperture range. Accessing the GART range via /proc/kcore results in a kernel crash.
vmcore used to have the same issue, until it was fixed with commit 2a3e83c6f96c ("x86/gart: Exclude GART aperture from vmcore")', leveraging existing hook infrastructure in vmcore to let /proc/vmcore return zeroes when attempting to read the aperture region, and so it won't read from the actual memory.
Apply the same workaround for kcore. First implement the same hook infrastructure for kcore, then reuse the hook functions introduced in the previous vmcore fix. Just with some minor adjustment, rename some functions for more general usage, and simplify the hook infrastructure a bit as there is no module usage yet.
--- arch/x86/kernel/aperture_64.c | 20 +++++++++++++------- fs/proc/kcore.c | 27 +++++++++++++++++++++++++++ include/linux/kcore.h | 2 ++ 3 files changed, 42 insertions(+), 7 deletions(-)
arch/x86/kernel/aperture_64.c +13 -7
@@ -14,6 +14,7 @@#define pr_fmt (fmt) "AGP: " fmt#include <linux/kernel.h> +#include <linux/kcore.h> #include <linux/types.h> #include <linux/init.h> #include <linux/memblock.h>
@@ -57,7 +58,7 @@ int fallback_aper_force __initdata;int fix_aperture__initdata =1 ; -#ifdef CONFIG_PROC_VMCORE +#if defined(CONFIG_PROC_VMCORE ) || defined(CONFIG_PROC_KCORE )/* * If the first kernel maps the aperture over e820 RAM, the kdump kernel will * use the same range because it will remain configured in the northbridge.
@@ -66,20 +67,25 @@ int fix_aperture __initdata = 1;*/ static unsigned long aperture_pfn_start, aperture_page_count; -static int gart_oldmem_pfn_is_ram (unsigned long pfn) +static int gart_mem_pfn_is_ram (unsigned long pfn) {return likely ((pfn < aperture_pfn_start) || (pfn >= aperture_pfn_start + aperture_page_count)); } -static void exclude_from_vmcore (u64 aper_base,u32 aper_order) +static void __init exclude_from_core (u64 aper_base,u32 aper_order) { aperture_pfn_start = aper_base >>PAGE_SHIFT ; aperture_page_count = (32 *1024 *1024 ) << aper_order >>PAGE_SHIFT ; -WARN_ON (register_oldmem_pfn_is_ram (&gart_oldmem_pfn_is_ram)); +#ifdef CONFIG_PROC_VMCORE +WARN_ON (register_oldmem_pfn_is_ram (&gart_mem_pfn_is_ram)); +#endif +#ifdef CONFIG_PROC_KCORE +WARN_ON (register_mem_pfn_is_ram (&gart_mem_pfn_is_ram)); +#endif }#else -static void exclude_from_vmcore (u64 aper_base,u32 aper_order) +static void exclude_from_core (u64 aper_base,u32 aper_order) { }#endif
@@ -469,7 +475,7 @@ int __init gart_iommu_hole_init(void)* may have allocated the range over its e820 RAM * and fixed up the northbridge */ -exclude_from_vmcore (last_aper_base, last_aper_order); +exclude_from_core (last_aper_base, last_aper_order);return 1 ; }
@@ -515,7 +521,7 @@ int __init gart_iommu_hole_init(void)* overlap with the first kernel's memory. We can't access the * range through vmcore even though it should be part of the dump. */ -exclude_from_vmcore (aper_alloc, aper_order); +exclude_from_core (aper_alloc, aper_order);/* Fix up the north bridges */ for (i =0 ; i < amd_nb_bus_dev_ranges[i].dev_limit; i++) {
fs/proc/kcore.c +27 -0
@@ -54,6 +54,28 @@ static LIST_HEAD(kclist_head);static DECLARE_RWSEM (kclist_lock);static int kcore_need_update =1 ; +/* +* Returns > 0 for RAM pages, 0 for non-RAM pages, < 0 on error +* Same as oldmem_pfn_is_ram in vmcore +*/ +static int (*mem_pfn_is_ram)(unsigned long pfn); + +int __init register_mem_pfn_is_ram (int (*fn)(unsigned long pfn)) +{ +if (mem_pfn_is_ram) +return -EBUSY ; + mem_pfn_is_ram = fn; +return 0 ; +} + +static int pfn_is_ram (unsigned long pfn) +{ +if (mem_pfn_is_ram) +return mem_pfn_is_ram (pfn); +else +return 1 ; +} +/* This doesn't grab kclist_lock, so it should only be used at init time. */ void __init kclist_add (struct kcore_list *new,void *addr,size_t size,int type)
@@ -465,6 +487,11 @@ read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos) goto out; } m =NULL ;/* skip the list anchor */ + }else if (!pfn_is_ram (__pa (start) >>PAGE_SHIFT )) { +if (clear_user (buffer, tsz)) { + ret = -EFAULT ; + goto out; + } }else if (m->type ==KCORE_VMALLOC ) {vread (buf, (char *)start, tsz);/* we have to zero-fill user buffer even if no read */
include/linux/kcore.h +2 -0
@@ -44,6 +44,8 @@ void kclist_add_remap(struct kcore_list *m, void *addr, void *vaddr, size_t sz) m->vaddr = (unsigned long )vaddr; kclist_add(m, addr, sz, KCORE_REMAP); } + +extern int __init register_mem_pfn_is_ram (int (*fn)(unsigned long pfn));#else static inline void kclist_add (struct kcore_list *new,void *addr,size_t size,int type)
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 52/52 ext4: prohibit fstrim in norecovery mode
In reply to Sasha LevinFrom: "Darrick J. Wong" <[email protected]>
[ Upstream commit 18915b5873f07e5030e6fb108a050fa7c71c59fb ]
The ext4 fstrim implementation uses the block bitmaps to find free space that can be discarded. If we haven't replayed the journal, the bitmaps will be stale and we absolutely *cannot* use stale metadata to zap the underlying storage.
--- fs/ext4/ioctl.c | 7 +++++++ 1 file changed, 7 insertions(+)
fs/ext4/ioctl.c +7 -0
@@ -999,6 +999,13 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)if (!blk_queue_discard (q))return -EOPNOTSUPP ; +/* +* We haven't replayed the journal, so we cannot use our +* block-bitmap-guided storage zapping commands. +*/ +if (test_opt (sb,NOLOAD ) &&ext4_has_feature_journal (sb)) +return -EROFS ; +if (copy_from_user (&range, (struct fstrim_range __user *)arg,sizeof (range)))return -EFAULT ;
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 46/52 x86/cpu/cyrix: Use correct macros for Cyrix calls on Geode processors
In reply to Sasha LevinFrom: Matthew Whitehead <[email protected]>
[ Upstream commit 18fb053f9b827bd98cfc64f2a35df8ab19745a1d ]
There are comments in processor-cyrix.h advising you to _not_ make calls using the deprecated macros in this style:
setCx86_old(CX86_CCR4, getCx86_old(CX86_CCR4) | 0x80);
This is because it expands the macro into a non-functioning calling sequence. The calling order must be:
outb(CX86_CCR2, 0x22); inb(0x23);
From the comments:
* When using the old macros a line like
* setCx86(CX86_CCR2, getCx86(CX86_CCR2) | 0x88);
* gets expanded to:
* do {
* outb((CX86_CCR2), 0x22);
* outb((({
* outb((CX86_CCR2), 0x22);
* inb(0x23);
* }) | 0x88), 0x23);
* } while (0);
The new macros fix this problem, so use them instead. Tested on an actual Geode processor.
--- arch/x86/kernel/cpu/cyrix.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
arch/x86/kernel/cpu/cyrix.c +7 -7
@@ -124,7 +124,7 @@ static void set_cx86_reorder(void)setCx86 (CX86_CCR3 , (ccr3 &0x0f ) |0x10 );/* enable MAPEN */ /* Load/Store Serialize to mem access disable (=reorder it) */ -setCx86_old (CX86_PCR0 ,getCx86_old (CX86_PCR0 ) & ~0x80 ); +setCx86 (CX86_PCR0 ,getCx86 (CX86_PCR0 ) & ~0x80 );/* set load/store serialize from 1GB to 4GB */ ccr3 |=0xe0 ;setCx86 (CX86_CCR3 , ccr3);
@@ -135,11 +135,11 @@ static void set_cx86_memwb(void)pr_info ("Enable Memory-Write-back mode on Cyrix/NSC processor.\n" );/* CCR2 bit 2: unlock NW bit */ -setCx86_old (CX86_CCR2 ,getCx86_old (CX86_CCR2 ) & ~0x04 ); +setCx86 (CX86_CCR2 ,getCx86 (CX86_CCR2 ) & ~0x04 );/* set 'Not Write-through' */ write_cr0 (read_cr0 () |X86_CR0_NW );/* CCR2 bit 2: lock NW bit and set WT1 */ -setCx86_old (CX86_CCR2 ,getCx86_old (CX86_CCR2 ) |0x14 ); +setCx86 (CX86_CCR2 ,getCx86 (CX86_CCR2 ) |0x14 ); }/*
@@ -153,14 +153,14 @@ static void geode_configure(void)local_irq_save (flags);/* Suspend on halt power saving and enable #SUSP pin */ -setCx86_old (CX86_CCR2 ,getCx86_old (CX86_CCR2 ) |0x88 ); +setCx86 (CX86_CCR2 ,getCx86 (CX86_CCR2 ) |0x88 ); ccr3 =getCx86 (CX86_CCR3 );setCx86 (CX86_CCR3 , (ccr3 &0x0f ) |0x10 );/* enable MAPEN */ /* FPU fast, DTE cache, Mem bypass */ -setCx86_old (CX86_CCR4 ,getCx86_old (CX86_CCR4 ) |0x38 ); +setCx86 (CX86_CCR4 ,getCx86 (CX86_CCR4 ) |0x38 );setCx86 (CX86_CCR3 , ccr3);/* disable MAPEN */ set_cx86_memwb ();
@@ -296,7 +296,7 @@ static void init_cyrix(struct cpuinfo_x86 *c)/* GXm supports extended cpuid levels 'ala' AMD */ if (c->cpuid_level ==2 ) {/* Enable cxMMX extensions (GX1 Datasheet 54) */ -setCx86_old (CX86_CCR7 ,getCx86_old (CX86_CCR7 ) |1 ); +setCx86 (CX86_CCR7 ,getCx86 (CX86_CCR7 ) |1 );/* * GXm : 0x30 ... 0x5f GXm datasheet 51
@@ -319,7 +319,7 @@ static void init_cyrix(struct cpuinfo_x86 *c)if (dir1 >7 ) { dir0_msn++;/* M II */ /* Enable MMX extensions (App note 108) */ -setCx86_old (CX86_CCR7 ,getCx86_old (CX86_CCR7 )|1 ); +setCx86 (CX86_CCR7 ,getCx86 (CX86_CCR7 )|1 ); }else {/* A 6x86MX - it has the bug. */ set_cpu_bug (c,X86_BUG_COMA );
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 44/52 x86/hpet: Prevent potential NULL pointer dereference
In reply to Sasha LevinFrom: Aditya Pakki <[email protected]>
[ Upstream commit 2e84f116afca3719c9d0a1a78b47b48f75fd5724 ]
hpet_virt_address may be NULL when ioremap_nocache fail, but the code lacks a check.
Add a check to prevent NULL pointer dereference.
--- arch/x86/kernel/hpet.c | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/kernel/hpet.c +2 -0
@@ -909,6 +909,8 @@ int __init hpet_enable(void)return 0 ;hpet_set_mapping (); +if (!hpet_virt_address) +return 0 ;/* * Read the period and check for a sane value:
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 43/52 irqchip/mbigen: Don't clear eventid when freeing an MSI
In reply to Sasha LevinFrom: Jianguo Chen <[email protected]>
[ Upstream commit fca269f201a8d9985c0a31fb60b15d4eb57cef80 ]
mbigen_write_msg clears eventid bits of a mbigen register when free a interrupt, because msi_domain_deactivate memset struct msg to zero. Then multiple mbigen pins with zero eventid will report the same interrupt number.
The eventid clear call trace:
free_irq
__free_irq
irq_shutdown
irq_domain_deactivate_irq
__irq_domain_deactivate_irq
__irq_domain_deactivate_irq
msi_domain_deactivate
platform_msi_write_msg
mbigen_write_msg--- drivers/irqchip/irq-mbigen.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/irqchip/irq-mbigen.c +3 -0
@@ -161,6 +161,9 @@ static void mbigen_write_msg(struct msi_desc *desc, struct msi_msg *msg)void __iomem *base = d->chip_data;u32 val; +if (!msg->address_lo && !msg->address_hi) +return ; + base +=get_mbigen_vec_reg (d->hwirq); val =readl_relaxed (base);
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 40/52 blk-iolatency: #include "blk.h"
In reply to Sasha LevinFrom: Bart Van Assche <[email protected]>
[ Upstream commit 373e915cd8e84544609eced57a44fbc084f8d60f ]
This patch avoids that the following warning is reported when building with W=1:
block/blk-iolatency.c:734:5: warning: no previous prototype for 'blk_iolatency_init' [-Wmissing-prototypes]
--- block/blk-iolatency.c | 1 + 1 file changed, 1 insertion(+)
block/blk-iolatency.c +1 -0
@@ -75,6 +75,7 @@#include <linux/blk-mq.h> #include "blk-rq-qos.h" #include "blk-stat.h" +#include "blk.h" #define DEFAULT_SCALE_COOKIE 1000000U
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 37/52 perf tests: Fix a memory leak in test__perf_evsel__tp_sched_test()
In reply to Sasha LevinFrom: Changbin Du <[email protected]>
[ Upstream commit d982b33133284fa7efa0e52ae06b88f9be3ea764 ]
=================================================================
==20875==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 1160 byte(s) in 1 object(s) allocated from:
#0 0x7f1b6fc84138 in calloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xee138)
#1 0x55bd50005599 in zalloc util/util.h:23
#2 0x55bd500068f5 in perf_evsel__newtp_idx util/evsel.c:327
#3 0x55bd4ff810fc in perf_evsel__newtp /home/work/linux/tools/perf/util/evsel.h:216
#4 0x55bd4ff81608 in test__perf_evsel__tp_sched_test tests/evsel-tp-sched.c:69
#5 0x55bd4ff528e6 in run_test tests/builtin-test.c:358
#6 0x55bd4ff52baf in test_and_print tests/builtin-test.c:388
#7 0x55bd4ff543fe in __cmd_test tests/builtin-test.c:583
#8 0x55bd4ff5572f in cmd_test tests/builtin-test.c:722
#9 0x55bd4ffc4087 in run_builtin /home/changbin/work/linux/tools/perf/perf.c:302
#10 0x55bd4ffc45c6 in handle_internal_command /home/changbin/work/linux/tools/perf/perf.c:354
#11 0x55bd4ffc49ca in run_argv /home/changbin/work/linux/tools/perf/perf.c:398
#12 0x55bd4ffc5138 in main /home/changbin/work/linux/tools/perf/perf.c:520
#13 0x7f1b6e34809a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)Indirect leak of 19 byte(s) in 1 object(s) allocated from:
#0 0x7f1b6fc83f30 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xedf30)
#1 0x7f1b6e3ac30f in vasprintf (/lib/x86_64-linux-gnu/libc.so.6+0x8830f)--- tools/perf/tests/evsel-tp-sched.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/tests/evsel-tp-sched.c +1 -0
@@ -85,5 +85,6 @@ int test__perf_evsel__tp_sched_test(struct test *test __maybe_unused, int subtesif (perf_evsel__test_field (evsel,"target_cpu" ,4 , true)) ret =-1 ; +perf_evsel__delete (evsel);return ret; }
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 26/52 x86/mm: Don't leak kernel addresses
In reply to Sasha LevinFrom: Matteo Croce <[email protected]>
[ Upstream commit a3151724437f54076cc10bc02b1c4f0003ae36cd ]
Since commit:
ad67b74d2469d9b8 ("printk: hash addresses printed with %p")
at boot "____ptrval____" is printed instead of actual addresses:
found SMP MP-table at [mem 0x000f5cc0-0x000f5ccf] mapped at [(____ptrval____)]
Instead of changing the print to "%px", and leaking a kernel addresses, just remove the print completely, like in:
071929dbdd865f77 ("arm64: Stop printing the virtual memory layout").
--- arch/x86/kernel/mpparse.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/mpparse.c +2 -2
@@ -599,8 +599,8 @@ static int __init smp_scan_config(unsigned long base, unsigned long length) mpf_base = base; mpf_found = true; -pr_info ("found SMP MP-table at [mem %#010lx-%#010lx] mapped at [%p]\n" , - base, base +sizeof (*mpf) -1 , mpf); +pr_info ("found SMP MP-table at [mem %#010lx-%#010lx]\n" , + base, base +sizeof (*mpf) -1 );memblock_reserve (base,sizeof (*mpf));if (mpf->physptr)
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 24/52 sched/cpufreq: Fix 32-bit math overflow
In reply to Sasha LevinFrom: Peter Zijlstra <[email protected]>
[ Upstream commit a23314e9d88d89d49e69db08f60b7caa470f04e1 ]
Vincent Wang reported that get_next_freq() has a mult overflow bug on 32-bit platforms in the IOWAIT boost case, since in that case {util,max} are in freq units instead of capacity units.
Solve this by moving the IOWAIT boost to capacity units. And since this means @max is constant; simplify the code.
--- kernel/sched/cpufreq_schedutil.c | 59 ++++++++++++++------------------ 1 file changed, 25 insertions(+), 34 deletions(-)
kernel/sched/cpufreq_schedutil.c +25 -34
@@ -50,10 +50,10 @@ struct sugov_cpu {bool iowait_boost_pending;unsigned int iowait_boost; -unsigned int iowait_boost_max;u64 last_update;unsigned long bw_dl; +unsigned long min;unsigned long max;/* The field below is for single-CPU policies only: */
@@ -283,8 +283,7 @@ static bool sugov_iowait_reset(struct sugov_cpu *sg_cpu, u64 time,if (delta_ns <=TICK_NSEC )return false; - sg_cpu->iowait_boost = set_iowait_boost - ? sg_cpu->sg_policy->policy->min :0 ; + sg_cpu->iowait_boost = set_iowait_boost ? sg_cpu->min :0 ; sg_cpu->iowait_boost_pending = set_iowait_boost;return true;
@@ -324,14 +323,13 @@ static void sugov_iowait_boost(struct sugov_cpu *sg_cpu, u64 time,/* Double the boost at each request */ if (sg_cpu->iowait_boost) { - sg_cpu->iowait_boost <<=1 ; -if (sg_cpu->iowait_boost > sg_cpu->iowait_boost_max) - sg_cpu->iowait_boost = sg_cpu->iowait_boost_max; + sg_cpu->iowait_boost = + min_t(unsigned int, sg_cpu->iowait_boost << 1, SCHED_CAPACITY_SCALE);return ; }/* First wakeup after IO: start with minimum boost */ - sg_cpu->iowait_boost = sg_cpu->sg_policy->policy->min; + sg_cpu->iowait_boost = sg_cpu->min; }/**
@@ -353,47 +351,38 @@ static void sugov_iowait_boost(struct sugov_cpu *sg_cpu, u64 time,* This mechanism is designed to boost high frequently IO waiting tasks, while * being more conservative on tasks which does sporadic IO operations. */ -static void sugov_iowait_apply (struct sugov_cpu *sg_cpu,u64 time, -unsigned long *util,unsigned long *max) +static unsigned long sugov_iowait_apply (struct sugov_cpu *sg_cpu,u64 time, +unsigned long util,unsigned long max) { -unsigned int boost_util, boost_max; +unsigned long boost;/* No boost currently required */ if (!sg_cpu->iowait_boost) -return ; +return util;/* Reset boost if the CPU appears to have been idle enough */ if (sugov_iowait_reset (sg_cpu, time, false)) -return ; +return util; -/* -* An IO waiting task has just woken up: -* allow to further double the boost value -*/ -if (sg_cpu->iowait_boost_pending) { - sg_cpu->iowait_boost_pending = false; - }else { +if (!sg_cpu->iowait_boost_pending) {/* -* Otherwise: reduce the boost value and disable it when we -* reach the minimum. +* No boost pending; reduce the boost value. */ sg_cpu->iowait_boost >>=1 ; -if (sg_cpu->iowait_boost < sg_cpu->sg_policy->policy->min) { +if (sg_cpu->iowait_boost < sg_cpu->min) { sg_cpu->iowait_boost =0 ; -return ; +return util; } } + sg_cpu->iowait_boost_pending = false; +/* -* Apply the current boost value: a CPU is boosted only if its current -* utilization is smaller then the current IO boost level. +* @util is already in capacity scale; convert iowait_boost +* into the same scale so we can compare. */ - boost_util = sg_cpu->iowait_boost; - boost_max = sg_cpu->iowait_boost_max; -if (*util * boost_max < *max * boost_util) { - *util = boost_util; - *max = boost_max; - } + boost = (sg_cpu->iowait_boost * max) >>SCHED_CAPACITY_SHIFT ; +return max (boost, util); }#ifdef CONFIG_NO_HZ_COMMON
@@ -440,7 +429,7 @@ static void sugov_update_single(struct update_util_data *hook, u64 time, util =sugov_get_util (sg_cpu); max = sg_cpu->max; -sugov_iowait_apply (sg_cpu, time, &util, &max); + util =sugov_iowait_apply (sg_cpu, time, util, max); next_f =get_next_freq (sg_policy, util, max);/* * Do not reduce the frequency if the CPU has not been idle
@@ -480,7 +469,7 @@ static unsigned int sugov_next_freq_shared(struct sugov_cpu *sg_cpu, u64 time) j_util =sugov_get_util (j_sg_cpu); j_max = j_sg_cpu->max; -sugov_iowait_apply (j_sg_cpu, time, &j_util, &j_max); + j_util =sugov_iowait_apply (j_sg_cpu, time, j_util, j_max);if (j_util * max > j_max * util) { util = j_util;
@@ -817,7 +806,9 @@ static int sugov_start(struct cpufreq_policy *policy)memset (sg_cpu,0 ,sizeof (*sg_cpu)); sg_cpu->cpu = cpu; sg_cpu->sg_policy = sg_policy; - sg_cpu->iowait_boost_max = policy->cpuinfo.max_freq; + sg_cpu->min = + (SCHED_CAPACITY_SCALE * policy->cpuinfo.min_freq) / + policy->cpuinfo.max_freq; }for_each_cpu (cpu, policy->cpus) {
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 10/52 ALSA: sb8: add a check for request_region
In reply to Sasha LevinFrom: Kangjie Lu <[email protected]>
[ Upstream commit dcd0feac9bab901d5739de51b3f69840851f8919 ]
In case request_region fails, the fix returns an error code to avoid NULL pointer dereference.
--- sound/isa/sb/sb8.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/isa/sb/sb8.c +4 -0
@@ -111,6 +111,10 @@ static int snd_sb8_probe(struct device *pdev, unsigned int dev)/* block the 0x388 port to avoid PnP conflicts */ acard->fm_res =request_region (0x388 ,4 ,"SoundBlaster FM" ); +if (!acard->fm_res) { + err = -EBUSY ; + goto _err; + } if (port[dev] != SNDRV_AUTO_PORT) { if ((err = snd_sbdsp_create(card, port[dev], irq[dev],
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 7/52 ext4: add missing brelse() in add_new_gdb_meta_bg()
In reply to Sasha LevinFrom: Lukas Czerner <[email protected]>
[ Upstream commit d64264d6218e6892edd832dc3a5a5857c2856c53 ]
Currently in add_new_gdb_meta_bg() there is a missing brelse of gdb_bh in case ext4_journal_get_write_access() fails.
Additionally kvfree() is missing in the same error path. Fix it by moving the ext4_journal_get_write_access() before the ext4 sb update as Ted suggested and release n_group_desc and gdb_bh in case it fails.
--- fs/ext4/resize.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
fs/ext4/resize.c +9 -2
@@ -932,11 +932,18 @@ static int add_new_gdb_meta_bg(struct super_block *sb,memcpy (n_group_desc, o_group_desc,EXT4_SB (sb)->s_gdb_count *sizeof (struct buffer_head *)); n_group_desc[gdb_num] = gdb_bh; + +BUFFER_TRACE (gdb_bh,"get_write_access" ); + err =ext4_journal_get_write_access (handle, gdb_bh); +if (err) { +kvfree (n_group_desc); +brelse (gdb_bh); +return err; + } +EXT4_SB (sb)->s_group_desc = n_group_desc;EXT4_SB (sb)->s_gdb_count++;kvfree (o_group_desc); -BUFFER_TRACE (gdb_bh,"get_write_access" ); - err =ext4_journal_get_write_access (handle, gdb_bh);return err; }
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 8/52 ext4: report real fs size after failed resize
In reply to Sasha LevinFrom: Lukas Czerner <[email protected]>
[ Upstream commit 6c7328400e0488f7d49e19e02290ba343b6811b2 ]
Currently when the file system resize using ext4_resize_fs() fails it will report into log that "resized filesystem to <requested block count>". However this may not be true in the case of failure. Use the current block count as returned by ext4_blocks_count() to report the block count.
Additionally, report a warning that "error occurred during file system resize"
--- fs/ext4/resize.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/ext4/resize.c +5 -1
@@ -2080,6 +2080,10 @@ int ext4_resize_fs(struct super_block *sb, ext4_fsblk_t n_blocks_count)free_flex_gd (flex_gd);if (resize_inode !=NULL )iput (resize_inode); -ext4_msg (sb,KERN_INFO ,"resized filesystem to %llu" , n_blocks_count); +if (err) +ext4_warning (sb,"error (%d) occurred during " +"file system resize" , err); +ext4_msg (sb,KERN_INFO ,"resized filesystem to %llu" , +ext4_blocks_count (es));return err; }
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 4/52 perf/core: Restore mmap record type correctly
In reply to Sasha LevinFrom: Stephane Eranian <[email protected]>
[ Upstream commit d9c1bb2f6a2157b38e8eb63af437cb22701d31ee ]
On mmap(), perf_events generates a RECORD_MMAP record and then checks which events are interested in this record. There are currently 2 versions of mmap records: RECORD_MMAP and RECORD_MMAP2. MMAP2 is larger. The event configuration controls which version the user level tool accepts.
If the event->attr.mmap2=1 field then MMAP2 record is returned. The perf_event_mmap_output() takes care of this. It checks attr->mmap2 and corrects the record fields before putting it in the sampling buffer of the event. At the end the function restores the modified MMAP record fields.
The problem is that the function restores the size but not the type. Thus, if a subsequent event only accepts MMAP type, then it would instead receive an MMAP2 record with a size of MMAP record.
This patch fixes the problem by restoring the record type on exit.
--- kernel/events/core.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/events/core.c +2 -0
@@ -7178,6 +7178,7 @@ static void perf_event_mmap_output(struct perf_event *event,struct perf_output_handle handle;struct perf_sample_data sample;int size = mmap_event->event_id.header.size; +u32 type = mmap_event->event_id.header.type;int ret;if (!perf_event_mmap_match (event, data))
@@ -7221,6 +7222,7 @@ static void perf_event_mmap_output(struct perf_event *event,perf_output_end (&handle); out: mmap_event->event_id.header.size = size; + mmap_event->event_id.header.type = type; }static void perf_event_mmap_event (struct perf_mmap_event *mmap_event)
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 5/52 perf data: Don't store auxtrace index for directory data file
In reply to Sasha LevinFrom: Jiri Olsa <[email protected]>
[ Upstream commit cd3dd8dd8ff62374d90cb3f2e54b8c94106c7810 ]
We can't store the auxtrace index when we store into multiple files, because we keep only offset for it, not the file.
The auxtrace data will be processed correctly in the 'pipe' mode.
--- tools/perf/builtin-record.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-record.c +1 -1
@@ -178,7 +178,7 @@ static int record__process_auxtrace(struct perf_tool *tool,size_t padding;u8 pad[8 ] = {0 }; -if (!perf_data__is_pipe (data)) { +if (!perf_data__is_pipe (data) && !perf_data__is_dir (data)) {off_t file_offset;int fd =perf_data__fd (data);int err;
Signature · 1 line
2.19.1