|
@@ -20,7 +20,7 @@ int nf_connlabel_set(struct nf_conn *ct, u16 bit)
|
|
|
{
|
|
|
struct nf_conn_labels *labels = nf_ct_labels_find(ct);
|
|
|
|
|
|
- if (!labels || BIT_WORD(bit) >= labels->words)
|
|
|
+ if (!labels)
|
|
|
return -ENOSPC;
|
|
|
|
|
|
if (test_bit(bit, labels->bits))
|
|
@@ -60,7 +60,7 @@ int nf_connlabels_replace(struct nf_conn *ct,
|
|
|
if (!labels)
|
|
|
return -ENOSPC;
|
|
|
|
|
|
- size = labels->words * sizeof(long);
|
|
|
+ size = sizeof(labels->bits);
|
|
|
if (size < (words32 * sizeof(u32)))
|
|
|
words32 = size / sizeof(u32);
|
|
|
|
|
@@ -80,16 +80,11 @@ EXPORT_SYMBOL_GPL(nf_connlabels_replace);
|
|
|
|
|
|
int nf_connlabels_get(struct net *net, unsigned int bits)
|
|
|
{
|
|
|
- size_t words;
|
|
|
-
|
|
|
- words = BIT_WORD(bits) + 1;
|
|
|
- if (words > NF_CT_LABELS_MAX_SIZE / sizeof(long))
|
|
|
+ if (BIT_WORD(bits) >= NF_CT_LABELS_MAX_SIZE / sizeof(long))
|
|
|
return -ERANGE;
|
|
|
|
|
|
spin_lock(&nf_connlabels_lock);
|
|
|
net->ct.labels_used++;
|
|
|
- if (words > net->ct.label_words)
|
|
|
- net->ct.label_words = words;
|
|
|
spin_unlock(&nf_connlabels_lock);
|
|
|
|
|
|
return 0;
|
|
@@ -100,8 +95,6 @@ void nf_connlabels_put(struct net *net)
|
|
|
{
|
|
|
spin_lock(&nf_connlabels_lock);
|
|
|
net->ct.labels_used--;
|
|
|
- if (net->ct.labels_used == 0)
|
|
|
- net->ct.label_words = 0;
|
|
|
spin_unlock(&nf_connlabels_lock);
|
|
|
}
|
|
|
EXPORT_SYMBOL_GPL(nf_connlabels_put);
|