From patchwork Sun Feb 11 01:33:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chengguang Xu X-Patchwork-Id: 10210639 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 9F44360329 for ; Sun, 11 Feb 2018 01:33:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 843DF2932E for ; Sun, 11 Feb 2018 01:33:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7824D293F7; Sun, 11 Feb 2018 01:33:49 +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_SIGNED, 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 EF5C32932E for ; Sun, 11 Feb 2018 01:33:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751087AbeBKBdn (ORCPT ); Sat, 10 Feb 2018 20:33:43 -0500 Received: from mr11p00im-asmtp004.me.com ([17.110.69.135]:41988 "EHLO mr11p00im-asmtp004.me.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750909AbeBKBdn (ORCPT ); Sat, 10 Feb 2018 20:33:43 -0500 Received: from process-dkim-sign-daemon.mr11p00im-asmtp004.me.com by mr11p00im-asmtp004.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) id <0P3Y00B00PDYT500@mr11p00im-asmtp004.me.com> for ceph-devel@vger.kernel.org; Sun, 11 Feb 2018 01:33:42 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=04042017; t=1518312822; bh=r6UJqNbTgG6jgj2WIsZWHcdkp12UaWPrYubJDr1Odes=; h=From:To:Subject:Date:Message-id; b=dFOzymeiT/d8DNe3o5TD2VnamOvHUJltnEwkQbi0g3c+WF06GLdVZ5JZclKNTHMga 0mc04t843VOPLCiIwN+Tzsjw+T/u7gbagPjGOPO5rEQCq4pTQtrCmV7zTc0IVn+wTr csfngjn90qS4askVPnFqyY/p9Awm68F+fOTFZ7+0w18VbdZitaMg2jJcQV7iZDydtE Nanu4Kdvhpr9goINadNM/dQInzYKMswkUbDBnEWdcLaqZnyAJ+O5xVsdlvk+qCYRkl oXY7K9hzMDTIas9SZcyBRGRYN4vEbBLHQMZiJU9UmOmhMzytmmZGaP05zBcsJHjf0m OpWg7b1uGq/UA== Received: from icloud.com ([127.0.0.1]) by mr11p00im-asmtp004.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) with ESMTPSA id <0P3Y007YCPO2JT10@mr11p00im-asmtp004.me.com>; Sun, 11 Feb 2018 01:33:42 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-02-10_10:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1015 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1802110018 From: Chengguang Xu To: idryomov@gmail.com, zyan@redhat.com Cc: ceph-devel@vger.kernel.org, Chengguang Xu Subject: [PATCH] libceph: fix misjudgement of maximum monitor number Date: Sun, 11 Feb 2018 09:33:28 +0800 Message-id: <1518312808-34839-1-git-send-email-cgxu519@icloud.com> X-Mailer: git-send-email 1.8.3.1 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 num_mon should allow up to CEPH_MAX_MON in ceph_monmap_decode(). Signed-off-by: Chengguang Xu --- net/ceph/mon_client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c index 1547107..b3dac24 100644 --- a/net/ceph/mon_client.c +++ b/net/ceph/mon_client.c @@ -60,7 +60,7 @@ struct ceph_monmap *ceph_monmap_decode(void *p, void *end) num_mon = ceph_decode_32(&p); ceph_decode_need(&p, end, num_mon*sizeof(m->mon_inst[0]), bad); - if (num_mon >= CEPH_MAX_MON) + if (num_mon > CEPH_MAX_MON) goto bad; m = kmalloc(sizeof(*m) + sizeof(m->mon_inst[0])*num_mon, GFP_NOFS); if (m == NULL)