patch-2.1.100 linux/drivers/block/xd.c

Next file: linux/drivers/cdrom/sbpcd.c
Previous file: linux/drivers/block/umc8672.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.99/linux/drivers/block/xd.c linux/drivers/block/xd.c
@@ -338,7 +338,7 @@
 			return copy_to_user(geometry, &g, sizeof g) ? -EFAULT : 0;
 		}
 		case BLKRASET:
-			if(!suser()) return -EACCES;
+			if(!capable(CAP_SYS_ADMIN)) return -EACCES;
 			if(arg > 0xff) return -EINVAL;
 			read_ahead[MAJOR(inode->i_rdev)] = arg;
 			return 0;
@@ -348,12 +348,12 @@
 			if (!arg) return -EINVAL;
 			return put_user(xd_struct[MINOR(inode->i_rdev)].nr_sects,(long *) arg);
 		case BLKFLSBUF:   /* Return devices size */
-			if(!suser())  return -EACCES;
+			if(!capable(CAP_SYS_ADMIN))  return -EACCES;
 			fsync_dev(inode->i_rdev);
 			invalidate_buffers(inode->i_rdev);
 			return 0;
 		case HDIO_SET_DMA:
-			if (!suser()) return -EACCES;
+			if (!capable(CAP_SYS_ADMIN)) return -EACCES;
 			if (xdc_busy) return -EBUSY;
 			nodma = !arg;
 			if (nodma && xd_dma_buffer) {
@@ -366,6 +366,8 @@
 		case HDIO_GET_MULTCOUNT:
 			return put_user(xd_maxsectors, (long *) arg);
 		case BLKRRPART:
+			if (!capable(CAP_SYS_ADMIN)) 
+				return -EACCES;
 			return xd_reread_partitions(inode->i_rdev);
 		RO_IOCTLS(inode->i_rdev,arg);
 		default:

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov