Received: by 10.192.165.156 with SMTP id m28csp1116521imm; Wed, 11 Apr 2018 12:44:59 -0700 (PDT) X-Google-Smtp-Source: AIpwx485zq+mNIv0PdW0Jc+Ge81GAQf3aMvN7ojgNFwcd8sYrhkeMyXJ9Gj6yrpGL+XccwhE5Qqy X-Received: by 10.167.133.85 with SMTP id y21mr5070424pfn.139.1523475899724; Wed, 11 Apr 2018 12:44:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523475899; cv=none; d=google.com; s=arc-20160816; b=mFqRfmwPVANTHYY3fRy7MqH4PDvqek9swv06HSIp/vXBHrmkjQLBlWb+CSdzw12c6W u6PSLjq/lB0BtlYugV15BcBeb2IWy+0+QDujedsytJ5TtHqCzrRMNHKD3MQS1sXK2brI MtAw6kLcWjzhr4d/lDDVebYjQgDxy3UeFiUYFKS5Fq5g4MXoPGBGc8ePJqtwjJKNIJy5 E6qnFGCclBmJtLXkbILEpHeutOXRrsk7sRpWN5os3jZ1LtXcYDhRWr3eboMN7qTpK2KJ 8TQSR5R5XYo0oj0aOTpBNCU2JfDsDW0AOC8zQ9oVt39ZvFD1DkxXhoFJTsFY9E8OyDPw H98g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Mhc/rPJKhCKkIs0kN/j5AGz4L6h1GkkB9B+j8dJLFpM=; b=qbQ8ol61+fP69X7YHcAeUW1daHeCo4Hic2/9U0Q1v24WnBrp3CUkXs5l4XlBvpHOg+ KwQ3JthnDvL9xtZlYcbX0cYBKDduQfpGIfEs1uHuX5gV38HW4/RVGgrtYlISDSubwtwJ JVDikBfUaGHGqptK56Jm5ZfiHdWBJU0fBw8hgOyE2oQcH4BpmxA3n1KlB9JROcgOCVQs VJ1kWEvq1Rzz0YpNDDD9FD+uvQiG7bxMrQoLR7jk3DLEK+MdszTkBwLDdMz5D4YLSyy8 SXSGoDXoiAf/0o5+U6OGBVDNFGgupVH93+/5EMiVI0oJXf0azO0ncIwwLwpifjQNPS2o XhjQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m2-v6si1669550plt.441.2018.04.11.12.44.23; Wed, 11 Apr 2018 12:44:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756821AbeDKTAw (ORCPT + 99 others); Wed, 11 Apr 2018 15:00:52 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:37906 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756806AbeDKTAu (ORCPT ); Wed, 11 Apr 2018 15:00:50 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id C5D6F9C1; Wed, 11 Apr 2018 19:00:49 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrey Konovalov , Firo Yang , "David S. Miller" , Sasha Levin Subject: [PATCH 4.9 148/310] hdlcdrv: Fix divide by zero in hdlcdrv_ioctl Date: Wed, 11 Apr 2018 20:34:47 +0200 Message-Id: <20180411183628.803315174@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180411183622.305902791@linuxfoundation.org> References: <20180411183622.305902791@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Firo Yang [ Upstream commit fb3ce90b7d7761b6f7f28f0ff5c456ef6b5229a1 ] syszkaller fuzzer triggered a divide by zero, when set calibration through ioctl(). To fix it, test 'bitrate' if it is negative or 0, just return -EINVAL. Reported-by: Andrey Konovalov Signed-off-by: Firo Yang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/hamradio/hdlcdrv.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/net/hamradio/hdlcdrv.c +++ b/drivers/net/hamradio/hdlcdrv.c @@ -576,6 +576,8 @@ static int hdlcdrv_ioctl(struct net_devi case HDLCDRVCTL_CALIBRATE: if(!capable(CAP_SYS_RAWIO)) return -EPERM; + if (s->par.bitrate <= 0) + return -EINVAL; if (bi.data.calibrate > INT_MAX / s->par.bitrate) return -EINVAL; s->hdlctx.calibrate = bi.data.calibrate * s->par.bitrate / 16;