From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0324BC47089 for ; Mon, 5 Dec 2022 08:17:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231705AbiLEIRj (ORCPT ); Mon, 5 Dec 2022 03:17:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232009AbiLEIR3 (ORCPT ); Mon, 5 Dec 2022 03:17:29 -0500 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 229B215FEB for ; Mon, 5 Dec 2022 00:17:28 -0800 (PST) Received: by mail-lj1-x22f.google.com with SMTP id bn5so12652806ljb.2 for ; Mon, 05 Dec 2022 00:17:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=bf6Nbj5cxRxF5T9bn4Fy/raNIgAK309Q68fjLTBm7eI=; b=p5kQNYNHPNalXdM+733RBJdI9HKCqDM+hMORWwDeb5fyl1AvTEzc+Y3gEjY9kwh2zp uge52YfmoJfA7DYYyObmwDaaDMhiG2MYUhsaZ4MM7YGpsy05vxD/QNePpYTrXoR4mXwH upZXn0q3UHrz2P/zQsTky0fjB0pzud4kJiq4HB6HSFZJ9WDyMJPB/COY/33rCF5qbPsJ WPqz4miEWVYeU3IWoHXbk5K8baf99T/KLQIvuqe2+pFdb1kBFF1XETB6P8Mnln+8PyFr ddWwTZZBNQD4qnpD+GikamKbbuc8GK/sU+w4LU9fUQqjVwrMT9rNLNDDw3Jl+c69xdKp DRvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=bf6Nbj5cxRxF5T9bn4Fy/raNIgAK309Q68fjLTBm7eI=; b=anCyebc+f260YRvcnSsgXCS5SeHXQKIRZv39TQyYH6Mdy/9EDn4KWT+MSd7N5eVXnY XkcVk5V+GFLIE35kOwJkKON7s8UZ3vzoVpn+7H0r2klhQ3FJBHjP0qkn1R84XOsNvLNp C+bagtmGCwUl6mN1lqfcHYZIhRh00AC6fA6M1JcuZVBJ8a3EVjFHwZiV0S6L4w8QA0ud RSlocF0V2nvw4JBFk8oNQUkTWSdI7FDQ/O/Kb/WsPnqcw259GKtRBs65WvJTNty7Vtbu kxD/+KD/+eDptMpix0oXOxUu6NEuQVN8A3Gd0GwdhzoG1VMRpGy7KZt95b2WCadysww7 dyYA== X-Gm-Message-State: ANoB5pmAlWcSIALVDaIzjim4vz9NgthLzfDyrhMpPlaU+Q4SzeV0tUYw 88qi/i6F+0lwRmR1Rsse89XDyw== X-Google-Smtp-Source: AA0mqf5kKgi93Ya3eHrNU7WE2C68xMRTgktckuxGsCFsnTqA54QrDg9C+bwHtTwQXyWbIA+VbTq8Yw== X-Received: by 2002:a2e:b550:0:b0:27a:273:eb51 with SMTP id a16-20020a2eb550000000b0027a0273eb51mr672981ljn.485.1670228246336; Mon, 05 Dec 2022 00:17:26 -0800 (PST) Received: from [192.168.0.20] (088156142067.dynamic-2-waw-k-3-2-0.vectranet.pl. [88.156.142.67]) by smtp.gmail.com with ESMTPSA id a11-20020ac25e6b000000b0048a9e899693sm2057639lfr.16.2022.12.05.00.17.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 05 Dec 2022 00:17:25 -0800 (PST) Message-ID: Date: Mon, 5 Dec 2022 09:17:24 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 Subject: Re: [PATCH] NFC: nci: Bounds check struct nfc_target arrays Content-Language: en-US To: Kees Cook Cc: syzbot+210e196cef4711b65139@syzkaller.appspotmail.com, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, "John W. Linville" , Ilan Elias , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org References: <20221202214410.never.693-kees@kernel.org> From: Krzysztof Kozlowski In-Reply-To: <20221202214410.never.693-kees@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/12/2022 22:44, Kees Cook wrote: > While running under CONFIG_FORTIFY_SOURCE=y, syzkaller reported: > > memcpy: detected field-spanning write (size 129) of single field "target->sensf_res" at net/nfc/nci/ntf.c:260 (size 18) > > This appears to be a legitimate lack of bounds checking in > nci_add_new_protocol(). Add the missing checks. > > Reported-by: syzbot+210e196cef4711b65139@syzkaller.appspotmail.com > Link: https://lore.kernel.org/lkml/0000000000001c590f05ee7b3ff4@google.com > Fixes: 019c4fbaa790 ("NFC: Add NCI multiple targets support") > Cc: Krzysztof Kozlowski > Cc: "David S. Miller" > Cc: Eric Dumazet > Cc: Jakub Kicinski > Cc: Paolo Abeni > Cc: netdev@vger.kernel.org > Signed-off-by: Kees Cook > --- Reviewed-by: Krzysztof Kozlowski Best regards, Krzysztof