142 lines
4.8 KiB
Diff
142 lines
4.8 KiB
Diff
diff --git a/drivers/tty/Kconfig b/drivers/tty/Kconfig
|
|
index 0840d27381ea..73aba9a31064 100644
|
|
--- a/drivers/tty/Kconfig
|
|
+++ b/drivers/tty/Kconfig
|
|
@@ -75,6 +75,19 @@ config VT_CONSOLE_SLEEP
|
|
def_bool y
|
|
depends on VT_CONSOLE && PM_SLEEP
|
|
|
|
+config NR_TTY_DEVICES
|
|
+ int "Maximum tty device number"
|
|
+ depends on VT
|
|
+ range 12 63
|
|
+ default 63
|
|
+ ---help---
|
|
+ This option is used to change the number of tty devices in /dev.
|
|
+ The default value is 63. The lowest number you can set is 12,
|
|
+ 63 is also the upper limit so we don't overrun the serial
|
|
+ consoles.
|
|
+
|
|
+ If unsure, say 63.
|
|
+
|
|
config HW_CONSOLE
|
|
bool
|
|
depends on VT && !UML
|
|
diff --git a/include/uapi/linux/vt.h b/include/uapi/linux/vt.h
|
|
index e9d39c48520a..3bceead8da40 100644
|
|
--- a/include/uapi/linux/vt.h
|
|
+++ b/include/uapi/linux/vt.h
|
|
@@ -3,12 +3,25 @@
|
|
#define _UAPI_LINUX_VT_H
|
|
|
|
|
|
+/*
|
|
+ * We will make this definition solely for the purpose of making packages
|
|
+ * such as splashutils build, because they can not understand that
|
|
+ * NR_TTY_DEVICES is defined in the kernel configuration.
|
|
+ */
|
|
+#ifndef CONFIG_NR_TTY_DEVICES
|
|
+#define CONFIG_NR_TTY_DEVICES 63
|
|
+#endif
|
|
+
|
|
/*
|
|
* These constants are also useful for user-level apps (e.g., VC
|
|
* resizing).
|
|
*/
|
|
#define MIN_NR_CONSOLES 1 /* must be at least 1 */
|
|
-#define MAX_NR_CONSOLES 63 /* serial lines start at 64 */
|
|
+/*
|
|
+ * NR_TTY_DEVICES:
|
|
+ * Value MUST be at least 12 and must never be higher then 63
|
|
+ */
|
|
+#define MAX_NR_CONSOLES CONFIG_NR_TTY_DEVICES /* serial lines start above this */
|
|
/* Note: the ioctl VT_GETSTATE does not work for
|
|
consoles 16 and higher (since it returns a short) */
|
|
|
|
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
|
|
index 86ffa0c2880f..710edc70e37e 100644
|
|
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
|
|
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
|
|
@@ -8717,20 +8717,38 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
|
|
* the same resource. If we have a new DC context as part of
|
|
* the DM atomic state from validation we need to free it and
|
|
* retain the existing one instead.
|
|
+ *
|
|
+ * Furthermore, since the DM atomic state only contains the DC
|
|
+ * context and can safely be annulled, we can free the state
|
|
+ * and clear the associated private object now to free
|
|
+ * some memory and avoid a possible use-after-free later.
|
|
*/
|
|
- struct dm_atomic_state *new_dm_state, *old_dm_state;
|
|
|
|
- new_dm_state = dm_atomic_get_new_state(state);
|
|
- old_dm_state = dm_atomic_get_old_state(state);
|
|
+ for (i = 0; i < state->num_private_objs; i++) {
|
|
+ struct drm_private_obj *obj = state->private_objs[i].ptr;
|
|
|
|
- if (new_dm_state && old_dm_state) {
|
|
- if (new_dm_state->context)
|
|
- dc_release_state(new_dm_state->context);
|
|
+ if (obj->funcs == adev->dm.atomic_obj.funcs) {
|
|
+ int j = state->num_private_objs-1;
|
|
|
|
- new_dm_state->context = old_dm_state->context;
|
|
+ dm_atomic_destroy_state(obj,
|
|
+ state->private_objs[i].state);
|
|
+
|
|
+ /* If i is not at the end of the array then the
|
|
+ * last element needs to be moved to where i was
|
|
+ * before the array can safely be truncated.
|
|
+ */
|
|
+ if (i != j)
|
|
+ state->private_objs[i] =
|
|
+ state->private_objs[j];
|
|
|
|
- if (old_dm_state->context)
|
|
- dc_retain_state(old_dm_state->context);
|
|
+ state->private_objs[j].ptr = NULL;
|
|
+ state->private_objs[j].state = NULL;
|
|
+ state->private_objs[j].old_state = NULL;
|
|
+ state->private_objs[j].new_state = NULL;
|
|
+
|
|
+ state->num_private_objs = j;
|
|
+ break;
|
|
+ }
|
|
}
|
|
}
|
|
|
|
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
|
|
index 02e6f8c4dde0..ebb8a28ff002 100644
|
|
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
|
|
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
|
|
@@ -778,7 +778,8 @@ static ssize_t amdgpu_set_pp_od_clk_voltage(struct device *dev,
|
|
tmp_str++;
|
|
while (isspace(*++tmp_str));
|
|
|
|
- while ((sub_str = strsep(&tmp_str, delimiter)) != NULL) {
|
|
+ while (tmp_str[0]) {
|
|
+ sub_str = strsep(&tmp_str, delimiter);
|
|
ret = kstrtol(sub_str, 0, ¶meter[parameter_size]);
|
|
if (ret)
|
|
return -EINVAL;
|
|
@@ -1038,7 +1039,8 @@ static ssize_t amdgpu_read_mask(const char *buf, size_t count, uint32_t *mask)
|
|
memcpy(buf_cpy, buf, bytes);
|
|
buf_cpy[bytes] = '\0';
|
|
tmp = buf_cpy;
|
|
- while ((sub_str = strsep(&tmp, delimiter)) != NULL) {
|
|
+ while (tmp[0]) {
|
|
+ sub_str = strsep(&tmp, delimiter);
|
|
if (strlen(sub_str)) {
|
|
ret = kstrtol(sub_str, 0, &level);
|
|
if (ret)
|
|
@@ -1635,7 +1637,8 @@ static ssize_t amdgpu_set_pp_power_profile_mode(struct device *dev,
|
|
i++;
|
|
memcpy(buf_cpy, buf, count-i);
|
|
tmp_str = buf_cpy;
|
|
- while ((sub_str = strsep(&tmp_str, delimiter)) != NULL) {
|
|
+ while (tmp_str[0]) {
|
|
+ sub_str = strsep(&tmp_str, delimiter);
|
|
ret = kstrtol(sub_str, 0, ¶meter[parameter_size]);
|
|
if (ret)
|
|
return -EINVAL;
|