提交 f9e69345 编写于 作者: S Sebastiano Di Paola 提交者: David S. Miller

net: packet socket packet_lookup_frame fix

packet_lookup_frames() fails to get user frame if current frame header
status contains extra flags.
This is due to the wrong assumption on the operators precedence during
frame status tests.
Fixed by forcing the right operators precedence order with explicit brackets.
Signed-off-by: NPaolo Abeni <paolo.abeni@gmail.com>
Signed-off-by: NSebastiano Di Paola <sebastiano.dipaola@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 5d0932a5
......@@ -222,13 +222,13 @@ static void *packet_lookup_frame(struct packet_sock *po, unsigned int position,
h.raw = po->pg_vec[pg_vec_pos] + (frame_offset * po->frame_size);
switch (po->tp_version) {
case TPACKET_V1:
if (status != h.h1->tp_status ? TP_STATUS_USER :
TP_STATUS_KERNEL)
if (status != (h.h1->tp_status ? TP_STATUS_USER :
TP_STATUS_KERNEL))
return NULL;
break;
case TPACKET_V2:
if (status != h.h2->tp_status ? TP_STATUS_USER :
TP_STATUS_KERNEL)
if (status != (h.h2->tp_status ? TP_STATUS_USER :
TP_STATUS_KERNEL))
return NULL;
break;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册