Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1582055pxb; Mon, 8 Mar 2021 00:47:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJxZIsY2GhqQZcW2F6cBWPENZ1OcCNSRKJGNYajB0g8wBcUKlie/e5zWSG/itIjKRKeWHmlS X-Received: by 2002:a17:907:2075:: with SMTP id qp21mr14353684ejb.451.1615193260550; Mon, 08 Mar 2021 00:47:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615193260; cv=none; d=google.com; s=arc-20160816; b=Ek2IcmngN17ap/Q0+wGkrU7xwxrALEbUtug8bjD3oQcL+5n6rd9K4KOFHKPq34YTrS WBIkEYTZU6jHxqo8Byl90Ka+JGJm9vU77hIHF3bSKwNouOUDuR8a6ZPi2NpCTva90YVD DjA6k9MoO6ygILs0H+ipiiKQt6FqPgE0XEWH8s/O27GOLzT3RWRnJk2wHFgMNeiE/Ltx uVfXsOt3Zz2lBWI6oaHKg1DUe9eDLJwvvSxPw36fGmdi4Ssu4HTlwij1uvuImBRKHOh9 qbGXEsYRARLwR7Wi8duyJssxTY/sW9NLi41OCbTG+YE5M9iymbnmCliV1w9CM1oVrbuU Wcug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=eVcmNkVaT4+KdJAwSWE3Uwhiy5rTlGCGMLR+CL1ud88=; b=KRh4rTxoZjzWHyZFINxLTf6vZEWv5km8i2qU3+EFhghwS4az7mDVajsaYZiQXv3uVi UhLNw1yaUPy+gozvDrNG1AJqvhZ2YkHwXS+3+CzBj+4KC6X7vQOdpwYOYyL3B598C+8y yeWA45j5Q8NxF215ZT3hPArfWOjM8mt/REz3Rd4W4a7goQ/Xz0rVR5BSIbEyq88UPOvL 6DW0EyrBX/95qj/mOOkmw8Qm5ZefS1zAH2o72NskDOGxaKx78o2UMM8uvaUrOrv2JQqn WiB3swdnguRReqhbOoJKQrRHyrtbh8I4Ho1R6rD/NVhKQWaPJ1BO8gVFXoPG4PAxsYni ahzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@datenfreihafen.org header.s=2021 header.b=YO6KWeUf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n12si6486579edo.340.2021.03.08.00.47.18; Mon, 08 Mar 2021 00:47:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@datenfreihafen.org header.s=2021 header.b=YO6KWeUf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231928AbhCHI2K (ORCPT + 99 others); Mon, 8 Mar 2021 03:28:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230466AbhCHI2D (ORCPT ); Mon, 8 Mar 2021 03:28:03 -0500 Received: from proxima.lasnet.de (proxima.lasnet.de [IPv6:2a01:4f8:121:31eb:3::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49082C06174A for ; Mon, 8 Mar 2021 00:28:03 -0800 (PST) Received: from [IPv6:2003:e9:d737:8f29:e49:1922:adb:7fb2] (p200300e9d7378f290e4919220adb7fb2.dip0.t-ipconnect.de [IPv6:2003:e9:d737:8f29:e49:1922:adb:7fb2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: stefan@datenfreihafen.org) by proxima.lasnet.de (Postfix) with ESMTPSA id 326F8C0CBC; Mon, 8 Mar 2021 09:27:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datenfreihafen.org; s=2021; t=1615192077; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eVcmNkVaT4+KdJAwSWE3Uwhiy5rTlGCGMLR+CL1ud88=; b=YO6KWeUf5VB09DvUatnqsZO7VE3lONLQOvrdoKxwFBeyVzN1RDwCdqIX041MYlYKpayszh 92QckaUlVVVykBU09/LEsElM5yNFXSUGiReviCofCztpB/9rnVx1hEjQzLX/lwqVsNalD9 gLs72ImrktrJtVjOd6KdaRedVbyuQixtP+h5XhJtRNmUGFYOhZ8BLDYjII07/OFdpV4C9q 1AL5cDOsDucQ1EEkQ+iLNY4wrsCJZLTN1c4TqyEP57ua17NjTScuU8UTx6GjXmoNNp8DrT kk/YI/eVM9US5WfxJa+LuPAIM0UCSwazXVaCvLqtlOpS/BvKMHdAIUV/vrmC/Q== Subject: Re: [PATCH v2] net: mac802154: Fix general protection fault To: Pavel Skripkin , alex.aring@gmail.com, davem@davemloft.net Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, syzbot+9ec037722d2603a9f52e@syzkaller.appspotmail.com References: <20210304152125.1052825-1-paskripkin@gmail.com> From: Stefan Schmidt Message-ID: <02c79193-808e-55b3-f2c9-9d7a0643aaee@datenfreihafen.org> Date: Mon, 8 Mar 2021 09:27:53 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20210304152125.1052825-1-paskripkin@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello. On 04.03.21 16:21, Pavel Skripkin wrote: > syzbot found general protection fault in crypto_destroy_tfm()[1]. > It was caused by wrong clean up loop in llsec_key_alloc(). > If one of the tfm array members is in IS_ERR() range it will > cause general protection fault in clean up function [1]. > > Call Trace: > crypto_free_aead include/crypto/aead.h:191 [inline] [1] > llsec_key_alloc net/mac802154/llsec.c:156 [inline] > mac802154_llsec_key_add+0x9e0/0xcc0 net/mac802154/llsec.c:249 > ieee802154_add_llsec_key+0x56/0x80 net/mac802154/cfg.c:338 > rdev_add_llsec_key net/ieee802154/rdev-ops.h:260 [inline] > nl802154_add_llsec_key+0x3d3/0x560 net/ieee802154/nl802154.c:1584 > genl_family_rcv_msg_doit+0x228/0x320 net/netlink/genetlink.c:739 > genl_family_rcv_msg net/netlink/genetlink.c:783 [inline] > genl_rcv_msg+0x328/0x580 net/netlink/genetlink.c:800 > netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2502 > genl_rcv+0x24/0x40 net/netlink/genetlink.c:811 > netlink_unicast_kernel net/netlink/af_netlink.c:1312 [inline] > netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1338 > netlink_sendmsg+0x856/0xd90 net/netlink/af_netlink.c:1927 > sock_sendmsg_nosec net/socket.c:654 [inline] > sock_sendmsg+0xcf/0x120 net/socket.c:674 > ____sys_sendmsg+0x6e8/0x810 net/socket.c:2350 > ___sys_sendmsg+0xf3/0x170 net/socket.c:2404 > __sys_sendmsg+0xe5/0x1b0 net/socket.c:2433 > do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 > entry_SYSCALL_64_after_hwframe+0x44/0xae > > Signed-off-by: Pavel Skripkin > Reported-by: syzbot+9ec037722d2603a9f52e@syzkaller.appspotmail.com > Change-Id: I29f7ac641a039096d63d1e6070bb32cb5a3beb07 > --- > net/mac802154/llsec.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/mac802154/llsec.c b/net/mac802154/llsec.c > index 585d33144c33..55550ead2ced 100644 > --- a/net/mac802154/llsec.c > +++ b/net/mac802154/llsec.c > @@ -152,7 +152,7 @@ llsec_key_alloc(const struct ieee802154_llsec_key *template) > crypto_free_sync_skcipher(key->tfm0); > err_tfm: > for (i = 0; i < ARRAY_SIZE(key->tfm); i++) > - if (key->tfm[i]) > + if (!IS_ERR_OR_NULL(key->tfm[i])) > crypto_free_aead(key->tfm[i]); > > kfree_sensitive(key); > Alex, are you happy with this patch now? I would like to get it applied. Waiting for your review or ack given you had comments on the first version. regards Stefan Schmidt