lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Sun, 15 Sep 2019 19:58:22 -0700
From:   Randy Dunlap <rdunlap@...radead.org>
To:     Hillf Danton <hdanton@...a.com>
Cc:     linux-pci <linux-pci@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Kishon Vijay Abraham I <kishon@...com>,
        Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
        Al Viro <viro@...IV.linux.org.uk>
Subject: Re: pci: endpoint test BUG

On 9/15/19 7:06 PM, Hillf Danton wrote:
> 
> On Sun, 15 Sep 2019 09:34:37 -0700
>>
>> Kernel is 5.3-rc8 on x86_64.
>>
>> Loading and removing the pci-epf-test module causes a BUG.
>>
>>
>> [40928.435755] calling  pci_epf_test_init+0x0/0x1000 [pci_epf_test] @ 12132
>> [40928.436717] initcall pci_epf_test_init+0x0/0x1000 [pci_epf_test] returned 0 after 891 usecs
>> [40936.996081] ==================================================================
>> [40936.996125] BUG: KASAN: use-after-free in pci_epf_remove_cfs+0x1ae/0x1f0
>> [40936.996153] Write of size 8 at addr ffff88810a22a068 by task rmmod/12139
> 
> Fix fb0de5b8dcc6 and ef1433f717a2 if the current group::group_entry
> used by pci epf does not break how configfs uses it.
> 
> --- a/drivers/pci/endpoint/pci-epf-core.c
> +++ b/drivers/pci/endpoint/pci-epf-core.c
> @@ -153,9 +153,11 @@ static void pci_epf_remove_cfs(struct pc
>  		return;
>  
>  	mutex_lock(&pci_epf_mutex);
> -	list_for_each_entry_safe(group, tmp, &driver->epf_group, group_entry)
> +	list_for_each_entry_safe(group, tmp, &driver->epf_group,
> +							group_entry) {
> +		list_del_init(&group->group_entry);
>  		pci_ep_cfs_remove_epf_group(group);
> -	list_del(&driver->epf_group);
> +	}
>  	mutex_unlock(&pci_epf_mutex);
>  }
>  
> 

Fixes the problem for me.  Thanks.
Tested-by: Randy Dunlap <rdunlap@...radead.org>

Please make a proper patch.

-- 
~Randy

Powered by blists - more mailing lists