Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6e6e95ce authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "net: qrtr: Allow control port access to AID_VENDOR_QRTR"

parents 42042db5 82ea58d6
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -351,8 +351,7 @@ int qmi_txn_wait(struct qmi_txn *txn, unsigned long timeout)
	struct qmi_handle *qmi = txn->qmi;
	int ret;

	ret = wait_for_completion_interruptible_timeout(&txn->completion,
							timeout);
	ret = wait_for_completion_timeout(&txn->completion, timeout);

	mutex_lock(&qmi->txn_lock);
	mutex_lock(&txn->lock);
@@ -360,9 +359,7 @@ int qmi_txn_wait(struct qmi_txn *txn, unsigned long timeout)
	mutex_unlock(&txn->lock);
	mutex_unlock(&qmi->txn_lock);

	if (ret < 0)
		return ret;
	else if (ret == 0)
	if (ret == 0)
		return -ETIMEDOUT;
	else
		return txn->result;
+6 −3
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#include <linux/wait.h>
#include <linux/rwsem.h>
#include <linux/ipc_logging.h>
#include <linux/uidgid.h>

#include <net/sock.h>

@@ -38,6 +39,8 @@
#define QRTR_STATE_MULTI	-2
#define QRTR_STATE_INIT	-1

#define AID_VENDOR_QRTR	KGIDT_INIT(2906)

/**
 * struct qrtr_hdr_v1 - (I|R)PCrouter packet header version 1
 * @version: protocol version
@@ -920,7 +923,8 @@ static int qrtr_port_assign(struct qrtr_sock *ipc, int *port)
			       GFP_ATOMIC);
		if (rc >= 0)
			*port = rc;
	} else if (*port < QRTR_MIN_EPH_SOCKET && !capable(CAP_NET_ADMIN)) {
	} else if (*port < QRTR_MIN_EPH_SOCKET &&
		   !(capable(CAP_NET_ADMIN) || in_egroup_p(AID_VENDOR_QRTR))) {
		rc = -EACCES;
	} else if (*port == QRTR_PORT_CTRL) {
		rc = idr_alloc(&qrtr_ports, ipc, 0, 1, GFP_ATOMIC);
@@ -1493,8 +1497,7 @@ static int qrtr_addr_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
	struct ifaddrmsg *ifm;
	int rc;

	if (!netlink_capable(skb, CAP_NET_ADMIN) &&
	    !netlink_capable(skb, CAP_NET_BIND_SERVICE))
	if (!netlink_capable(skb, CAP_NET_ADMIN))
		return -EPERM;

	ASSERT_RTNL();