Message ID | 20240410091315.57241-9-philmd@linaro.org |
---|---|
State | Accepted |
Commit | d39fdfff348fdf00173b7a58e935328a64db7d28 |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:adf:fdd2:0:b0:346:15ad:a2a with SMTP id i18csp598874wrs; Wed, 10 Apr 2024 02:17:59 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV163tKRXlxzpBvrAgy+TfmK/8N5UlxrPAn1cQG4BspSkciO/VaP0VpKwIr4aSHK6cfEmFzNAxURMrdXJjFA+7R X-Google-Smtp-Source: AGHT+IFN9aN35oULI/NSiPrRpvRwIl+m4dQ4odtLqFSQTQgIwFNiwl0pu3gagqiw0Fbhe2GwU8x5 X-Received: by 2002:ad4:5ecd:0:b0:69b:901:b068 with SMTP id jm13-20020ad45ecd000000b0069b0901b068mr2117683qvb.8.1712740679405; Wed, 10 Apr 2024 02:17:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712740679; cv=none; d=google.com; s=arc-20160816; b=S0iT7eO9mTAYwZPInTolqMykRH4/UJLRPBQ9kERJ3Drbs4JiH7Y4C4fjp14ojsqhss yk7dBpvwdCFslQog22dm8qSbNFZGXZSSYJTvAzq6Rj+dRAEhWMMXO5xD2FFr4lAnS1Kh b7faV+APgtnik7AOFbbCayjDrH4CGahrzuk+JsL8QJuo4R2wYDW+Sb3YRQCNMlJv7K7N pCh8GAWiHJLJY+9QC8J82rzcqovuiPl1LgHvHhNZ/21vQb3zN48h0BAYJGasKB3AivVv QBVsjTpk+Hgl8e/x3o9Tc+Qjyf86QvK8BnCaM+OenGz0p85FmTOOCkVk39Z9y6pcGjX9 ktZQ== 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:dkim-signature; bh=qxZBIWm4tgxEEXfwbtjrHn2I7XDplBRXPRN1tLGRLQA=; fh=rbuy61gmDFlYuX5HtFk9k6CvjR/0CPitgMV5U9jtUZs=; b=CHutIRcQMPaHC7pZ3r6pbUEbl7UL+CKr6vH9GNIfgWMGTzp+YMTMdSypt/vGcE/AvV 3VhF70Zhiz2ylUkbgp+o8d8+6AXfYLLT+HrCbfwKwxGl9USRmkTVtbETfZx3NwM+C3sS RKug+NQj1RgyJE++EGGJ9lpyA2gXVJMnQH97IAoF0ST9rANTYCqJzA3Y98PpYd8M69DD moPpiD2OZ2iqM/3Zij5TEWuQnNVSZWJhiKN5+hE1qX+zoczYWAi+XWT8oxTabtA+8nw1 6ha0AgARyDoRFzHlKeneMRFWUEIzVcJCKsUTdm+UtTASL/idMIAPU9/14mOLt+zrlgKp krJw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OlHQvv2i; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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 i7-20020ad44ba7000000b0069b40c7f96fsi236243qvw.310.2024.04.10.02.17.59 for <patch@linaro.org> (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Apr 2024 02:17:59 -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; dkim=pass header.i=@linaro.org header.s=google header.b=OlHQvv2i; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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 1ruU23-0005xu-2h; Wed, 10 Apr 2024 05:14:15 -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 <philmd@linaro.org>) id 1ruU21-0005x4-Ci for qemu-devel@nongnu.org; Wed, 10 Apr 2024 05:14:13 -0400 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <philmd@linaro.org>) id 1ruU1y-0005b4-GH for qemu-devel@nongnu.org; Wed, 10 Apr 2024 05:14:13 -0400 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-a4644bde1d4so883637666b.3 for <qemu-devel@nongnu.org>; Wed, 10 Apr 2024 02:14:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712740448; x=1713345248; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qxZBIWm4tgxEEXfwbtjrHn2I7XDplBRXPRN1tLGRLQA=; b=OlHQvv2iRL1kMwJPjfJ9lp1SyKf5m9/yk6nqLdQrJVQ2j6mn3rmd/1dOK6ds3NHnjM EbjJohb598s3SI7mvKbmgXN4gMcBmqkj36xKOr9+npNBNhGVjSkm9eRmyjSgERLrvdpo XajwAb+UoGXJwCtqoW/yLfcHmwENjjlTPXC0HCv+u1zrVMR3v/zfVXUu2w41bbilTw9R 2QqIEpBb06NJV/oPJxHDKQt21zssNfk1jw8YVmYHrO9VeH1h29QVARhAxJvXMPSxbk1K x9ASERYFKU93MM6JYvXnc6mxDkNwR2y6+zmNEG1Br6TRL3LUAbznlEwANqyS3zPOCQm2 J+xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712740448; x=1713345248; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qxZBIWm4tgxEEXfwbtjrHn2I7XDplBRXPRN1tLGRLQA=; b=JnMKwMoGXL9d0pkOycKE1yo5Wb4xRbZsZR834Cumhfa/wdYx/++gn80ZJMfMSHtcbT xTavoMIjAeppy/7DJrgx3ScP1jlM+kWrK4Xs/qYYw38ukJyx/IgCqrk8OI+nW0R3SnwZ iYCOtVfz1/X1WYssg2DUjLuwOtSm4bEiOjB9aNA7xBWk+BB+z4nR2MLIBzL+UMGE4j// +Ig3g4XTHHs1aT+D6b/ZhbvtiiG5n2DGKARFbEHzgJu7+pkcHG8ahRJhZcej9BEfhAR9 fvPIcDV98Cc+b2HDgBnVzXDMpz5o88i+fhnGV37ta4y4JDVxhGSgBu7uJ4cp3k1BYQxT tgkQ== X-Gm-Message-State: AOJu0YyKEbhm72uq0m4p5W2/TwkzTyRC4cDchDfPoIyeV1JZLQmStQl5 fIaJcpRDp5O/CUZABrgMWwhYdTonqpVX7A7kbDzFB5dCTKO8KJKjiko6FgDLh8/xbeHy2yWbmy6 S X-Received: by 2002:a17:907:7208:b0:a4a:aaa9:8b3b with SMTP id dr8-20020a170907720800b00a4aaaa98b3bmr1295738ejc.77.1712740448595; Wed, 10 Apr 2024 02:14:08 -0700 (PDT) Received: from m1x-phil.lan (arl95-h02-176-184-34-173.dsl.sta.abo.bbox.fr. [176.184.34.173]) by smtp.gmail.com with ESMTPSA id me6-20020a170906aec600b00a51ef986051sm2016438ejb.57.2024.04.10.02.14.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 10 Apr 2024 02:14:08 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>, qemu-stable@nongnu.org, Qiang Liu <cyruscyliu@gmail.com>, Richard Henderson <richard.henderson@linaro.org>, Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>, qemu-block@nongnu.org Subject: [PULL 08/16] hw/block/nand: Fix out-of-bound access in NAND block buffer Date: Wed, 10 Apr 2024 11:13:07 +0200 Message-ID: <20240410091315.57241-9-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240410091315.57241-1-philmd@linaro.org> References: <20240410091315.57241-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::62f; envelope-from=philmd@linaro.org; helo=mail-ej1-x62f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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 |
[PULL,01/16] hw/virtio: Introduce virtio_bh_new_guarded() helper
|
expand
|
diff --git a/hw/block/nand.c b/hw/block/nand.c index 5a31d78b6b..e2433c25bd 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,