[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8D983423E7EDF846BB3056827B8CC5D14BC3ABB9@corpmail1.na.ads.idt.com>
Date: Mon, 8 Jul 2013 11:55:56 +0000
From: "Bounine, Alexandre" <Alexandre.Bounine@....com>
To: Dan Carpenter <dan.carpenter@...cle.com>,
Matt Porter <mporter@...nel.crashing.org>
CC: Ryan Mallon <rmallon@...il.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>
Subject: RE: [patch v2] rapidio: use after free in unregister function
On Friday, July 05, 2013 4:39 PM, Dan Carpenter wrote:
> We're freeing the list iterator so we can't move to the next entry.
> Since there is only one matching mport_id, we can just break after
> finding it.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
> ---
> v2: cleaner fix than v1
>
> diff --git a/drivers/rapidio/rio.c b/drivers/rapidio/rio.c
> index f4f30af..2e8a20c 100644
> --- a/drivers/rapidio/rio.c
> +++ b/drivers/rapidio/rio.c
> @@ -1715,11 +1715,13 @@ int rio_unregister_scan(int mport_id, struct
> rio_scan *scan_ops)
> (mport_id == RIO_MPORT_ANY && port->nscan == scan_ops))
> port->nscan = NULL;
>
> - list_for_each_entry(scan, &rio_scans, node)
> + list_for_each_entry(scan, &rio_scans, node) {
> if (scan->mport_id == mport_id) {
> list_del(&scan->node);
> kfree(scan);
> + break;
> }
> + }
>
> mutex_unlock(&rio_mport_list_lock);
>
Acked-by: Alexandre Bounine <alexandre.bounine@....com>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists