Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6487C05027 for ; Mon, 6 Feb 2023 15:16:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230520AbjBFPQI (ORCPT ); Mon, 6 Feb 2023 10:16:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229640AbjBFPQG (ORCPT ); Mon, 6 Feb 2023 10:16:06 -0500 Received: from exchange.fintech.ru (e10edge.fintech.ru [195.54.195.159]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD65EEFA6; Mon, 6 Feb 2023 07:16:03 -0800 (PST) Received: from Ex16-02.fintech.ru (10.0.10.19) by exchange.fintech.ru (195.54.195.159) with Microsoft SMTP Server (TLS) id 14.3.498.0; Mon, 6 Feb 2023 18:15:54 +0300 Received: from Ex16-01.fintech.ru (10.0.10.18) by Ex16-02.fintech.ru (10.0.10.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Mon, 6 Feb 2023 18:15:54 +0300 Received: from Ex16-01.fintech.ru ([fe80::2534:7600:5275:d3f9]) by Ex16-01.fintech.ru ([fe80::2534:7600:5275:d3f9%7]) with mapi id 15.01.2242.004; Mon, 6 Feb 2023 18:15:54 +0300 From: =?utf-8?B?0J/QtdGC0YDQvtCy0LAg0J3QsNGC0LDQu9C40Y8g0JzQuNGF0LDQudC70L4=?= =?utf-8?B?0LLQvdCw?= To: Ilya Dryomov CC: Dongsheng Yang , Jens Axboe , "ceph-devel@vger.kernel.org" , "linux-block@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "lvc-project@linuxtesting.org" , "Alexey Khoroshilov" Subject: RE: [PATCH] rbd: avoid double free memory on error path in rbd_dev_create() Thread-Topic: [PATCH] rbd: avoid double free memory on error path in rbd_dev_create() Thread-Index: AQHZN9nxgAE2L2YDAUOtBDoC3Rb6ma7Boq2AgABcKRA= Date: Mon, 6 Feb 2023 15:15:54 +0000 Message-ID: References: <20230203141515.125205-1-n.petrova@fintech.ru> In-Reply-To: Accept-Language: ru-RU, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.0.253.125] Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org SGkgSWx5YSENClRoYW5rcyBmb3IgeW91ciByZXNwb25zZSEgSSBkb24ndCBxdWl0ZSB1bmRlcnN0 YW5kIHlvdXIgaWRlYSBhbmQgc3VnZ2VzdGlvbi4gVGhlIHBhdGNoIGlzIGRlc2lnbmVkIHRvIGF2 b2lkIGRvdWJsZSBmcmVlIG1lbW9yeS4gSSBleHBsb3JlZCB0aGUgY29kZSBhZ2FpbiBhbmQgc3Vw cG9zZSB0aGVyZSBpcyBhbm90aGVyIHNpdHVhdGlvbiBmb3IgcmJkX2Rldi0+cmJkX2NsaWVudCBh bmQgcmJkX2Rldi0+c3BlYy4gRnJlZSBtZW1vcnkgb2YgdGhlc2UgcG9pbnRlcnMgaXMgcG9zc2li bGUgb25seSBvbmNlIGluIHJiZF9kZXZfZnJlZSgpIGZ1bmN0aW9uLiBJbiBkb19yYmRfYWRkKCkg ZGVhbGxvY2F0aW9uIG1lbW9yeSBpcyBvbmx5IGZvciByYmRfb3B0czogZHJpdmVycy9ibG9jay9y YmQuYyA3MTU3Lg0KQ29ycmVjdCBtZSBpZiBJJ20gd3JvbmcuDQoNClRoYW5rcywgDQpOYXRhbGlh DQoNCi0tLS0tT3JpZ2luYWwgTWVzc2FnZS0tLS0tDQpGcm9tOiBJbHlhIERyeW9tb3YgPGlkcnlv bW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