[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADvbK_dBm1b97eFqGrEp1EZN8Sfozm3PJ1MhqEZK+R3FB47-ZQ@mail.gmail.com>
Date: Sun, 10 Sep 2017 23:45:52 +1200
From: Xin Long <lucien.xin@...il.com>
To: Cong Wang <xiyou.wangcong@...il.com>
Cc: network dev <netdev@...r.kernel.org>,
David Miller <davem@...emloft.net>,
Florian Westphal <fw@...len.de>
Subject: Re: [PATCH net] netlink: access nlk groups safely in netlink bind and getname
On Sat, Sep 9, 2017 at 7:35 AM, Cong Wang <xiyou.wangcong@...il.com> wrote:
> On Tue, Sep 5, 2017 at 8:53 PM, Xin Long <lucien.xin@...il.com> wrote:
>> Now there is no lock protecting nlk ngroups/groups' accessing in
>> netlink bind and getname. It's safe from nlk groups' setting in
>> netlink_release, but not from netlink_realloc_groups called by
>> netlink_setsockopt.
>>
>> netlink_lock_table is needed in both netlink bind and getname when
>> accessing nlk groups.
>
> This looks very odd.
>
> netlink_lock_table() should be protecting nl_table, why
> it also protects nlk->groups?? For me it looks like you
> need lock_sock() instead.
I believe netlink_lock_table might be only used to protect nl_table
at the beginning and surely lock_sock is better here. Thanks.
But can you explain why netlink_lock_table() was also used in
netlink_getsockopt NETLINK_LIST_MEMBERSHIPS ? or it
was just a mistake ?
Powered by blists - more mailing lists