Message ID | 20240418200224.952785-10-mjt@tls.msk.ru |
---|---|
State | New |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:adf:e6ca:0:b0:346:15ad:a2a with SMTP id y10csp748826wrm; Thu, 18 Apr 2024 13:07:10 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXJtp+2vZF10HAieBsTo9Ebasy+4OELPsVTGN1NRef0QQ0UKSmcih8I7KzmK6GKHSB74BCeFLwbNoSW9xa4KQFk X-Google-Smtp-Source: AGHT+IHMIjakRpiCA3hCFTKTP4Jd5oKdxjA+XGATjEcX/BIgSvNeTTiwgwdLlTdFRphQ2yxhjHtK X-Received: by 2002:a05:6358:4b01:b0:186:249a:c8de with SMTP id kr1-20020a0563584b0100b00186249ac8demr358110rwc.5.1713470829884; Thu, 18 Apr 2024 13:07:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713470829; cv=none; d=google.com; s=arc-20160816; b=ybKyTzkT6ypS+m70wTt/TDR8KqbVp/5xH1JYjYz4G32jsAYRXk8U8RGqDHAEcWQ7RK DNCg12PrfVzRsBAKefAiReARARRzG3fXyRzlCFa74jbA6aECSvPJow3KSbAPE7K9ljM9 vB+EC3zgJdMrEzj4s64brM8JU2WtN+9j3Q9VNBoKhM1zHjHTZNpfMnNDotSl5rdPvqQe bIid6YYs6bkFm4Yh5LRQZohbspmQYEUNSydFpbO0LTAyZV8k+h+58FY+Jc7hlvQgT4ax C9DPkHJo5oOmijTsBYsdb7PiEYm3e4Cxu5XSVgD0QYsXAJWLNH7+j9ZseaIj0aP1at9I FUew== 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=Euw+OU7XLFwGu2EhJCZq7uqCAlPqlFFFHDIAVSBRPhU=; fh=tRhOdRo3RUGB1Op9NsKs6zZ1tjf3Fks3D9Jm5ySYJkw=; b=vxUS0TVjuCRuQ2gXdLaxL5PG4E5FqrnPmUlJ2WcWLbl5neBAql/zX+zYOzOlOstwb1 ZCnHnoYDv6zyXG2Zmh9Iuu3XQF/Jyw6eJjvossQuGCMC0OgSdubkINY6vBV1X6UclX8D Aq58dJEStdJ6nwUrIlPbK1dAnX3X6SNUZyDctw+b52rI20WxqvhpYWSJqe3GT8nMQlQl UcclIc0tT47uYQAjISCbMwqLwDL2PAARZAGyIBJPth0Gkuokahkw2Qgw85tQqRgkqDvW aHnvKP29PrLlhXXHqKpLEhJSCg8arbxe3/N5uvyyvx80wGWyKsT/lgo13IQWYT7Yr6IX AuiA==; 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 g4-20020a0562140ac400b006a04d4c2eebsi2232262qvi.569.2024.04.18.13.07.09 for <patch@linaro.org> (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Apr 2024 13:07:09 -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 1rxXyc-0001lr-Fr; Thu, 18 Apr 2024 16:03:22 -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 1rxXyA-0001ZU-W8; Thu, 18 Apr 2024 16:02:59 -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 1rxXy6-0005LH-Lm; Thu, 18 Apr 2024 16:02:54 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id DA62D5FE12; Thu, 18 Apr 2024 23:02:27 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 4303FB93F8; Thu, 18 Apr 2024 23:02:25 +0300 (MSK) Received: (nullmailer pid 952869 invoked by uid 1000); Thu, 18 Apr 2024 20:02:24 -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-7.2.11 51/59] hw/block/nand: Fix out-of-bound access in NAND block buffer Date: Thu, 18 Apr 2024 23:02:11 +0300 Message-Id: <20240418200224.952785-10-mjt@tls.msk.ru> X-Mailer: git-send-email 2.39.2 In-Reply-To: <qemu-stable-7.2.11-20240418230159@cover.tls.msk.ru> References: <qemu-stable-7.2.11-20240418230159@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 81b2bb804d..d994bfe372 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,