Commit 9c25704
committed
netfilter: nf_tables: report use refcount overflow
jira VULN-429
subsystem-sync netfilter:nf_tables 4.18.0-534
commit-author Pablo Neira Ayuso <pablo@netfilter.org>
commit 1689f25
upstream-diff This cherry pick is a complete mess and I tried
to follow the 5.18.0-534 code as the guiding light, but the
upstream diff is a large.
Overflow use refcount checks are not complete.
Add helper function to deal with object reference counter tracking.
Report -EMFILE in case UINT_MAX is reached.
nft_use_dec() splats in case that reference counter underflows,
which should not ever happen.
Add nft_use_inc_restore() and nft_use_dec_restore() which are used
to restore reference counter from error and abort paths.
Use u32 in nft_flowtable and nft_object since helper functions cannot
work on bitfields.
Remove the few early incomplete checks now that the helper functions
are in place and used to check for refcount overflow.
Fixes: 9651851 ("netfilter: add nftables")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
(cherry picked from commit 1689f25)
Signed-off-by: Greg Rose <g.v.rose@ciq.com>1 parent 68dc18f commit 9c25704
File tree
4 files changed
+151
-83
lines changed- include/net/netfilter
- net/netfilter
4 files changed
+151
-83
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1079 | 1079 | | |
1080 | 1080 | | |
1081 | 1081 | | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
1082 | 1105 | | |
1083 | 1106 | | |
1084 | 1107 | | |
| |||
1148 | 1171 | | |
1149 | 1172 | | |
1150 | 1173 | | |
1151 | | - | |
1152 | | - | |
| 1174 | + | |
| 1175 | + | |
1153 | 1176 | | |
1154 | 1177 | | |
1155 | 1178 | | |
| |||
1249 | 1272 | | |
1250 | 1273 | | |
1251 | 1274 | | |
1252 | | - | |
1253 | | - | |
| 1275 | + | |
| 1276 | + | |
1254 | 1277 | | |
1255 | 1278 | | |
1256 | 1279 | | |
| |||
0 commit comments