Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp148335ybl; Fri, 16 Aug 2019 20:59:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqyIa4WPkr0cgo9J5PevKKRRkj1j7YcXWxTrvQ6TFpMxNCQRnipkoc2aiZtfPq5c6SWU7Ibk X-Received: by 2002:a63:ab08:: with SMTP id p8mr10881647pgf.340.1566014398292; Fri, 16 Aug 2019 20:59:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566014398; cv=none; d=google.com; s=arc-20160816; b=B1CeHj/I/GEznKGJ0iD5hSq68nOAS/7vjX/0kxouwKnsD0uhLq0PWEzW+gNV6VJ01p YbQ8cJ+s6Rkzkxw59Jd5uxUnG4/dkZor0GGepnsSKJiWH7K7TPdb4dC3g7oOlX83AUx7 7jpTApRot3GBx+Qx5FVjqeAlNhN4sF65BLbHurSZKiRi0U/a+2UG1t2FcbAyZf+155uj Ui9Un12KdwXNSPK807PvK65K8gRQ2sSk42I3r1ObkyZ3QuELbmTE9dol80qoS5tzCgPI niOI3X3BRB7RaLDoiE3NL7+f5y/UBjW2FkYvKJluXVf3bVxN//ZCiROAe8D1m3NoYoFM RxWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=e15dOmbpA8wIpFGMmENC5OPVg5eKR3YlOR31gP+EdrU=; b=utihDUktPq/NX3SCg9wkCQ1V/RequktoGCh3qDBLJ8ptrP8jaHVfaQJS5uC1FgMQn3 nHY9hQz7wdfmvCQDgqe157z/8RuiFUkjZgGCcplY5N6KTCOG7oNwf3jcAmX+KNUj1cSN 7Ih0RxxjGsPM4CwS9Ymf1cuQVsVnLzMJpi+a9scyh7BAPfTZSMrXvN9dsbl1tUDZCOPc A1jMOHO4ikDQdy+/dtW2RVBgqQciSeqJSIqSsXW0y3mYHOkg+YHYdKgVbXoq2/+8dGmo 8PBqRkI43Dqu6LiQuw2YcpnNAZltPLbcE2yAxtMo9kVKqC3VdNZjbcwm0JlM9FzInhto ufrg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a65si4302164pje.91.2019.08.16.20.59.43; Fri, 16 Aug 2019 20:59:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726240AbfHQD6h (ORCPT + 99 others); Fri, 16 Aug 2019 23:58:37 -0400 Received: from mail-yb1-f196.google.com ([209.85.219.196]:35812 "EHLO mail-yb1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725911AbfHQD6g (ORCPT ); Fri, 16 Aug 2019 23:58:36 -0400 Received: by mail-yb1-f196.google.com with SMTP id c9so2633264ybq.2; Fri, 16 Aug 2019 20:58:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=e15dOmbpA8wIpFGMmENC5OPVg5eKR3YlOR31gP+EdrU=; b=jnEJ7bIuyQGx3v1YxbTnOPFUe1Fc5T405W3abXkoNW0aLkJf9jAFQXDfldmtr/+4ya 2VtmI9HFlMTaJ0YnYNsgICLf+1b85weCVp8MPdeKgtdUmKO5DX5fwESkcNMzdKmvJLkU QemP6kC44lG0wuK6RTN0kIcMCwzuhn7PIT2RocEO92w0Zn4Pu73i+InVUgneAzJX7OuL yC706eyR6GCnx3Pz8MRWx7Am4DKmnbv347ldO/9PkwpCnufe7+SKB30+pWAOeeQvZG7V /mEAxEE6DykvG8GPkcWJ0rAClanzD+Yu+1m/hW7mphYPEUx3BAxjYYxk65MlOEXVy0kO ipTw== X-Gm-Message-State: APjAAAXDDhed1os8lx6HnE0d9Q/W6GTsCt36Z2swrM3Ob7eso8X1oSj3 J31jJUtBUkDwwoTCK8QFG7M= X-Received: by 2002:a25:97c1:: with SMTP id j1mr9979564ybo.349.1566014315893; Fri, 16 Aug 2019 20:58:35 -0700 (PDT) Received: from localhost.localdomain (24-158-240-219.dhcp.smyr.ga.charter.com. [24.158.240.219]) by smtp.gmail.com with ESMTPSA id j3sm1656183ywk.21.2019.08.16.20.58.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 16 Aug 2019 20:58:35 -0700 (PDT) From: Wenwen Wang To: Wenwen Wang Cc: Jens Axboe , linux-ide@vger.kernel.org (open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers)), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] libata: Fix a memory leak bug Date: Fri, 16 Aug 2019 22:58:29 -0500 Message-Id: <1566014309-3045-1-git-send-email-wenwen@cs.uga.edu> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In ata_init(), 'ata_force_tbl' is allocated through kcalloc() in ata_parse_force_param(). However, it is not deallocated if ata_attach_transport() fails, leading to a memory leak bug. To fix this issue, free 'ata_force_tbl' before go to the 'err_out' label. Signed-off-by: Wenwen Wang --- drivers/ata/libata-core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 28c492b..185dd69 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -7040,6 +7040,7 @@ static int __init ata_init(void) ata_scsi_transport_template = ata_attach_transport(); if (!ata_scsi_transport_template) { ata_sff_exit(); + kfree(ata_force_tbl); rc = -ENOMEM; goto err_out; } -- 2.7.4