Message ID | 20240418174955.947730-16-mjt@tls.msk.ru |
---|---|
State | Superseded |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:adf:e6ca:0:b0:346:15ad:a2a with SMTP id y10csp695034wrm; Thu, 18 Apr 2024 10:51:42 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVz+UKZMIHuaMTjH4vX9qqh1jIb7vzxI44W62hmz9QlurxcDc16waO6bhVGg8jn6RRi98/794PrGAcSob+qnwbk X-Google-Smtp-Source: AGHT+IEVKFdjVNRZcH/8hAmZnXA5/VscvI5AQcDjJ3fLzPLc0LY7e990N+t6LH4070MVvVQh/ot8 X-Received: by 2002:a05:6102:3a07:b0:47a:22cd:bbb5 with SMTP id b7-20020a0561023a0700b0047a22cdbbb5mr4756651vsu.20.1713462702527; Thu, 18 Apr 2024 10:51:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713462702; cv=none; d=google.com; s=arc-20160816; b=VNPhD++IY9HXOlJIXLEfe/kJ2K8186SGKhGYLB1vdWshMc6aRWX2ta/9KuKYcbX7XW JthQnofL9/OiLWR6C7oY0Y3uhbN93EEFYUKmnbp7Lo99EKWjjoSPrJpre8sHVfeIAuH6 /0U7iCCFuoHuE0H2WY1xRgUVJtUpItWVqFs/zPMIV4dISX74F3rWXkXpN6SvRQCRgXt5 s238+EtSik/1km2d6FFCtKHosxWsMCenfQyTnD6D0TmUcv5vAkrIWtJx8t2toVZwYhf+ UisDQAPrt5w+8MxfZyG92R9PVgvBlEcnjJvh6M9z9y/Td7r8LietWwtlcRk20iFKL1o0 DNGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=Wtv9PfzdX+mJtarXXCTy5KlxRZBFpD+9QIlA4zdQOHw=; fh=tRhOdRo3RUGB1Op9NsKs6zZ1tjf3Fks3D9Jm5ySYJkw=; b=m0C4UM58EjILIgQv83zyqapoVR2j0EQO7T3/pARtHU2A1frsOv8IyNcHRrboxG8PGV LrnVv2J3kR/2OzTNn/UGt3YkAlmFvLRYIPIcF3jaCrkUBMgtkeEmpOhX0/b+5J26Qdua g/QQYn86sWz2cT8k0QdSAA9vz1sokDHYdM1TRtx6HJN7ghnDuWqCeL/Z0zshacT7xHXM rDT4IkpYTCEhOh6p0YTDNYizuUycS8wgMY+EmJRBO87Upd6Ey6wnNTr75ASRh1wjUp5P dwDljPDO0QCGJITnud62J84tFMdmRy5Og1jh26kHVfjzDJDsb9AeVl7s1gn0piO9n5W1 PBdg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: <qemu-devel-bounces+patch=linaro.org@nongnu.org> Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h11-20020a0562140dab00b006a03fe210c8si1998869qvh.206.2024.04.18.10.51.42 for <patch@linaro.org> (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Apr 2024 10:51:42 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <qemu-devel-bounces@nongnu.org>) id 1rxVum-0001SC-A4; Thu, 18 Apr 2024 13:51:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <mjt@tls.msk.ru>) id 1rxVuh-0001Jo-NO; Thu, 18 Apr 2024 13:51:12 -0400 Received: from isrv.corpit.ru ([86.62.121.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <mjt@tls.msk.ru>) id 1rxVuf-0007bL-MQ; Thu, 18 Apr 2024 13:51:11 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 437235FD70; Thu, 18 Apr 2024 20:50:03 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 8A276B934A; Thu, 18 Apr 2024 20:50:00 +0300 (MSK) Received: (nullmailer pid 947851 invoked by uid 1000); Thu, 18 Apr 2024 17:49:55 -0000 From: Michael Tokarev <mjt@tls.msk.ru> To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>, Qiang Liu <cyruscyliu@gmail.com>, Richard Henderson <richard.henderson@linaro.org>, Kevin Wolf <kwolf@redhat.com>, Michael Tokarev <mjt@tls.msk.ru> Subject: [Stable-8.2.3 103/116] hw/block/nand: Fix out-of-bound access in NAND block buffer Date: Thu, 18 Apr 2024 20:49:33 +0300 Message-Id: <20240418174955.947730-16-mjt@tls.msk.ru> X-Mailer: git-send-email 2.39.2 In-Reply-To: <qemu-stable-8.2.3-20240418204921@cover.tls.msk.ru> References: <qemu-stable-8.2.3-20240418204921@cover.tls.msk.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=86.62.121.231; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org |
Series |
None
|
expand
|
diff --git a/hw/block/nand.c b/hw/block/nand.c index d945c0b9e3..902cc56a03 100644 --- a/hw/block/nand.c +++ b/hw/block/nand.c @@ -255,7 +255,9 @@ static unsigned nand_load_block(NANDFlashState *s, unsigned offset) { unsigned iolen; - s->blk_load(s, s->addr, offset); + if (!s->blk_load(s, s->addr, offset)) { + return 0; + } iolen = (1 << s->page_shift); if (s->gnd) { @@ -783,6 +785,10 @@ static bool glue(nand_blk_load_, NAND_PAGE_SIZE)(NANDFlashState *s, return false; } + if (offset > NAND_PAGE_SIZE + OOB_SIZE) { + return false; + } + if (s->blk) { if (s->mem_oob) { if (blk_pread(s->blk, SECTOR(addr) << BDRV_SECTOR_BITS,