Skip to content

Commit f0bfcc2

Browse files
committed
drm/bridge: adv7511: Fix mutex deadlock when interrupts are disabled
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 <[email protected]>
1 parent c582778 commit f0bfcc2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/gpu/drm/bridge/adv7511/adv7511_drv.c

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

430-
static int adv7511_irq_process(struct adv7511 *adv7511)
430+
static int adv7511_irq_process(struct adv7511 *adv7511, bool process_hpd)
431431
{
432432
unsigned int irq0, irq1;
433433
int ret;
@@ -443,7 +443,7 @@ static int adv7511_irq_process(struct adv7511 *adv7511)
443443
regmap_write(adv7511->regmap, ADV7511_REG_INT(0), irq0);
444444
regmap_write(adv7511->regmap, ADV7511_REG_INT(1), irq1);
445445

446-
if (irq0 & ADV7511_INT0_HPD && adv7511->bridge.encoder)
446+
if (process_hpd && irq0 & ADV7511_INT0_HPD && adv7511->bridge.encoder)
447447
drm_helper_hpd_irq_event(adv7511->connector.dev);
448448

449449
if (irq0 & ADV7511_INT0_EDID_READY || irq1 & ADV7511_INT1_DDC_ERROR) {
@@ -461,7 +461,7 @@ static irqreturn_t adv7511_irq_handler(int irq, void *devid)
461461
struct adv7511 *adv7511 = devid;
462462
int ret;
463463

464-
ret = adv7511_irq_process(adv7511);
464+
ret = adv7511_irq_process(adv7511, true);
465465
return ret < 0 ? IRQ_NONE : IRQ_HANDLED;
466466
}
467467

@@ -478,7 +478,7 @@ static int adv7511_wait_for_edid(struct adv7511 *adv7511, int timeout)
478478
adv7511->edid_read, msecs_to_jiffies(timeout));
479479
} else {
480480
for (; timeout > 0; timeout -= 25) {
481-
ret = adv7511_irq_process(adv7511);
481+
ret = adv7511_irq_process(adv7511, false);
482482
if (ret < 0)
483483
break;
484484

0 commit comments

Comments
 (0)