From: Oleg Drokin <green@linuxhacker.ru>
To: marcelo.tosatti@cyclades.com, linux-kernel@vger.kernel.org
Subject: [2.4] [PATCH] Fix possible memleaks in VIA IrDA driver
Date: Sun, 9 May 2004 15:08:34 +0300 [thread overview]
Message-ID: <20040509120834.GA13899@linuxhacker.ru> (raw)
Hello!
Patch below fixes some possible memleaks in VIA IrDA driver, also
checks for skb->data being non-NULL are dropped since alloc_skb
cannot return such skbs as far as I can see.
Bye,
Oleg
===== drivers/net/irda/via-ircc.c 1.3 vs edited =====
--- 1.3/drivers/net/irda/via-ircc.c Fri Jan 30 21:14:14 2004
+++ edited/drivers/net/irda/via-ircc.c Sun May 9 15:01:34 2004
@@ -1142,13 +1142,16 @@
st_fifo->head++;
st_fifo->len--;
- skb = dev_alloc_skb(len + 1 - 4);
/*
- * if frame size,data ptr,or skb ptr are wrong ,the get next
+ * if frame size or data ptr are wrong ,then get next
* entry.
*/
- if ((skb == NULL) || (skb->data == NULL)
- || (self->rx_buff.data == NULL) || (len < 6)) {
+ if ((self->rx_buff.data == NULL) || (len < 6)) {
+ self->stats.rx_dropped++;
+ return TRUE;
+ }
+ skb = dev_alloc_skb(len + 1 - 4);
+ if (!skb) {
self->stats.rx_dropped++;
return TRUE;
}
@@ -1194,8 +1197,12 @@
#ifdef DBGMSG
DBG(printk(KERN_INFO "upload_rxdata: len=%x\n", len));
#endif
+ if ((len - 4) < 2) {
+ self->stats.rx_dropped++;
+ return FALSE;
+ }
skb = dev_alloc_skb(len + 1);
- if ((skb == NULL) || ((len - 4) < 2)) {
+ if (!skb) {
self->stats.rx_dropped++;
return FALSE;
}
@@ -1258,13 +1265,17 @@
st_fifo->head++;
st_fifo->len--;
- skb = dev_alloc_skb(len + 1 - 4);
/*
- * if frame size, data ptr, or skb ptr are wrong,
+ * if frame size or data ptr are wrong,
* then get next entry.
*/
- if ((skb == NULL) || (skb->data == NULL)
- || (self->rx_buff.data == NULL) || (len < 6)) {
+ if ((self->rx_buff.data == NULL) || (len < 6)) {
+ self->stats.rx_dropped++;
+ continue;
+ }
+
+ skb = dev_alloc_skb(len + 1 - 4);
+ if (!skb) {
self->stats.rx_dropped++;
continue;
}
reply other threads:[~2004-05-09 12:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040509120834.GA13899@linuxhacker.ru \
--to=green@linuxhacker.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.tosatti@cyclades.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.