Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 185081
b: refs/heads/master
c: b525c06
h: refs/heads/master
i:
  185079: c0f1b4b
v: v3
  • Loading branch information
Henrique de Moraes Holschuh committed Feb 26, 2010
1 parent 84a3126 commit 51991cd
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 08fedfc903c78e380b0baa7b57c52d367794d0a5
refs/heads/master: b525c06cdbd8a3963f0173ccd23f9147d4c384b5
4 changes: 4 additions & 0 deletions trunk/Documentation/laptops/thinkpad-acpi.txt
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,10 @@ LCD, CRT or DVI (if available). The following commands are available:
echo expand_toggle > /proc/acpi/ibm/video
echo video_switch > /proc/acpi/ibm/video

NOTE: Access to this feature is restricted to processes owning the
CAP_SYS_ADMIN capability for safety reasons, as it can interact badly
enough with some versions of X.org to crash it.

Each video output device can be enabled or disabled individually.
Reading /proc/acpi/ibm/video shows the status of each device.

Expand Down
10 changes: 8 additions & 2 deletions trunk/drivers/platform/x86/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,15 @@ config THINKPAD_ACPI_VIDEO
server running, phase of the moon, and the current mood of
Schroedinger's cat. If you can use X.org's RandR to control
your ThinkPad's video output ports instead of this feature,
don't think twice: do it and say N here to save some memory.
don't think twice: do it and say N here to save memory and avoid
bad interactions with X.org.

If you are not sure, say Y here.
NOTE: access to this feature is limited to processes with the
CAP_SYS_ADMIN capability, to avoid local DoS issues in platforms
where it interacts badly with X.org.

If you are not sure, say Y here but do try to check if you could
be using X.org RandR instead.

config THINKPAD_ACPI_HOTKEY_POLL
bool "Support NVRAM polling for hot keys"
Expand Down
15 changes: 13 additions & 2 deletions trunk/drivers/platform/x86/thinkpad_acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ struct ibm_init_struct {
char param[32];

int (*init) (struct ibm_init_struct *);
mode_t base_procfs_mode;
struct ibm_struct *data;
};

Expand Down Expand Up @@ -4629,6 +4630,10 @@ static int video_read(struct seq_file *m)
return 0;
}

/* Even reads can crash X.org, so... */
if (!capable(CAP_SYS_ADMIN))
return -EPERM;

status = video_outputsw_get();
if (status < 0)
return status;
Expand Down Expand Up @@ -4662,6 +4667,10 @@ static int video_write(char *buf)
if (video_supported == TPACPI_VIDEO_NONE)
return -ENODEV;

/* Even reads can crash X.org, let alone writes... */
if (!capable(CAP_SYS_ADMIN))
return -EPERM;

enable = 0;
disable = 0;

Expand Down Expand Up @@ -8487,9 +8496,10 @@ static int __init ibm_init(struct ibm_init_struct *iibm)
"%s installed\n", ibm->name);

if (ibm->read) {
mode_t mode;
mode_t mode = iibm->base_procfs_mode;

mode = S_IRUGO;
if (!mode)
mode = S_IRUGO;
if (ibm->write)
mode |= S_IWUSR;
entry = proc_create_data(ibm->name, mode, proc_dir,
Expand Down Expand Up @@ -8680,6 +8690,7 @@ static struct ibm_init_struct ibms_init[] __initdata = {
#ifdef CONFIG_THINKPAD_ACPI_VIDEO
{
.init = video_init,
.base_procfs_mode = S_IRUSR,
.data = &video_driver_data,
},
#endif
Expand Down

0 comments on commit 51991cd

Please sign in to comment.