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 X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A672C7618B for ; Wed, 24 Jul 2019 12:39:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2DCCD229FA for ; Wed, 24 Jul 2019 12:39:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728437AbfGXMjY (ORCPT ); Wed, 24 Jul 2019 08:39:24 -0400 Received: from s3.sipsolutions.net ([144.76.43.62]:52908 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725776AbfGXMjX (ORCPT ); Wed, 24 Jul 2019 08:39:23 -0400 Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1hqGYC-0005nl-5P; Wed, 24 Jul 2019 14:39:20 +0200 Message-ID: <91f918911b7a33c84d7a620e75a1d8155a239237.camel@sipsolutions.net> Subject: Re: [PATCH 2/2] net: mac80211: Fix possible null-pointer dereferences in ieee80211_xmit_fast_finish() From: Johannes Berg To: Jia-Ju Bai , davem@davemloft.net Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Date: Wed, 24 Jul 2019 14:39:16 +0200 In-Reply-To: <20190724123633.10145-1-baijiaju1990@gmail.com> (sfid-20190724_143645_528233_F6E5B778) References: <20190724123633.10145-1-baijiaju1990@gmail.com> (sfid-20190724_143645_528233_F6E5B778) Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5 (3.30.5-1.fc29) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2019-07-24 at 20:36 +0800, Jia-Ju Bai wrote: > In ieee80211_xmit_fast_finish(), there is an if statement on line 3356 > to check whether key is NULL: > if (key) > > When key is NULL, it is used on line 3388: > switch (key->conf.cipher) > and line 3393: > pn = atomic64_inc_return(&key->conf.tx_pn); > and line 3396: > crypto_hdr[3] = 0x20 | (key->conf.keyidx << 6); > > Thus, possible null-pointer dereferences may occur. No, this cannot happen, because pn_offs can only be non-zero when there is a key. Maybe we should pass the fast_tx pointer instead of the pn_offs/key from it, but the two are coupled. johannes