From patchwork Wed Feb 5 13:47:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 3586171 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8B4C0C02DC for ; Wed, 5 Feb 2014 13:47:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B7CE6201B4 for ; Wed, 5 Feb 2014 13:47:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9479820181 for ; Wed, 5 Feb 2014 13:47:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751631AbaBENrs (ORCPT ); Wed, 5 Feb 2014 08:47:48 -0500 Received: from mail-la0-f46.google.com ([209.85.215.46]:46031 "EHLO mail-la0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751388AbaBENrs (ORCPT ); Wed, 5 Feb 2014 08:47:48 -0500 Received: by mail-la0-f46.google.com with SMTP id b8so331328lan.33 for ; Wed, 05 Feb 2014 05:47:46 -0800 (PST) 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; bh=e2UHvD321lxtB1BMVSROaQxPnrpJwrIGy8kkkYvQ7Wc=; b=hBvzkRMXPm4VR1Wwsx7DGGcoUPMFsYGM4IQBHHYaGt5dfBDuGIew0l7/YqohI8/W3J yc2vRPoIaUqAr3FqfPjaiNMO3mom6V4VZj1VHEoT+s1bhM5U0oB2gdIczRaukRm3AoYG XB831dKI7iv3ut7mXUAAzL1p34A2e1b5MrbSwyD9sUHnE635MxK4d2HHhs8D5UU5yRMl DfvSX6SF0Mjo2E6Pjepu9owmUYsMrDzsUVTatN0Z+U4k8eCl5D/c6E7Q+rPWVZTNeJr9 88FoK1RAypLO3HwgbKr/pjBTekXPmSUoFqVvni+8gY9C81FPC2AdFlQndka1rr7qntDD +w1A== X-Gm-Message-State: ALoCoQkJ9sRyq1ZJ9KNWei51E35/OMUq4RSbBL10gQmnZTL3t7WXxBRQgBKjC47w4N62n+yY9d9Q X-Received: by 10.112.129.168 with SMTP id nx8mr1118273lbb.37.1391608066852; Wed, 05 Feb 2014 05:47:46 -0800 (PST) Received: from localhost ([109.110.66.216]) by mx.google.com with ESMTPSA id ri4sm29242894lbb.6.2014.02.05.05.47.45 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 05 Feb 2014 05:47:46 -0800 (PST) From: Ilya Dryomov To: ceph-devel@vger.kernel.org Cc: Kent Overstreet Subject: [PATCH] libceph: do not dereference a NULL bio pointer Date: Wed, 5 Feb 2014 15:47:43 +0200 Message-Id: <1391608063-5744-1-git-send-email-ilya.dryomov@inktank.com> X-Mailer: git-send-email 1.7.10.4 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Commit f38a5181d9f3 ("ceph: Convert to immutable biovecs") introduced a NULL pointer dereference, which broke rbd in -rc1. Fix it. Cc: Kent Overstreet Signed-off-by: Ilya Dryomov --- net/ceph/messenger.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 0e478a0f4204..30efc5c18622 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -840,9 +840,13 @@ static bool ceph_msg_data_bio_advance(struct ceph_msg_data_cursor *cursor, if (!cursor->bvec_iter.bi_size) { bio = bio->bi_next; - cursor->bvec_iter = bio->bi_iter; + cursor->bio = bio; + if (bio) + cursor->bvec_iter = bio->bi_iter; + else + memset(&cursor->bvec_iter, 0, + sizeof(cursor->bvec_iter)); } - cursor->bio = bio; if (!cursor->last_piece) { BUG_ON(!cursor->resid);