netfilter: nf_tables: fix possible null-pointer dereference in object update
Subsystems (2)
PATCH 1/1 netfilter: nf_tables: fix possible null-pointer dereference in object update
--- net/netfilter/nf_tables_api.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/netfilter/nf_tables_api.c +2 -1
@@ -6477,7 +6477,8 @@ static void nft_obj_commit_update(struct nft_trans *trans) obj =nft_trans_obj (trans); newobj =nft_trans_obj_newobj (trans); - obj->ops->update (obj, newobj); +if (obj->ops->update) + obj->ops->update (obj, newobj);kfree (newobj); }
Signature · 1 line
2.20.1
Phil Sutter
reviewerHi Fernando,
Quoted 2 lines · Fernando Fernandez Mancera
Fixes d62d0ba97b58 ("netfilter: nf_tables: Introduce stateful object update operation")Signed-off-by Fernando Fernandez Mancera <[email protected]>
Your patch looks good but please (always) provide a bit of explanation. In this case typical questions to answer in commit message are:
- Why may obj->ops->update be NULL? For which object type are they not defined?
- How could one trigger the issue? In other words, why is nft_obj_commit_update() called for the "wrong" object?
Cheers, Phil
Hi Phil,
I am sending a v2 with an explanation. Thanks!
Quoted 15 lines · Phil Sutter
Hi Fernando,
Quoted 2 lines · Fernando Fernandez Mancera
Fixes d62d0ba97b58 ("netfilter: nf_tables: Introduce stateful object update operation")Signed-off-by Fernando Fernandez Mancera <[email protected]>Your patch looks good but please (always) provide a bit of explanation. In this case typical questions to answer in commit message are:
- Why mayobj->ops->updatebe NULL? For which object type are they not defined?
- How could one trigger the issue? In other words, why isnft_obj_commit_update()called for the "wrong" object?Cheers, Phil
Pablo Neira Ayuso
maintainerQuoted 11 lines · Fernando Fernandez Mancera
Fixes d62d0ba97b58 ("netfilter: nf_tables: Introduce stateful object update operation")Signed-off-by Fernando Fernandez Mancera <[email protected]>--- net/netfilter/nf_tables_api.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)net/netfilter/nf_tables_api.c +0
-0
net/netfilter/nf_tables_api.c static void nft_obj_commit_update(struct nft_trans *trans) · line 6481
Quoted 6 lines
net/netfilter/nf_tables_api.c +2
-1@@ -6477,7 +6477,8 @@ static void nft_obj_commit_update(struct nft_trans *trans) obj =nft_trans_obj (trans); newobj =nft_trans_obj_newobj (trans); - obj->ops->update (obj, newobj); +if (obj->ops->update) + obj->ops->update (obj, newobj);
Please, check for obj->ops->update() from the preparation phase, ie. from nf_tables_updobj().
If obj->ops->update is NULL, then return -EOPNOTSUPP.