]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/pppoe.c
pppoe: Fix socket leak.
[linux-2.6-omap-h63xx.git] / drivers / net / pppoe.c
index bafb69b6f7cbdeb26ea7975a2d46d2f04f7bdb24..b646e92134dc79a6bbfe6e55f7c80fd0ea19d3f1 100644 (file)
@@ -399,11 +399,11 @@ static int pppoe_rcv(struct sk_buff *skb,
        if (skb->len < len)
                goto drop;
 
-       po = get_item(ph->sid, eth_hdr(skb)->h_source, dev->ifindex);
-       if (!po)
+       if (pskb_trim_rcsum(skb, len))
                goto drop;
 
-       if (pskb_trim_rcsum(skb, len))
+       po = get_item(ph->sid, eth_hdr(skb)->h_source, dev->ifindex);
+       if (!po)
                goto drop;
 
        return sk_receive_skb(sk_pppox(po), skb, 0);
@@ -942,7 +942,7 @@ static int pppoe_recvmsg(struct kiocb *iocb, struct socket *sock,
        m->msg_namelen = 0;
 
        if (skb) {
-               total_len = min(total_len, skb->len);
+               total_len = min_t(size_t, total_len, skb->len);
                error = skb_copy_datagram_iovec(skb, 0, m->msg_iov, total_len);
                if (error == 0)
                        error = total_len;