From: Maxime Bizon Date: Thu, 16 Jul 2009 06:32:52 +0000 (+0000) Subject: ide: fix memory leak when flush command is issued X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=bc146d23d1358af43f03793c3ad8c9f16bbcffcb;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git ide: fix memory leak when flush command is issued I'm using ide on 2.6.30.1 with xfs filesystem. I noticed a kernel memory leak after writing lots of data, the kmalloc-96 slab cache keeps growing. It seems the struct ide_cmd kmalloced by idedisk_prepare_flush is never kfreed. Commit a09485df9cda49fbde2766c86eb18a9cae585162 ("ide: move request type specific code from ide_end_drive_cmd() to callers (v3)") and f505d49ffd25ed062e76ffd17568d3937fcd338c ("ide: fix barriers support") cause this regression, cmd->rq must now be set for ide_complete_cmd to honor the IDE_TFLAG_DYN flag. Signed-off-by: Maxime Bizon Acked-by: Bartlomiej Zolnierkiewicz Signed-off-by: David S. Miller --- diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 695181120cd..7f878017b73 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c @@ -455,6 +455,7 @@ static void idedisk_prepare_flush(struct request_queue *q, struct request *rq) rq->cmd_type = REQ_TYPE_ATA_TASKFILE; rq->special = cmd; + cmd->rq = rq; } ide_devset_get(multcount, mult_count);