Thread (6 messages) flat view 6 messages, 2 authors, 2021-01-14

Re: [Patch net v2] cls_flower: call nla_ok() before nla_next()

From: Jakub Kicinski <kuba@kernel.org>
Date: 2021-01-14 20:28:57

On Thu, 14 Jan 2021 12:24:19 -0800 Cong Wang wrote:
quoted
Fair, depth will but 0 so first check already fails, but nla_next()
would crash since it tries to access the length of the attribute
unconditionally.  
nla_next() is only called when nla_ok() returns true, which is not
the case for msk_depth==0, therefore NULL won't crash here.

The only problem is we become too strict to reject optionally missing
masks, we should not even call nla_ok() here, otherwise it would
break user-space. So,

+               if (!nla_opt_msk)
+                       continue;

Thanks.
You're right.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help