From patchwork Tue Feb 7 14:52:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 9560311 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 680A36047A for ; Tue, 7 Feb 2017 14:53:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5AA5B205AF for ; Tue, 7 Feb 2017 14:53:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F62828401; Tue, 7 Feb 2017 14:53:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E61CA280DE for ; Tue, 7 Feb 2017 14:53:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754258AbdBGOxQ (ORCPT ); Tue, 7 Feb 2017 09:53:16 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:35536 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754191AbdBGOxO (ORCPT ); Tue, 7 Feb 2017 09:53:14 -0500 Received: by mail-pf0-f196.google.com with SMTP id f144so9472026pfa.2 for ; Tue, 07 Feb 2017 06:53:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KxkzjLABXLkKVSjlXT7blyjZog1a66mxDeHK5EcUQK8=; b=KWpVGJG9RYm6A4CdeVXvvM4d+YH/38Anr87xcuzi9H4hexhFpcvg6TIe4vda3lNE4t OwKap71kSNGK/HxmG8yRRmxNKSwgHmePpqSdewZ51Me9gb+fgg3th/ErMWeGUsuO67kk oHsc/UuFK5asZL4wjzbPBP3IgwSosFAKeIUF0Fg3/go4Sn0RRuBZGwr03l6XDBcUBZT6 Q/ifRr7cxYaJ+qOzAgxJDvRwTvcbh6arjJiwJgZ2SGloGjUGw124k7di93bjGhpf0v1g ELlizYIrT7E+hPMMjxVZLd+JiSwPOWELteyzeL6/TrI5yloOk2zXw2qWRe8hTC6mENkN uZrg== 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:mime-version :content-transfer-encoding; bh=KxkzjLABXLkKVSjlXT7blyjZog1a66mxDeHK5EcUQK8=; b=BQ5ZDXesC+GUToHMNKy29cZgGFAOt30qiN0A7r4BNG8Yt/Bi80W9jMT7SjjVH1KATq 6SmOil/BpN8bMBTwKF4iONHMB+k5/aIokxK6qBaFGssW0g1c/OuUD/sWE6bxhP9bbCzb vCVZ6xNIbIanwSvXq88dy6aPUhHsptT5WQrBe1/F+gijZ8iBthaaVcqG+k+2qKY7k4J5 LfhRQNkyVp8a+8P/k4F0EsAC3DnvlUFA91oQe1M5GQtnJQ7ZA93tHQNiUGBO7JxBSmxH nrOgDzN19VUq6+c4gY6Aq5ZTxRZc8zAUfg7/G0TJXETHMkojqEyonlMnBZxd+fGcX3Oq cRww== X-Gm-Message-State: AIkVDXJzCHqWwDTryZ94ikFjfk/WXNskoTNhvW+dF5WOLLYj+wK9q6RDOU7iqSz/bS4CMA== X-Received: by 10.84.241.129 with SMTP id b1mr26727018pll.135.1486479183856; Tue, 07 Feb 2017 06:53:03 -0800 (PST) Received: from 192.168.0.37 (ec2-52-192-197-227.ap-northeast-1.compute.amazonaws.com. [52.192.197.227]) by smtp.gmail.com with ESMTPSA id c204sm12169033pfb.51.2017.02.07.06.53.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Feb 2017 06:53:03 -0800 (PST) From: Wei Yongjun To: "James E . J . Bottomley" , "Martin K. Petersen" , Manish Rangankar Cc: Wei Yongjun , QLogic-Storage-Upstream@cavium.com, linux-scsi@vger.kernel.org Subject: [PATCH -next] scsi: qedi: Fix possible memory leak in qedi_iscsi_update_conn() Date: Tue, 7 Feb 2017 14:52:58 +0000 Message-Id: <20170207145258.31429-1-weiyj.lk@gmail.com> X-Mailer: git-send-email 2.9.3 MIME-Version: 1.0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Wei Yongjun 'conn_info' is malloced in qedi_iscsi_update_conn() and should be freed before leaving from the error handling cases, otherwise it will cause memory leak. Fixes: ace7f46ba5fd ("scsi: qedi: Add QLogic FastLinQ offload iSCSI driver framework.") Signed-off-by: Wei Yongjun Acked-by: Manish Rangankar --- drivers/scsi/qedi/qedi_iscsi.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/scsi/qedi/qedi_iscsi.c b/drivers/scsi/qedi/qedi_iscsi.c index d6a2054..eb64469 100644 --- a/drivers/scsi/qedi/qedi_iscsi.c +++ b/drivers/scsi/qedi/qedi_iscsi.c @@ -453,13 +453,9 @@ static int qedi_iscsi_update_conn(struct qedi_ctx *qedi, if (rval) { rval = -ENXIO; QEDI_ERR(&qedi->dbg_ctx, "Could not update connection\n"); - goto update_conn_err; } kfree(conn_info); - rval = 0; - -update_conn_err: return rval; }