Pablo Neira Ayuso 039ce5eb6b netfilter: nf_tables: report use refcount overflow
commit 1689f25924ada8fe14a4a82c38925d04994c7142 upstream.

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: 96518518cc41 ("netfilter: add nftables")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-08-16 18:21:03 +02:00
..
2023-06-09 10:30:12 +02:00
2023-07-27 08:44:35 +02:00
2023-06-21 15:45:38 +02:00
2023-03-22 13:30:00 +01:00
2023-05-17 11:48:11 +02:00
2023-07-27 08:44:09 +02:00
2021-06-18 10:00:06 +02:00
2023-06-21 15:45:38 +02:00
2023-06-21 15:45:38 +02:00