From patchwork Wed Nov 23 04:35:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xi Wang X-Patchwork-Id: 127210 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 098EDB70DC for ; Wed, 23 Nov 2011 15:35:43 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759799Ab1KWEfU (ORCPT ); Tue, 22 Nov 2011 23:35:20 -0500 Received: from mail-iy0-f174.google.com ([209.85.210.174]:45915 "EHLO mail-iy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752496Ab1KWEfS convert rfc822-to-8bit (ORCPT ); Tue, 22 Nov 2011 23:35:18 -0500 Received: by iage36 with SMTP id e36so1076944iag.19 for ; Tue, 22 Nov 2011 20:35:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:content-type:content-transfer-encoding:subject:date:message-id :cc:to:mime-version:x-mailer; bh=QO2HjKfLVl2o+KfWgO1UHOw7hzs09QdXlEgEcAGB4vQ=; b=kPKwAjM2pyJm4n6aWFNrLuqP+nuZLZfsMQ36X4cM+Sb/mUjWME9LEZAYbZ72ZMYcMd GcsvtHBDAwSZpE7fXZJh+aQGq0pgiXbGAl8PG4Gttnu42HqrYyPYjRcrDbC/INa2jV8i ecAbSO4jh+sVL0n0rAxqwwj2D+B1lUzz2Rnck= Received: by 10.50.207.99 with SMTP id lv3mr26305746igc.16.1322022917684; Tue, 22 Nov 2011 20:35:17 -0800 (PST) Received: from vpn-18-101-16-236.mit.edu (VPN-18-101-16-236.MIT.EDU. [18.101.16.236]) by mx.google.com with ESMTPS id dd36sm68298045ibb.7.2011.11.22.20.35.15 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 22 Nov 2011 20:35:16 -0800 (PST) From: Xi Wang Subject: [PATCH 2/2] ax25: integer overflows in ax25_ctl_ioctl() Date: Tue, 22 Nov 2011 23:35:13 -0500 Message-Id: Cc: Joerg Reuter , Ralf Baechle , David Miller , linux-hams@vger.kernel.org, netdev@vger.kernel.org To: linux-kernel@vger.kernel.org Mime-Version: 1.0 (Apple Message framework v1084) X-Mailer: Apple Mail (2.1084) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org ax25_ctl_ioctl() misses several bound checks on the user-controlled value. Signed-off-by: Xi Wang --- net/ax25/af_ax25.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index be6a8cf..bd47e22 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c @@ -402,14 +402,14 @@ static int ax25_ctl_ioctl(const unsigned int cmd, void __user *arg) break; case AX25_T1: - if (ax25_ctl.arg < 1) + if (ax25_ctl.arg < 1 || ax25_ctl.arg > 30) goto einval_put; ax25->rtt = (ax25_ctl.arg * HZ) / 2; ax25->t1 = ax25_ctl.arg * HZ; break; case AX25_T2: - if (ax25_ctl.arg < 1) + if (ax25_ctl.arg < 1 || ax25_ctl.arg > 20) goto einval_put; ax25->t2 = ax25_ctl.arg * HZ; break; @@ -422,10 +422,14 @@ static int ax25_ctl_ioctl(const unsigned int cmd, void __user *arg) break; case AX25_T3: + if (ax25_ctl.arg > 3600) + goto einval_put; ax25->t3 = ax25_ctl.arg * HZ; break; case AX25_IDLE: + if (ax25_ctl.arg > 65535) + goto einval_put; ax25->idle = ax25_ctl.arg * 60 * HZ; break;