Skip to contentSkip to conversation

mmc:Fix refcount leak in the function mmc_queue_resume for the semaphone thread_sem

PATCH Ulf Hansson 1 participant 1 message Jul 21, 2015 1 message not in the archive MMC, SD and SDIO

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 6 lines · Nicholas Krause

This fixes the unneeded possible freeing of the semaphone lock thread_sem as part of the passed mmc_queue structure pointer mq to the function mmc_queue_resume by calling up on this lock now due to this lock's refcount never being incremented by the caller before the call to this particular function by means of the function down.

I guess you only looked at the code, but didn't actually notice any bug/hang?

Quoted 11 lines
---
 drivers/mmc/card/queue.c | 2 --
 1 file changed, 2 deletions(-)
drivers/mmc/card/queue.c +0 -0
index b5a2b14..97a80f6 100644

drivers/mmc/card/queue.c void mmc_queue_resume(struct mmc_queue *mq) · line 442

Quoted 5 lines
drivers/mmc/card/queue.c +0 -2
@@ -438,8 +438,6 @@ void mmc_queue_resume(struct mmc_queue *mq)
        if (mq->flags & MMC_QUEUE_SUSPENDED) {
                mq->flags &= ~MMC_QUEUE_SUSPENDED;
 
-               up(&mq->thread_sem);
-

This should be balanced from mmc_queue_suspend(), so it's likely a bad idea to remove "up()" here. :-)

Quoted 6 lines
drivers/mmc/card/queue.c +0 -1
                spin_lock_irqsave(q->queue_lock, flags);
                blk_start_queue(q);
                spin_unlock_irqrestore(q->queue_lock, flags);
--

2.1.4

Kind regards
Uffe