mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
netfilter: nf_queue: reject NF_STOLEN verdicts from userspace
A userspace listener may send (bogus) NF_STOLEN verdict, which causes skb leak. This problem was previously fixed via64507fdbc2(netfilter: nf_queue: fix NF_STOLEN skb leak) but this had to be reverted because NF_STOLEN can also be returned by a netfilter hook when iterating the rules in nf_reinject. Reject userspace NF_STOLEN verdict, as suggested by Michal Miroslaw. This is complementary to commitfad5444043(netfilter: avoid double free in nf_reinject). Cc: Julian Anastasov <[email protected]> Cc: Eric Dumazet <[email protected]> Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Patrick McHardy <[email protected]>
This commit is contained in:
parent
9823d9ff48
commit
c6675233f9
3 changed files with 10 additions and 16 deletions
|
|
@ -314,7 +314,7 @@ ipq_set_verdict(struct ipq_verdict_msg *vmsg, unsigned int len)
|
|||
{
|
||||
struct nf_queue_entry *entry;
|
||||
|
||||
if (vmsg->value > NF_MAX_VERDICT)
|
||||
if (vmsg->value > NF_MAX_VERDICT || vmsg->value == NF_STOLEN)
|
||||
return -EINVAL;
|
||||
|
||||
entry = ipq_find_dequeue_entry(vmsg->id);
|
||||
|
|
@ -359,12 +359,9 @@ ipq_receive_peer(struct ipq_peer_msg *pmsg,
|
|||
break;
|
||||
|
||||
case IPQM_VERDICT:
|
||||
if (pmsg->msg.verdict.value > NF_MAX_VERDICT)
|
||||
status = -EINVAL;
|
||||
else
|
||||
status = ipq_set_verdict(&pmsg->msg.verdict,
|
||||
len - sizeof(*pmsg));
|
||||
break;
|
||||
status = ipq_set_verdict(&pmsg->msg.verdict,
|
||||
len - sizeof(*pmsg));
|
||||
break;
|
||||
default:
|
||||
status = -EINVAL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue