Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp1504762lqt; Wed, 20 Mar 2024 06:13:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXyBZzh6ZKDCGmIPvALdQ3L2DdpgwRTVSOTIRGyETCKNx9b0B44tu7KBWembmHs38n4/adoXJY9y5JKzNP0IMSFFoErabpcumFum/IiqQ== X-Google-Smtp-Source: AGHT+IFsYqxhEHorzrGeZUxgMwBgPz3dKaux2mRUyx8IQ6QUX/V/U9PEoVqPnWDoliWfGZG7VjL2 X-Received: by 2002:a05:6a20:b228:b0:1a3:6ed5:dbe with SMTP id eh40-20020a056a20b22800b001a36ed50dbemr5258480pzb.10.1710940415567; Wed, 20 Mar 2024 06:13:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710940415; cv=pass; d=google.com; s=arc-20160816; b=Dl2yuBBsylegq7bCZnYxBwrNT8yDMHXd3EQMOy+946Ckjco9Eg4qeiNE8S73eYqmpJ 463UStq3KgbWtMr75F7LLKftLMuVwGA5MAkJt4n99Ewk2bO3DEpv+DQ+9tcIfYAi7i+o OvsV0ZW7J3ApVe1l9TwC5A+V4AGRIA7bVwiaDDTxy0TRRu0NSm6sD2Z7BciBcurM3HSx PWLGP+AtdJpWbgGFnJYrLlsMWlikEKuo8JYc2UJlojlxIWpbfmHhCEssqdO+UnrdqOCD rzMFCmbpzZiphx8a6ZwNthURS7QpjU3Gdx04DysnmQK3keNp3/2d5XlOgE3TRdJbQtkr P1Uw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=uVomIyPH9mjZgwPoEk9ARj2Eibh5eoevRCgdrcw3zEs=; fh=rcw/plFzy8c1g6Fq58Qm8Tsmm8dSMbVEGvIIz6eviu4=; b=vtSIYPv+iZOcMed9DP1vqNF5uWgXibwidOWwOfMo7VCUBpfzbPBHqp8fUl9AEANut7 PEt6CW1Osz6KSjSDz8J9u0tnx6UI6jcFqZTvf+Kh240p1e5kv3x/HjAloqEbmEPxWZUG +8/xahsIaF6r+rJQl8z+eWlMLLlcHtKJbxmrgk/KIJDlXeGGGtHrhNytIj6z26n4Tp4R 3AJQk2S4uaR+KpRbJQ/sas8DNv737GenSQVtGMxxE8dNgV5+m5jq0jYs4g7gmeaSe8J7 q37/P51fadfblgIzrqZvAvhtZ/TuPuZOYk+DD9erGJcrmjvemVVZrOOBa9xsxZ8znXFg CHGQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@resnulli-us.20230601.gappssmtp.com header.s=20230601 header.b=RH6tDIoq; arc=pass (i=1 dkim=pass dkdomain=resnulli-us.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-108929-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108929-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id t185-20020a6281c2000000b006e6b7630052si13370147pfd.280.2024.03.20.06.13.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 06:13:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-108929-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@resnulli-us.20230601.gappssmtp.com header.s=20230601 header.b=RH6tDIoq; arc=pass (i=1 dkim=pass dkdomain=resnulli-us.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-108929-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108929-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 37716282FF9 for ; Wed, 20 Mar 2024 13:13:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0D96947F4D; Wed, 20 Mar 2024 13:13:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=resnulli-us.20230601.gappssmtp.com header.i=@resnulli-us.20230601.gappssmtp.com header.b="RH6tDIoq" Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E0265446DD for ; Wed, 20 Mar 2024 13:13:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710940388; cv=none; b=mMUq3fbsPxpOywc3J+2trEsPjsPuuxKtFi/mEvGbxA8rI0lf/uyG4UzdcICQoNcZwBbb9W0Tgoxl5VJCupQWiB2XRDkRRG4bbtF4y/0iccMMPbrm3PjeB0nqZrNWubFkZO4Bj3yMzXUUW0nVKJJ9SaAGlq1xnlTdDbvhRUl1pbc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710940388; c=relaxed/simple; bh=2YDNxT0fhZocPvNupmzUSE6JHPXKV+e0KiJYW7C14PE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=u9RoWSHeZ3REM02CxWu6Dqftcf9UK4YvYt7kWTdVN/JzlmQ/Zq+XZ1ms+S+RxQkiGb8nfMj+TZv32pcXiISklzggkkf495A51dYedmp5WjgdlQrMHsw/nuaZZFBkgkQBzTmFFF2WhHo4kE/k/oGTDOuk0Af/j9qYvMuyr2wjP+k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=resnulli.us; spf=none smtp.mailfrom=resnulli.us; dkim=pass (2048-bit key) header.d=resnulli-us.20230601.gappssmtp.com header.i=@resnulli-us.20230601.gappssmtp.com header.b=RH6tDIoq; arc=none smtp.client-ip=209.85.221.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=resnulli.us Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=resnulli.us Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-33ecb04e018so3754649f8f.1 for ; Wed, 20 Mar 2024 06:13:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20230601.gappssmtp.com; s=20230601; t=1710940384; x=1711545184; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=uVomIyPH9mjZgwPoEk9ARj2Eibh5eoevRCgdrcw3zEs=; b=RH6tDIoqFk2GlSkPb4LZxoH5sjs5R0xVeBhqL2B7okGgmo8bUeAYJ532yYqZcfHyGJ sNMuIXV3Y0j4OidmhzynnEHLXMKIPu0hslFgbZrRoYViHy3bKYY6cSzcKjeg02hYj3S5 Bl50X69E1uDoJT1WDyHPfHcI/KxQHj8CQJ/6QCxnTzbbOJvRAhFbp2cdzNm64M3c84yZ 1ZVaBsbg4x5lQlt2kEZfhCc04wOT4NCRXHuQZX7neaC6R1D62D7s4oRA0wm2sM5KD5Rp nPDCakKzK/t8u9C8kS0N48vrbUdReJtsSS3cBCid5UC9EdKF2ZIdIVdIqmjsYZUurHlz P8dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710940384; x=1711545184; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=uVomIyPH9mjZgwPoEk9ARj2Eibh5eoevRCgdrcw3zEs=; b=aeYzUCUCM7rScEA3HFyw9ICkrb4tb1GbVBDQ1Dm74X1nrKmp7be/yiCR+ZV+ZjsSWw qfwkSSI7haFeDzHFrCR9rB9DoIfxIg04JcWL5xZoT6+s6zUe4mRmP/18C5aiybCfqEqZ eOTYUuoxaDTiyA+/X5zA+5p93eYy5ZDfHSIHNaVp6XNBKenFVrp9TjHbHyIXjO1spxWn CNU8bpmxHq5NdcB0XrIG9QKm0jj9s7fScBGijQEveuWUDsVzCLpmgjEWM790ozekPU4W PtuMAnGgapa/EuhqZiiDjRSwVSR9lKH13q5ZSP7Kje+0W6lb8ueFVCKUPBfgFkNljEq4 33Qw== X-Forwarded-Encrypted: i=1; AJvYcCUVXg6yZNXQmBnKFxkJZiNSdtl1s/9g/ouYSBx5LqzsnaiWMN2YFA2hoNUGHkBkTBZcjS2Et+K3MJet6FLeybHhnBwzHhROiagMeqj7 X-Gm-Message-State: AOJu0YyDsklME7KOJSqZiFaZojqa8y17cHBNEXvNdYoZ2zFZJ+7e4bId rd/h5a9Cz3QSdeY65Wyi6xPAG5/Avs81L08Q8f9Ex4cbtKudJjk6pQYEoXm30Uo= X-Received: by 2002:a5d:4747:0:b0:33e:7f65:e4f4 with SMTP id o7-20020a5d4747000000b0033e7f65e4f4mr12573236wrs.56.1710940384083; Wed, 20 Mar 2024 06:13:04 -0700 (PDT) Received: from localhost ([86.61.181.4]) by smtp.gmail.com with ESMTPSA id o23-20020a5d58d7000000b0033ec5ca5665sm14657545wrf.95.2024.03.20.06.13.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 06:13:03 -0700 (PDT) Date: Wed, 20 Mar 2024 14:13:02 +0100 From: Jiri Pirko To: Ryosuke Yasuoka Cc: krzysztof.kozlowski@linaro.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, jeremy@jcline.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, syoshida@redhat.com, syzbot+7ea9413ea6749baf5574@syzkaller.appspotmail.com, syzbot+29b5ca705d2e0f4a44d2@syzkaller.appspotmail.com Subject: Re: [PATCH net v2] nfc: nci: Fix uninit-value in nci_dev_up and nci_ntf_packet Message-ID: References: <20240320005412.905060-1-ryasuoka@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240320005412.905060-1-ryasuoka@redhat.com> Wed, Mar 20, 2024 at 01:54:10AM CET, ryasuoka@redhat.com wrote: >syzbot reported the following uninit-value access issue [1][2]: > >nci_rx_work() parses and processes received packet. When the payload >length is zero, each message type handler reads uninitialized payload >and KMSAN detects this issue. The receipt of a packet with a zero-size >payload is considered unexpected, and therefore, such packets should be >silently discarded. > >This patch resolved this issue by checking payload size before calling >each message type handler codes. Nit. Instead of talking about "this patch" in this patch description, you should use imperative mood to tell the codebase what to do. https://www.kernel.org/doc/html/v6.6/process/submitting-patches.html#describe-your-changes Patch looks ok. > >Fixes: 6a2968aaf50c ("NFC: basic NCI protocol implementation") >Reported-and-tested-by: syzbot+7ea9413ea6749baf5574@syzkaller.appspotmail.com >Reported-and-tested-by: syzbot+29b5ca705d2e0f4a44d2@syzkaller.appspotmail.com >Closes: https://syzkaller.appspot.com/bug?extid=7ea9413ea6749baf5574 [1] >Closes: https://syzkaller.appspot.com/bug?extid=29b5ca705d2e0f4a44d2 [2] >Signed-off-by: Ryosuke Yasuoka >--- > >v2 >- Fix typo in commit message >- Remove Call Trace from commit message that syzbot reported. Make it > shorter than the previous version. >- Check the payload length in earlier code path. And it can address > another reported syzbot bug too. [2] > >v1 >https://lore.kernel.org/all/20240312145658.417288-1-ryasuoka@redhat.com/ > > > net/nfc/nci/core.c | 5 +++++ > 1 file changed, 5 insertions(+) > >diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c >index 6c9592d05120..f471fc54c6a1 100644 >--- a/net/nfc/nci/core.c >+++ b/net/nfc/nci/core.c >@@ -1512,6 +1512,11 @@ static void nci_rx_work(struct work_struct *work) > nfc_send_to_raw_sock(ndev->nfc_dev, skb, > RAW_PAYLOAD_NCI, NFC_DIRECTION_RX); > >+ if (!nci_plen(skb->data)) { >+ kfree_skb(skb); >+ break; >+ } >+ > /* Process frame */ > switch (nci_mt(skb->data)) { > case NCI_MT_RSP_PKT: >-- >2.44.0 > >