|
@@ -286,6 +286,7 @@ struct ibm_init_struct {
|
|
char param[32];
|
|
char param[32];
|
|
|
|
|
|
int (*init) (struct ibm_init_struct *);
|
|
int (*init) (struct ibm_init_struct *);
|
|
|
|
+ mode_t base_procfs_mode;
|
|
struct ibm_struct *data;
|
|
struct ibm_struct *data;
|
|
};
|
|
};
|
|
|
|
|
|
@@ -4629,6 +4630,10 @@ static int video_read(struct seq_file *m)
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /* Even reads can crash X.org, so... */
|
|
|
|
+ if (!capable(CAP_SYS_ADMIN))
|
|
|
|
+ return -EPERM;
|
|
|
|
+
|
|
status = video_outputsw_get();
|
|
status = video_outputsw_get();
|
|
if (status < 0)
|
|
if (status < 0)
|
|
return status;
|
|
return status;
|
|
@@ -4662,6 +4667,10 @@ static int video_write(char *buf)
|
|
if (video_supported == TPACPI_VIDEO_NONE)
|
|
if (video_supported == TPACPI_VIDEO_NONE)
|
|
return -ENODEV;
|
|
return -ENODEV;
|
|
|
|
|
|
|
|
+ /* Even reads can crash X.org, let alone writes... */
|
|
|
|
+ if (!capable(CAP_SYS_ADMIN))
|
|
|
|
+ return -EPERM;
|
|
|
|
+
|
|
enable = 0;
|
|
enable = 0;
|
|
disable = 0;
|
|
disable = 0;
|
|
|
|
|
|
@@ -8487,9 +8496,10 @@ static int __init ibm_init(struct ibm_init_struct *iibm)
|
|
"%s installed\n", ibm->name);
|
|
"%s installed\n", ibm->name);
|
|
|
|
|
|
if (ibm->read) {
|
|
if (ibm->read) {
|
|
- mode_t mode;
|
|
|
|
|
|
+ mode_t mode = iibm->base_procfs_mode;
|
|
|
|
|
|
- mode = S_IRUGO;
|
|
|
|
|
|
+ if (!mode)
|
|
|
|
+ mode = S_IRUGO;
|
|
if (ibm->write)
|
|
if (ibm->write)
|
|
mode |= S_IWUSR;
|
|
mode |= S_IWUSR;
|
|
entry = proc_create_data(ibm->name, mode, proc_dir,
|
|
entry = proc_create_data(ibm->name, mode, proc_dir,
|
|
@@ -8680,6 +8690,7 @@ static struct ibm_init_struct ibms_init[] __initdata = {
|
|
#ifdef CONFIG_THINKPAD_ACPI_VIDEO
|
|
#ifdef CONFIG_THINKPAD_ACPI_VIDEO
|
|
{
|
|
{
|
|
.init = video_init,
|
|
.init = video_init,
|
|
|
|
+ .base_procfs_mode = S_IRUSR,
|
|
.data = &video_driver_data,
|
|
.data = &video_driver_data,
|
|
},
|
|
},
|
|
#endif
|
|
#endif
|