From: Sebastiano Di Paola Date: Fri, 30 Jan 2009 23:37:17 +0000 (+0000) Subject: net: packet socket packet_lookup_frame fix X-Git-Tag: v2.6.28.6~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3cb569832d1b79a60b5df1b510c1712aa76e7cdd;p=thirdparty%2Fkernel%2Fstable.git net: packet socket packet_lookup_frame fix [ Upstream commit f9e6934502e46c363100245f137ddf0f4b1cb574 ] 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: Paolo Abeni Signed-off-by: Sebastiano Di Paola Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index c718e7e3f7dea..1789f6cf1cbe7 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -220,13 +220,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; }