[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20091222100553.GA10314@basil.fritz.box>
Date: Tue, 22 Dec 2009 11:05:53 +0100
From: Andi Kleen <andi@...stfloor.org>
To: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
Cc: Andi Kleen <andi@...stfloor.org>, linux-kernel@...r.kernel.org,
ebiederm@...ssion.com
Subject: Re: [PATCH] [1/11] Add rcustring ADT for RCU protected strings
On Mon, Dec 21, 2009 at 06:46:35PM -0800, Paul E. McKenney wrote:
> My guess is that you will sooner or later need a size field, perhaps
> under some debug config parameter.
That can be gotten from ksize() if needed.
> > +/*
> > + * Get a local private copy of a RCU protected string.
> > + * Mostly useful to get a string that is stable while sleeping.
> > + * Caller must free returned string.
> > + */
> > +char *access_rcu_string(const char *str, int size, gfp_t gfp)
> > +{
> > + char *copy = kmalloc(size, gfp);
> > + if (!str)
> > + return NULL;
>
> Assuming that "str" points to the "str" field of a struct rcu_string,
> what prevents a grace period from elapsing at this point, freeing the
> "str" out from under us?
Yes, that's broken thanks. I'll move the reference into the read lock
section.
-Andi
--
ak@...ux.intel.com -- Speaking for myself only.
--
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