diff options
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/apm_bios.c | 2 | ||||
-rw-r--r-- | drivers/char/bttv.c | 6 | ||||
-rw-r--r-- | drivers/char/console.c | 2 | ||||
-rw-r--r-- | drivers/char/esp.c | 4 | ||||
-rw-r--r-- | drivers/char/ftape/zftape/zftape-ctl.c | 4 | ||||
-rw-r--r-- | drivers/char/istallion.c | 2 | ||||
-rw-r--r-- | drivers/char/lp.c | 138 | ||||
-rw-r--r-- | drivers/char/nvram.c | 4 | ||||
-rw-r--r-- | drivers/char/pc_keyb.c | 7 | ||||
-rw-r--r-- | drivers/char/random.c | 10 | ||||
-rw-r--r-- | drivers/char/riscom8.c | 2 | ||||
-rw-r--r-- | drivers/char/rocket.c | 2 | ||||
-rw-r--r-- | drivers/char/rtc.c | 8 | ||||
-rw-r--r-- | drivers/char/serial.c | 10 | ||||
-rw-r--r-- | drivers/char/specialix.c | 2 | ||||
-rw-r--r-- | drivers/char/stallion.c | 2 | ||||
-rw-r--r-- | drivers/char/vt.c | 5 |
17 files changed, 124 insertions, 86 deletions
diff --git a/drivers/char/apm_bios.c b/drivers/char/apm_bios.c index f4fcf4f7b..c461cf709 100644 --- a/drivers/char/apm_bios.c +++ b/drivers/char/apm_bios.c @@ -1050,7 +1050,7 @@ static int do_open(struct inode * inode, struct file * filp) * we might close the device immediately without doing a * privileged operation -- cevans */ - as->suser = suser(); + as->suser = capable(CAP_SYS_ADMIN); as->next = user_list; user_list = as; filp->private_data = as; diff --git a/drivers/char/bttv.c b/drivers/char/bttv.c index ec66585cf..97d5794f1 100644 --- a/drivers/char/bttv.c +++ b/drivers/char/bttv.c @@ -1581,7 +1581,7 @@ static int bttv_ioctl(struct video_device *dev, unsigned int cmd, void *arg) case VIDIOCSFBUF: { struct video_buffer v; - if(!suser()) + if(!capable(CAP_SYS_ADMIN)) return -EPERM; if(copy_from_user(&v, arg,sizeof(v))) return -EFAULT; @@ -1680,7 +1680,7 @@ static int bttv_ioctl(struct video_device *dev, unsigned int cmd, void *arg) return 0; case BTTV_WRITEE: - if(!suser()) + if(!capable(CAP_SYS_ADMIN)) return -EPERM; if(copy_from_user((void *) eedata, (void *) arg, 256)) return -EFAULT; @@ -1688,7 +1688,7 @@ static int bttv_ioctl(struct video_device *dev, unsigned int cmd, void *arg) return 0; case BTTV_READEE: - if(!suser()) + if(!capable(CAP_SYS_ADMIN)) return -EPERM; readee(&(btv->i2c), eedata); if(copy_to_user((void *) arg, (void *) eedata, 256)) diff --git a/drivers/char/console.c b/drivers/char/console.c index bff096479..9c9e61e8c 100644 --- a/drivers/char/console.c +++ b/drivers/char/console.c @@ -347,7 +347,7 @@ int vc_allocate(unsigned int i) /* return 0 on success */ long p, q; /* prevent users from taking too much memory */ - if (i >= MAX_NR_USER_CONSOLES && !suser()) + if (i >= MAX_NR_USER_CONSOLES && !capable(CAP_SYS_RESOURCE)) return -EPERM; /* due to the granularity of kmalloc, we waste some memory here */ diff --git a/drivers/char/esp.c b/drivers/char/esp.c index 2ea9cb86f..553bf273b 100644 --- a/drivers/char/esp.c +++ b/drivers/char/esp.c @@ -926,7 +926,7 @@ static int startup(struct esp_struct * info) "esp serial", info); if (retval) { - if (suser()) { + if (capable(CAP_SYS_ADMIN)) { if (info->tty) set_bit(TTY_IO_ERROR, &info->tty->flags); @@ -1499,7 +1499,7 @@ static int set_serial_info(struct esp_struct * info, if (change_irq && (info->line % 8)) return -EINVAL; - if (!suser()) { + if (!capable(CAP_SYS_ADMIN)) { if (change_irq || (new_serial.close_delay != info->close_delay) || ((new_serial.flags & ~ASYNC_USR_MASK) != diff --git a/drivers/char/ftape/zftape/zftape-ctl.c b/drivers/char/ftape/zftape/zftape-ctl.c index 3b80c207f..da2010ceb 100644 --- a/drivers/char/ftape/zftape/zftape-ctl.c +++ b/drivers/char/ftape/zftape/zftape-ctl.c @@ -1342,9 +1342,9 @@ static int mtiocftcmd(struct mtftcmd *ftcmd, int arg_size) TRACE_FUN(ft_t_flow); TRACE(ft_t_noise, "Mag tape ioctl command: MTIOCFTCMD"); - if (!suser()) { + if (!capable(CAP_SYS_ADMIN)) { TRACE_ABORT(-EPERM, ft_t_info, - "only the superuser may send raw qic-117 commands"); + "need CAP_SYS_ADMIN capability to send raw qic-117 commands"); } if (zft_qic_mode) { TRACE_ABORT(-EACCES, ft_t_info, diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c index 2e0dd3736..404f9c88c 100644 --- a/drivers/char/istallion.c +++ b/drivers/char/istallion.c @@ -1774,7 +1774,7 @@ static int stli_setserial(stliport_t *portp, struct serial_struct *sp) #endif copy_from_user(&sio, sp, sizeof(struct serial_struct)); - if (!suser()) { + if (!capable(CAP_SYS_ADMIN)) { if ((sio.baud_base != portp->baud_base) || (sio.close_delay != portp->close_delay) || ((sio.flags & ~ASYNC_USR_MASK) != diff --git a/drivers/char/lp.c b/drivers/char/lp.c index 2e2ffc341..7df3eb655 100644 --- a/drivers/char/lp.c +++ b/drivers/char/lp.c @@ -13,7 +13,7 @@ * lp_read (Status readback) support added by Carsten Gross, * carsten@sol.wohnheim.uni-ulm.de * Support for parport by Philip Blundell <Philip.Blundell@pobox.com> - * parport_sharing hacking by Andrea Arcangeli <arcangeli@mbox.queen.it> + * Parport sharing hacking by Andrea Arcangeli <arcangeli@mbox.queen.it> * Fixed kernel_(to/from)_user memory copy to check for errors * by Riccardo Facchetti <fizban@tin.it> */ @@ -75,6 +75,8 @@ #include <linux/delay.h> #include <linux/parport.h> +#undef LP_STATS +#undef LP_NEED_CAREFUL #include <linux/lp.h> #include <asm/irq.h> @@ -87,17 +89,23 @@ struct lp_struct lp_table[LP_NO] = { [0 ... LP_NO-1] = {NULL, 0, LP_INIT_CHAR, LP_INIT_TIME, LP_INIT_WAIT, - NULL, 0, 0, 0, {0}} + NULL, +#ifdef LP_STATS + 0, 0, {0}, +#endif + NULL, 0} }; /* Test if printer is ready (and optionally has no error conditions) */ +#ifdef LP_NEED_CAREFUL #define LP_READY(minor, status) \ - ((LP_F(minor) & LP_CAREFUL) ? _LP_CAREFUL_READY(status) : (status & LP_PBUSY)) -#define LP_CAREFUL_READY(minor, status) \ - ((LP_F(minor) & LP_CAREFUL) ? _LP_CAREFUL_READY(status) : 1) + ((LP_F(minor) & LP_CAREFUL) ? _LP_CAREFUL_READY(status) : ((status) & LP_PBUSY)) #define _LP_CAREFUL_READY(status) \ - (status & (LP_PBUSY|LP_POUTPA|LP_PSELECD|LP_PERRORP)) == \ + ((status) & (LP_PBUSY|LP_POUTPA|LP_PSELECD|LP_PERRORP)) == \ (LP_PBUSY|LP_PSELECD|LP_PERRORP) +#else +#define LP_READY(minor, status) ((status) & LP_PBUSY) +#endif #undef LP_DEBUG #undef LP_READ_DEBUG @@ -108,8 +116,8 @@ static int lp_preempt(void *handle) { struct lp_struct *lps = (struct lp_struct *)handle; - if (waitqueue_active (&lps->dev->wait_q)) - wake_up_interruptible(&lps->dev->wait_q); + if (waitqueue_active (&lps->wait_q)) + wake_up_interruptible(&lps->wait_q); /* Don't actually release the port now */ return 1; @@ -157,31 +165,29 @@ static int lp_reset(int minor) static inline int lp_char(char lpchar, int minor) { - int status; + unsigned char status; unsigned int wait = 0; unsigned long count = 0; +#ifdef LP_STATS struct lp_stats *stats; +#endif - for (;;) { + for (;;) + { lp_yield(minor); status = r_str (minor); - if (++count == LP_CHAR(minor)) + if (LP_READY(minor, status)) + break; + if (!LP_POLLED(minor) || ++count == LP_CHAR(minor) || + signal_pending(current)) return 0; - if (LP_POLLING(minor)) - { - if (LP_READY(minor, status)) - break; - } else { - if (!LP_READY(minor, status)) - return 0; - else - break; - } } w_dtr(minor, lpchar); +#ifdef LP_STATS stats = &LP_STAT(minor); stats->chars++; +#endif /* must wait before taking strobe high, and after taking strobe low, according spec. Some printers need it, others don't. */ #ifndef __sparc__ @@ -200,6 +206,8 @@ static inline int lp_char(char lpchar, int minor) #endif /* take strobe low */ w_ctr(minor, LP_PSELECP | LP_PINITP); + +#ifdef LP_STATS /* update waittime statistics */ if (count > stats->maxwait) { #ifdef LP_DEBUG @@ -212,6 +220,7 @@ static inline int lp_char(char lpchar, int minor) stats->meanwait - count; stats->meanwait = (255 * stats->meanwait + count + 128) / 256; stats->mdev = ((127 * stats->mdev) + wait + 64) / 128; +#endif return 1; } @@ -220,13 +229,13 @@ static void lp_interrupt(int irq, void *dev_id, struct pt_regs *regs) { struct lp_struct *lp_dev = (struct lp_struct *) dev_id; - if (waitqueue_active (&lp_dev->dev->wait_q)) - wake_up_interruptible(&lp_dev->dev->wait_q); + if (waitqueue_active (&lp_dev->wait_q)) + wake_up_interruptible(&lp_dev->wait_q); } static void lp_error(int minor) { - if (LP_POLLING(minor) || LP_PREEMPTED(minor)) { + if (LP_POLLED(minor) || LP_PREEMPTED(minor)) { current->state = TASK_INTERRUPTIBLE; current->timeout = jiffies + LP_TIMEOUT_POLLED; lp_parport_release(minor); @@ -236,7 +245,7 @@ static void lp_error(int minor) } static int lp_check_status(int minor) { - static unsigned char last = 0; + unsigned int last = lp_table[minor].last_error; unsigned char status = r_str(minor); if ((status & LP_POUTPA)) { if (last != LP_POUTPA) { @@ -256,6 +265,8 @@ static int lp_check_status(int minor) { } else last = 0; + lp_table[minor].last_error = last; + if (last != 0) { if (LP_F(minor) & LP_ABORT) return 1; @@ -265,7 +276,7 @@ static int lp_check_status(int minor) { return 0; } -static inline int lp_write_buf(unsigned int minor, const char *buf, int count) +static int lp_write_buf(unsigned int minor, const char *buf, int count) { unsigned long copy_size; unsigned long total_bytes_written = 0; @@ -275,9 +286,11 @@ static inline int lp_write_buf(unsigned int minor, const char *buf, int count) if (minor >= LP_NO) return -ENXIO; - if (lp_table[minor].dev == NULL) + if (lp->dev == NULL) return -ENXIO; + lp_table[minor].last_error = 0; + do { bytes_written = 0; copy_size = (count <= LP_BUFFER_SIZE ? count : LP_BUFFER_SIZE); @@ -289,55 +302,69 @@ static inline int lp_write_buf(unsigned int minor, const char *buf, int count) if (lp_char(lp->lp_buffer[bytes_written], minor)) { --copy_size; ++bytes_written; - lp_table[minor].runchars++; +#ifdef LP_STATS + lp->runchars++; +#endif } else { int rc = total_bytes_written + bytes_written; - if (lp_table[minor].runchars > LP_STAT(minor).maxrun) - LP_STAT(minor).maxrun = lp_table[minor].runchars; + +#ifdef LP_STATS + if (lp->runchars > LP_STAT(minor).maxrun) + LP_STAT(minor).maxrun = lp->runchars; LP_STAT(minor).sleeps++; +#endif - if (LP_POLLING(minor)) { - lp_polling: + if (signal_pending(current)) { + if (total_bytes_written + bytes_written) + return total_bytes_written + bytes_written; + else + return -EINTR; + } + +#ifdef LP_STATS + lp->runchars = 0; +#endif + + if (LP_POLLED(minor)) { if (lp_check_status(minor)) return rc ? rc : -EIO; -#ifdef LP_DEBUG - printk(KERN_DEBUG "lp%d sleeping at %d characters for %d jiffies\n", minor, lp_table[minor].runchars, LP_TIME(minor)); + lp_polling: +#if defined(LP_DEBUG) && defined(LP_STATS) + printk(KERN_DEBUG "lp%d sleeping at %d characters for %d jiffies\n", minor, lp->runchars, LP_TIME(minor)); #endif current->state = TASK_INTERRUPTIBLE; current->timeout = jiffies + LP_TIME(minor); lp_schedule (minor); } else { cli(); - if (LP_PREEMPTED(minor)) { + if (LP_PREEMPTED(minor)) + { + /* + * We can' t sleep on the interrupt + * since another pardevice need the port. + */ sti(); goto lp_polling; } - enable_irq(lp->dev->port->irq); - w_ctr(minor, LP_PSELECP|LP_PINITP|LP_PINTEN); + w_ctr(minor, LP_PSELECP | LP_PINITP | LP_PINTEN); status = r_str(minor); - if ((!(status & LP_PACK) || (status & LP_PBUSY)) - && LP_CAREFUL_READY(minor, status)) { + if (!(status & LP_PACK) || (status & LP_PBUSY)) + { + /* + * The interrupt is happened in the + * meantime so don' t wait for it. + */ w_ctr(minor, LP_PSELECP | LP_PINITP); sti(); continue; } current->timeout = jiffies + LP_TIMEOUT_INTERRUPT; - interruptible_sleep_on(&lp->dev->wait_q); - disable_irq(lp->dev->port->irq); + interruptible_sleep_on(&lp->wait_q); w_ctr(minor, LP_PSELECP | LP_PINITP); sti(); if (lp_check_status(minor)) return rc ? rc : -EIO; } - - lp_table[minor].runchars = 0; - - if (signal_pending(current)) { - if (total_bytes_written + bytes_written) - return total_bytes_written + bytes_written; - else - return -EINTR; - } } } @@ -356,10 +383,12 @@ static ssize_t lp_write(struct file * file, const char * buf, unsigned int minor = MINOR(file->f_dentry->d_inode->i_rdev); ssize_t retv; +#ifdef LP_STATS if (jiffies-lp_table[minor].lastcall > LP_TIME(minor)) lp_table[minor].runchars = 0; lp_table[minor].lastcall = jiffies; +#endif /* Claim Parport or sleep until it becomes available */ @@ -495,9 +524,8 @@ static int lp_open(struct inode * inode, struct file * file) return -ENXIO; if ((LP_F(minor) & LP_EXIST) == 0) return -ENXIO; - if (LP_F(minor) & LP_BUSY) + if (test_and_set_bit(LP_BUSY_BIT_POS, &LP_F(minor)) & LP_BUSY) return -EBUSY; - LP_F(minor) |= LP_BUSY; MOD_INC_USE_COUNT; @@ -543,8 +571,8 @@ static int lp_release(struct inode * inode, struct file * file) kfree_s(lp_table[minor].lp_buffer, LP_BUFFER_SIZE); lp_table[minor].lp_buffer = NULL; - LP_F(minor) &= ~LP_BUSY; MOD_DEC_USE_COUNT; + LP_F(minor) &= ~LP_BUSY; return 0; } @@ -581,12 +609,14 @@ static int lp_ioctl(struct inode *inode, struct file *file, else LP_F(minor) &= ~LP_ABORTOPEN; break; +#ifdef LP_NEED_CAREFUL case LPCAREFUL: if (arg) LP_F(minor) |= LP_CAREFUL; else LP_F(minor) &= ~LP_CAREFUL; break; +#endif case LPWAIT: LP_WAIT(minor) = arg; break; @@ -609,6 +639,7 @@ static int lp_ioctl(struct inode *inode, struct file *file, case LPRESET: lp_reset(minor); break; +#ifdef LP_STATS case LPGETSTATS: if (copy_to_user((int *) arg, &LP_STAT(minor), sizeof(struct lp_stats))) @@ -617,6 +648,7 @@ static int lp_ioctl(struct inode *inode, struct file *file, memset(&LP_STAT(minor), 0, sizeof(struct lp_stats)); break; +#endif case LPGETFLAGS: status = LP_F(minor); if (copy_to_user((int *) arg, &status, sizeof(int))) diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c index 329ac7b32..fba8c7d51 100644 --- a/drivers/char/nvram.c +++ b/drivers/char/nvram.c @@ -285,7 +285,7 @@ static int nvram_ioctl( struct inode *inode, struct file *file, switch( cmd ) { case NVRAM_INIT: /* initialize NVRAM contents and checksum */ - if (!suser()) + if (!capable(CAP_SYS_ADMIN)) return( -EACCES ); save_flags(flags); @@ -301,7 +301,7 @@ static int nvram_ioctl( struct inode *inode, struct file *file, case NVRAM_SETCKS: /* just set checksum, contents unchanged * (maybe useful after checksum garbaged * somehow...) */ - if (!suser()) + if (!capable(CAP_SYS_ADMIN)) return( -EACCES ); save_flags(flags); diff --git a/drivers/char/pc_keyb.c b/drivers/char/pc_keyb.c index e4718688a..c466ae4a4 100644 --- a/drivers/char/pc_keyb.c +++ b/drivers/char/pc_keyb.c @@ -522,8 +522,13 @@ static void keyboard_interrupt(int irq, void *dev_id, struct pt_regs *regs) unsigned char scancode; /* mouse data? */ - if (status & kbd_read_mask & KBD_STAT_MOUSE_OBF) + if (status & kbd_read_mask & KBD_STAT_MOUSE_OBF) { +#if defined(CONFIG_SGI) && defined(CONFIG_PSMOUSE) + scancode = kbd_read_input(); + aux_interrupt(status, scancode); +#endif break; + } scancode = kbd_read_input(); if ((status & KBD_STAT_OBF) && do_acknowledge(scancode)) diff --git a/drivers/char/random.c b/drivers/char/random.c index 226694a71..13d5d6d36 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -1199,7 +1199,7 @@ random_ioctl(struct inode * inode, struct file * file, put_user(ent_count, (int *) arg); return 0; case RNDADDTOENTCNT: - if (!suser()) + if (!capable(CAP_SYS_ADMIN)) return -EPERM; retval = verify_area(VERIFY_READ, (void *) arg, sizeof(int)); if (retval) @@ -1228,7 +1228,7 @@ random_ioctl(struct inode * inode, struct file * file, wake_up_interruptible(&random_read_wait); return 0; case RNDGETPOOL: - if (!suser()) + if (!capable(CAP_SYS_ADMIN)) return -EPERM; p = (int *) arg; retval = verify_area(VERIFY_WRITE, (void *) p, sizeof(int)); @@ -1249,7 +1249,7 @@ random_ioctl(struct inode * inode, struct file * file, return -EFAULT; return 0; case RNDADDENTROPY: - if (!suser()) + if (!capable(CAP_SYS_ADMIN)) return -EPERM; p = (int *) arg; retval = verify_area(VERIFY_READ, (void *) p, 2*sizeof(int)); @@ -1287,13 +1287,13 @@ random_ioctl(struct inode * inode, struct file * file, wake_up_interruptible(&random_read_wait); return 0; case RNDZAPENTCNT: - if (!suser()) + if (!capable(CAP_SYS_ADMIN)) return -EPERM; random_state.entropy_count = 0; return 0; case RNDCLEARPOOL: /* Clear the entropy pool and associated counters. */ - if (!suser()) + if (!capable(CAP_SYS_ADMIN)) return -EPERM; rand_clear_pool(); return 0; diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c index bed251b19..b854fa338 100644 --- a/drivers/char/riscom8.c +++ b/drivers/char/riscom8.c @@ -1447,7 +1447,7 @@ extern inline int rc_set_serial_info(struct riscom_port * port, change_speed = ((port->flags & ASYNC_SPD_MASK) != (tmp.flags & ASYNC_SPD_MASK)); - if (!suser()) { + if (!capable(CAP_SYS_ADMIN)) { if ((tmp.close_delay != port->close_delay) || (tmp.closing_wait != port->closing_wait) || ((tmp.flags & ~ASYNC_USR_MASK) != diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c index 901077455..cb4e9d498 100644 --- a/drivers/char/rocket.c +++ b/drivers/char/rocket.c @@ -1315,7 +1315,7 @@ static int set_config(struct r_port * info, struct rocket_config * new_info) if (copy_from_user(&new_serial, new_info, sizeof(new_serial))) return -EFAULT; - if (!suser()) { + if (!capable(CAP_SYS_ADMIN)) { if ((new_serial.flags & ~ROCKET_USR_MASK) != (info->flags & ~ROCKET_USR_MASK)) return -EPERM; diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c index 9edca1683..5f827bed9 100644 --- a/drivers/char/rtc.c +++ b/drivers/char/rtc.c @@ -220,7 +220,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, * We don't really want Joe User enabling more * than 64Hz of interrupts on a multi-user machine. */ - if ((rtc_freq > 64) && (!suser())) + if ((rtc_freq > 64) && (!capable(CAP_SYS_RESOURCE))) return -EACCES; if (!(rtc_status & RTC_TIMER_ON)) { @@ -308,7 +308,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned int yrs; unsigned long flags; - if (!suser()) + if (!capable(CAP_SYS_TIME)) return -EACCES; if (copy_from_user(&rtc_tm, (struct rtc_time*)arg, @@ -394,7 +394,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, * We don't really want Joe User generating more * than 64Hz of interrupts on a multi-user machine. */ - if ((arg > 64) && (!suser())) + if ((arg > 64) && (!capable(CAP_SYS_RESOURCE))) return -EACCES; while (arg > (1<<tmp)) @@ -429,7 +429,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, if (arg < 1900) return -EINVAL; - if (!suser()) + if (!capable(CAP_SYS_TIME)) return -EACCES; epoch = arg; diff --git a/drivers/char/serial.c b/drivers/char/serial.c index dbec8e285..b5e41a2d2 100644 --- a/drivers/char/serial.c +++ b/drivers/char/serial.c @@ -995,7 +995,7 @@ static int startup(struct async_struct * info) * here. */ if (serial_inp(info, UART_LSR) == 0xff) { - if (suser()) { + if (capable(CAP_SYS_ADMIN)) { if (info->tty) set_bit(TTY_IO_ERROR, &info->tty->flags); } else @@ -1027,7 +1027,7 @@ static int startup(struct async_struct * info) retval = request_irq(state->irq, handler, IRQ_T(info), "serial", NULL); if (retval) { - if (suser()) { + if (capable(CAP_SYS_ADMIN)) { if (info->tty) set_bit(TTY_IO_ERROR, &info->tty->flags); @@ -1660,7 +1660,7 @@ static int set_serial_info(struct async_struct * info, change_port = (new_serial.port != state->port) || (new_serial.hub6 != state->hub6); - if (!suser()) { + if (!capable(CAP_SYS_ADMIN)) { if (change_irq || change_port || (new_serial.baud_base != state->baud_base) || (new_serial.type != state->type) || @@ -1859,7 +1859,7 @@ static int do_autoconfig(struct async_struct * info) { int retval; - if (!suser()) + if (!capable(CAP_SYS_ADMIN)) return -EPERM; if (info->state->count > 1) @@ -1944,7 +1944,7 @@ static int set_multiport_struct(struct async_struct * info, int retval; void (*handler)(int, void *, struct pt_regs *); - if (!suser()) + if (!capable(CAP_SYS_ADMIN)) return -EPERM; state = info->state; diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c index ef5e6f7c7..a5d66bbd8 100644 --- a/drivers/char/specialix.c +++ b/drivers/char/specialix.c @@ -1842,7 +1842,7 @@ extern inline int sx_set_serial_info(struct specialix_port * port, change_speed = ((port->flags & ASYNC_SPD_MASK) != (tmp.flags & ASYNC_SPD_MASK)); - if (!suser()) { + if (!capable(CAP_SYS_ADMIN)) { if ((tmp.close_delay != port->close_delay) || (tmp.closing_wait != port->closing_wait) || ((tmp.flags & ~ASYNC_USR_MASK) != diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c index 31fa5ab50..06795e07a 100644 --- a/drivers/char/stallion.c +++ b/drivers/char/stallion.c @@ -1338,7 +1338,7 @@ static int stl_setserial(stlport_t *portp, struct serial_struct *sp) #endif copy_from_user(&sio, sp, sizeof(struct serial_struct)); - if (!suser()) { + if (!capable(CAP_SYS_ADMIN)) { if ((sio.baud_base != portp->baud_base) || (sio.close_delay != portp->close_delay) || ((sio.flags & ~ASYNC_USR_MASK) != diff --git a/drivers/char/vt.c b/drivers/char/vt.c index 6316be514..360ca915f 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c @@ -254,7 +254,8 @@ do_kdsk_ioctl(int cmd, struct kbentry *user_kbe, int perm, struct kbd_struct *kb if (!(key_map = key_maps[s])) { int j; - if (keymap_count >= MAX_NR_OF_USER_KEYMAPS && !suser()) + if (keymap_count >= MAX_NR_OF_USER_KEYMAPS && + !capable(CAP_SYS_RESOURCE)) return -EPERM; key_map = (ushort *) kmalloc(sizeof(plain_map), @@ -273,7 +274,7 @@ do_kdsk_ioctl(int cmd, struct kbentry *user_kbe, int perm, struct kbd_struct *kb /* * Attention Key. */ - if (((ov == K_SAK) || (v == K_SAK)) && !suser()) + if (((ov == K_SAK) || (v == K_SAK)) && !capable(CAP_SYS_ADMIN)) return -EPERM; key_map[i] = U(v); if (!s && (KTYP(ov) == KT_SHIFT || KTYP(v) == KT_SHIFT)) |