Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3930847imm; Mon, 8 Oct 2018 11:53:08 -0700 (PDT) X-Google-Smtp-Source: ACcGV62fs5e6WirgVCHgzqgFQFaSDZ0lDfg516togz743nGbMoGxZFql7OxhqInfHfTaBbPSUgL6 X-Received: by 2002:a17:902:6184:: with SMTP id u4-v6mr24718678plj.121.1539024788244; Mon, 08 Oct 2018 11:53:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539024788; cv=none; d=google.com; s=arc-20160816; b=QjKoo2GOB5kDnvvl+PHeHg+pyDSfkVemy7yxmWO+DPAWHnhderwKUA2tiXn6gAPtRK efgRzps+iWQvzvzW/FAUUogVkNur+bCsgOCHozAz1RQsTl7s9iN/eMY8rmbe3Tv0jHgp rs8D61JSNFY7Uq858PktGiPc8dXlQefozHT8qNItRWd0xWMUe+toibhcISmkWhnTCjcz SONUZknABQMU/TxHqYrecA8/m+ukh/5nzCNd6Ftqbw22yD9Lr7FOCd4N9IJhcAH19Wpj 8ZIBDMe0rVQI5/zOjbkBDqfi+ryPt7FdO5Sa+l8thJVS3x7OWXeLCOH9n/0XOmVskUjV oWVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=n/gRfciw580pUKh9bnxWwLyKf1GVq5OaVcMWrHlwKHE=; b=pF+JPTnHQTguKMBwI/egv7krYGOkkwkZPHLgOoGJ5+ZD3WRFv5sUe5GujVAyLStmj+ dViN6Owbobmosd/xD5lEzlxZ1I8BFUhUuLKFsaZUSZCTirNGMfYAXRHPrCkxE1MTv4fc IefIkDxpa322DTY1ZkTIkfeBWXymI3NA9N0iOzYaoAWhcMpFZD3DXuzvKuZ8JRuawoNj rlVtcO2P5lYdGI6T9QSKgxpF61WqBJQguG3QdeZq+wY/grxE88ltzXEKjWAmZSvY2LEe VTlE+LZEY08AQ8FQ42h+lvsDIhwmyj8KKJ0Mw7z+ZSs0oHvic+DlLeN4b3lMoScqy9lS aq/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=o1ddPJO6; 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 g24-v6si5079637pgh.188.2018.10.08.11.52.53; Mon, 08 Oct 2018 11:53:08 -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; dkim=pass header.i=@kernel.org header.s=default header.b=o1ddPJO6; 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 S1732595AbeJICFw (ORCPT + 99 others); Mon, 8 Oct 2018 22:05:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:56048 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727260AbeJICFv (ORCPT ); Mon, 8 Oct 2018 22:05:51 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D596C204FD; Mon, 8 Oct 2018 18:52:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539024763; bh=0HNTmVqhTPjqQ/VTPHL1+mzxEZXQchjwPK5MCXfkHys=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o1ddPJO6uepoL9ExRzGss7RJjtGBU9LXO8o+doPPlegtj6rHho7naT6RGfxXTQ0wn bl1w+UOAD0MMDbhqenfGNvatgoC7gI2HJWJ7+CnY4PBFT/O4hUM+OB6C0/xwAf24tW P4oZDzuTF0vgkFr23P0T+B125GAbkDBvfBL4PY4w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dr Silvio Cesare of InfoSect , Dan Carpenter , Steve French , Aurelien Aptel , Sasha Levin Subject: [PATCH 4.18 138/168] cifs: read overflow in is_valid_oplock_break() Date: Mon, 8 Oct 2018 20:31:58 +0200 Message-Id: <20181008175625.283934273@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181008175620.043587728@linuxfoundation.org> References: <20181008175620.043587728@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dan Carpenter [ Upstream commit 097f5863b1a0c9901f180bbd56ae7d630655faaa ] We need to verify that the "data_offset" is within bounds. Reported-by: Dr Silvio Cesare of InfoSect Signed-off-by: Dan Carpenter Signed-off-by: Steve French Reviewed-by: Aurelien Aptel Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- fs/cifs/misc.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/fs/cifs/misc.c +++ b/fs/cifs/misc.c @@ -404,9 +404,17 @@ is_valid_oplock_break(char *buffer, stru (struct smb_com_transaction_change_notify_rsp *)buf; struct file_notify_information *pnotify; __u32 data_offset = 0; + size_t len = srv->total_read - sizeof(pSMBr->hdr.smb_buf_length); + if (get_bcc(buf) > sizeof(struct file_notify_information)) { data_offset = le32_to_cpu(pSMBr->DataOffset); + if (data_offset > + len - sizeof(struct file_notify_information)) { + cifs_dbg(FYI, "invalid data_offset %u\n", + data_offset); + return true; + } pnotify = (struct file_notify_information *) ((char *)&pSMBr->hdr.Protocol + data_offset); cifs_dbg(FYI, "dnotify on %s Action: 0x%x\n",