Commit cab29322 authored by Daniel Vetter's avatar Daniel Vetter

Merge tag 'drm-misc-fixes-2023-04-13' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes

Short summary of fixes pull:

 * armada: Fix double free
 * fb: Clear FB_ACTIVATE_KD_TEXT in ioctl
 * nouveau: Add missing callbacks
 * scheduler: Fix use-after-free error
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
From: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20230413184233.GA8148@linux-uq9g
parents fffb0b52 5603effb
...@@ -99,7 +99,6 @@ static int armada_drm_bind(struct device *dev) ...@@ -99,7 +99,6 @@ static int armada_drm_bind(struct device *dev)
if (ret) { if (ret) {
dev_err(dev, "[" DRM_NAME ":%s] can't kick out simple-fb: %d\n", dev_err(dev, "[" DRM_NAME ":%s] can't kick out simple-fb: %d\n",
__func__, ret); __func__, ret);
kfree(priv);
return ret; return ret;
} }
......
...@@ -31,6 +31,7 @@ gf108_fb = { ...@@ -31,6 +31,7 @@ gf108_fb = {
.init = gf100_fb_init, .init = gf100_fb_init,
.init_page = gf100_fb_init_page, .init_page = gf100_fb_init_page,
.intr = gf100_fb_intr, .intr = gf100_fb_intr,
.sysmem.flush_page_init = gf100_fb_sysmem_flush_page_init,
.ram_new = gf108_ram_new, .ram_new = gf108_ram_new,
.default_bigpage = 17, .default_bigpage = 17,
}; };
......
...@@ -77,6 +77,7 @@ gk104_fb = { ...@@ -77,6 +77,7 @@ gk104_fb = {
.init = gf100_fb_init, .init = gf100_fb_init,
.init_page = gf100_fb_init_page, .init_page = gf100_fb_init_page,
.intr = gf100_fb_intr, .intr = gf100_fb_intr,
.sysmem.flush_page_init = gf100_fb_sysmem_flush_page_init,
.ram_new = gk104_ram_new, .ram_new = gk104_ram_new,
.default_bigpage = 17, .default_bigpage = 17,
.clkgate_pack = gk104_fb_clkgate_pack, .clkgate_pack = gk104_fb_clkgate_pack,
......
...@@ -59,6 +59,7 @@ gk110_fb = { ...@@ -59,6 +59,7 @@ gk110_fb = {
.init = gf100_fb_init, .init = gf100_fb_init,
.init_page = gf100_fb_init_page, .init_page = gf100_fb_init_page,
.intr = gf100_fb_intr, .intr = gf100_fb_intr,
.sysmem.flush_page_init = gf100_fb_sysmem_flush_page_init,
.ram_new = gk104_ram_new, .ram_new = gk104_ram_new,
.default_bigpage = 17, .default_bigpage = 17,
.clkgate_pack = gk110_fb_clkgate_pack, .clkgate_pack = gk110_fb_clkgate_pack,
......
...@@ -31,6 +31,7 @@ gm107_fb = { ...@@ -31,6 +31,7 @@ gm107_fb = {
.init = gf100_fb_init, .init = gf100_fb_init,
.init_page = gf100_fb_init_page, .init_page = gf100_fb_init_page,
.intr = gf100_fb_intr, .intr = gf100_fb_intr,
.sysmem.flush_page_init = gf100_fb_sysmem_flush_page_init,
.ram_new = gm107_ram_new, .ram_new = gm107_ram_new,
.default_bigpage = 17, .default_bigpage = 17,
}; };
......
...@@ -507,12 +507,19 @@ void drm_sched_entity_push_job(struct drm_sched_job *sched_job) ...@@ -507,12 +507,19 @@ void drm_sched_entity_push_job(struct drm_sched_job *sched_job)
{ {
struct drm_sched_entity *entity = sched_job->entity; struct drm_sched_entity *entity = sched_job->entity;
bool first; bool first;
ktime_t submit_ts;
trace_drm_sched_job(sched_job, entity); trace_drm_sched_job(sched_job, entity);
atomic_inc(entity->rq->sched->score); atomic_inc(entity->rq->sched->score);
WRITE_ONCE(entity->last_user, current->group_leader); WRITE_ONCE(entity->last_user, current->group_leader);
/*
* After the sched_job is pushed into the entity queue, it may be
* completed and freed up at any time. We can no longer access it.
* Make sure to set the submit_ts first, to avoid a race.
*/
sched_job->submit_ts = submit_ts = ktime_get();
first = spsc_queue_push(&entity->job_queue, &sched_job->queue_node); first = spsc_queue_push(&entity->job_queue, &sched_job->queue_node);
sched_job->submit_ts = ktime_get();
/* first job wakes up scheduler */ /* first job wakes up scheduler */
if (first) { if (first) {
...@@ -529,7 +536,7 @@ void drm_sched_entity_push_job(struct drm_sched_job *sched_job) ...@@ -529,7 +536,7 @@ void drm_sched_entity_push_job(struct drm_sched_job *sched_job)
spin_unlock(&entity->rq_lock); spin_unlock(&entity->rq_lock);
if (drm_sched_policy == DRM_SCHED_POLICY_FIFO) if (drm_sched_policy == DRM_SCHED_POLICY_FIFO)
drm_sched_rq_update_fifo(entity, sched_job->submit_ts); drm_sched_rq_update_fifo(entity, submit_ts);
drm_sched_wakeup(entity->rq->sched); drm_sched_wakeup(entity->rq->sched);
} }
......
...@@ -1116,6 +1116,8 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, ...@@ -1116,6 +1116,8 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,
case FBIOPUT_VSCREENINFO: case FBIOPUT_VSCREENINFO:
if (copy_from_user(&var, argp, sizeof(var))) if (copy_from_user(&var, argp, sizeof(var)))
return -EFAULT; return -EFAULT;
/* only for kernel-internal use */
var.activate &= ~FB_ACTIVATE_KD_TEXT;
console_lock(); console_lock();
lock_fb_info(info); lock_fb_info(info);
ret = fbcon_modechange_possible(info, &var); ret = fbcon_modechange_possible(info, &var);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment