diff options
author | Paul Moore <paul.moore@hp.com> | 2006-11-17 17:38:50 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:24:11 -0500 |
commit | 9fade4bf8eed3db2fd1306968da4d51bc611aca3 (patch) | |
tree | 29aa9d8d4b658dd160bc35af3678b4d1113e1577 | |
parent | 91b1ed0afdbffbda88c472ef72af37e19b7876fb (diff) |
NetLabel: return the correct error for translated CIPSOv4 tags
The CIPSOv4 translated tag #1 mapping does not always return the correct error
code if the desired mapping does not exist; instead of returning -EPERM it
returns -ENOSPC indicating that the buffer is not large enough to hold the
translated value. This was caused by failing to check a specific error
condition. This patch fixes this so that unknown mappings return
-EPERM which is consistent with the rest of the related CIPSOv4 code.
Signed-off-by: Paul Moore <paul.moore@hp.com>
Signed-off-by: James Morris <jmorris@namei.org>
-rw-r--r-- | net/ipv4/cipso_ipv4.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c index a056278ad626..c305de6fa206 100644 --- a/net/ipv4/cipso_ipv4.c +++ b/net/ipv4/cipso_ipv4.c | |||
@@ -867,6 +867,8 @@ static int cipso_v4_map_cat_rbm_hton(const struct cipso_v4_doi *doi_def, | |||
867 | return -EPERM; | 867 | return -EPERM; |
868 | 868 | ||
869 | net_spot = host_cat_array[host_spot]; | 869 | net_spot = host_cat_array[host_spot]; |
870 | if (net_spot >= CIPSO_V4_INV_CAT) | ||
871 | return -EPERM; | ||
870 | if (net_spot >= net_clen_bits) | 872 | if (net_spot >= net_clen_bits) |
871 | return -ENOSPC; | 873 | return -ENOSPC; |
872 | cipso_v4_bitmap_setbit(net_cat, net_spot, 1); | 874 | cipso_v4_bitmap_setbit(net_cat, net_spot, 1); |
@@ -935,6 +937,8 @@ static int cipso_v4_map_cat_rbm_ntoh(const struct cipso_v4_doi *doi_def, | |||
935 | return -EPERM; | 937 | return -EPERM; |
936 | 938 | ||
937 | host_spot = net_cat_array[net_spot]; | 939 | host_spot = net_cat_array[net_spot]; |
940 | if (host_spot >= CIPSO_V4_INV_CAT) | ||
941 | return -EPERM; | ||
938 | if (host_spot >= host_clen_bits) | 942 | if (host_spot >= host_clen_bits) |
939 | return -ENOSPC; | 943 | return -ENOSPC; |
940 | cipso_v4_bitmap_setbit(host_cat, host_spot, 1); | 944 | cipso_v4_bitmap_setbit(host_cat, host_spot, 1); |