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=-3.8 required=3.0 tests=BAYES_00, 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 5ECE0C64E7B for ; Tue, 1 Dec 2020 10:02:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 151EA20705 for ; Tue, 1 Dec 2020 10:02:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403797AbgLAKBu (ORCPT ); Tue, 1 Dec 2020 05:01:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388122AbgLAKBt (ORCPT ); Tue, 1 Dec 2020 05:01:49 -0500 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55E18C0613CF; Tue, 1 Dec 2020 02:01:09 -0800 (PST) Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94) (envelope-from ) id 1kk2Sy-000RHc-KT; Tue, 01 Dec 2020 11:01:00 +0100 Message-ID: <3025db173074d4dfbc323e91d3586f0e36426cf0.camel@sipsolutions.net> Subject: Re: [PATCH] net: mac80211: cfg: enforce sanity checks for key_index in ieee80211_del_key() From: Johannes Berg To: Anant Thazhemadam , "David S. Miller" , Jakub Kicinski Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, syzbot+49d4cab497c2142ee170@syzkaller.appspotmail.com Date: Tue, 01 Dec 2020 11:00:37 +0100 In-Reply-To: <20201201095639.63936-1-anant.thazhemadam@gmail.com> (sfid-20201201_105711_390361_13D95CBF) References: <20201201095639.63936-1-anant.thazhemadam@gmail.com> (sfid-20201201_105711_390361_13D95CBF) Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-1.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-malware-bazaar: not-scanned Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2020-12-01 at 15:26 +0530, Anant Thazhemadam wrote: > Currently, it is assumed that key_idx values that are passed to > ieee80211_del_key() are all valid indexes as is, and no sanity checks > are performed for it. > However, syzbot was able to trigger an array-index-out-of-bounds bug > by passing a key_idx value of 5, when the maximum permissible index > value is (NUM_DEFAULT_KEYS - 1). > Enforcing sanity checks helps in preventing this bug, or a similar > instance in the context of ieee80211_del_key() from occurring. I think we should do this more generally in cfg80211, like in nl80211_new_key() we do it via cfg80211_validate_key_settings(). I suppose we cannot use the same function, but still, would be good to address this generally in nl80211 for all drivers. johannes