Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2279152imm; Thu, 7 Jun 2018 08:06:58 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL++m56EEM2PwAGxWtK1je6626zhUds63KdtQlvve20EG/0hjPhFy4abCgzC5cdOBV6kmbq X-Received: by 2002:a62:ea14:: with SMTP id t20-v6mr2139360pfh.117.1528384017936; Thu, 07 Jun 2018 08:06:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528384017; cv=none; d=google.com; s=arc-20160816; b=NDPFszrysS74OOGjeCBw65fL37vxIlDozaPoYaefJPDE4fOv9zbcDdY7Ko4bw3me4o EtO4SBvZHhHJDNvfc4/nahKhrFFQXgb4Lqf73wAH4ByYAXeP5NTkVtwInVucFp3UWoru +frRUBWyYzcJxAjqtGVKvTXDbELBVp7gJOQHZrWdAt2X/9MBkQHmXI08G31b4U7yc1IC YGPgk9iauV4mTXSj9CX6RaW7NbM06QjJ/667V/XCM3XL/V/AFcuewGI+2iDU9Ldl4d2/ DJvDSkz0M9OVjDpgIVnzSIc4vTpLJFbe52yiGMQyXOkTo7P8Bj/MDk93Qhov3Ds/ht8p ThMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=6HyOcgZoUj6UVXOsKHNMcHj3TpXgNsTPogo+2bf1ohw=; b=K4GSH2mxMjJLrYK036sISX7v0Pp7365S01O6eBckenWdyCWhVOlNJhvoR7sh94wZAz Tm/sYFNO8Gw+0QmjoH8viWjjraRsmC3Z+nXbcIHxBJzXFd4JIhiQM7PxagRT4tI9lyG/ Nt7QBLDP4r4Yusq52MXruFEzf6NvS4SbYLD3ZJRhl0+S+L9xPjHuT5NlD8h89f4pcmrh H7YXclJ8wN/AXCLMRmb3EBWlHg7RyVHTgFTJLwnRHgOhhn+9xJxBErTbK2QVAwoJkBlR n448LAR0jY12baHuIO5c2OhLiyVUvaz90Ui0/F5qve1tKPXpJogelGO3MVe5dN0EWVpO mqkQ== 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 g14-v6si13235444pgr.419.2018.06.07.08.06.43; Thu, 07 Jun 2018 08:06:57 -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 S936037AbeFGPEJ (ORCPT + 99 others); Thu, 7 Jun 2018 11:04:09 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:41567 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934962AbeFGPEG (ORCPT ); Thu, 7 Jun 2018 11:04:06 -0400 Received: from [148.252.241.226] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1fQvbz-0005dI-Se; Thu, 07 Jun 2018 15:10:00 +0100 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1fQvay-0002iw-9f; Thu, 07 Jun 2018 15:08:56 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Dan Carpenter" , "Christoph Hellwig" , "Jens Axboe" Date: Thu, 07 Jun 2018 15:05:21 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 035/410] cdrom: information leak in cdrom_ioctl_media_changed() In-Reply-To: X-SA-Exim-Connect-IP: 148.252.241.226 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.57-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Dan Carpenter commit 9de4ee40547fd315d4a0ed1dd15a2fa3559ad707 upstream. This cast is wrong. "cdi->capacity" is an int and "arg" is an unsigned long. The way the check is written now, if one of the high 32 bits is set then we could read outside the info->slots[] array. This bug is pretty old and it predates git. Reviewed-by: Christoph Hellwig Signed-off-by: Dan Carpenter Signed-off-by: Jens Axboe Signed-off-by: Ben Hutchings --- drivers/cdrom/cdrom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c @@ -2357,7 +2357,7 @@ static int cdrom_ioctl_media_changed(str if (!CDROM_CAN(CDC_SELECT_DISC) || arg == CDSL_CURRENT) return media_changed(cdi, 1); - if ((unsigned int)arg >= cdi->capacity) + if (arg >= cdi->capacity) return -EINVAL; info = kmalloc(sizeof(*info), GFP_KERNEL);