From patchwork Sat Mar 22 22:54:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yan, Zheng" X-Patchwork-Id: 3878081 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 B78F7BF540 for ; Sat, 22 Mar 2014 22:55:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A12E220295 for ; Sat, 22 Mar 2014 22:55:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8530120263 for ; Sat, 22 Mar 2014 22:55:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751883AbaCVWzD (ORCPT ); Sat, 22 Mar 2014 18:55:03 -0400 Received: from mga02.intel.com ([134.134.136.20]:41434 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751501AbaCVWzC (ORCPT ); Sat, 22 Mar 2014 18:55:02 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 22 Mar 2014 15:55:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,711,1389772800"; d="scan'208";a="505629491" Received: from unknown (HELO zyan5-mobl.ccr.corp.intel.com) ([10.255.20.16]) by orsmga002.jf.intel.com with ESMTP; 22 Mar 2014 15:55:00 -0700 From: "Yan, Zheng" To: ceph-devel@vger.kernel.org Cc: "Yan, Zheng" Subject: [PATCH] libceph: fix oops in ceph_msg_data_pagelist_advance() Date: Sun, 23 Mar 2014 06:54:57 +0800 Message-Id: <1395528897-26031-1-git-send-email-zheng.z.yan@intel.com> X-Mailer: git-send-email 1.8.5.3 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 When there is no more data, ceph_msg_data_pagelist_advance() should not move on to the next page. Signed-off-by: Yan, Zheng --- net/ceph/messenger.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 30efc5c..8859f2e 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -1004,6 +1004,9 @@ static bool ceph_msg_data_pagelist_advance(struct ceph_msg_data_cursor *cursor, if (!bytes || cursor->offset & ~PAGE_MASK) return false; /* more bytes to process in the current page */ + if (!cursor->resid) + return false; /* no more data */ + /* Move on to the next page */ BUG_ON(list_is_last(&cursor->page->lru, &pagelist->head));