lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201203140604.25488-2-socketcan@hartkopp.net>
Date:   Thu,  3 Dec 2020 15:06:03 +0100
From:   Oliver Hartkopp <socketcan@...tkopp.net>
To:     mkl@...gutronix.de, kuba@...nel.org, davem@...emloft.net,
        netdev@...r.kernel.org, linux-can@...r.kernel.org
Cc:     Oliver Hartkopp <socketcan@...tkopp.net>,
        Thomas Wagner <thwa1@....de>
Subject: [PATCH 1/2] can-isotp: block setsockopt on bound sockets

The isotp socket can be widely configured in its behaviour regarding
addressing types, fill-ups, receive pattern tests and link layer length.
Usually all these settings need to be fixed before bind() and can not
be changed afterwards.

This patch adds a check to enforce the common usage pattern.

Fixes: e057dd3fc20f ("can: add ISO 15765-2:2016 transport protocol")
Tested-by: Thomas Wagner <thwa1@....de>
Signed-off-by: Oliver Hartkopp <socketcan@...tkopp.net>
---
 net/can/isotp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/can/isotp.c b/net/can/isotp.c
index d78ab13bd8be..26bdc3c20b7e 100644
--- a/net/can/isotp.c
+++ b/net/can/isotp.c
@@ -1155,10 +1155,13 @@ static int isotp_setsockopt(struct socket *sock, int level, int optname,
 	int ret = 0;
 
 	if (level != SOL_CAN_ISOTP)
 		return -EINVAL;
 
+	if (so->bound)
+		return -EISCONN;
+
 	switch (optname) {
 	case CAN_ISOTP_OPTS:
 		if (optlen != sizeof(struct can_isotp_options))
 			return -EINVAL;
 
-- 
2.29.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ