[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BY5PR10MB41295AF42563F023651E109FC4BE9@BY5PR10MB4129.namprd10.prod.outlook.com>
Date: Tue, 14 Mar 2023 02:32:13 +0000
From: Anjali Kulkarni <anjali.k.kulkarni@...cle.com>
To: Jakub Kicinski <kuba@...nel.org>
CC: "davem@...emloft.net" <davem@...emloft.net>,
"edumazet@...gle.com" <edumazet@...gle.com>,
"pabeni@...hat.com" <pabeni@...hat.com>,
"zbr@...emap.net" <zbr@...emap.net>,
"brauner@...nel.org" <brauner@...nel.org>,
"johannes@...solutions.net" <johannes@...solutions.net>,
"ecree.xilinx@...il.com" <ecree.xilinx@...il.com>,
"leon@...nel.org" <leon@...nel.org>,
"keescook@...omium.org" <keescook@...omium.org>,
"socketcan@...tkopp.net" <socketcan@...tkopp.net>,
"petrm@...dia.com" <petrm@...dia.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH v1 2/5] connector/cn_proc: Add filtering to fix some bugs
> -int cn_netlink_send_mult(struct cn_msg *msg, u16 len, u32 portid, u32 group, gfp_t gfp_mask);
> +int cn_netlink_send_mult(struct cn_msg *msg, u16 len, u32 portid,
> + u32 group, gfp_t gfp_mask,
> + int (*filter)(struct sock *dsk, struct sk_buff *skb,
> + void *data),
> + void *filter_data);
kdoc needs to be extended
ANJALI> Thanks, will update in next revision.
> -
> + if (sk->sk_protocol == NETLINK_CONNECTOR) {
> + if (test_bit(CN_IDX_PROC - 1, nlk->groups)) {
> + kfree(sk->sk_user_data);
> + sk->sk_user_data = NULL;
> + }
> + }
> for (i = 0; i < nlk->ngroups; i++)
> if (test_bit(i, nlk->groups))
> nlk->netlink_unbind(sock_net(sk), i + 1);
This is clearly a layering violation, right?
Please don't add "if (family_x)" to the core netlink code.
ANJALI> Yes, it is, but there does not seem a very clean way to do it otherwise and I saw a check for protocol NETLINK_GENERIC just below it, so used it for connector as well. There is no release or free callback in the netlink_sock. Is it ok to add it? There was another bug (for which I have not yet sent a patch) in which, we need to decrement proc_event_num_listeners, when client exits without calling IGNORE, else that count again gets out of status of actual no of listeners.
The other option is to add a flag in netlink_sock, something like NETLINK_F_SK_USER_DATA_FREE, which will free the sk_user_data, if this flag is set. But it does not solve the above scenario.
.
Powered by blists - more mailing lists