From patchwork Wed Jun 17 09:17:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xue, Ying" X-Patchwork-Id: 6623371 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 511E19F326 for ; Wed, 17 Jun 2015 09:17:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 821BD206CD for ; Wed, 17 Jun 2015 09:17:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6014520634 for ; Wed, 17 Jun 2015 09:17:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753791AbbFQJRc (ORCPT ); Wed, 17 Jun 2015 05:17:32 -0400 Received: from mail.windriver.com ([147.11.1.11]:33531 "EHLO mail.windriver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752222AbbFQJRb (ORCPT ); Wed, 17 Jun 2015 05:17:31 -0400 Received: from ALA-HCB.corp.ad.wrs.com (ala-hcb.corp.ad.wrs.com [147.11.189.41]) by mail.windriver.com (8.15.1/8.15.1) with ESMTPS id t5H9HREN000234 (version=TLSv1 cipher=AES128-SHA bits=128 verify=FAIL); Wed, 17 Jun 2015 02:17:27 -0700 (PDT) Received: from ying.corp.ad.wrs.com (128.224.163.180) by ALA-HCB.corp.ad.wrs.com (147.11.189.41) with Microsoft SMTP Server id 14.3.224.2; Wed, 17 Jun 2015 02:17:27 -0700 From: Ying Xue To: CC: , Subject: [PATCH] cxgb4i: Fix neigh entry leak Date: Wed, 17 Jun 2015 17:17:16 +0800 Message-ID: <1434532636-32274-1-git-send-email-ying.xue@windriver.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When csk->atid returned by cxgb4_alloc_atid() is less than zero, init_act_open() directly returns with -EINVAL. But as init_act_open() ever invokes dst_neigh_lookup() before it calls cxgb4_alloc_atid(), this leads to the leak of neigh entry searched by dst_neigh_lookup(). Signed-off-by: Ying Xue --- drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c index dd00e5f..c449d2a 100644 --- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c +++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c @@ -1393,7 +1393,7 @@ static int init_act_open(struct cxgbi_sock *csk) csk->atid = cxgb4_alloc_atid(lldi->tids, csk); if (csk->atid < 0) { pr_err("%s, NO atid available.\n", ndev->name); - return -EINVAL; + goto rel_resource; } cxgbi_sock_set_flag(csk, CTPF_HAS_ATID); cxgbi_sock_get(csk);