From patchwork Mon Sep 19 17:03:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 9339923 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 17DA3607D0 for ; Mon, 19 Sep 2016 17:03:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0549D295E2 for ; Mon, 19 Sep 2016 17:03:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EE48B295E7; Mon, 19 Sep 2016 17:03:57 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 7221E295E2 for ; Mon, 19 Sep 2016 17:03:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752529AbcISRDv (ORCPT ); Mon, 19 Sep 2016 13:03:51 -0400 Received: from mail-yw0-f196.google.com ([209.85.161.196]:35424 "EHLO mail-yw0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752436AbcISRDt (ORCPT ); Mon, 19 Sep 2016 13:03:49 -0400 Received: by mail-yw0-f196.google.com with SMTP id u82so8530417ywc.2 for ; Mon, 19 Sep 2016 10:03:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6BL7PwP+NqFY/NSJ2HSjkJ1Bxy5Uk4Pmfcrf0k3D2LQ=; b=f6UYHNlC6SNbBAQabqSwTyraUTNjwitTPv7KsEfYGu6wZSIoFt+Z2ZUOYF0bE2Cfgc rtv5V7W/buD9C7iWeNUHFKnnlxsl2EBzgNqWU28YE6VueLMvwwOZE8BMZV4S/bIXZcp5 ibI/HZXSsIPNZkRfD6J4yoASgS6XpGX8GBjJhfRIRGgZzcxLXchoi34KOrQsmWThxFeC fyMx4H4mUeXrnMd71zBQfSQmApiYwP5PIR6I78dF/UdP/yPQQQiW+o613fGNRi/Rt+8l w+Cgn0Pm9yWqYLHxujbfB0BP99Wlnv1418MuIY/fQQkPyHAz+Zb2v0f2rc+4JiK74jcx AihA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6BL7PwP+NqFY/NSJ2HSjkJ1Bxy5Uk4Pmfcrf0k3D2LQ=; b=ebmHGCZCCSTMd6u2Z7T0bQ6gRlWXWw+Zl3N/v1SuciCPX8r7GgFslTuduAho9XiR+l yY29X2Cy+gV3TZuZW+7hL3SWRT1vsfsKI+sSOiW0t3h7TCiERmAHTQiGh7uWndXSsM/R 6nmY5pp/pP7PTT3n0kH2hkNi79euG7NCW3NZXcvywI/y15tpCPaNObqfevaVMCTBj0Zs HJfpKnX7eGjSOIWWC1lkdY9feXzZwQsgyn7hprVAh9G3XUDSa3lDNTMIyxGe0hipDfDt keYvhQkfTztu6GXlAX9wfsqjhnnm0ZkJDS+iduZLAKmcrI/k2L8qoTv/4X45vw1Rdg6e C4eQ== X-Gm-Message-State: AE9vXwOkLFrK2uNxPmBd2+vF0XjQGZgbQwx8VfeKn9yvnWCtk/AAAX3kx0EwOoJTL3+6ZA== X-Received: by 10.129.120.136 with SMTP id t130mr6563281ywc.97.1474304628563; Mon, 19 Sep 2016 10:03:48 -0700 (PDT) Received: from localhost.localdomain.com (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id o14sm9773905ywd.3.2016.09.19.10.03.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Sep 2016 10:03:48 -0700 (PDT) From: Ilya Dryomov To: ceph-devel@vger.kernel.org Cc: Alex Elder Subject: [PATCH 5/8] rbd: don't crash or leak on errors in rbd_img_obj_parent_read_full_callback() Date: Mon, 19 Sep 2016 19:03:25 +0200 Message-Id: <1474304608-17958-6-git-send-email-idryomov@gmail.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1474304608-17958-1-git-send-email-idryomov@gmail.com> References: <1474304608-17958-1-git-send-email-idryomov@gmail.com> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP - fix parent_length == img_request->xferred assert to not fire on copyup read failures - don't leak pages if copyup read fails or we can't allocate a new osd request Signed-off-by: Ilya Dryomov Reviewed-by: Alex Elder Reviewed-by: David Disseldorp --- drivers/block/rbd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index d8070bd29fd1..b9a4e79a663f 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -2666,7 +2666,7 @@ rbd_img_obj_parent_read_full_callback(struct rbd_img_request *img_request) rbd_assert(obj_request_type_valid(orig_request->type)); img_result = img_request->result; parent_length = img_request->length; - rbd_assert(parent_length == img_request->xferred); + rbd_assert(img_result || parent_length == img_request->xferred); rbd_img_request_put(img_request); rbd_assert(orig_request->img_request); @@ -2719,6 +2719,7 @@ rbd_img_obj_parent_read_full_callback(struct rbd_img_request *img_request) return; out_err: + ceph_release_page_vector(pages, page_count); orig_request->result = img_result; orig_request->xferred = 0; rbd_img_request_get(orig_request->img_request);