From patchwork Tue Feb 9 14:48:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harry Wentland X-Patchwork-Id: 8262581 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 69611BEEE5 for ; Tue, 9 Feb 2016 15:03:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B68622026D for ; Tue, 9 Feb 2016 15:02:57 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 114E520263 for ; Tue, 9 Feb 2016 15:02:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D75F76E055; Tue, 9 Feb 2016 07:02:50 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 846 seconds by postgrey-1.34 at gabe; Tue, 09 Feb 2016 07:02:48 PST Received: from na01-by2-obe.outbound.protection.outlook.com (mail-by2on0085.outbound.protection.outlook.com [207.46.100.85]) by gabe.freedesktop.org (Postfix) with ESMTPS id D04216E055 for ; Tue, 9 Feb 2016 07:02:48 -0800 (PST) Authentication-Results: amd.com; dkim=none (message not signed) header.d=none;amd.com; dmarc=none action=none header.from=amd.com; Received: from [10.6.7.130] (165.204.54.251) by SN1PR12MB0415.namprd12.prod.outlook.com (10.162.104.28) with Microsoft SMTP Server (TLS) id 15.1.403.16; Tue, 9 Feb 2016 14:48:40 +0000 Subject: Re: [PATCH] drm: fix missing reference counting decrease To: Insu Yun , , , References: <1454342909-15327-1-git-send-email-wuninsu@gmail.com> From: Harry Wentland Message-ID: <56B9FC43.3040407@amd.com> Date: Tue, 9 Feb 2016 09:48:35 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <1454342909-15327-1-git-send-email-wuninsu@gmail.com> X-Originating-IP: [165.204.54.251] X-ClientProxiedBy: CY1PR20CA0049.namprd20.prod.outlook.com (25.163.250.17) To SN1PR12MB0415.namprd12.prod.outlook.com (25.162.104.28) X-MS-Office365-Filtering-Correlation-Id: 1de75dc4-b23d-4b3b-43bb-08d331601a4f X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0415; 2:NOVPHFZPizBMvf6+QSJuJg8ZUE9PqOPNgIw5ZGUyJvDQPjnJqg+jOwniPz7COiJtLIgfjEnYvAFV95ApLuB1dNbeJpKDR0Vko+uFnn8E9tfhV2xMVA7oYGpMJxifCzpLF3rBoRB+kj+hww/nt25TfYdauhijnEe+qYa3qthnZHaJxMIZ/TkqlqvLgrxQ0Ez7; 3:SKwdYcHkaYqvHQZE2xxwKa8npbkqChQmD7z3vQwp3VfDYkS5JYa+dhJrl/uQUfzid8xDOKp69Iry06QL9JX0X0Lkx7Vqm822Ob/kdi4jTQrl4IrHIW9rCo5NXrirvoV5; 25:cPEzlv+uV4h9dHKR80RoHdsBjqUsyRtHAFZoduz9hq28jYq3EKwyYGC9osGeAHRZocc21fP6+LczWcvggdvC35VXqMA/byghbIPoLbpEjY/j/XTNhGav+MIRNlEqiXkNz/z4Y1T6xq30VNniBM+SPYdxzPXftueulHSGvQ9bX1aC5ZJm7KKeNdij3QLji1bz9azp3R2pQefIo0GEHjK8vafYHvMtD1/ssvnoCWaI7ccDp9MTnBkwXbolxb/wD85a8RscApGTFTmpaEKNxcIGB7+eOKoWl5TdvUkL6sR06cHeeWq9rKJaDuOvvfhJj08h X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN1PR12MB0415; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0415; 20:GjKJ3DDgnyxHG6V+2Sf4MSPVBKXk63wGO7+MHEL7sJv8rlNP2SB98kL2Lkxj/LG18HTzzsv0gqV52kp17QLqu3CyeGQ7/DeeGvRvzvFDy+ihNe1Cj/PamrhIt5aZOf/SWMYJtz4zwe6ldCXnYy8EALYooIy+STymrDRWbU1/71PQItW6GW9YwmHitZ2blIXxzrwAJiZPBCS0T5nJiX4W89oihjus8q48fXqBleO+A+upMVW2jsQ63FOUIJLkUHtaHPRQvY4ZpbX/UKYqFw1RaDfkf+2VINKJ5yboVL17Ul9UCsGxVZGHEyZ14zwYMmvuP744U3iHrCYQOuOLnIDt36npLtCl9jpDloBdWdVlLRqUIpHofpFpolrnw9GrTFGbeRpJVBwVagZeygHicDELlgIu5Qx9PO+q4cNT02zbur1D4ix8Bg+uuZksJnwq0vO7GzrFpqEt2VTLUKL682nSElYS6JB/Onk+V6/98QZQJ42zEe5OHhJRbIZ9muCGSkI9; 4:ZvVue84bUC3uISgStMGgmgh16Wc3S0+XZD9NRawDeTK4XgDE2WR7SPKIuIs75GBjGdAXuNrqdtpoGpPuD2MIHHtWJyefG2Y3qm9E9QdK5+lp1mKCv7t1hJQ1f68K8xvs8oS00d8ORsUJdeKSN/EztUfSoBh5PMZSDoJpeDo0koqbRfcmRPRQyVrVVkzIiQQ/oNw1qra1gQ3TDgDzeEPyBP3w6uphj8Yzv0QU87o7xEEaIpZeokC1z4vEfsE0eON6jJFGoSl1M1zq3Bu9Teg1Il0lSf4LmlpV/Gmcvsnv4RBEUaV4DcY3qOAF2Pi9OOys0f2RKEU6HMLHBWeSIFoKe76pVwHZ9f3yNLuIy8g+G2Gbikbea/opVmDBU02BFYbohIZwmUJ1WtUU6xCwXFD3SmnaNycawSFWTKF5q/46sVk= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(102415293)(102615271)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001); SRVR:SN1PR12MB0415; BCL:0; PCL:0; RULEID:; SRVR:SN1PR12MB0415; X-Forefront-PRVS: 08476BC6EF X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6049001)(6009001)(24454002)(164054003)(377454003)(377424004)(5890100001)(77096005)(6116002)(270700001)(3846002)(65806001)(2906002)(66066001)(42186005)(189998001)(4326007)(5008740100001)(586003)(5001770100001)(1096002)(5001960100002)(2476003)(512944002)(2201001)(19580395003)(87976001)(19580405001)(5004730100002)(76176999)(50986999)(92566002)(54356999)(36756003)(122386002)(4001350100001)(64126003)(80316001)(86362001)(84326002)(568964002)(33656002)(4610100001)(40100003)(65816999)(83506001)(2950100001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0415; H:[10.6.7.130]; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1; SN1PR12MB0415; 23:PN0tKjB36RdcPF0NcNjfJOAT5JUB/lLyKaCDJ?= =?Windows-1252?Q?zv2TFi5u38XUQZ0tgWW2P7T4UQospQsQmxgzKtdx6uSCkqPhInKZ7QS8?= =?Windows-1252?Q?yvTjv7JFbYqx4606OsC5VlByd3Qv7WRFtR/eRoAf1jMzLRXdcjQfJNHm?= =?Windows-1252?Q?dUD3G7zjAjj63FV5agB80HBEtoEKSLjFfz7UyuzI3UfAZsRihhUr0S7A?= =?Windows-1252?Q?fFitHuxP+/u9r0rQMVnXsg1OvHsEcSmTkgrNgHeBNB2O/CfEN271QJ0m?= =?Windows-1252?Q?fv9Rxmsdhn21vXAcDzE5B5lRySKAE1JylcG2ECDQUNIJij9ZTshGjIDY?= =?Windows-1252?Q?UjgBvuxbZdQtq99TK/U8u7lPR9lMmSZRqWhfJTpiWtPjSfPKoVVjW50Q?= =?Windows-1252?Q?9o/qMaKSA+C6Ba8uGlVH+ObtRDANNFSPa0sE+VzmrAkwMf3aGGX91cIF?= =?Windows-1252?Q?0+xJhm6v/VxVxGw1OTpv733MTtZNwvIlHp7hlbzru3SkVQ+Fu4dONfOs?= =?Windows-1252?Q?vsTJxn3FMC1wbl56FQBL6kOshvIsHIhUxLwtxCSZ284LUX+tDIyLSIDn?= =?Windows-1252?Q?pIhUB6sKkLnG4vcq63j7m1s2hLKn5rHJRCXxGN4NDGM3+N6bQDAuPSFv?= =?Windows-1252?Q?7HNXyAJU3+UP1lOaf3jSlC4JHfbPSDwpjY4r8WjC9Lvi8o6Q7g6Is9Oz?= =?Windows-1252?Q?Q95uAhy7hJsGTcOd/jDkDoQEQptzuiiWt1N/aH0AvHA74qI54g9t+LcU?= =?Windows-1252?Q?FBG4/tzkuu820SUAR6HFBVvSQpiZ4wJ1dKG/cS1pzQka4D2l0FTpw5o+?= =?Windows-1252?Q?qAhzOKpBH0eJKfPi58Sp37ulkvCFFNCcyiKHhYI492lHApk1MywBHeMW?= =?Windows-1252?Q?WPdidPbagBM+xdMlV9j3iMlHYBlrprwckOMaRHURjio0KiuN/OgWxJKK?= =?Windows-1252?Q?3y/5u+UdMtakPVjR1dqEL7ZXYgHp+FTYbnR7tk+gmPX5Pfj2eWR6cyOq?= =?Windows-1252?Q?mfD7yWgptQUYSkMCtrH0IliXBt8iVqlZhYOB7C6ekcATjIzIqepcPi4z?= =?Windows-1252?Q?ztdRnaBtl3+o574XGE2FZTjZ4m4H/pAlzkLby4Va3u8d4/xbLfrtiUTw?= =?Windows-1252?Q?snyjyGerSc65kwRmqYdWYMiKgRvBu8eALprwZF2baRha6wXoGJtcbYs2?= =?Windows-1252?Q?SyZ3RqRDo3nwimHm1YqBspzLrxELqerbBORezAE4mAl7aBGvJeNNRYaI?= =?Windows-1252?Q?E4Mg0cW9nT4wB9U6kwTBgpXhuBe5O3SqCPrsCyX9Gd7x4yVycSaeIpTS?= =?Windows-1252?Q?Zc7zCy2RfhicGoxEwoCeGYHphXdisqNZyqc46jUWHP2lJg=3D?= X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0415; 5:FwtxvbIcvNRZV+jekpuXO9fCfM5ApWCPENs3VkgERvwsyZPIHuXoyshMDqFXcwZhNAd73L2kncWZ1YKR/leJQB5sNVt9BwnXORu+kJ5LyvpnkrAaUSFaj+ZnhtNzihVGPxdWekyMFKAPmiGoKs2aYg==; 24:wxaGVTw+YcYPoiipyW7Ec/EBdOQGTgf2ZBNlepg3rTNBx85+EeURUaoSVBt4nUzFuiIZ0bRcBHKP/rJwF/SV1qdUoCOnntHU//N5zJWGQMk=; 20:03LLsKliAib5jx/f3SIrJVHyCwNNtxfblBLVKOCP+7nHtcOp9vmW8SNAitcXCSQBKjxxXx62Cnwiroaojj+dVe57QGPfjgwln150xqLFbT37Vntu7HKUl8uC3JAEQrCdbAZR6mqE4wj8ikGMmh/WmNibJKQow8GVZdz6jrfb6LcfsQeuhgGaoKZM0mcTc4fxhq3EAWmtZrIJhgROTc/XCnPTR3jAUwK0bCxYqfpUMwit0vdnhfNn2OpaYzB3bO3Q X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Feb 2016 14:48:40.5988 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0415 Cc: yeongjin.jang@gatech.edu, taesoo@gatech.edu, insu@gatech.edu, changwoo@gatech.edu, "Deucher, Alexander" , "Lysenko, Mykola" X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.5 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_MED, 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 This looks good but we should probably do the same for all return paths when reference for port has been acquired. Please see attached patch. Thanks, Harry On 2016-02-01 11:08 AM, Insu Yun wrote: > In drm_dp_mst_allocate_vcpi, it returns true in two paths, > but in one path, there is no reference couting decrease. > > Signed-off-by: Insu Yun > --- > drivers/gpu/drm/drm_dp_mst_topology.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c > index 6ed90a2..fe273b6 100644 > --- a/drivers/gpu/drm/drm_dp_mst_topology.c > +++ b/drivers/gpu/drm/drm_dp_mst_topology.c > @@ -2446,6 +2446,7 @@ bool drm_dp_mst_allocate_vcpi(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp > DRM_DEBUG_KMS("payload: vcpi %d already allocated for pbn %d - requested pbn %d\n", port->vcpi.vcpi, port->vcpi.pbn, pbn); > if (pbn == port->vcpi.pbn) { > *slots = port->vcpi.num_slots; > + drm_dp_put_port(port); > return true; > } > } From a6d4dc6206f06a3d1acc05ea5bf3b4885cc96a0a Mon Sep 17 00:00:00 2001 From: Harry Wentland Date: Tue, 9 Feb 2016 09:33:11 -0500 Subject: [PATCH] drm/dp/mst: Fix missing ref count decrease Decrease ref count for port on all exit conditions. Signed-off-by: Harry Wentland Reviewed-by: Mykola Lysenko --- drivers/gpu/drm/drm_dp_mst_topology.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c index 5662e68ecccd..fa50fd0cb5ef 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c @@ -2498,7 +2498,8 @@ bool drm_dp_mst_allocate_vcpi(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp DRM_DEBUG_KMS("payload: vcpi %d already allocated for pbn %d - requested pbn %d\n", port->vcpi.vcpi, port->vcpi.pbn, pbn); if (pbn == port->vcpi.pbn) { *slots = port->vcpi.num_slots; - return true; + ret = 0; + goto out; } } @@ -2510,10 +2511,10 @@ bool drm_dp_mst_allocate_vcpi(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp DRM_DEBUG_KMS("initing vcpi for %d %d\n", pbn, port->vcpi.num_slots); *slots = port->vcpi.num_slots; - drm_dp_put_port(port); - return true; + ret = 0; out: - return false; + drm_dp_put_port(port); + return ret == 0; } EXPORT_SYMBOL(drm_dp_mst_allocate_vcpi); -- 2.1.4