From patchwork Thu Dec 13 17:01:24 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 1875591 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id D7587DF23A for ; Thu, 13 Dec 2012 17:01:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756534Ab2LMRBd (ORCPT ); Thu, 13 Dec 2012 12:01:33 -0500 Received: from mail-ie0-f174.google.com ([209.85.223.174]:56754 "EHLO mail-ie0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755109Ab2LMRBc (ORCPT ); Thu, 13 Dec 2012 12:01:32 -0500 Received: by mail-ie0-f174.google.com with SMTP id c11so4280962ieb.19 for ; Thu, 13 Dec 2012 09:01:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=dOYHJC7QPnj7h+VCDmh9eCMQf7G164i0C5/YPu5XKMM=; b=YA31wtwtawyP3dwPdbZKZ/u1DurJxftnSIadnHniVA5sQZ+rFlDY9cmyGa58XAHzPP BKv2h/SHYLpF349Ht0siNWuhWH7bfUlboNSUVx1k+8pidq4DobKGber0j9uIPegxpvhe aS2Y/e2pviJJRwarVuEaY0OhtILzoiMAURXkkEIQ8oSrPPofej8hSQ88EVJjp5yDPjp1 D7R4pRgh55uYEHk4owarTa0K9msqHSHjGpcb6NhWfQp4MslubiPQPcsgzRyUKK4lIU9O XqjNEqsGoEKBfsfp72416d+PdV6/ZXCB2CEvSUHII7J9O7BdWNu+uBSQWoF0jdH5hzsG aQRw== Received: by 10.50.236.104 with SMTP id ut8mr2369385igc.20.1355418088461; Thu, 13 Dec 2012 09:01:28 -0800 (PST) Received: from [172.22.22.4] (c-71-195-31-37.hsd1.mn.comcast.net. [71.195.31.37]) by mx.google.com with ESMTPS id aa6sm4595584igc.14.2012.12.13.09.01.25 (version=SSLv3 cipher=OTHER); Thu, 13 Dec 2012 09:01:26 -0800 (PST) Message-ID: <50CA09E4.4010406@inktank.com> Date: Thu, 13 Dec 2012 11:01:24 -0600 From: Alex Elder User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: ceph-devel@vger.kernel.org Subject: [PATCH 2/9] ceph: don't reference req after put References: <50CA0915.1090801@inktank.com> In-Reply-To: <50CA0915.1090801@inktank.com> X-Gm-Message-State: ALoCoQmDk7aEdVLR7GxZDB659H+ko0WVdMU3Vl+41yCxdGTqeaT346Xo2mXIdA4YZsiykxnK1xbW Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org In __unregister_request(), there is a call to list_del_init() referencing a request that was the subject of a call to ceph_osdc_put_request() on the previous line. This is not safe, because the request structure could have been freed by the time we reach the list_del_init(). Fix this by reversing the order of these lines. Signed-off-by: Alex Elder Reviewed-off-by: Sage Weil --- net/ceph/osd_client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) __cancel_osd_timeout(osdc); diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 7ebfe13..ac7be72 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -871,9 +871,9 @@ static void __unregister_request(struct ceph_osd_client *osdc, req->r_osd = NULL; } + list_del_init(&req->r_req_lru_item); ceph_osdc_put_request(req); - list_del_init(&req->r_req_lru_item); if (osdc->num_requests == 0) { dout(" no requests, canceling timeout\n");