[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1183473121.3722.16.camel@johannes.berg>
Date: Tue, 03 Jul 2007 16:32:01 +0200
From: Johannes Berg <johannes@...solutions.net>
To: Patrick McHardy <kaber@...sh.net>
Cc: hadi@...erus.ca, Zhang Rui <rui.zhang@...el.com>,
netdev@...r.kernel.org,
"linux-acpi@...r" <linux-acpi@...r.kernel.org>, lenb@...nel.org,
Thomas Graf <tgraf@...g.ch>
Subject: Re: [PATCH] netlink: allocate group bitmaps dynamically
On Tue, 2007-07-03 at 16:11 +0200, Patrick McHardy wrote:
> >>>- nlk->groups = kzalloc(NLGRPSZ(groups), GFP_KERNEL);
> >>>- if (nlk->groups == NULL)
> >>>+ if (nlk->ngroups >= groups)
> >>>+ return 0;
> >>>+
> >>>+ new_groups = krealloc(nlk->groups, NLGRPSZ(groups), GFP_KERNEL);
> >>>+ if (new_groups == NULL)
> >>> return -ENOMEM;
> >>>+ memset((char*)new_groups + NLGRPSZ(nlk->ngroups), 0,
> >>>+ NLGRPSZ(groups) - NLGRPSZ(nlk->ngroups));
> >>>+ nlk->groups = new_groups;
> >>
> >>
> >>This should probably happen with the table grabbed to avoid races
> >>with concurrent broadcasts.
> >
> >
> > Hmm, possibly, I'll have to look again.
>
>
> do_one_broadcast locks the table and checks nlk->groups. The
> reallocation races with this without taking the lock or maybe
> using rcu.
Yeah, sounds about right, but since we lock the table anyway I see
little use in using RCU here. I'll look into it and also double-check
the first hunk of this patch.
johannes
Download attachment "signature.asc" of type "application/pgp-signature" (191 bytes)
Powered by blists - more mailing lists