From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751790AbdJ2Hp3 (ORCPT ); Sun, 29 Oct 2017 03:45:29 -0400 Received: from mail-bn3nam01on0042.outbound.protection.outlook.com ([104.47.33.42]:19904 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750928AbdJ2Hp0 (ORCPT ); Sun, 29 Oct 2017 03:45:26 -0400 From: "Kalderon, Michal" To: Dan Carpenter , Yunsheng Lin CC: "Elior, Ariel" , Dept-Eng Everest Linux L2 , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "kernel-janitors@vger.kernel.org" Subject: Re: [PATCH net-next] qed: Set error code for allocation failures Thread-Topic: [PATCH net-next] qed: Set error code for allocation failures Thread-Index: AQHTTu587uCXVOC9tkul0P7kKFBRbqL3bzYAgAAnKQCAAt3Usg== Date: Sun, 29 Oct 2017 07:45:23 +0000 Message-ID: References: <20171027064020.aq52ue4kfp5htrb5@mwanda> <9ae1759e-18a1-18fb-ec93-8edf947b1cc6@huawei.com>,<20171027115252.hhqc2u6zrn5b4uet@mwanda> In-Reply-To: <20171027115252.hhqc2u6zrn5b4uet@mwanda> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [109.67.96.88] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;CY1PR0701MB1338;6:eAKiL4VI0RdmrN+wQcByHLy2pX56GhekKOOSmei3pLXhwPGModWOudRjp9IjM8jJmgOqXspXDmg+ULLcBOuig9wUCp7hkUgaWCf0xl54wqMCvoBpO5S8gV5ckelssP/+A1cYgeoGXhS06IhcHQw4EeA/qzvBtmFYtaEMS2b5S4PmkU6rDKFcqy3jkC2YyylbwPZzM/4WAu56h5yX+3RHkrkkDPm512Mz4E9AJ1V8AxJELh3p9MmMDMSrw00U5eGoOiGduhYFD9zLO6YAQmKO56RVtAQNpV7/DYqbihs75ICIzu0HSQdXSzsgOiqhp5JYUtHAiKxZNkDrCds9WexQmeLaBpQTKThk+8KJBWLBBY4=;5:qPwTbLVtogVJsE3Ht+2Big2NrLwD5JKLyQlqRrZ+fCr2qKFxjG59zp6D+I5z62EfT/Tc2++WIR8g9NQm3GwjNtR4nCpxWhSlGv5J1UUdg9MKGEGom58eXjtSJa+EAuA50Hj07X/Syi9J89s/EC5ODwVR4um5h4/ma2viCfaUQQc=;24:crwpBw8jq5sDdPEW//rB+XhJHGJ/PptfAVKgfkjBlBS8phJkUrjT/NaFqS/G04qqL/NrvEnvldI24jV6VZxK3GnAuD25kkDsK6S65+rpNqY=;7:sf+cryXL7Kck5E53v+PXsUErM2nNq3T8iRZtELNtEC8vMH8xjcYtVuLv6Se7kHogwdkufCXaYSYHHKBVOlHUYYI9YscOmPVwOI+xymJhuNd4Cgm/GufkIX+quP9mkwCPr4gxbs8XD8iirpKKNeQfdCUCrR3yppZPfkx4xHHqLDvnNVYPU/ldyMCQRfpBpTzvyt1beXvNQJHIV1QMz4YOqSYBfuosB0C+oy2wrjSBLn46NjUkI7fu7i2QhyNKM2ev x-ms-exchange-antispam-srfa-diagnostics: SSOS;SSOR; x-ms-office365-filtering-correlation-id: e2e9681f-2168-45d7-5444-08d51ea10375 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(4534020)(4602075)(2017052603238);SRVR:CY1PR0701MB1338; x-ms-traffictypediagnostic: CY1PR0701MB1338: x-exchange-antispam-report-test: UriScan:(146099531331640); x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(10201501046)(3231020)(100000703101)(100105400095)(6041248)(20161123558100)(20161123560025)(20161123562025)(20161123564025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:CY1PR0701MB1338;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:CY1PR0701MB1338; x-forefront-prvs: 0475418F50 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(6009001)(346002)(376002)(24454002)(189002)(199003)(97736004)(101416001)(105586002)(76176999)(50986999)(106356001)(4326008)(25786009)(33656002)(6246003)(8676002)(7736002)(229853002)(6116002)(3846002)(102836003)(7696004)(2950100002)(305945005)(54356999)(3660700001)(3280700002)(110136005)(2906002)(5660300001)(54906003)(74316002)(68736007)(8936002)(81166006)(6436002)(189998001)(6506006)(77096006)(66066001)(99286003)(81156014)(478600001)(53936002)(14454004)(316002)(72206003)(9686003)(86362001)(2900100001)(55016002);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR0701MB1338;H:CY1PR0701MB2012.namprd07.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; authentication-results: spf=none (sender IP is ) smtp.mailfrom=Michal.Kalderon@cavium.com; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" MIME-Version: 1.0 X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-Network-Message-Id: e2e9681f-2168-45d7-5444-08d51ea10375 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Oct 2017 07:45:23.7663 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0701MB1338 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id v9T7jbP7020944 From: Dan Carpenter Sent: Friday, October 27, 2017 2:52 PM >On Fri, Oct 27, 2017 at 05:32:42PM +0800, Yunsheng Lin wrote: >> > iwarp_info = &p_hwfn->p_rdma_info->iwarp; >> > @@ -2696,6 +2696,7 @@ qed_iwarp_ll2_start(struct qed_hwfn *p_hwfn, >> > if (rc) >> > goto err; >> > >> > + rc = -ENOMEM; >> > iwarp_info->partial_fpdus = kcalloc((u16)p_hwfn->p_rdma_info->num_qps, >> > sizeof(*iwarp_info->partial_fpdus), >> > GFP_KERNEL); >> >> Does the memory allocated here need to be freed when error happens below? >> > >Hm... I think you're right that it leaks. Also I'm confused by the >qed_iwarp_ll2_alloc_buffers() allocation. The comment in there says >that /* buffers will be deallocated by qed_ll2 */ but qed_ll2 is not >a function name or something which is useful to grep. Thanks Dan, partial_fpdus is released during qed_iwarp_resc_free, called from qed_rdma_resc_free called on qed_rdma_stop and on failure during qed_rdma_start. Regarding ll2 buffers. For each successfully allocated buffer we call qed_iwarp_ll2_post_rx->qed_ll2_post_rx_buffer. These buffers will get released and freed when we call qed_ll2_terminate_connection called from qed_iwarp_ll2_stop ( which is called during qed_iwarp_ll2_start on error ). thanks, Michal