aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ppp_generic.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ppp_generic.c')
-rw-r--r--drivers/net/ppp_generic.c66
1 files changed, 33 insertions, 33 deletions
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
index f671bb810047..2282e729edbe 100644
--- a/drivers/net/ppp_generic.c
+++ b/drivers/net/ppp_generic.c
@@ -425,8 +425,8 @@ static ssize_t ppp_read(struct file *file, char __user *buf,
425 * network traffic (demand mode). 425 * network traffic (demand mode).
426 */ 426 */
427 struct ppp *ppp = PF_TO_PPP(pf); 427 struct ppp *ppp = PF_TO_PPP(pf);
428 if (ppp->n_channels == 0 428 if (ppp->n_channels == 0 &&
429 && (ppp->flags & SC_LOOP_TRAFFIC) == 0) 429 (ppp->flags & SC_LOOP_TRAFFIC) == 0)
430 break; 430 break;
431 } 431 }
432 ret = -EAGAIN; 432 ret = -EAGAIN;
@@ -511,8 +511,8 @@ static unsigned int ppp_poll(struct file *file, poll_table *wait)
511 else if (pf->kind == INTERFACE) { 511 else if (pf->kind == INTERFACE) {
512 /* see comment in ppp_read */ 512 /* see comment in ppp_read */
513 struct ppp *ppp = PF_TO_PPP(pf); 513 struct ppp *ppp = PF_TO_PPP(pf);
514 if (ppp->n_channels == 0 514 if (ppp->n_channels == 0 &&
515 && (ppp->flags & SC_LOOP_TRAFFIC) == 0) 515 (ppp->flags & SC_LOOP_TRAFFIC) == 0)
516 mask |= POLLIN | POLLRDNORM; 516 mask |= POLLIN | POLLRDNORM;
517 } 517 }
518 518
@@ -1057,8 +1057,8 @@ ppp_xmit_process(struct ppp *ppp)
1057 ppp_xmit_lock(ppp); 1057 ppp_xmit_lock(ppp);
1058 if (!ppp->closing) { 1058 if (!ppp->closing) {
1059 ppp_push(ppp); 1059 ppp_push(ppp);
1060 while (!ppp->xmit_pending 1060 while (!ppp->xmit_pending &&
1061 && (skb = skb_dequeue(&ppp->file.xq))) 1061 (skb = skb_dequeue(&ppp->file.xq)))
1062 ppp_send_frame(ppp, skb); 1062 ppp_send_frame(ppp, skb);
1063 /* If there's no work left to do, tell the core net 1063 /* If there's no work left to do, tell the core net
1064 code that we can accept some more. */ 1064 code that we can accept some more. */
@@ -1137,18 +1137,18 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb)
1137 /* the filter instructions are constructed assuming 1137 /* the filter instructions are constructed assuming
1138 a four-byte PPP header on each packet */ 1138 a four-byte PPP header on each packet */
1139 *skb_push(skb, 2) = 1; 1139 *skb_push(skb, 2) = 1;
1140 if (ppp->pass_filter 1140 if (ppp->pass_filter &&
1141 && sk_run_filter(skb, ppp->pass_filter, 1141 sk_run_filter(skb, ppp->pass_filter,
1142 ppp->pass_len) == 0) { 1142 ppp->pass_len) == 0) {
1143 if (ppp->debug & 1) 1143 if (ppp->debug & 1)
1144 printk(KERN_DEBUG "PPP: outbound frame not passed\n"); 1144 printk(KERN_DEBUG "PPP: outbound frame not passed\n");
1145 kfree_skb(skb); 1145 kfree_skb(skb);
1146 return; 1146 return;
1147 } 1147 }
1148 /* if this packet passes the active filter, record the time */ 1148 /* if this packet passes the active filter, record the time */
1149 if (!(ppp->active_filter 1149 if (!(ppp->active_filter &&
1150 && sk_run_filter(skb, ppp->active_filter, 1150 sk_run_filter(skb, ppp->active_filter,
1151 ppp->active_len) == 0)) 1151 ppp->active_len) == 0))
1152 ppp->last_xmit = jiffies; 1152 ppp->last_xmit = jiffies;
1153 skb_pull(skb, 2); 1153 skb_pull(skb, 2);
1154#else 1154#else
@@ -1202,8 +1202,8 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb)
1202 } 1202 }
1203 1203
1204 /* try to do packet compression */ 1204 /* try to do packet compression */
1205 if ((ppp->xstate & SC_COMP_RUN) && ppp->xc_state 1205 if ((ppp->xstate & SC_COMP_RUN) && ppp->xc_state &&
1206 && proto != PPP_LCP && proto != PPP_CCP) { 1206 proto != PPP_LCP && proto != PPP_CCP) {
1207 if (!(ppp->flags & SC_CCP_UP) && (ppp->flags & SC_MUST_COMP)) { 1207 if (!(ppp->flags & SC_CCP_UP) && (ppp->flags & SC_MUST_COMP)) {
1208 if (net_ratelimit()) 1208 if (net_ratelimit())
1209 printk(KERN_ERR "ppp: compression required but down - pkt dropped.\n"); 1209 printk(KERN_ERR "ppp: compression required but down - pkt dropped.\n");
@@ -1577,8 +1577,8 @@ ppp_input(struct ppp_channel *chan, struct sk_buff *skb)
1577 /* put it on the channel queue */ 1577 /* put it on the channel queue */
1578 skb_queue_tail(&pch->file.rq, skb); 1578 skb_queue_tail(&pch->file.rq, skb);
1579 /* drop old frames if queue too long */ 1579 /* drop old frames if queue too long */
1580 while (pch->file.rq.qlen > PPP_MAX_RQLEN 1580 while (pch->file.rq.qlen > PPP_MAX_RQLEN &&
1581 && (skb = skb_dequeue(&pch->file.rq))) 1581 (skb = skb_dequeue(&pch->file.rq)))
1582 kfree_skb(skb); 1582 kfree_skb(skb);
1583 wake_up_interruptible(&pch->file.rwait); 1583 wake_up_interruptible(&pch->file.rwait);
1584 } else { 1584 } else {
@@ -1654,8 +1654,8 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb)
1654 * Note that some decompressors need to see uncompressed frames 1654 * Note that some decompressors need to see uncompressed frames
1655 * that come in as well as compressed frames. 1655 * that come in as well as compressed frames.
1656 */ 1656 */
1657 if (ppp->rc_state && (ppp->rstate & SC_DECOMP_RUN) 1657 if (ppp->rc_state && (ppp->rstate & SC_DECOMP_RUN) &&
1658 && (ppp->rstate & (SC_DC_FERROR | SC_DC_ERROR)) == 0) 1658 (ppp->rstate & (SC_DC_FERROR | SC_DC_ERROR)) == 0)
1659 skb = ppp_decompress_frame(ppp, skb); 1659 skb = ppp_decompress_frame(ppp, skb);
1660 1660
1661 if (ppp->flags & SC_MUST_COMP && ppp->rstate & SC_DC_FERROR) 1661 if (ppp->flags & SC_MUST_COMP && ppp->rstate & SC_DC_FERROR)
@@ -1726,8 +1726,8 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb)
1726 /* control or unknown frame - pass it to pppd */ 1726 /* control or unknown frame - pass it to pppd */
1727 skb_queue_tail(&ppp->file.rq, skb); 1727 skb_queue_tail(&ppp->file.rq, skb);
1728 /* limit queue length by dropping old frames */ 1728 /* limit queue length by dropping old frames */
1729 while (ppp->file.rq.qlen > PPP_MAX_RQLEN 1729 while (ppp->file.rq.qlen > PPP_MAX_RQLEN &&
1730 && (skb = skb_dequeue(&ppp->file.rq))) 1730 (skb = skb_dequeue(&ppp->file.rq)))
1731 kfree_skb(skb); 1731 kfree_skb(skb);
1732 /* wake up any process polling or blocking on read */ 1732 /* wake up any process polling or blocking on read */
1733 wake_up_interruptible(&ppp->file.rwait); 1733 wake_up_interruptible(&ppp->file.rwait);
@@ -1745,26 +1745,26 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb)
1745 goto err; 1745 goto err;
1746 1746
1747 *skb_push(skb, 2) = 0; 1747 *skb_push(skb, 2) = 0;
1748 if (ppp->pass_filter 1748 if (ppp->pass_filter &&
1749 && sk_run_filter(skb, ppp->pass_filter, 1749 sk_run_filter(skb, ppp->pass_filter,
1750 ppp->pass_len) == 0) { 1750 ppp->pass_len) == 0) {
1751 if (ppp->debug & 1) 1751 if (ppp->debug & 1)
1752 printk(KERN_DEBUG "PPP: inbound frame " 1752 printk(KERN_DEBUG "PPP: inbound frame "
1753 "not passed\n"); 1753 "not passed\n");
1754 kfree_skb(skb); 1754 kfree_skb(skb);
1755 return; 1755 return;
1756 } 1756 }
1757 if (!(ppp->active_filter 1757 if (!(ppp->active_filter &&
1758 && sk_run_filter(skb, ppp->active_filter, 1758 sk_run_filter(skb, ppp->active_filter,
1759 ppp->active_len) == 0)) 1759 ppp->active_len) == 0))
1760 ppp->last_recv = jiffies; 1760 ppp->last_recv = jiffies;
1761 __skb_pull(skb, 2); 1761 __skb_pull(skb, 2);
1762 } else 1762 } else
1763#endif /* CONFIG_PPP_FILTER */ 1763#endif /* CONFIG_PPP_FILTER */
1764 ppp->last_recv = jiffies; 1764 ppp->last_recv = jiffies;
1765 1765
1766 if ((ppp->dev->flags & IFF_UP) == 0 1766 if ((ppp->dev->flags & IFF_UP) == 0 ||
1767 || ppp->npmode[npi] != NPMODE_PASS) { 1767 ppp->npmode[npi] != NPMODE_PASS) {
1768 kfree_skb(skb); 1768 kfree_skb(skb);
1769 } else { 1769 } else {
1770 /* chop off protocol */ 1770 /* chop off protocol */
@@ -2228,13 +2228,13 @@ ppp_set_compress(struct ppp *ppp, unsigned long arg)
2228 unsigned char ccp_option[CCP_MAX_OPTION_LENGTH]; 2228 unsigned char ccp_option[CCP_MAX_OPTION_LENGTH];
2229 2229
2230 err = -EFAULT; 2230 err = -EFAULT;
2231 if (copy_from_user(&data, (void __user *) arg, sizeof(data)) 2231 if (copy_from_user(&data, (void __user *) arg, sizeof(data)) ||
2232 || (data.length <= CCP_MAX_OPTION_LENGTH 2232 (data.length <= CCP_MAX_OPTION_LENGTH &&
2233 && copy_from_user(ccp_option, (void __user *) data.ptr, data.length))) 2233 copy_from_user(ccp_option, (void __user *) data.ptr, data.length)))
2234 goto out; 2234 goto out;
2235 err = -EINVAL; 2235 err = -EINVAL;
2236 if (data.length > CCP_MAX_OPTION_LENGTH 2236 if (data.length > CCP_MAX_OPTION_LENGTH ||
2237 || ccp_option[1] < 2 || ccp_option[1] > data.length) 2237 ccp_option[1] < 2 || ccp_option[1] > data.length)
2238 goto out; 2238 goto out;
2239 2239
2240 cp = try_then_request_module( 2240 cp = try_then_request_module(