Skip to content

Commit c634cec

Browse files
boddobgregkh
authored andcommitted
drm/bridge: adv7511: Fix mutex deadlock when interrupts are disabled
commit f0bfcc22d9822947b0ad3095e8363eab5261864c upstream. When the adv7511 i2c client doesn't have an interrupt line, we observe a deadlock on caused by trying to lock drm device's mode_config.mutex twice in the same context. Here is the sequence that causes it: ioctl DRM_IOCTL_MODE_GETCONNECTOR from userspace drm_mode_getconnector (acquires mode_config mutex) connector->fill_modes() drm_helper_probe_single_connector_modes connector_funcs->get_modes adv7511_encoder_get_modes adv7511_get_edid_block adv7511_irq_process drm_helper_hpd_irq_event (acquires mode_config mutex again) In adv7511_irq_process, don't call drm_helper_hpd_irq_event when not called from the interrupt handler. It doesn't serve any purpose there anyway. Signed-off-by: Archit Taneja <architt@codeaurora.org> Signed-off-by: Thong Ho <thong.ho.px@rvc.renesas.com> Signed-off-by: Nhan Nguyen <nhan.nguyen.yb@renesas.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent aea7e5c commit c634cec

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/gpu/drm/i2c/adv7511.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ static bool adv7511_hpd(struct adv7511 *adv7511)
429429
return false;
430430
}
431431

432-
static int adv7511_irq_process(struct adv7511 *adv7511)
432+
static int adv7511_irq_process(struct adv7511 *adv7511, bool process_hpd)
433433
{
434434
unsigned int irq0, irq1;
435435
int ret;
@@ -445,7 +445,7 @@ static int adv7511_irq_process(struct adv7511 *adv7511)
445445
regmap_write(adv7511->regmap, ADV7511_REG_INT(0), irq0);
446446
regmap_write(adv7511->regmap, ADV7511_REG_INT(1), irq1);
447447

448-
if (irq0 & ADV7511_INT0_HDP && adv7511->encoder)
448+
if (process_hpd && irq0 & ADV7511_INT0_HDP && adv7511->encoder)
449449
drm_helper_hpd_irq_event(adv7511->encoder->dev);
450450

451451
if (irq0 & ADV7511_INT0_EDID_READY || irq1 & ADV7511_INT1_DDC_ERROR) {
@@ -463,7 +463,7 @@ static irqreturn_t adv7511_irq_handler(int irq, void *devid)
463463
struct adv7511 *adv7511 = devid;
464464
int ret;
465465

466-
ret = adv7511_irq_process(adv7511);
466+
ret = adv7511_irq_process(adv7511, true);
467467
return ret < 0 ? IRQ_NONE : IRQ_HANDLED;
468468
}
469469

@@ -480,7 +480,7 @@ static int adv7511_wait_for_edid(struct adv7511 *adv7511, int timeout)
480480
adv7511->edid_read, msecs_to_jiffies(timeout));
481481
} else {
482482
for (; timeout > 0; timeout -= 25) {
483-
ret = adv7511_irq_process(adv7511);
483+
ret = adv7511_irq_process(adv7511, false);
484484
if (ret < 0)
485485
break;
486486

0 commit comments

Comments
 (0)