Received: by 10.223.185.116 with SMTP id b49csp825142wrg; Sat, 10 Feb 2018 21:17:09 -0800 (PST) X-Google-Smtp-Source: AH8x227DM+Bw/f/+CkBgckakcFajOfKlJ4Jjl0o/wl7n6zjZ1z06UuUMjkNkFZEKol0UMhnIQsJE X-Received: by 10.99.175.3 with SMTP id w3mr6396548pge.328.1518326229757; Sat, 10 Feb 2018 21:17:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518326229; cv=none; d=google.com; s=arc-20160816; b=hsm+GeYhUYzkzipHlxcnSJo33iphmxEJunXhPgupy0jmRJ1dSlPYW5I6Yi2Ve4R1e0 QZZDVq9etHyvWo1nQajdLNK/TISCZx7MDZ59oc/9K9Wu4Ez1X8qpV4xWIcR9uHkHaGuw eU7KSl67RIMqMQngM7nUh2xDdZpf64cbuMAyC2yQhsfDSaJDhUh1j1BieN3+wUNezSko 2hnbmWpS+p8HqiykYHBeNc85MLq9woQA7C6x3YDzoiPH0nWQjv4NzzfIgu4R8FRtxfU8 2Y0jx3GwsFqIOzLUUwnPPuU8LDK+vHxhwRDVuqO0bSf+D8hQqZSNR0dB+3RTg4oceHBH 8roA== 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=ILAEFQ0JBBuV79RsDt4ePSSDS2iODlVAhQKYnhH5LYE=; b=lHgW4kaqBjVhxSaPN9vJ6YN/xtDXqzGV2VxF/7uyNtzGoyeeV16bCi3Qq//ZNAsJTK p8nSzEQJm3WzFq6NzQGoSfPzca/+mogpSD1a1G7lhVPWP0mX3yxME2c1q35KJJ2bU6vw Op3Yl9lo/HR+dsu62Hd14ps6XqFxbpbWKklVh5TqElWTtEzTaRN1Vkik6eb8uOShNhlN oY+4rLaR2FirLQ8EjUtnpAJQpLDdOvmDNSpiaPCzN+LojOB05s1vF04RIYwB9pI1+fpP fZcaVYoFbhjEobgZMwhtwRIwYfW5+TBhs0kYoiifirBG5aAwCeQIiViEumJ9spDgdyHP qxgw== 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 c80si2266939pfb.182.2018.02.10.21.16.56; Sat, 10 Feb 2018 21:17:09 -0800 (PST) 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 S1754011AbeBKFOV (ORCPT + 99 others); Sun, 11 Feb 2018 00:14:21 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:41386 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752617AbeBKEdl (ORCPT ); Sat, 10 Feb 2018 23:33:41 -0500 Received: from [2a02:8011:400e:2:6f00:88c8:c921:d332] (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 1ekjKd-0002hC-0C; Sun, 11 Feb 2018 04:33:39 +0000 Received: from ben by deadeye with local (Exim 4.90) (envelope-from ) id 1ekjKZ-0004XY-0R; Sun, 11 Feb 2018 04:33:35 +0000 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, "Secunia Research" , "Shuah Khan" , "Greg Kroah-Hartman" Date: Sun, 11 Feb 2018 04:20:06 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.2 76/79] usbip: fix stub_send_ret_submit() vulnerability to null transfer_buffer In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 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.2.99-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Shuah Khan commit be6123df1ea8f01ee2f896a16c2b7be3e4557a5a upstream. stub_send_ret_submit() handles urb with a potential null transfer_buffer, when it replays a packet with potential malicious data that could contain a null buffer. Add a check for the condition when actual_length > 0 and transfer_buffer is null. Reported-by: Secunia Research Signed-off-by: Shuah Khan Signed-off-by: Greg Kroah-Hartman [bwh: Backported to 3.2: - Device for logging purposes is &sdev->interface->dev - Adjust filename] Signed-off-by: Ben Hutchings --- drivers/staging/usbip/stub_tx.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/drivers/staging/usbip/stub_tx.c +++ b/drivers/staging/usbip/stub_tx.c @@ -178,6 +178,13 @@ static int stub_send_ret_submit(struct s memset(&pdu_header, 0, sizeof(pdu_header)); memset(&msg, 0, sizeof(msg)); + if (urb->actual_length > 0 && !urb->transfer_buffer) { + dev_err(&sdev->interface->dev, + "urb: actual_length %d transfer_buffer null\n", + urb->actual_length); + return -1; + } + if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) iovnum = 2 + urb->number_of_packets; else