Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4394781pxu; Tue, 1 Dec 2020 04:03:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJyf7cteKPy/7kBeuWlDFAW5E6O1mZIStN1fOWeN9xB1yIW5XAEki+cGJzN9o9v34SDH5+DU X-Received: by 2002:a17:906:a95:: with SMTP id y21mr2568905ejf.339.1606824187130; Tue, 01 Dec 2020 04:03:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606824187; cv=none; d=google.com; s=arc-20160816; b=m0H+BPK/4wMg8SdVnG/TG0Qg9QaYcrjElxOpygIl+S1wcliIPDyfIoRVpqvxqvVO4B pLiQJhtYeGmLAYu25jPVa6UKPp1vJj56lFsfo94XHVPmUqz4btTm9cT8yFy7CKyd1s1P xLx4FUaJpY0l/W2q1li2IO6TWZKH59zb9gbWGk4d4l2sJ/XfFFGbZFv+wz4Nfw/hfO/5 veRfEMNV6vycuCW7IWAtOq2GwAn4vF2AtwXLB/NOXDWh+awG7XWlFB6IQy/R3AoPcxu7 /tMKS+7oFztbnXa8K8OOCQBSeLYYmyq8QcDALa7osnOXBX2AfQn557KXxLYE2dmnFvGO A2GQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=5hgImp7mtfyoIITXeXte4NNvXY5OiJT0esiIV50KJpM=; b=qDd+DcjzrYsGVcL43Br5G85wm/MGelKSCltptNn06iWi9i7i6ZiFW9TthssaMsqpZD vKhJDvS23eCsCh1OIU/e8mOXRfSj+8s/yOLtG+nqP1kL1qkyMVaQJmSIdGeytTDw4G5i JGhZkVxXnzj3Gms2YWiDU18WErTt2Zqz6fxRXPHz/uCPg1Xs5jWssMbSkB+DzWtE+4Sx 4WNticWDj6ZgCvQnaPUdT9v6Hv3XW+d/nEpt5Cxw5YkRvfuhkV+MPGsDCm/UKUqwUC+G bCigACVFom2GFvFi92v67ZIqdAjlWBdpBvD7BVYCnJ9cxl02Nsl40fx3kXUrb2XOCOHo lM7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lWOTJbbb; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-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 hp17si833410ejc.31.2020.12.01.04.01.52; Tue, 01 Dec 2020 04:03:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-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=lWOTJbbb; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-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 S2390183AbgLAL5X (ORCPT + 99 others); Tue, 1 Dec 2020 06:57:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387398AbgLAL5W (ORCPT ); Tue, 1 Dec 2020 06:57:22 -0500 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8B45C0613CF; Tue, 1 Dec 2020 03:56:42 -0800 (PST) Received: by mail-pj1-x1042.google.com with SMTP id l23so1103550pjg.1; Tue, 01 Dec 2020 03:56:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=5hgImp7mtfyoIITXeXte4NNvXY5OiJT0esiIV50KJpM=; b=lWOTJbbbgEMI60IivvuuQmAV2odlXSz6fZw8/Iszp7pYWor6b3zFNFQFsFM6Up5Kdp QFqBHeutH7Yw0GaA2mJ3koaPoWpIk72FVZu5RMo2nEtrkss9ZlPkYb0qHl1U1Z4nvMcE wwLFuCMN0dlmweMQgSs+zbrmSbkJ2HxmO0jM00flUSXb7vSBn7ia+Pe3VBFrgy2+4Jza AtFlxBVsYL5ZcODz2pnTH97xjSoNRIsVdv9gDeWZZoh2vXamSt4AQ18M1z91oBXOPBOu uTmLb+NUodI1LrwNSNnlK6rnSVvTy+lU2ZCw1eu2TXyCGRZh6h7YMWGPr7agsuQscdCI rCVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=5hgImp7mtfyoIITXeXte4NNvXY5OiJT0esiIV50KJpM=; b=WWogOGBkbxrhCgBQnqyQl3aZjMpsvQHyfC0wQfNsovyPhGgPW2WwOSG/AfkQecb8oy erQjkJjcWXRosyauBudAtamYtrThjrk/GEs20JmwZTin8eve7MqxcIho1mLziLgL4L/S wdRxG/it06KxJgonfE8E46Yva3vzmsf0/+ZNoZBuasmb2G8BC7SGbiLvrcDe5q3qCkLU qr6230nebD/NRKp47jmE4RG8JhGl5obWZMsNxpRI6S3jahwxdkqtCWAxLI9kEmFgOaKY MWoYpwfLHpW3F6YPVHH8t4+wpsCwktlymx5VmQToGs9sA0gpQQ7yUyvXXRPuE1gpyHAd fe5A== X-Gm-Message-State: AOAM5311ZJlkbgjTP3TG6Sy609gfIrFzIMWR6O+0cGqkCxpX9P3VQfL8 Tx1b6ah6qtL2J05WOOQq6eY= X-Received: by 2002:a17:902:c155:b029:da:9460:99a0 with SMTP id 21-20020a170902c155b02900da946099a0mr2471436plj.20.1606823802205; Tue, 01 Dec 2020 03:56:42 -0800 (PST) Received: from [192.168.0.104] ([49.207.197.72]) by smtp.gmail.com with ESMTPSA id h11sm2574403pfo.69.2020.12.01.03.56.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Dec 2020 03:56:41 -0800 (PST) Subject: Re: [PATCH] net: mac80211: cfg: enforce sanity checks for key_index in ieee80211_del_key() To: Johannes Berg , "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 References: <20201201095639.63936-1-anant.thazhemadam@gmail.com> <3025db173074d4dfbc323e91d3586f0e36426cf0.camel@sipsolutions.net> From: Anant Thazhemadam Message-ID: <1e5e4471-5cf4-6d23-6186-97f764f4d25f@gmail.com> Date: Tue, 1 Dec 2020 17:26:37 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <3025db173074d4dfbc323e91d3586f0e36426cf0.camel@sipsolutions.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On 01/12/20 3:30 pm, Johannes Berg wrote: > 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. Hello, This gave me the idea of trying to use cfg80211_validate_key_settings() directly in ieee80211_del_key(). I did try that out, tested it, and this bug doesn't seem to be getting triggered anymore. If this is okay, then I can send in a v2 soon. :) If there is any reason that I'm missing as to why cfg80211_validate_key_settings() cannot be used in this context, please let me know. Thanks, Anant