summaryrefslogtreecommitdiff
path: root/net/netlink
diff options
context:
space:
mode:
Diffstat (limited to 'net/netlink')
-rw-r--r--net/netlink/af_netlink.c6
-rw-r--r--net/netlink/diag.c2
-rw-r--r--net/netlink/genetlink.c20
-rw-r--r--net/netlink/policy.c4
4 files changed, 16 insertions, 16 deletions
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 4d609d5cf406..2aeb0680807d 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -2108,8 +2108,8 @@ int __netlink_change_ngroups(struct sock *sk, unsigned int groups)
* This changes the number of multicast groups that are available
* on a certain netlink family. Note that it is not possible to
* change the number of groups to below 32. Also note that it does
- * not implicitly call netlink_clear_multicast_users() when the
- * number of groups is reduced.
+ * not implicitly clear listeners from groups that are removed when
+ * the number of groups is reduced.
*
* @sk: The kernel netlink socket, as returned by netlink_kernel_create().
* @groups: The new number of groups.
@@ -2700,7 +2700,7 @@ static int netlink_native_seq_show(struct seq_file *seq, void *v)
struct sock *s = v;
struct netlink_sock *nlk = nlk_sk(s);
- seq_printf(seq, "%pK %-3d %-10u %08x %-8d %-8d %-5d %-8d %-8u %-8lu\n",
+ seq_printf(seq, "%pK %-3d %-10u %08x %-8d %-8d %-5d %-8d %-8u %-8llu\n",
s,
s->sk_protocol,
nlk->portid,
diff --git a/net/netlink/diag.c b/net/netlink/diag.c
index 1dfc340736b8..0b3e021bd0ed 100644
--- a/net/netlink/diag.c
+++ b/net/netlink/diag.c
@@ -43,7 +43,7 @@ static int sk_diag_put_flags(struct sock *sk, struct sk_buff *skb)
static int sk_diag_fill(struct sock *sk, struct sk_buff *skb,
struct netlink_diag_req *req,
- u32 portid, u32 seq, u32 flags, int sk_ino)
+ u32 portid, u32 seq, u32 flags, u64 sk_ino)
{
struct nlmsghdr *nlh;
struct netlink_diag_msg *rep;
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index a23d4c51c089..d251d894afd4 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -92,10 +92,8 @@ static unsigned long mc_group_start = 0x3 | BIT(GENL_ID_CTRL) |
static unsigned long *mc_groups = &mc_group_start;
static unsigned long mc_groups_longs = 1;
-/* We need the last attribute with non-zero ID therefore a 2-entry array */
static struct nla_policy genl_policy_reject_all[] = {
{ .type = NLA_REJECT },
- { .type = NLA_REJECT },
};
static int genl_ctrl_event(int event, const struct genl_family *family,
@@ -106,13 +104,10 @@ static void
genl_op_fill_in_reject_policy(const struct genl_family *family,
struct genl_ops *op)
{
- BUILD_BUG_ON(ARRAY_SIZE(genl_policy_reject_all) - 1 != 1);
-
if (op->policy || op->cmd < family->resv_start_op)
return;
op->policy = genl_policy_reject_all;
- op->maxattr = 1;
}
static void
@@ -123,7 +118,6 @@ genl_op_fill_in_reject_policy_split(const struct genl_family *family,
return;
op->policy = genl_policy_reject_all;
- op->maxattr = 1;
}
static const struct genl_family *genl_family_find_byid(unsigned int id)
@@ -250,6 +244,7 @@ genl_get_cmd_split(u32 cmd, u8 flag, const struct genl_family *family,
if (family->split_ops[i].cmd == cmd &&
family->split_ops[i].flags & flag) {
*op = family->split_ops[i];
+ genl_op_fill_in_reject_policy_split(family, op);
return 0;
}
@@ -934,12 +929,17 @@ genl_family_rcv_msg_attrs_parse(const struct genl_family *family,
struct nlattr **attrbuf;
int err;
- if (!ops->maxattr)
+ if (!ops->policy)
return NULL;
- attrbuf = kmalloc_objs(struct nlattr *, ops->maxattr + 1);
- if (!attrbuf)
- return ERR_PTR(-ENOMEM);
+ if (ops->maxattr) {
+ attrbuf = kmalloc_objs(struct nlattr *, ops->maxattr + 1);
+ if (!attrbuf)
+ return ERR_PTR(-ENOMEM);
+ } else {
+ /* Reject all policy, __nlmsg_parse() will just validate */
+ attrbuf = NULL;
+ }
err = __nlmsg_parse(nlh, hdrlen, attrbuf, ops->maxattr, ops->policy,
validate, extack);
diff --git a/net/netlink/policy.c b/net/netlink/policy.c
index f39cd7cc4fb5..08b006c48f06 100644
--- a/net/netlink/policy.c
+++ b/net/netlink/policy.c
@@ -31,7 +31,7 @@ static int add_policy(struct netlink_policy_dump_state **statep,
struct netlink_policy_dump_state *state = *statep;
unsigned int old_n_alloc, n_alloc, i;
- if (!policy || !maxtype)
+ if (!policy)
return 0;
for (i = 0; i < state->n_alloc; i++) {
@@ -85,7 +85,7 @@ int netlink_policy_dump_get_policy_idx(struct netlink_policy_dump_state *state,
{
unsigned int i;
- if (WARN_ON(!policy || !maxtype))
+ if (WARN_ON(!policy))
return 0;
for (i = 0; i < state->n_alloc; i++) {