From patchwork Thu Feb 29 18:12:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13577511 Received: from mail-oi1-f173.google.com (mail-oi1-f173.google.com [209.85.167.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BC2C67A14D for ; Thu, 29 Feb 2024 18:12:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709230344; cv=none; b=ObpjuEE/Bf9qdAuWWzCkOTN07ZHsEyZRF6L8rQKwutmqr70QMSTgcqEj2bodWNrUYw8Ozy3WtkPCt/Fqz+u2t5dhGyZkLlSZ6gYAlFJw9dp+Sp9CBjIqIDDasqUQp6G8L9TTx8z1fKlKL5oFqw0WVNdKV4j/dXCLYlntVV0mnk4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709230344; c=relaxed/simple; bh=646KmK1RvSswNlbzZgSinVPK8Ss1ur7oAy9g1npibwI=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=gfMH/pxKjmmb+nVwXLYz/ZCkyM6kcLPN86RTg34vncJanHE2LmzuM0Al3Gb9uxOIVdXQDYvd6xjIKi1ht+kQtn3EVYdsw6oNsqi6qaoYRqseGfye2pYBP9Y+ppSNwtCEhw9HnvSCkaemCnXmPdSungQheuS5dg552yDa4xLPW0M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=TtYQG2Bo; arc=none smtp.client-ip=209.85.167.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TtYQG2Bo" Received: by mail-oi1-f173.google.com with SMTP id 5614622812f47-3c1adc90830so708748b6e.0 for ; Thu, 29 Feb 2024 10:12:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709230341; x=1709835141; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ZpYd4eAmDozTkDrfe+wGEdypkLGh1/izS9K1ey/Woho=; b=TtYQG2BochcsrHfM8TJcQf51tP8u9f72GoEMf4AWONKPqcbba11VXkCwa1nEkdDcuX G20XJxXcxUYr7GacvWAtyAr2XBOcjG+6FmZjBXP/7kS3TcDCGcaFsERbTExZJQoXokAw AVSsk5xxP93MIB8B0JcU0KibN7qcV+yqlS/PuJcQAN5QPbGe1jsP0CA5uep1NYeEMSIu zZQxdsPxtw2YWYY6190s70hb7jtlFDy8e+wZeCZ2UK5eZyRPSL0W8hDsdyQk4/hzw0BI j+ISIsUIMs7tEph0A4swoWE479iZbK5EK7c0t5JKAn4PfLKx9j97NW9RPHXSwGlMK4ZG TXhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709230341; x=1709835141; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ZpYd4eAmDozTkDrfe+wGEdypkLGh1/izS9K1ey/Woho=; b=Zv27BQ4YDB0a6AXxkSyq3S7SRoGojvIXgJgH7CqKa5SLlQyFFgdP+YlUH9aONs2UzR cqO5pm+eXPXXupctSrB+O6sqQ3smlh8znd6nTYLpcOJdv6LIJsxHq5GGdadYL4TKc6Y9 5okdU/hNPixcT05qUDWBD/Pvrye5DJna2ffozAIeTbFiRRiWdjzKrAuf3rfwdglVid3/ Ft3EKVxvk0C2nS/J+mQg5ZoGGDPJDSq7XA3njqaSGHj3QMnG2PbW+3YVqhS1XZa9YPxZ OQNLtaYadkQiD8iFM9wIEtqq6DKBgUQSqw1XovcxIthymiJP7bdUbT44yxg+28f/euJt i2mA== X-Gm-Message-State: AOJu0YywO7af8xOyj+WyjQrL1FX87kid4PxT0lChakSBKwzwVm6iwpRD 5Zklozi2klUs4sEKEekVKLsmhTtP5NJkvXTPoQq8lwt8tokMAAS1V+CqY9Po X-Google-Smtp-Source: AGHT+IFv0YgRmFbHLReRe5q9JdTuNH1UG/hAlKhoIb0SMUp6jWSeHCAWVODRu0J8mFwQ8n40I/vrHQ== X-Received: by 2002:a05:6358:4411:b0:17a:ed6c:3f0f with SMTP id z17-20020a056358441100b0017aed6c3f0fmr3166259rwc.22.1709230341412; Thu, 29 Feb 2024 10:12:21 -0800 (PST) Received: from LOCLAP699.rst-01.locus ([208.195.13.130]) by smtp.gmail.com with ESMTPSA id mf15-20020a0562145d8f00b0068cc0b46682sm994209qvb.4.2024.02.29.10.12.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 10:12:20 -0800 (PST) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 1/5] ap: check that the last band_freq_attrs was set Date: Thu, 29 Feb 2024 10:12:13 -0800 Message-Id: <20240229181217.1503555-1-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Static analysis complains that 'last' could be NULL which is true. This really could only happen if every frequency was disabled which likely is impossible but in any case, check before dereferencing the pointer. --- src/ap.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ap.c b/src/ap.c index bce389d3..ee3c4dca 100644 --- a/src/ap.c +++ b/src/ap.c @@ -1247,8 +1247,10 @@ static size_t ap_build_country_ie(struct ap_state *ap, uint8_t *out_buf, } /* finish final group */ - *pos++ = nchans; - *pos++ = last->tx_power; + if (last) { + *pos++ = nchans; + *pos++ = last->tx_power; + } len = pos - out_buf - 2; From patchwork Thu Feb 29 18:12:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13577512 Received: from mail-qv1-f46.google.com (mail-qv1-f46.google.com [209.85.219.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1118316062E for ; Thu, 29 Feb 2024 18:12:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709230345; cv=none; b=RdIj/4ESqB8hez/yG/ygGH0VUZ4KRmeBjLuU0h/8JT6B3xjASXGaYGLtdQ4R/29414HRVEaYrS725sjM+nFyfj8ToJcf0DF0OKKNLeVW23SExNMMoQKVDMLSgnMfdsaD3UFwfLb8XQc8kivyBGRFVTdzC89gDoMjLKuufC8mXP8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709230345; c=relaxed/simple; bh=l9orJplI/D/vl66mVZVSCCO5Tka1bOjCGi3o1gPFM8E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=GVe1fM/imz7ecencAk32QuxrfFaOkGAsQxG+Hwc0zk7jxHcXYsuxa9AjlzzdtGN2ZObmOgZtN9vEi1+31Gc2T0FhBS9Q9dz9iL5uXf67lVv9B7u0lmtaonx3loByyfkHVGX8S376+6bgJjmSNooU7/bJ3my/jMCVPAAVcN4UCPE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=msCbtiVj; arc=none smtp.client-ip=209.85.219.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="msCbtiVj" Received: by mail-qv1-f46.google.com with SMTP id 6a1803df08f44-690508d70e3so2294466d6.1 for ; Thu, 29 Feb 2024 10:12:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709230342; x=1709835142; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=15I/CPKcuBVHku9lovFCh7EpGd8mdbZT2xvInBpTlNA=; b=msCbtiVjjOj32+neFSPTGz8sDQao37NlY5b2M/0nadY5L6ltMNwJMYioyXO+m8jmIf El+mbx/Y+MssP/ZJoSIEfAC1ZvWhUdTvSZbkqeq6ima9eMWRIhOYgZp38mVY7vpnx4zG t/TvUbxjb/exhbiOqHFVXT/oLnhcALvQtmCRu3tiTzzTOv9aMx8PwJZFycJeG7sE6RGa 9PcpBRQwB/iSe37Q2R+7sgH0RIIeK0oCd3QWvBkMYo+DWAW4f7APygk5zTKFDUwxs8QA D5zSXdMWsdywGGYnsiP0FgNmGXSqfFy66A8bySk/hNJrc0LJ5NAgh2XbLDELsfcX7c0y 9j6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709230342; x=1709835142; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=15I/CPKcuBVHku9lovFCh7EpGd8mdbZT2xvInBpTlNA=; b=DYOgZhNG5Ki4DymcmnqvQm9NVYWMBmIzbrYbWIoWLV9Qb9M2P3H62I66k/KAr/C1YG hYxPadSCc6JQPCER4yVV82qdhgAcMYWk2t+/ZEDlZuokeIWkzxytzkaAT7VeYsz+7OiZ rZWmpQVs2SGU6pSuuo20K+qoXyxXi+SOciEYBLA5tEK3yPsqoq1A8caOWYwsWCi+H+6x IYu6KRpRs6F5siPXVg+9+/nLkGpMAQo/O27jkRzjEgEJHHXGYZN3ibjbJwFh17Po449l 9do/2yOlGRWr9savDCog0qtC13oxKVVGOj5Znftfy33Qz/6bfqd+jac2gFNLkkKPfsEy DakQ== X-Gm-Message-State: AOJu0YwBQrgEuJLz9BDF1wxeJmiTwr2KjHBkBpFIXSH+viH1VUt6reZu hGiq8Gmx/JuXTONgZR3xq3mEqtBhwcbNOG+FBfKmg3PIzhb0rPqa3kqX9gm/ X-Google-Smtp-Source: AGHT+IEIg6m1I1u/x8x+OO5JG1ZACQgtIkhDTSq+iokmbKdjPq5p+kde4qOU+wLZQwn3J0YAJSBivQ== X-Received: by 2002:a05:6214:88a:b0:68f:e5e1:8464 with SMTP id cz10-20020a056214088a00b0068fe5e18464mr3065476qvb.20.1709230342473; Thu, 29 Feb 2024 10:12:22 -0800 (PST) Received: from LOCLAP699.rst-01.locus ([208.195.13.130]) by smtp.gmail.com with ESMTPSA id mf15-20020a0562145d8f00b0068cc0b46682sm994209qvb.4.2024.02.29.10.12.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 10:12:22 -0800 (PST) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 2/5] ap: allow va_end to get called in ap_handshake_event Date: Thu, 29 Feb 2024 10:12:14 -0800 Message-Id: <20240229181217.1503555-2-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240229181217.1503555-1-prestwoj@gmail.com> References: <20240229181217.1503555-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Caught by static analysis, va_end was never being called since the REKEY_COMPLETE event was returning early. --- src/ap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ap.c b/src/ap.c index ee3c4dca..25d1b8a3 100644 --- a/src/ap.c +++ b/src/ap.c @@ -1484,7 +1484,7 @@ static void ap_handshake_event(struct handshake_state *hs, } case HANDSHAKE_EVENT_REKEY_COMPLETE: ap_set_sta_rekey_timer(ap, sta); - return; + break; default: break; } From patchwork Thu Feb 29 18:12:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13577513 Received: from mail-qv1-f48.google.com (mail-qv1-f48.google.com [209.85.219.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F04347A14D for ; Thu, 29 Feb 2024 18:12:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709230346; cv=none; b=PN2FdAXt6xOwfvRJRhVdJ3ah9g+IpHTrzJX/NV3HM+I7DUh0y7ZWJ8clULCyVDTubrUeZG3p3nDeRINjjM18FlgqwFxC/w1sOfiR06AUGZbkkCi8FVTkr5ifaXfpuruScc7HtPFMsg6uwKDN9Ki7+d8uo0kg6kuWF968uAqtL/Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709230346; c=relaxed/simple; bh=D9qaCwOs2WfvFweRi46JlUNqo4Im3anMYizu90zR5OM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=W0gzWD08vr6noCEH2P2I9Y8C+yspzOaPxQNKS5jIHGtq5nQgI99pQZ0NoNEEB4+XAAGZ/b6qu3pF6ckrZe/fugKhGEWaU1hOo/8I5gmczeC+GSWyiOdPDc8qd8sBeyhq1pv9/D1YCMYcan8RRWp+Ze6L/Irjnt/gaW7EA3/DM5A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=GW7mxOgQ; arc=none smtp.client-ip=209.85.219.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GW7mxOgQ" Received: by mail-qv1-f48.google.com with SMTP id 6a1803df08f44-68ee2c0a237so9657236d6.1 for ; Thu, 29 Feb 2024 10:12:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709230343; x=1709835143; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Sc0k+IPPi4zpQnvnZ9sLDHJ5NbYazm4LKQBcmJ3HcdE=; b=GW7mxOgQb1QbCudeFD+Fgp/xKm52qdu2/6Vw7RjSQ6FLZOvZbdgUJMEAneeBlCqqrT aYqrBGV4ssUnRoYskrTbIWFr9ctd0O7TWqIkpih5CH4HPYrsi9K2zZKMnVQubzRTUpLW 8ekGmaIabdTbBtQxJEi3CJq8ooPbG5Il73dX8T3U2odrC7iBJw1KAM749AFCNFGGo0E8 nKgCQSuRjeol5MMd95raqyT5/1KOT14ru3dUHv7jsxjXGSLN9+U5dGAGDsD+mqLj0O3y sk98QCrTc0n+gV1xK0qdTAYK5m+IfvYTMkoGfIJ0/d3U7lZCSyxWU/3rM3DRDCPWz6BS hmoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709230343; x=1709835143; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Sc0k+IPPi4zpQnvnZ9sLDHJ5NbYazm4LKQBcmJ3HcdE=; b=Mdx/FVQ+GCwJJMsMwqNRP4yyr4QZWVl5UPMsGCce9moU2LiEd+JZZaQFH/tJ2n3/lf w+LmzYB+EaHoCFykeg+us+wLERcZ6DFIIteNLZNAMlVfWNE3rrJ1qFehadJdoZs8V9Mg GdGsmZRk1uPTki1nhrbyUTmm7uG2/HTWKiy4ZMN6KGP5JH91TZ5GSMvpB2AP0nTMImZ2 gLiTrMNsf9l2gBh891pWQ+dyvZYTxK4P4o7PbOLT+jm86Uu/sBmPBAybu29HyWHk8woT LzjCP/x7aD00Fkzxi2mI2bDBqdr7hSdKb+wmZ4a8Pvy0P9OC4T3WYPITGnX3fLrC2ugL tOoA== X-Gm-Message-State: AOJu0YwjElHBiAuQv1sf0Okyg6cLYbxZ9Xjm/znf30/eaZNPX2AGgRcX J9wI0zoT4oiZxZiRXJoyG1IIbCrj5HhURgWt5m+FmQgQmuElDKtubU5vopsz X-Google-Smtp-Source: AGHT+IGYx1X6e66i+NXTlXZ+vM5tbX+ly7Vr04W2sKlpgViobqJSw+cDy0aVySjKKzW9eoR8EX/8fw== X-Received: by 2002:a05:6214:4119:b0:68f:71b5:b234 with SMTP id kc25-20020a056214411900b0068f71b5b234mr4170608qvb.23.1709230343545; Thu, 29 Feb 2024 10:12:23 -0800 (PST) Received: from LOCLAP699.rst-01.locus ([208.195.13.130]) by smtp.gmail.com with ESMTPSA id mf15-20020a0562145d8f00b0068cc0b46682sm994209qvb.4.2024.02.29.10.12.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 10:12:23 -0800 (PST) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 3/5] nl80211util: check l_genl_attr_recurse return in extract_nested Date: Thu, 29 Feb 2024 10:12:15 -0800 Message-Id: <20240229181217.1503555-3-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240229181217.1503555-1-prestwoj@gmail.com> References: <20240229181217.1503555-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Caught by static analysis, the recurse operation return was not being checked. --- src/nl80211util.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/nl80211util.c b/src/nl80211util.c index 0f45c905..3f9a43ac 100644 --- a/src/nl80211util.c +++ b/src/nl80211util.c @@ -136,9 +136,7 @@ static bool extract_nested(const void *data, uint16_t len, void *o) const struct l_genl_attr *outer = data; struct l_genl_attr *nested = o; - l_genl_attr_recurse(outer, nested); - - return true; + return l_genl_attr_recurse(outer, nested); } static bool extract_u8(const void *data, uint16_t len, void *o) From patchwork Thu Feb 29 18:12:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13577514 Received: from mail-oi1-f174.google.com (mail-oi1-f174.google.com [209.85.167.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4298716062E for ; Thu, 29 Feb 2024 18:12:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709230347; cv=none; b=Q+nW6dtz2XhXd3cM9h0rVBtiYVDSs01ini3pO2FUAimMf086kHcgfq4sanVwhDaQOfFFbOpd3Z7R2tWzM8CrjAXhPQaNp6dwXm9c9rlZVe84ZtuFizA0mcJk/HHG3agVjzIeNkTH+ugOK1RAgqmDPVlUNPRYUC5AFOlg+sHZ0rQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709230347; c=relaxed/simple; bh=DWiOEHAar973PghSXAZgRxP/Hftyl595KVjHNKnCjeU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NR42/McolRzPCU8ANXphPm5ay3n0S/qt3SeBjEajkWOtd/B5aF+ttgbYZeZdeVnduoU+YYiXj8xlGaBGU7JMx7lyWkxoS8pLRpI9JQKk5bRLrXdYxc+9kWEX0U6ABacPfVpA7rUtAePjSbnbjOemA2mTsVKRVYdqnjQ2LmU03Sk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hlMjpiAA; arc=none smtp.client-ip=209.85.167.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hlMjpiAA" Received: by mail-oi1-f174.google.com with SMTP id 5614622812f47-3c1a7d51fb5so990095b6e.1 for ; Thu, 29 Feb 2024 10:12:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709230345; x=1709835145; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZjqAu03B4BDxAKqLbGFRDggUMZqATfnkNUiiCO8E6f4=; b=hlMjpiAAbUOMMexBZZpw9Zh8798T9gHqo2vU1tkiabLGSMXSuij4sVTMt7YwtVRejD qZq7qGmEmiTe+1M2Qi4ewaI08Z33ysGb8AdrNnInWbm82V6LioFr6/9AgJaxdmz0RNnB On8lr5q6nOSFF951TXdPR/DpQADdswXYDG6uFUeBvpT9NKkRqw8CZ938oWCEGGQ2ztgN q0v/7qr/1nZJ38lz7ogbwC87G52KDV8M3HVYb+jBkiYWbclhnaFDQw60WRC2FEUaDxdn +dDCrQB/lUnVZQK3ebPyXXBvLDmImj1vywbmgQDlo1JTXWmAMGr9wEkLsblFN6XY4CA6 T4JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709230345; x=1709835145; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZjqAu03B4BDxAKqLbGFRDggUMZqATfnkNUiiCO8E6f4=; b=hOIKrJgRESxWbC5jnEiK+ZCDIGcDvW5CgwbnaljI8UQVM4uueXrUJtO4dH108/4KIy +gD7fZmelOT3Uo6KzACpgP0vEZa53z5eq1X8IiuyfZADAS9ajHdr5xWt9YydVLS3iLyM sEVxcQLSLUUfO4lDuQqWJqDhvoPdSTeG4Q9BnqR39N+9YvEp7mHk9Knw9mudBIOO5E1n e73Y5pUkSfYlGfAXkTaIfXKLPsl4rw0zwl1xcFdIxC0jZecFwnGI/Ndh5FUwebem25j5 JH73KHlmw3F4WymMQX3b/zK/ldVsebk5j4bW0lknGI1giaV49SBLAXOVUUKgUHp6AyRL VqTg== X-Gm-Message-State: AOJu0YwQWFI2vb4fBYRk/f1kcak/6jHthLhk1oNiPcom8kAujPpCllxs 5RwJdR8DgCOWAp1EwtQY3MtWAs3jqRPWjb2/yFW3XDEnWa+BWk4yAK0NlTat X-Google-Smtp-Source: AGHT+IFMFT+Ewy+y4uU/LxK8rbvdWBqtN2/EFO02m7ZaJqcBN0EKZ8phCtc/P+lEkV2ssJ8REEK9AA== X-Received: by 2002:a05:6358:7f0a:b0:17b:ee6f:b6b1 with SMTP id p10-20020a0563587f0a00b0017bee6fb6b1mr937614rwn.31.1709230344579; Thu, 29 Feb 2024 10:12:24 -0800 (PST) Received: from LOCLAP699.rst-01.locus ([208.195.13.130]) by smtp.gmail.com with ESMTPSA id mf15-20020a0562145d8f00b0068cc0b46682sm994209qvb.4.2024.02.29.10.12.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 10:12:24 -0800 (PST) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 4/5] ap: verify ATTR_MAC exists in NEW_STATION Date: Thu, 29 Feb 2024 10:12:16 -0800 Message-Id: <20240229181217.1503555-4-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240229181217.1503555-1-prestwoj@gmail.com> References: <20240229181217.1503555-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Caught by static analysis, if ATTR_MAC was not in the message there would be a memcpy with uninitialized bytes. In addition there is no reason to memcpy twice. Instead 'mac' can be a const pointer which both verifies it exists and removes the need for a second memcpy. --- src/ap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ap.c b/src/ap.c index 25d1b8a3..a6f8f306 100644 --- a/src/ap.c +++ b/src/ap.c @@ -2963,7 +2963,7 @@ static void ap_handle_new_station(struct ap_state *ap, struct l_genl_msg *msg) uint16_t type; uint16_t len; const void *data; - uint8_t mac[6]; + const uint8_t *mac = NULL; uint8_t *assoc_rsne = NULL; if (!l_genl_attr_init(&attr, msg)) @@ -2983,12 +2983,12 @@ static void ap_handle_new_station(struct ap_state *ap, struct l_genl_msg *msg) if (len != 6) goto cleanup; - memcpy(mac, data, 6); + mac = data; break; } } - if (!assoc_rsne) + if (!assoc_rsne || !mac) goto cleanup; /* From patchwork Thu Feb 29 18:12:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13577515 Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 65C907A14D for ; Thu, 29 Feb 2024 18:12:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709230348; cv=none; b=aYzxBWCLY6idNWvMX1+Hmpi8cmuURVaVTY0A0C19M41f/at56paEVUWajuWm7+FOtofDHFPL+ZABjbqp6qTWU79EkZSANKE8/mEm/VwmmjcHwtnND2XiY0ygIUeb6OQ5lFuRnFSMnmtK3r7SWLi6Hco17nghLDLYPQsR7E5Da2M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709230348; c=relaxed/simple; bh=Nq5BxIQ2iQOPy0RDMFtf/L0ikATR0G+NwkOvknD+sPg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=iSGXyl6VMHd4xjO05vyfnnACoLQuQCG9zZGaP2BAs9CbsEY3YC3iuUSU8v0FfQ7LYYLrlFTjT7sCByBCisLmel7Lso2F6dLV44X7RoMw8YHhDflQH7HgKw/FCJszPYjxi7HgZxQ/KCUsAC4V6MkkBchVzBq3CmAe8sAnNs31UPk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=GswkniKX; arc=none smtp.client-ip=209.85.160.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GswkniKX" Received: by mail-qt1-f176.google.com with SMTP id d75a77b69052e-42e885c8885so5289231cf.2 for ; Thu, 29 Feb 2024 10:12:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709230346; x=1709835146; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ibns01NBkL1xPU+v4AK+lmGTo+9X6/v8xLW9qDyfV7I=; b=GswkniKXnsTzjycuCIdH9vphjAeg2CXDM6R337Rbak2chdg3MMHAqXWDHJVSOwrJHL Q3hJYHoYfTl/iMpXGu6mtCU/9pl+XtgexJx9bxJVXbBeXMCQR/ej2NUPvoOtrTV3tibL CpL5rGOz5sQJ3Y6yhJRmUvQxMMjRaJW1ZQ07/aOZxir3q5oK6PkmANKA1FhfAUptCVIE o31gDZZuM348RGSjaYdpymyRlz0AKZ8ghSND/KM6p7ne3BFS7sYZQMtjEqZeUEs00SH4 F2OjvJhUtcM8TjHVD4WITB1GtH1kQmlq0wpXmBcWPDnRxwQmjujBanrZmGBoW1O/+lEa Z3Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709230346; x=1709835146; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ibns01NBkL1xPU+v4AK+lmGTo+9X6/v8xLW9qDyfV7I=; b=I+Zi3T29kwgp5YOs4a8mO8KkGozuZ/lXjc+QaF4AovWADkTwEXiGJquoLAEvX39Kuy eqsjjURt7hoZlW9sLvgpUocRZOyTvSKw7dZDlxFYk464W2m+E0jWlxrk6ypiyli8FdX+ Y9ogZgPZU5sowdNtCkydaNZGNw6LENQUKnGxFhaQYq6zeoEXcF1lhkUVBM0uQ5H1z45R SL9U/x93v9s8NvwwlCaQ0G3pu5/b1/7a9lM16bNjXmiAxmaWhLoxMQAcokeWYhjlTzvF Cag1LCO2/2iG6IjGKJcJqMjRE9zwU1LTrALRjI/nczt1L7vjPgPs71gt9e780MilzCmp o5Dg== X-Gm-Message-State: AOJu0Yz65ceQ87qQoqjN+Ag1YSjc4rYj8ARB8WOLK3K5XAKciNslo4Op Re7Ek+FbdaX2hC4bjV3ii26alC8LeFEQPhtpa63YPRtxeSui0VOkrQSeEtsU X-Google-Smtp-Source: AGHT+IHQY7ZBVUVDr04OQEf0XMdLc7GoK38Ptak8oL7DZ1udvF55HvrhItGoF5lca5MuOiMFgz8p2Q== X-Received: by 2002:a05:6214:1741:b0:690:4568:55eb with SMTP id dc1-20020a056214174100b00690456855ebmr2579568qvb.40.1709230346007; Thu, 29 Feb 2024 10:12:26 -0800 (PST) Received: from LOCLAP699.rst-01.locus ([208.195.13.130]) by smtp.gmail.com with ESMTPSA id mf15-20020a0562145d8f00b0068cc0b46682sm994209qvb.4.2024.02.29.10.12.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 10:12:25 -0800 (PST) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 5/5] ap: bail in ap_del_station if AP is going down Date: Thu, 29 Feb 2024 10:12:17 -0800 Message-Id: <20240229181217.1503555-5-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240229181217.1503555-1-prestwoj@gmail.com> References: <20240229181217.1503555-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Caught by static analysis, if this condition is met the AP is going down so we cannot continue further accessing the ap object. --- src/ap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ap.c b/src/ap.c index a6f8f306..b4e7593e 100644 --- a/src/ap.c +++ b/src/ap.c @@ -455,7 +455,8 @@ static void ap_del_station(struct sta_state *sta, uint16_t reason, sta->ip_alloc_lease = NULL; l_dhcp_server_expire_by_mac(ap->netconfig_dhcp, sta->addr); - ap_event_done(ap, prev); + if (ap_event_done(ap, prev)) + return; } /*