diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-10-05 01:18:40 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-10-05 01:18:40 +0000 |
commit | 012bb3e61e5eced6c610f9e036372bf0c8def2d1 (patch) | |
tree | 87efc733f9b164e8c85c0336f92c8fb7eff6d183 /drivers/net/wan | |
parent | 625a1589d3d6464b5d90b8a0918789e3afffd220 (diff) |
Merge with Linux 2.4.0-test9. Please check DECstation, I had a number
of rejects to fixup while integrating Linus patches. I also found
that this kernel will only boot SMP on Origin; the UP kernel freeze
soon after bootup with SCSI timeout messages. I commit this anyway
since I found that the last CVS versions had the same problem.
Diffstat (limited to 'drivers/net/wan')
-rw-r--r-- | drivers/net/wan/Makefile | 2 | ||||
-rw-r--r-- | drivers/net/wan/comx-hw-comx.c | 44 | ||||
-rw-r--r-- | drivers/net/wan/comx-hw-locomx.c | 16 | ||||
-rw-r--r-- | drivers/net/wan/comx-hw-mixcom.c | 25 | ||||
-rw-r--r-- | drivers/net/wan/comx-proto-fr.c | 27 | ||||
-rw-r--r-- | drivers/net/wan/comx-proto-ppp.c | 2 | ||||
-rw-r--r-- | drivers/net/wan/comx.c | 60 | ||||
-rw-r--r-- | drivers/net/wan/cosa.c | 34 | ||||
-rw-r--r-- | drivers/net/wan/sdla.c | 6 |
9 files changed, 162 insertions, 54 deletions
diff --git a/drivers/net/wan/Makefile b/drivers/net/wan/Makefile index 5b13578e7..061badd12 100644 --- a/drivers/net/wan/Makefile +++ b/drivers/net/wan/Makefile @@ -35,6 +35,8 @@ obj-$(CONFIG_COMX_PROTO_LAPB) += comx-proto-lapb.o obj-$(CONFIG_COMX_PROTO_FR) += comx-proto-fr.o obj-$(CONFIG_COSA) += syncppp.o cosa.o obj-$(CONFIG_LANMEDIA) += syncppp.o +obj-$(CONFIG_SYNCLINK_SYNCPPP) += syncppp.o +obj-$(CONFIG_X25_ASY) += x25_asy.o ifeq ($(CONFIG_LANMEDIA),y) SUB_DIRS += lmc diff --git a/drivers/net/wan/comx-hw-comx.c b/drivers/net/wan/comx-hw-comx.c index 23899bde9..8ace26d88 100644 --- a/drivers/net/wan/comx-hw-comx.c +++ b/drivers/net/wan/comx-hw-comx.c @@ -9,6 +9,9 @@ * * Copyright (C) 1995-2000 ITConsult-Pro Co. <info@itc.hu> * + * Contributors: + * Arnaldo Carvalho de Melo <acme@conectiva.com.br> - 0.86 + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version @@ -37,13 +40,12 @@ * Version 0.85 (00/01/14): * - some additional workarounds :/ * - printk cleanups + * Version 0.86 (00/08/15): + * - resource release on failure at COMX_init */ -#define VERSION "0.85" +#define VERSION "0.86" -#include <asm/uaccess.h> -#include <asm/io.h> -#include <asm/delay.h> #include <linux/module.h> #include <linux/version.h> #include <linux/types.h> @@ -52,6 +54,9 @@ #include <linux/proc_fs.h> #include <linux/ioport.h> #include <linux/init.h> +#include <linux/delay.h> +#include <asm/uaccess.h> +#include <asm/io.h> #include "comx.h" #include "comxhw.h" @@ -1224,7 +1229,7 @@ static int COMX_init(struct net_device *dev) if ((new_file = create_proc_entry(FILENAME_IO, S_IFREG | 0644, ch->procdir)) == NULL) { - return -EIO; + goto cleanup_HW_privdata; } new_file->data = (void *)new_file; new_file->read_proc = &comxhw_read_proc; @@ -1234,7 +1239,7 @@ static int COMX_init(struct net_device *dev) if ((new_file = create_proc_entry(FILENAME_IRQ, S_IFREG | 0644, ch->procdir)) == NULL) { - return -EIO; + goto cleanup_filename_io; } new_file->data = (void *)new_file; new_file->read_proc = &comxhw_read_proc; @@ -1244,7 +1249,7 @@ static int COMX_init(struct net_device *dev) if ((new_file = create_proc_entry(FILENAME_CHANNEL, S_IFREG | 0644, ch->procdir)) == NULL) { - return -EIO; + goto cleanup_filename_irq; } new_file->data = (void *)new_file; new_file->read_proc = &comxhw_read_proc; @@ -1255,7 +1260,7 @@ static int COMX_init(struct net_device *dev) if (ch->hardware == &hicomx_hw || ch->hardware == &cmx_hw) { if ((new_file = create_proc_entry(FILENAME_CLOCK, S_IFREG | 0644, ch->procdir)) == NULL) { - return -EIO; + goto cleanup_filename_channel; } new_file->data = (void *)new_file; new_file->read_proc = &comxhw_read_proc; @@ -1266,7 +1271,7 @@ static int COMX_init(struct net_device *dev) if ((new_file = create_proc_entry(FILENAME_MEMADDR, S_IFREG | 0644, ch->procdir)) == NULL) { - return -EIO; + goto cleanup_filename_clock; } new_file->data = (void *)new_file; new_file->read_proc = &comxhw_read_proc; @@ -1276,7 +1281,7 @@ static int COMX_init(struct net_device *dev) if ((new_file = create_proc_entry(FILENAME_TWIN, S_IFREG | 0444, ch->procdir)) == NULL) { - return -EIO; + goto cleanup_filename_memaddr; } new_file->data = (void *)new_file; new_file->read_proc = &comxhw_read_proc; @@ -1285,7 +1290,7 @@ static int COMX_init(struct net_device *dev) if ((new_file = create_proc_entry(FILENAME_FIRMWARE, S_IFREG | 0644, ch->procdir)) == NULL) { - return -EIO; + goto cleanup_filename_twin; } new_file->data = (void *)new_file; new_file->read_proc = &comxhw_read_proc; @@ -1326,6 +1331,23 @@ static int COMX_init(struct net_device *dev) MOD_INC_USE_COUNT; return 0; + +cleanup_filename_twin: + remove_proc_entry(FILENAME_TWIN, ch->procdir); +cleanup_filename_memaddr: + remove_proc_entry(FILENAME_MEMADDR, ch->procdir); +cleanup_filename_clock: + if (ch->hardware == &hicomx_hw || ch->hardware == &cmx_hw) + remove_proc_entry(FILENAME_CLOCK, ch->procdir); +cleanup_filename_channel: + remove_proc_entry(FILENAME_CHANNEL, ch->procdir); +cleanup_filename_irq: + remove_proc_entry(FILENAME_IRQ, ch->procdir); +cleanup_filename_io: + remove_proc_entry(FILENAME_IO, ch->procdir); +cleanup_HW_privdata: + kfree(ch->HW_privdata); + return -EIO; } /* Called on echo valami >boardtype */ diff --git a/drivers/net/wan/comx-hw-locomx.c b/drivers/net/wan/comx-hw-locomx.c index 94561e859..3714c6e60 100644 --- a/drivers/net/wan/comx-hw-locomx.c +++ b/drivers/net/wan/comx-hw-locomx.c @@ -7,6 +7,9 @@ * Based on skeleton code and old LoCOMX driver by Tivadar Szemethy <tiv@itc.hu> * and the hostess_sv11 driver * + * Contributors: + * Arnaldo Carvalho de Melo <acme@conectiva.com.br> (0.14) + * * Copyright (C) 1999 ITConsult-Pro Co. <info@itc.hu> * * This program is free software; you can redistribute it and/or @@ -27,9 +30,11 @@ * Version 0.13 (99/07/08): * - Fix the transmitter status check * - Handle the net device statistics better + * Version 0.14 (00/08/15): + * - resource release on failure at LOCOMX_init */ -#define VERSION "0.13" +#define VERSION "0.14" #include <linux/module.h> #include <linux/version.h> @@ -385,7 +390,7 @@ static int LOCOMX_init(struct net_device *dev) /* Register /proc files */ if ((new_file = create_proc_entry(FILENAME_IO, S_IFREG | 0644, ch->procdir)) == NULL) { - return -EIO; + goto cleanup_HW_privdata; } new_file->data = (void *)new_file; new_file->read_proc = &locomx_read_proc; @@ -394,7 +399,7 @@ static int LOCOMX_init(struct net_device *dev) if ((new_file = create_proc_entry(FILENAME_IRQ, S_IFREG | 0644, ch->procdir)) == NULL) { - return -EIO; + goto cleanup_filename_io; } new_file->data = (void *)new_file; new_file->read_proc = &locomx_read_proc; @@ -432,6 +437,11 @@ static int LOCOMX_init(struct net_device *dev) /* O.K. Count one more user on this module */ MOD_INC_USE_COUNT; return 0; +cleanup_filename_io: + remove_proc_entry(FILENAME_IO, ch->procdir); +cleanup_HW_privdata: + kfree(ch->HW_privdata); + return -EIO; } diff --git a/drivers/net/wan/comx-hw-mixcom.c b/drivers/net/wan/comx-hw-mixcom.c index 3ee2b690b..2bf564aba 100644 --- a/drivers/net/wan/comx-hw-mixcom.c +++ b/drivers/net/wan/comx-hw-mixcom.c @@ -8,6 +8,9 @@ * * Copyright (C) 1998-1999 ITConsult-Pro Co. <info@itc.hu> * + * Contributors: + * Arnaldo Carvalho de Melo <acme@conectiva.com.br> (0.65) + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version @@ -29,9 +32,12 @@ * * Version 0.64 (99/12/01): * - some more cosmetical fixes + * + * Version 0.65 (00/08/15) + * - resource release on failure at MIXCOM_init */ -#define VERSION "0.64" +#define VERSION "0.65" #include <linux/module.h> #include <linux/version.h> @@ -819,7 +825,7 @@ static int MIXCOM_init(struct net_device *dev) { if ((new_file = create_proc_entry(FILENAME_IO, S_IFREG | 0644, ch->procdir)) == NULL) { - return -EIO; + goto cleanup_HW_privdata; } new_file->data = (void *)new_file; new_file->read_proc = &mixcom_read_proc; @@ -828,7 +834,7 @@ static int MIXCOM_init(struct net_device *dev) { if ((new_file = create_proc_entry(FILENAME_IRQ, S_IFREG | 0644, ch->procdir)) == NULL) { - return -EIO; + goto cleanup_filename_io; } new_file->data = (void *)new_file; new_file->read_proc = &mixcom_read_proc; @@ -848,7 +854,7 @@ static int MIXCOM_init(struct net_device *dev) { if ((new_file = create_proc_entry(FILENAME_CHANNEL, S_IFREG | 0644, ch->procdir)) == NULL) { - return -EIO; + goto cleanup_filename_irq; } new_file->data = (void *)new_file; new_file->read_proc = &mixcom_read_proc; @@ -857,7 +863,7 @@ static int MIXCOM_init(struct net_device *dev) { if ((new_file = create_proc_entry(FILENAME_TWIN, S_IFREG | 0444, ch->procdir)) == NULL) { - return -EIO; + goto cleanup_filename_channel; } new_file->data = (void *)new_file; new_file->read_proc = &mixcom_read_proc; @@ -881,6 +887,15 @@ static int MIXCOM_init(struct net_device *dev) { MOD_INC_USE_COUNT; return 0; +cleanup_filename_channel: + remove_proc_entry(FILENAME_CHANNEL, ch->procdir); +cleanup_filename_irq: + remove_proc_entry(FILENAME_IRQ, ch->procdir); +cleanup_filename_io: + remove_proc_entry(FILENAME_IO, ch->procdir); +cleanup_HW_privdata: + kfree(ch->HW_privdata); + return -EIO; } static int MIXCOM_exit(struct net_device *dev) diff --git a/drivers/net/wan/comx-proto-fr.c b/drivers/net/wan/comx-proto-fr.c index f32c84e76..c2a0a5ac4 100644 --- a/drivers/net/wan/comx-proto-fr.c +++ b/drivers/net/wan/comx-proto-fr.c @@ -6,6 +6,9 @@ * Maintainer: Gergely Madarasz <gorgo@itc.hu> * * Copyright (C) 1998-1999 ITConsult-Pro Co. <info@itc.hu> + * + * Contributors: + * Arnaldo Carvalho de Melo <acme@conectiva.com.br> (0.73) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -25,9 +28,13 @@ * Version 0.72 (99/07/09): * - handle slave tbusy with master tbusy (should be fixed) * - fix the keepalive timer addition/deletion + * + * Version 0.73 (00/08/15) + * - resource release on failure at fr_master_init and + * fr_slave_init */ -#define VERSION "0.72" +#define VERSION "0.73" #include <linux/module.h> #include <linux/version.h> @@ -793,7 +800,7 @@ static int fr_master_init(struct net_device *dev) if ((new_file = create_proc_entry(FILENAME_DLCI, S_IFREG | 0644, ch->procdir)) == NULL) { - return -ENOMEM; + goto cleanup_LINE_privdata; } new_file->data = (void *)new_file; new_file->read_proc = &fr_read_proc; @@ -803,7 +810,7 @@ static int fr_master_init(struct net_device *dev) if ((new_file = create_proc_entry(FILENAME_KEEPALIVE, S_IFREG | 0644, ch->procdir)) == NULL) { - return -ENOMEM; + goto cleanup_filename_dlci; } new_file->data = (void *)new_file; new_file->read_proc = &fr_read_proc; @@ -815,6 +822,11 @@ static int fr_master_init(struct net_device *dev) MOD_INC_USE_COUNT; return 0; +cleanup_filename_dlci: + remove_proc_entry(FILENAME_DLCI, ch->procdir); +cleanup_LINE_privdata: + kfree(fr); + return -EIO; } static int fr_slave_init(struct net_device *dev) @@ -847,7 +859,7 @@ static int fr_slave_init(struct net_device *dev) if ((new_file = create_proc_entry(FILENAME_DLCI, S_IFREG | 0644, ch->procdir)) == NULL) { - return -ENOMEM; + goto cleanup_LINE_privdata; } new_file->data = (void *)new_file; @@ -858,7 +870,7 @@ static int fr_slave_init(struct net_device *dev) if ((new_file = create_proc_entry(FILENAME_MASTER, S_IFREG | 0644, ch->procdir)) == NULL) { - return -EIO; + goto cleanup_filename_dlci; } new_file->data = (void *)new_file; new_file->read_proc = &fr_read_proc; @@ -867,6 +879,11 @@ static int fr_slave_init(struct net_device *dev) new_file->nlink = 1; MOD_INC_USE_COUNT; return 0; +cleanup_filename_dlci: + remove_proc_entry(FILENAME_DLCI, ch->procdir); +cleanup_LINE_privdata: + kfree(fr); + return -EIO; } static int dlci_open(struct net_device *dev) diff --git a/drivers/net/wan/comx-proto-ppp.c b/drivers/net/wan/comx-proto-ppp.c index 0b791685d..825abc776 100644 --- a/drivers/net/wan/comx-proto-ppp.c +++ b/drivers/net/wan/comx-proto-ppp.c @@ -200,6 +200,8 @@ static int syncppp_init(struct net_device *dev) struct ppp_device *pppdev = (struct ppp_device *)ch->if_ptr; ch->LINE_privdata = kmalloc(sizeof(struct syncppp_data), GFP_KERNEL); + if (!ch->LINE_privdata) + return -ENOMEM; pppdev->dev = dev; sppp_attach(pppdev); diff --git a/drivers/net/wan/comx.c b/drivers/net/wan/comx.c index d9b774f6f..f1e1ffdcb 100644 --- a/drivers/net/wan/comx.c +++ b/drivers/net/wan/comx.c @@ -10,6 +10,9 @@ * * Copyright (C) 1995-1999 ITConsult-Pro Co. * + * Contributors: + * Arnaldo Carvalho de Melo <acme@conectiva.com.br> (0.85) + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version @@ -39,9 +42,13 @@ * Version 0.84 (99/12/01): * - comx_status should not check for IFF_UP (to report * line status from dev->open()) + * + * Version 0.85 (00/08/15): + * - resource release on failure in comx_mkdir + * - fix return value on failure at comx_write_proc */ -#define VERSION "0.84" +#define VERSION "0.85" #include <linux/config.h> #include <linux/module.h> @@ -506,6 +513,7 @@ static int comx_init_dev(struct net_device *dev) ch->loadavg_size = ch->loadavg[2] / ch->loadavg[0] + 1; if ((ch->avg_bytes = kmalloc(ch->loadavg_size * sizeof(unsigned long) * 2, GFP_KERNEL)) == NULL) { + kfree(ch); return -ENOMEM; } @@ -629,7 +637,7 @@ static int comx_write_proc(struct file *file, const char *buffer, u_long count, ch->debug_start = ch->debug_end = 0; restore_flags(flags); free_page((unsigned long)page); - return count; + return ret ? ret : count; } if (*page != '+' && *page != '-') { @@ -762,10 +770,16 @@ static int comx_mkdir(struct inode *dir, struct dentry *dentry, int mode) struct proc_dir_entry *new_dir, *debug_file; struct net_device *dev; struct comx_channel *ch; + int ret = -EIO; + + if ((dev = kmalloc(sizeof(struct net_device), GFP_KERNEL)) == NULL) { + return -ENOMEM; + } + memset(dev, 0, sizeof(struct net_device)); if ((new_dir = create_proc_entry(dentry->d_name.name, mode | S_IFDIR, comx_root_dir)) == NULL) { - return -EIO; + goto cleanup_dev; } new_dir->nlink = 2; @@ -774,42 +788,38 @@ static int comx_mkdir(struct inode *dir, struct dentry *dentry, int mode) /* Ezek kellenek */ if (!create_comx_proc_entry(FILENAME_HARDWARE, 0644, strlen(HWNAME_NONE) + 1, new_dir)) { - return -ENOMEM; + goto cleanup_new_dir; } if (!create_comx_proc_entry(FILENAME_PROTOCOL, 0644, strlen(PROTONAME_NONE) + 1, new_dir)) { - return -ENOMEM; + goto cleanup_filename_hardware; } if (!create_comx_proc_entry(FILENAME_STATUS, 0444, 0, new_dir)) { - return -ENOMEM; + goto cleanup_filename_protocol; } if (!create_comx_proc_entry(FILENAME_LINEUPDELAY, 0644, 2, new_dir)) { - return -ENOMEM; + goto cleanup_filename_status; } if ((debug_file = create_proc_entry(FILENAME_DEBUG, S_IFREG | 0644, new_dir)) == NULL) { - return -ENOMEM; + goto cleanup_filename_lineupdelay; } debug_file->data = (void *)debug_file; debug_file->read_proc = NULL; // see below debug_file->write_proc = &comx_write_proc; debug_file->nlink = 1; - if ((dev = kmalloc(sizeof(struct net_device), GFP_KERNEL)) == NULL) { - return -ENOMEM; - } - memset(dev, 0, sizeof(struct net_device)); strcpy(dev->name, (char *)new_dir->name); dev->init = comx_init_dev; if (register_netdevice(dev)) { - return -EIO; + goto cleanup_filename_debug; } ch=dev->priv; if((ch->if_ptr = (void *)kmalloc(sizeof(struct ppp_device), GFP_KERNEL)) == NULL) { - return -ENOMEM; + goto cleanup_register; } memset(ch->if_ptr, 0, sizeof(struct ppp_device)); ch->debug_file = debug_file; @@ -819,13 +829,33 @@ static int comx_mkdir(struct inode *dir, struct dentry *dentry, int mode) ch->debug_start = ch->debug_end = 0; if ((ch->debug_area = kmalloc(ch->debug_size = DEFAULT_DEBUG_SIZE, GFP_KERNEL)) == NULL) { - return -ENOMEM; + ret = -ENOMEM; + goto cleanup_if_ptr; } ch->lineup_delay = DEFAULT_LINEUP_DELAY; MOD_INC_USE_COUNT; return 0; +cleanup_if_ptr: + kfree(ch->if_ptr); +cleanup_register: + unregister_netdevice(dev); +cleanup_filename_debug: + remove_proc_entry(FILENAME_DEBUG, new_dir); +cleanup_filename_lineupdelay: + remove_proc_entry(FILENAME_LINEUPDELAY, new_dir); +cleanup_filename_status: + remove_proc_entry(FILENAME_STATUS, new_dir); +cleanup_filename_protocol: + remove_proc_entry(FILENAME_PROTOCOL, new_dir); +cleanup_filename_hardware: + remove_proc_entry(FILENAME_HARDWARE, new_dir); +cleanup_new_dir: + remove_proc_entry(dentry->d_name.name, &comx_root_dir); +cleanup_dev: + kfree(dev); + return ret; } static int comx_rmdir(struct inode *dir, struct dentry *dentry) diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c index be015f195..5ab238eb0 100644 --- a/drivers/net/wan/cosa.c +++ b/drivers/net/wan/cosa.c @@ -303,8 +303,7 @@ static void chardev_channel_init(struct channel_data *chan); static char *chrdev_setup_rx(struct channel_data *channel, int size); static int chrdev_rx_done(struct channel_data *channel); static int chrdev_tx_done(struct channel_data *channel, int size); -static long long cosa_lseek(struct file *file, - long long offset, int origin); +static loff_t cosa_lseek(struct file *file, loff_t offset, int origin); static ssize_t cosa_read(struct file *file, char *buf, size_t count, loff_t *ppos); static ssize_t cosa_write(struct file *file, @@ -783,8 +782,7 @@ static void chardev_channel_init(struct channel_data *chan) init_MUTEX(&chan->wsem); } -static long long cosa_lseek(struct file * file, - long long offset, int origin) +static loff_t cosa_lseek(struct file * file, loff_t offset, int origin) { return -ESPIPE; } @@ -1043,9 +1041,10 @@ static inline int cosa_download(struct cosa_data *cosa, struct cosa_download *d) return -EPERM; } - get_user_ret(addr, &(d->addr), -EFAULT); - get_user_ret(len, &(d->len), -EFAULT); - get_user_ret(code, &(d->code), -EFAULT); + if (get_user(addr, &(d->addr)) || + __get_user(len, &(d->len)) || + __get_user(code, &(d->code))) + return -EFAULT; if (d->addr < 0 || d->addr > COSA_MAX_FIRMWARE_SIZE) return -EINVAL; @@ -1083,9 +1082,10 @@ static inline int cosa_readmem(struct cosa_data *cosa, struct cosa_download *d) return -EPERM; } - get_user_ret(addr, &(d->addr), -EFAULT); - get_user_ret(len, &(d->len), -EFAULT); - get_user_ret(code, &(d->code), -EFAULT); + if (get_user(addr, &(d->addr)) || + __get_user(len, &(d->len)) || + __get_user(code, &(d->code))) + return -EFAULT; /* If something fails, force the user to reset the card */ cosa->firmware_status &= ~COSA_FW_RESET; @@ -1133,7 +1133,8 @@ static inline int cosa_start(struct cosa_data *cosa, int address) static inline int cosa_getidstr(struct cosa_data *cosa, char *string) { int l = strlen(cosa->id_string)+1; - copy_to_user_ret(string, cosa->id_string, l, -EFAULT); + if (copy_to_user(string, cosa->id_string, l)) + return -EFAULT; return l; } @@ -1141,7 +1142,8 @@ static inline int cosa_getidstr(struct cosa_data *cosa, char *string) static inline int cosa_gettype(struct cosa_data *cosa, char *string) { int l = strlen(cosa->type)+1; - copy_to_user_ret(string, cosa->type, l, -EFAULT); + if (copy_to_user(string, cosa->type, l)) + return -EFAULT; return l; } @@ -1208,7 +1210,7 @@ static int cosa_sppp_ioctl(struct net_device *dev, struct ifreq *ifr, { int rv; struct channel_data *chan = (struct channel_data *)dev->priv; - rv = cosa_ioctl_common(chan->cosa, chan, cmd, (int)ifr->ifr_data); + rv = cosa_ioctl_common(chan->cosa, chan, cmd, (unsigned long)ifr->ifr_data); if (rv == -ENOIOCTLCMD) { return sppp_do_ioctl(dev, ifr, cmd); } @@ -1429,7 +1431,8 @@ static int download(struct cosa_data *cosa, char *microcode, int length, int add while (length--) { char c; #ifndef SRP_DOWNLOAD_AT_BOOT - get_user_ret(c,microcode, -23); + if (get_user(c, microcode)) + return -23; /* ??? */ #else c = *microcode; #endif @@ -1507,7 +1510,8 @@ static int readmem(struct cosa_data *cosa, char *microcode, int length, int addr } c=i; #if 1 - put_user_ret(c,microcode, -23); + if (put_user(c, microcode)) + return -23; /* ??? */ #else *microcode = c; #endif diff --git a/drivers/net/wan/sdla.c b/drivers/net/wan/sdla.c index 0454118a8..ef489b1a6 100644 --- a/drivers/net/wan/sdla.c +++ b/drivers/net/wan/sdla.c @@ -1203,7 +1203,10 @@ static int sdla_xfer(struct net_device *dev, struct sdla_mem *info, int read) return(-ENOMEM); sdla_read(dev, mem.addr, temp, mem.len); if(copy_to_user(mem.data, temp, mem.len)) + { + kfree(temp); return -EFAULT; + } kfree(temp); } else @@ -1212,7 +1215,10 @@ static int sdla_xfer(struct net_device *dev, struct sdla_mem *info, int read) if (!temp) return(-ENOMEM); if(copy_from_user(temp, mem.data, mem.len)) + { + kfree(temp); return -EFAULT; + } sdla_write(dev, mem.addr, temp, mem.len); kfree(temp); } |