Looks good. Ethan
On Thu, Dec 8, 2011 at 14:01, Ben Pfaff <b...@nicira.com> wrote: > Found by inspection. > --- > lib/netdev-linux.c | 7 +++++-- > lib/netdev-provider.h | 3 +++ > 2 files changed, 8 insertions(+), 2 deletions(-) > > diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c > index 9ff286e..27a123c 100644 > --- a/lib/netdev-linux.c > +++ b/lib/netdev-linux.c > @@ -802,8 +802,11 @@ netdev_linux_recv(struct netdev *netdev_, void *data, > size_t size) > } > > for (;;) { > - ssize_t retval = read(netdev->fd, data, size); > - if (retval >= 0) { > + ssize_t retval = recv(netdev->fd, data, size, MSG_TRUNC); > + if (retval > size) { > + /* Received packet was longer than supplied buffer. */ > + return -EMSGSIZE; > + } else if (retval >= 0) { > return retval; > } else if (errno != EINTR) { > if (errno != EAGAIN) { > diff --git a/lib/netdev-provider.h b/lib/netdev-provider.h > index 81e6c39..d5a30c8 100644 > --- a/lib/netdev-provider.h > +++ b/lib/netdev-provider.h > @@ -172,6 +172,9 @@ struct netdev_class { > * packet, otherwise a negative errno value. Returns -EAGAIN immediately > * if no packet is ready to be received. > * > + * Returns -EMSGSIZE, and discards the packet, if the received packet is > + * longer than 'size' bytes. > + * > * This function can only be expected to return a packet if ->listen() has > * been called successfully. > * > -- > 1.7.4.4 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > http://openvswitch.org/mailman/listinfo/dev _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev