linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 4.9 01/17] net/nfc/rawsock.c: fix a permission check bug
@ 2021-06-03 17:10 Sasha Levin
  2021-06-03 17:10 ` [PATCH AUTOSEL 4.9 02/17] ASoC: sti-sas: add missing MODULE_DEVICE_TABLE Sasha Levin
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: Sasha Levin @ 2021-06-03 17:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Jeimon, David S . Miller, Sasha Levin, linux-nfc, netdev

From: Jeimon <jjjinmeng.zhou@gmail.com>

[ Upstream commit 8ab78863e9eff11910e1ac8bcf478060c29b379e ]

The function rawsock_create() calls a privileged function sk_alloc(), which requires a ns-aware check to check net->user_ns, i.e., ns_capable(). However, the original code checks the init_user_ns using capable(). So we replace the capable() with ns_capable().

Signed-off-by: Jeimon <jjjinmeng.zhou@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/nfc/rawsock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/nfc/rawsock.c b/net/nfc/rawsock.c
index 92a3cfae4de8..2fba626a0125 100644
--- a/net/nfc/rawsock.c
+++ b/net/nfc/rawsock.c
@@ -345,7 +345,7 @@ static int rawsock_create(struct net *net, struct socket *sock,
 		return -ESOCKTNOSUPPORT;
 
 	if (sock->type == SOCK_RAW) {
-		if (!capable(CAP_NET_RAW))
+		if (!ns_capable(net->user_ns, CAP_NET_RAW))
 			return -EPERM;
 		sock->ops = &rawsock_raw_ops;
 	} else {
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2021-06-03 17:17 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-03 17:10 [PATCH AUTOSEL 4.9 01/17] net/nfc/rawsock.c: fix a permission check bug Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.9 02/17] ASoC: sti-sas: add missing MODULE_DEVICE_TABLE Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.9 03/17] isdn: mISDN: netjet: Fix crash in nj_probe: Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.9 04/17] bonding: init notify_work earlier to avoid uninitialized use Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.9 05/17] netlink: disable IRQs for netlink_lock_table() Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.9 06/17] net: mdiobus: get rid of a BUG_ON() Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.9 07/17] cgroup: disable controllers at parse time Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.9 08/17] wq: handle VM suspension in stall detection Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.9 09/17] net/qla3xxx: fix schedule while atomic in ql_sem_spinlock Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.9 10/17] scsi: vmw_pvscsi: Set correct residual data length Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.9 11/17] scsi: target: qla2xxx: Wait for stop_phase1 at WWN removal Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.9 12/17] net: macb: ensure the device is available before accessing GEMGXL control registers Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.9 13/17] net: appletalk: cops: Fix data race in cops_probe1 Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.9 14/17] MIPS: Fix kernel hang under FUNCTION_GRAPH_TRACER and PREEMPT_TRACER Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.9 15/17] bnx2x: Fix missing error code in bnx2x_iov_init_one() Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.9 16/17] powerpc/fsl: set fsl,i2c-erratum-a004447 flag for P2041 i2c controllers Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.9 17/17] powerpc/fsl: set fsl,i2c-erratum-a004447 flag for P1010 " Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).