diff options
author | Jesper Juhl <jesper.juhl@gmail.com> | 2006-06-23 05:05:28 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-23 10:43:04 -0400 |
commit | d20d04bc9befbd752092b4aa42bb8254a1af0776 (patch) | |
tree | acf5686c7353aab275451e9033f5aa7693c8dc23 /drivers/isdn/i4l/isdn_common.c | |
parent | 94a6735cd67375029c2092e6d46f14b2721e6793 (diff) |
[PATCH] ISDN: correctly handle isdn_writebuf_stub() errors
isdn_writebuf_stub() forgets to detect memory allocation and uaccess errors.
And when that's fixed, if a error happens the caller will just keep on
looping.
So change the caller to detect the error, and to return it.
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Cc: Karsten Keil <kkeil@suse.de>
Signed-off-by: Tilman Schmidt <tilman@imap.cc>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/isdn/i4l/isdn_common.c')
-rw-r--r-- | drivers/isdn/i4l/isdn_common.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c index 22759c01746a..81accdf35168 100644 --- a/drivers/isdn/i4l/isdn_common.c +++ b/drivers/isdn/i4l/isdn_common.c | |||
@@ -1177,9 +1177,8 @@ isdn_write(struct file *file, const char __user *buf, size_t count, loff_t * off | |||
1177 | goto out; | 1177 | goto out; |
1178 | } | 1178 | } |
1179 | chidx = isdn_minor2chan(minor); | 1179 | chidx = isdn_minor2chan(minor); |
1180 | while (isdn_writebuf_stub(drvidx, chidx, buf, count) != count) | 1180 | while ((retval = isdn_writebuf_stub(drvidx, chidx, buf, count)) == 0) |
1181 | interruptible_sleep_on(&dev->drv[drvidx]->snd_waitq[chidx]); | 1181 | interruptible_sleep_on(&dev->drv[drvidx]->snd_waitq[chidx]); |
1182 | retval = count; | ||
1183 | goto out; | 1182 | goto out; |
1184 | } | 1183 | } |
1185 | if (minor <= ISDN_MINOR_CTRLMAX) { | 1184 | if (minor <= ISDN_MINOR_CTRLMAX) { |
@@ -1951,9 +1950,10 @@ isdn_writebuf_stub(int drvidx, int chan, const u_char __user * buf, int len) | |||
1951 | struct sk_buff *skb = alloc_skb(hl + len, GFP_ATOMIC); | 1950 | struct sk_buff *skb = alloc_skb(hl + len, GFP_ATOMIC); |
1952 | 1951 | ||
1953 | if (!skb) | 1952 | if (!skb) |
1954 | return 0; | 1953 | return -ENOMEM; |
1955 | skb_reserve(skb, hl); | 1954 | skb_reserve(skb, hl); |
1956 | copy_from_user(skb_put(skb, len), buf, len); | 1955 | if (copy_from_user(skb_put(skb, len), buf, len)) |
1956 | return -EFAULT; | ||
1957 | ret = dev->drv[drvidx]->interface->writebuf_skb(drvidx, chan, 1, skb); | 1957 | ret = dev->drv[drvidx]->interface->writebuf_skb(drvidx, chan, 1, skb); |
1958 | if (ret <= 0) | 1958 | if (ret <= 0) |
1959 | dev_kfree_skb(skb); | 1959 | dev_kfree_skb(skb); |