Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp5684477pxv; Wed, 7 Jul 2021 09:21:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0sv2CupHyg8VIX5wF3vHIWQAUkmS8I5BSQVAV6j/3lqqOHmPq+OBjfsm0cJ7jMkRBaEFT X-Received: by 2002:a05:6402:220a:: with SMTP id cq10mr24704979edb.85.1625674917414; Wed, 07 Jul 2021 09:21:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625674917; cv=none; d=google.com; s=arc-20160816; b=b03hopolr7reSOGv/QNHn1aFrjdN80pcjvsIo6fR5tcLpWpVY7zHQBxo7k9Iti3RSd RCnEKGY2Pvf4dSdkgU1AKVuYnzuPMb12pSFaqEWTiFcDCQNySzJlmYWlqXRpayCKJQsP 0oUW4fjFj7wnpd25YrENe/Icti3Vk9fEZFJ8OIAFrVBtotCXr1BXfwKXaC7ZmpnzqCIK VSkIlSUKIdW/bqbSaXalZKvi9EUBDmtb85T2heDpr3eEvTia9wresCyr768YDtfcAN+c ibYZ31wcJMWa/lBzI8dV2LprOdfVePHe9zwUU6DPcBRft0SSNvTMK2jdoTxzszAIeUw7 +Zeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=LPc2qNU/VIe5sZOEkhG3d0C8qdMRokFxLpvqhr2pZtU=; b=OZvTZyYiQnxGH7P6EHYamwsDuhcD1q9UOht90/jamq2CZwMRl4IscpXtyT2P5d+JkS gtcpWS9Nr2gr22K/iTVHxoVDPxRWPoWm4bqnX2VliBiKpektjXziMbpLJf0VNFrCWZHr M+pQTGMT9GbRciv3rWM+72diu4s+o+bYGVI+gUK4nviFrBLAccdZ15VVLC023Z7povKW eSb77BrzHuQ8GuJfjbEESuk1N+oJIlcpsg3C7On+LW4wMSk6bKqVLuNwHu6QDJ80DNcN bTtrD/IYowRHHwwjcKPl7jbfhBdGc263lEBeKQ4YyGlis2uY4HPiPdnMZBXuuo8G6YtR 1GSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=H1N73JjW; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k4si18445904eje.406.2021.07.07.09.21.33; Wed, 07 Jul 2021 09:21:57 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=H1N73JjW; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231994AbhGGQOB (ORCPT + 99 others); Wed, 7 Jul 2021 12:14:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231533AbhGGQOA (ORCPT ); Wed, 7 Jul 2021 12:14:00 -0400 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9FC7C061574; Wed, 7 Jul 2021 09:11:18 -0700 (PDT) Received: by mail-ej1-x635.google.com with SMTP id c17so4082123ejk.13; Wed, 07 Jul 2021 09:11:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=LPc2qNU/VIe5sZOEkhG3d0C8qdMRokFxLpvqhr2pZtU=; b=H1N73JjW9Wqpazm4xdkwx1BGX8HrKTHOaWZ6kdDFgns8Uqx2EpKOjJ+1Y2/mPE72GQ RlH3p8g2CVkEow1MFOnJRt1+br9f7QX8VS+wNY08FXwHqICqn7hfuBvPeI4sKxwbnzXl 4P5v/9ECBGNfXD4BgbAEHbt4EDrx/An7Xy4u50EZj4my2BQr6SOREwfGAdAVRh5QZ6lU DMt0WFIB8c5rJvbwSJtRattI+J18iyqv9vBtuLS3eQp7WTaB1HE+O+eYPNQ7eD8Izg2i FLVdXXFyI2QEmKDGSezXUN/wdGtwk8InoBJa9k06sYA5UPLftMR7Jmg5w6TpG1JY7R8x RkoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LPc2qNU/VIe5sZOEkhG3d0C8qdMRokFxLpvqhr2pZtU=; b=CDE7r4Y3A76J7lVaa2pCeC9mns780G7oQHn9D7iOKwqfnJ5+dt+3kMDX5hEof44Bmn AUAfYC3LIBiFXM6HUf7rtaQ7VxFPohqrMXZkwk8x6HWZfCbbojLghGXJoBzyUoZaGigd RCcOHenW02wYSNwCKaZPwI0c/7vUbk++sUY4PXfO7681xFgUnWnkzpvsaLkt1uC5icAp 6Zj+ZXVJWGegie2Lp8pQ4K7UDQ1EDDaWKOkZ1Kc6zzI/YBytginviMoWGGVNevmvRrOC O0ID7rIRXcBx9UC7ZzgOKJg9a2np106lBWOi9jWUWu5YTqTwoVhUoW57akCFgmHltLGR PYAQ== X-Gm-Message-State: AOAM531QGr0hHAwkB63P0+hQgy4KEG2pcN3GJEc51MfNQDU4d/Z0TsEz DmLIA3wRrS1oLlkHg8pYVe/dpHdQrJrqL/gLwSo= X-Received: by 2002:a17:906:4784:: with SMTP id cw4mr9069964ejc.160.1625674277560; Wed, 07 Jul 2021 09:11:17 -0700 (PDT) MIME-Version: 1.0 References: <20210707155633.1486603-1-mudongliangabcd@gmail.com> In-Reply-To: <20210707155633.1486603-1-mudongliangabcd@gmail.com> From: Dongliang Mu Date: Thu, 8 Jul 2021 00:10:51 +0800 Message-ID: Subject: Re: [PATCH] ieee802154: hwsim: fix GPF in hwsim_new_edge_nl To: Alexander Aring , Stefan Schmidt , "David S. Miller" , Jakub Kicinski Cc: Alexander Aring , linux-wpan - ML , "open list:NETWORKING [GENERAL]" , linux-kernel Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 7, 2021 at 11:56 PM Dongliang Mu wrote: > > Both MAC802154_HWSIM_ATTR_RADIO_ID and MAC802154_HWSIM_ATTR_RADIO_EDGE > must be present to fix GPF. I double-check the whole file, and there is only one similar issue left in Line 421. mac802154_hwsim.c 187 if (!info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID]) mac802154_hwsim.c 299 if (!info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID]) mac802154_hwsim.c 421 if (!info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID] && mac802154_hwsim.c 483 if (!info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID] || mac802154_hwsim.c 531 if (!info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID] || mac80211_hwsim.c 3575 if (!info->attrs[HWSIM_ATTR_ADDR_TRANSMITTER] || mac80211_hwsim.c 3663 if (!info->attrs[HWSIM_ATTR_ADDR_RECEIVER] || mac80211_hwsim.c 3982 if (!info->attrs[HWSIM_ATTR_RADIO_ID]) In addition, I check this pattern in the whole source code, it seems if statements with "&&" in other files are correct. For example, if (!info->attrs[NFC_ATTR_DEVICE_INDEX] || (!info->attrs[NFC_ATTR_LLC_PARAM_LTO] && !info->attrs[NFC_ATTR_LLC_PARAM_RW] && !info->attrs[NFC_ATTR_LLC_PARAM_MIUX])) return -EINVAL; > > Fixes: f25da51fdc38 ("ieee802154: hwsim: add replacement for fakelb") > Signed-off-by: Dongliang Mu > --- > drivers/net/ieee802154/mac802154_hwsim.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/ieee802154/mac802154_hwsim.c b/drivers/net/ieee802154/mac802154_hwsim.c > index cae52bfb871e..8caa61ec718f 100644 > --- a/drivers/net/ieee802154/mac802154_hwsim.c > +++ b/drivers/net/ieee802154/mac802154_hwsim.c > @@ -418,7 +418,7 @@ static int hwsim_new_edge_nl(struct sk_buff *msg, struct genl_info *info) > struct hwsim_edge *e; > u32 v0, v1; > > - if (!info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID] && > + if (!info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID] || > !info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE]) > return -EINVAL; > > -- > 2.25.1 >