Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp1164441lqb; Thu, 18 Apr 2024 01:53:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWKHruAQ/MuBW5dBape3o6Eq95nb7wxWbvRwBfo5EABwHOpGLyFgbg/Mzc52xj1JKjkygKd2c6fL4wv3YxcF8TwgmXwELUmBdOVttbePA== X-Google-Smtp-Source: AGHT+IEEwKUYlwMVCiFu3p3rbZyQdVMwou5Ff52vLO+b7n7p2isHSHNJmQXG8T9MSiqKg6x54UjE X-Received: by 2002:a05:6a20:d80d:b0:1a9:c13e:eda9 with SMTP id iv13-20020a056a20d80d00b001a9c13eeda9mr3166277pzb.9.1713430405858; Thu, 18 Apr 2024 01:53:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713430405; cv=pass; d=google.com; s=arc-20160816; b=Yjd2uvkbEX3Btrzc7Upak9NLfwwYlJ3fhUhTF1lOTTp4F+L/TG0QR3aM57BWwrDrAS CLrJMwtouwcdCd81Pqx5OWvyZyQXT5hHpnBmw8EiIWctWe2ZP+vQrHdFgMuLlW1iQNbq bwP4lvMNl7TB4044N4l1ZEiLCHkqHcbA6ybaHUZHVz4/G/95jIWTB9kqA5e4yqBSnBqq YW35ypeglJFox2ALwBb74McnxfyWBLVUYNGPDWsG0fTgt2YD1zAJgjNTVAPVnrtgUN0l jY87g6gocSsTXdlX8bxZ+pMuSW/bST1Ef/Puz1Vw4QwFH1MPk2YC7DxcTXHTZmKnE6Sy v0uQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=lia9aGJ7ZZV7DUgVVqlynCBBe+EaF3Gt5BYAEzt/vDA=; fh=0ZKV22Mpi0Z+/zRlCC9GRUAKl0wLMxmYgR1nXO1NAEs=; b=aeYP/alXG/1+cfl3hq0istuq5RzF5VdGOy2jgjOdz+8y7LL3aG+wr0KLTGiJOzHxgX tXRZTVJGNJ8S8qe2x4Sx8ARGck0Y2UFC5WZO4oOEW7tgHmatUB0aTDIaJh6ZJc0IoEhP wHSiJkOxYG9qn5v5K/71Q6kxXotmoZD5WmNwP2atbBlbzh7j2a1KT/ZZOi8wlzydrzFA oBvEDcVxw4cC0iTT0aRUuRd78WEZxnWZ/YgHIloyVFWPxGaLfI378ac/vM6GBSVus6zz sWM6+tpcJCxrpP092akK3px1sHXv4i7sziDooPYDDeOK0NzbmN6XjPt1eyxhEmRAoG+e xzBQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=gc6oFSFF; arc=pass (i=1 spf=pass spfdomain=sipsolutions.net dkim=pass dkdomain=sipsolutions.net dmarc=pass fromdomain=sipsolutions.net); spf=pass (google.com: domain of linux-wireless+bounces-6508-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6508-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id i10-20020a170902e48a00b001e3cf5b15f2si976178ple.366.2024.04.18.01.53.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 01:53:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-6508-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=gc6oFSFF; arc=pass (i=1 spf=pass spfdomain=sipsolutions.net dkim=pass dkdomain=sipsolutions.net dmarc=pass fromdomain=sipsolutions.net); spf=pass (google.com: domain of linux-wireless+bounces-6508-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6508-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id CB5A5B2257B for ; Thu, 18 Apr 2024 08:52:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EFE9C15AAAD; Thu, 18 Apr 2024 08:52:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="gc6oFSFF" X-Original-To: linux-wireless@vger.kernel.org Received: from sipsolutions.net (s3.sipsolutions.net [168.119.38.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5BB5515AACB for ; Thu, 18 Apr 2024 08:52:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=168.119.38.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713430356; cv=none; b=AiqjR+0PicN29Zs2Yq4lmgLaCDn82/KfVZ/co12rwziiyue3iAWN5Yc3G8vlZTsWS2r5vjiR/rUKs45jp1lQHduWCheGKEXLLf9bwZvb0e4FWaEMklRb7N17e3joIHEgZKvJ+ER8dADyAkaJU/Hl2dy+NJYzOEVx55oy8wciy3s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713430356; c=relaxed/simple; bh=vCd8u3N5w/fGbAvjU7foKfLM1z1GiDWyU5CdD4qiu2A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fYFBMyUmib+JjCz1/8/gbTk+4fRSbCqFhb4cJ6eGLM1/8kErjg1YQ90P/bUY3cmdchuRjuHh8sQwUOutzJA4VJOsVV48uTOgrDbLWnDU38cBQUhws5In97rgmmVdGg6Mb4CxEUv6k8SDMR2fx+I8ljOcx4LVrRVVwr1kDF+prZI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net; spf=pass smtp.mailfrom=sipsolutions.net; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b=gc6oFSFF; arc=none smtp.client-ip=168.119.38.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sipsolutions.net DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Content-Type:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=lia9aGJ7ZZV7DUgVVqlynCBBe+EaF3Gt5BYAEzt/vDA=; t=1713430355; x=1714639955; b=gc6oFSFFM0UaodGouasipqi4oHCKlCqZl6UUGN90h8V3Yiz iziDIxWblQvxrqniX+rK/4O92+iRIKwFxM2vKbzavAkGZ9KybR/ppPI9keRRfPOd3OEkOZJU98sLl O1AwF5NxMCiRGcuzWw+paXax6TsDKsqWHqe3Ve7a9KVAKxrTKQqS4gjodoj9hFYUOO8J0adOJy3kr 4aMYDV5ZpzZOOBVhxbx+THgohZ93PJ5HgkqNJnyxxI+myPrwP4dxgUfCX8H0nJYNZqjDHQ1rD4fU6 o/ut/GykA6egXH6ayV6pyjCjwYk2whNf+MlFiJ/LcX8tEjPZ2wf0T1+rcfo9urYQ==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1rxNVK-0000000CIvO-47Og; Thu, 18 Apr 2024 10:52:27 +0200 From: Johannes Berg To: linux-wireless@vger.kernel.org Cc: Johannes Berg , Miriam Rachel Korenblit Subject: [PATCH wireless 5/8] wifi: nl80211: don't free NULL coalescing rule Date: Thu, 18 Apr 2024 10:52:23 +0200 Message-ID: <20240418105220.b328f80406e7.Id75d961050deb05b3e4e354e024866f350c68103@changeid> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240418105220.90df97557702.I05d2228ce85c203b9f2d6da8538cc16dce46752a@changeid> References: <20240418105220.90df97557702.I05d2228ce85c203b9f2d6da8538cc16dce46752a@changeid> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Johannes Berg If the parsing fails, we can dereference a NULL pointer here. Fixes: be29b99a9b51 ("cfg80211/nl80211: Add packet coalesce support") Reviewed-by: Miriam Rachel Korenblit Signed-off-by: Johannes Berg --- net/wireless/nl80211.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index b4edba6b0b7b..30ff9a470813 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -14030,6 +14030,8 @@ static int nl80211_set_coalesce(struct sk_buff *skb, struct genl_info *info) error: for (i = 0; i < new_coalesce.n_rules; i++) { tmp_rule = &new_coalesce.rules[i]; + if (!tmp_rule) + continue; for (j = 0; j < tmp_rule->n_patterns; j++) kfree(tmp_rule->patterns[j].mask); kfree(tmp_rule->patterns); -- 2.44.0