Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3306207imu; Sun, 11 Nov 2018 12:02:32 -0800 (PST) X-Google-Smtp-Source: AJdET5cbrq+bC6/umQRoC02assWMjL8VmLJmpP5Q12O6FYxXy/RV8vJJ4R4wSEu56YXQmyhYAfJq X-Received: by 2002:a63:a84a:: with SMTP id i10mr15159621pgp.263.1541966552622; Sun, 11 Nov 2018 12:02:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541966552; cv=none; d=google.com; s=arc-20160816; b=Zuw5AEjykPe/K/A9ch8ayi4jRGabrLzbvQMqjUNQIXLtxsmsXxSOEZFTWWGeABHjpq 8NoZWRoIJC3nONh57sZaFzJJfM/vp5XtsZkseHg/xWPhg4m5rdqbFaFu9/JGfTPc4dwW qytLl4nReXFQYDZFI2U9LZDZlZ6LOaEGv9JNjrSSF9Ku8zqh0yOLKNYJMi+0TCCHxXbP eE5NcQrFvCCWy6mu8JAzkgdMquOl0KPOfO1oEe0/gYin+Vk3xa7AiA5l1ON+20Q0Eywf pOIoZrhMhX7/3B7qQT38je9dwBAHDJkmy7KqoNmBTejWosR8j1qaI6WYopJy1PNaDoeJ rfLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=yJD+5rBQ4ee7uvCRi+EcmEqNzN14kp4Y1edZGV0Z99o=; b=vTT9imcxzar0zS0n/zlyFqEnIy9+zvnZGW1Vmur25H4ZzVec/FVNJ8Rbt4jPYy4PHk 7UO6noDWPV7ji90iNk/j3fsAhjc251XirHATHd+p7yNsQBX5Xp+Mu1tfFFxzqJPfxlh4 wKHWKdR6rnNn4zGNBzZb3I/f8/qBG3r9E46old8mcMJPnLjOOx/dw39OjTrhuSbXD305 Is+C2cLjEg3++8aEFxVerwNJzjPoxpJ0+zGnQcBYS1eoG/alQK19MUYmxD64t6uneHfQ weyha21VXMGPgJFKSN6gI95tzTOFbc8zuIWMaBg7q0PbqmJPF/5a1wofWAs8cEYO7LyE 817g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 37si13730138pgw.590.2018.11.11.12.02.17; Sun, 11 Nov 2018 12:02:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730804AbeKLFsd (ORCPT + 99 others); Mon, 12 Nov 2018 00:48:33 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:51042 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730690AbeKLFsa (ORCPT ); Mon, 12 Nov 2018 00:48:30 -0500 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gLvsk-0000l5-Br; Sun, 11 Nov 2018 19:58:54 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gLvsY-0001np-Py; Sun, 11 Nov 2018 19:58:42 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Herbert Xu" , "Dmitry Safonov" , "David S. Miller" , netdev@vger.kernel.org, "Steffen Klassert" Date: Sun, 11 Nov 2018 19:49:05 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 304/366] netlink: Do not subscribe to non-existent groups In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.61-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Dmitry Safonov commit 7acf9d4237c46894e0fa0492dd96314a41742e84 upstream. Make ABI more strict about subscribing to group > ngroups. Code doesn't check for that and it looks bogus. (one can subscribe to non-existing group) Still, it's possible to bind() to all possible groups with (-1) Cc: "David S. Miller" Cc: Herbert Xu Cc: Steffen Klassert Cc: netdev@vger.kernel.org Signed-off-by: Dmitry Safonov Signed-off-by: David S. Miller Signed-off-by: Ben Hutchings --- net/netlink/af_netlink.c | 1 + 1 file changed, 1 insertion(+) --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c @@ -927,6 +927,7 @@ static int netlink_bind(struct socket *s if (err) return err; } + groups &= (1UL << nlk->ngroups) - 1; if (nlk->portid) if (nladdr->nl_pid != nlk->portid)