summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2011-01-26 22:59:25 +0100
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2011-01-26 22:59:25 +0100
commit36c7d241b6486d1ce3c4dd1c8a1fa42e870c3355 (patch)
treea81273b38044ee08d181284227063a49d09379ed /kernel
parent8271afcab2f219158ec5d63f6b625cd64dcc98a8 (diff)
Constified attribute cannot be written
Attribute is const so a little bit more work is needed to return the error line number. A test is also added in order to check the functionality. (Patrick McHardy's review)
Diffstat (limited to 'kernel')
-rw-r--r--kernel/ip_set_core.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/kernel/ip_set_core.c b/kernel/ip_set_core.c
index 3071d3f..3dad957 100644
--- a/kernel/ip_set_core.c
+++ b/kernel/ip_set_core.c
@@ -1118,7 +1118,17 @@ call_ad(struct sk_buff *skb, const struct nlattr *const attr[],
return 0;
if (lineno && attr[IPSET_ATTR_LINENO]) {
/* Error in restore/batch mode: send back lineno */
- u32 *errline = nla_data(attr[IPSET_ATTR_LINENO]);
+ struct nlmsghdr *nlh = nlmsg_hdr(skb);
+ int min_len = NLMSG_SPACE(sizeof(struct nfgenmsg));
+ struct nlattr *cda[IPSET_ATTR_CMD_MAX+1];
+ struct nlattr *cmdattr = (void *)nlh + min_len;
+ u32 *errline;
+
+ nla_parse(cda, IPSET_ATTR_CMD_MAX,
+ cmdattr, nlh->nlmsg_len - min_len,
+ ip_set_adt_policy);
+
+ errline = nla_data(cda[IPSET_ATTR_LINENO]);
*errline = lineno;
}