Message ID | 1539973243-12774-1-git-send-email-wang6495@umn.edu (mailing list archive) |
---|---|
State | Deferred |
Headers | show
Return-Path: <linux-scsi-owner@kernel.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8F1A8112B for <patchwork-linux-scsi@patchwork.kernel.org>; Fri, 19 Oct 2018 18:20:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7BB6C27F86 for <patchwork-linux-scsi@patchwork.kernel.org>; Fri, 19 Oct 2018 18:20:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6CCCF28420; Fri, 19 Oct 2018 18:20:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1649227F86 for <patchwork-linux-scsi@patchwork.kernel.org>; Fri, 19 Oct 2018 18:20:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727509AbeJTC2K (ORCPT <rfc822;patchwork-linux-scsi@patchwork.kernel.org>); Fri, 19 Oct 2018 22:28:10 -0400 Received: from mta-p8.oit.umn.edu ([134.84.196.208]:35214 "EHLO mta-p8.oit.umn.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727160AbeJTC2J (ORCPT <rfc822;linux-scsi@vger.kernel.org>); Fri, 19 Oct 2018 22:28:09 -0400 Received: from localhost (unknown [127.0.0.1]) by mta-p8.oit.umn.edu (Postfix) with ESMTP id 24022BC8 for <linux-scsi@vger.kernel.org>; Fri, 19 Oct 2018 18:20:57 +0000 (UTC) X-Virus-Scanned: amavisd-new at umn.edu Received: from mta-p8.oit.umn.edu ([127.0.0.1]) by localhost (mta-p8.oit.umn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7be_i2mvDqkQ for <linux-scsi@vger.kernel.org>; Fri, 19 Oct 2018 13:20:57 -0500 (CDT) Received: from mail-it1-f199.google.com (mail-it1-f199.google.com [209.85.166.199]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mta-p8.oit.umn.edu (Postfix) with ESMTPS id EA3B4BC0 for <linux-scsi@vger.kernel.org>; Fri, 19 Oct 2018 13:20:56 -0500 (CDT) Received: by mail-it1-f199.google.com with SMTP id h20-v6so4405728ita.0 for <linux-scsi@vger.kernel.org>; Fri, 19 Oct 2018 11:20:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umn.edu; s=google; h=from:to:cc:subject:date:message-id; bh=WXSvFJIXT+uGScquomKG8+xbpaigI0Fwr+jtoZB7FIo=; b=WIUd9J/BRO1f0nImqtfl6QES0CSpz/RsphMT4yQXzeeG7nakEB0CnKj08YSgHyjRlZ OQU+DAjYBCYBQqJz+MvkmV49i2LmOdshGbLIYDbwDgRlUB1kriZiHVkFPHOzT7rlOir+ gwpSdsJNwUQRCu758JgbNwQLl9xKbUM30a7GgvL5VAE8cscRKZrfVka5DX/E1MyZuLuG iR/00o8TAjlsOcMdQud1zNMfxQUGxKVQygB+85Gr9gyFLFumCE49COGIelHcYIQw/M50 nQCR+Nh4FYFfUNAbS0GxM+/Y+b2thYRC3SUSEBsQMF1rOubRQ6RskYUH4F8Ab5+O+YfL uJHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=WXSvFJIXT+uGScquomKG8+xbpaigI0Fwr+jtoZB7FIo=; b=p80oeGjj9PTk1qIUX6tMoeCsiCWMFpCbwEvfQu/5ck2Pj7DHXziR8QDxQC8wk5cemU b9YGFLlZ1enr7CVK9MWFBQX04MmOOFuxJL23Olf/kFWGgun/jGYxh4Uyqlt6een8GDuH 5J/s/IYVEHzbVb5POI++SnTKVHAO/qhuhaDG6Ihr57GZW2TdUfZ0WsugtJN8kFh1Z/wv qeP6gqK81/tMLccMdfMghysa/yGo4DejRQfpAsGyemdzEPF92n75Hjz5IUHZLhnMC0Uw 00uPxc/tH0pxwyQ32xdsVtxPnh4qzkqkRbvGuYH5wCUTCRllW+H+Yzkb6dTSvURtQBq5 keig== X-Gm-Message-State: AGRZ1gKmoxOQPVt9PuKDZOGRk2tQ1LrbmZc1G8uZpA6Qa7FqHZ9LixVo xpB9rfwk1D7Zg19nhu4CuDEEYk1bZsC0J6+qZctVsY+Y2+of0jt/ovHeXX16QUDMh1Krli15YxT sPw6TqegAlqAfZ014yVZoqN+0YQ== X-Received: by 2002:a6b:b383:: with SMTP id c125-v6mr3616419iof.267.1539973256632; Fri, 19 Oct 2018 11:20:56 -0700 (PDT) X-Google-Smtp-Source: AJdET5fMuchsU2ck5rSP3eoTTWZQ8mAJNSB9irL2CKISGdoQ3hWOi28EgyNlaqCc3Xg5R30CJ21i/Q== X-Received: by 2002:a6b:b383:: with SMTP id c125-v6mr3616414iof.267.1539973256458; Fri, 19 Oct 2018 11:20:56 -0700 (PDT) Received: from cs-u-cslp16.cs.umn.edu (cs-u-cslp16.cs.umn.edu. [134.84.121.95]) by smtp.gmail.com with ESMTPSA id q123-v6sm9073277iod.23.2018.10.19.11.20.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 19 Oct 2018 11:20:55 -0700 (PDT) From: Wenwen Wang <wang6495@umn.edu> To: Wenwen Wang <wang6495@umn.edu> Cc: Kangjie Lu <kjlu@umn.edu>, Intel SCU Linux support <intel-linux-scu@intel.com>, Artur Paszkiewicz <artur.paszkiewicz@intel.com>, "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>, "Martin K. Petersen" <martin.petersen@oracle.com>, linux-scsi@vger.kernel.org (open list:INTEL C600 SERIES SAS CONTROLLER DRIVER), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] scsi: isci: Fix a missing-check bug Date: Fri, 19 Oct 2018 13:20:43 -0500 Message-Id: <1539973243-12774-1-git-send-email-wang6495@umn.edu> X-Mailer: git-send-email 2.7.4 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: <linux-scsi.vger.kernel.org> X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP |
Series |
scsi: isci: Fix a missing-check bug
|
expand
|
diff --git a/drivers/scsi/isci/probe_roms.c b/drivers/scsi/isci/probe_roms.c index a2bbe46..bff54f2 100644 --- a/drivers/scsi/isci/probe_roms.c +++ b/drivers/scsi/isci/probe_roms.c @@ -68,6 +68,7 @@ struct isci_orom *isci_request_oprom(struct pci_dev *pdev) size_t copy_len; memcpy_fromio(&oem_hdr, oprom + i, sizeof(oem_hdr)); + memcpy(&oem_hdr.sig, oem_sig, ISCI_OEM_SIG_SIZE); copy_len = min(oem_hdr.len - sizeof(oem_hdr), sizeof(*rom));
In isci_request_oprom(), a for loop is used to find the OEM table by scanning the signature, which has four bytes. In each iteration, the signature is copied from the IO memory region 'oprom + i' to 'oem_sig' through memcpy_fromio(). Then 'oem_sig' is checked to see whether it is ISCI_OEM_SIG. If yes, the OEM table is found. Next, the header of the rom, including the signature, is then copied to 'oem_hdr' through memcpy_fromio(). It is obvious that the signature is copied twice here. Given that the device also has the permission to access the IO memory region, it is possible that a malicious device controlled by an attacker can modify the signature between these two copies. By doing so, the attacker can supply unexpected signatures, which can cause undefined behavior of the kernel and introduce potential security risk. This patch rewrites the signature after the second copy, using the value obtained in the first copy, and thus avoids the above issue. Signed-off-by: Wenwen Wang <wang6495@umn.edu> --- drivers/scsi/isci/probe_roms.c | 1 + 1 file changed, 1 insertion(+)