mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: Hillf Danton <hdanton@sina.com>, Kishon Vijay Abraham I <kishon@ti.com>
Cc: Randy Dunlap <rdunlap@infradead.org>,
	linux-pci <linux-pci@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: pci: endpoint test BUG
Date: Mon, 16 Sep 2019 12:22:46 +0100	[thread overview]
Message-ID: <20190916112246.GA6693@e121166-lin.cambridge.arm.com> (raw)
In-Reply-To: <20190916020630.1584-1-hdanton@sina.com>

On Mon, Sep 16, 2019 at 10:06:30AM +0800, 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);
>  }

Thank you Hillf. Kishon, can you confirm that's the proper fix for
this bug please ? I would like to turn this into a patch and merge
it in the upcoming merge window PR so it ought to be fairly quick,
please let me know asap.

Lorenzo

  parent reply	other threads:[~2019-09-16 11:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190916020630.1584-1-hdanton@sina.com>
2019-09-16  2:58 ` Randy Dunlap
2019-09-16 11:22 ` Lorenzo Pieralisi [this message]
2019-09-17  5:40   ` Kishon Vijay Abraham I
2019-09-20 15:20     ` Lorenzo Pieralisi
2019-09-21  0:57       ` Randy Dunlap
2019-09-21  3:32         ` Randy Dunlap
     [not found]         ` <c2cadd96-a6d5-45f9-9abc-4c89b4a8b056@VE1EUR03FT044.eop-EUR03.prod.protection.outlook.com>
2019-09-23  9:55           ` Lorenzo Pieralisi
2019-09-15 16:34 Randy Dunlap
2019-09-15 16:39 ` Al Viro
2019-09-15 19:48   ` Randy Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190916112246.GA6693@e121166-lin.cambridge.arm.com \
    --to=lorenzo.pieralisi@arm.com \
    --cc=hdanton@sina.com \
    --cc=kishon@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=rdunlap@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®