All of lore.kernel.org
 help / color / mirror / Atom feed
* + misdn-add-support-for-group-membership-check.patch added to -mm tree
@ 2013-05-28 23:13 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2013-05-28 23:13 UTC (permalink / raw)
  To: mm-commits, sergei.shtylyov, jslaby, isdn, isdn4linux, davem, jeffm

Subject: + misdn-add-support-for-group-membership-check.patch added to -mm tree
To: jeffm@suse.com,davem@davemloft.net,isdn4linux@koppen.de,isdn@linux-pingi.de,jslaby@suse.cz,sergei.shtylyov@cogentembedded.com
From: akpm@linux-foundation.org
Date: Tue, 28 May 2013 16:13:27 -0700


The patch titled
     Subject: mISDN: add support for group membership check
has been added to the -mm tree.  Its filename is
     misdn-add-support-for-group-membership-check.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Jeff Mahoney <jeffm@suse.com>
Subject: mISDN: add support for group membership check

This patch adds a module parameter to allow a group access to the mISDN
devices.  Otherwise, unpriviledged users on systems with ISDN hardware
have the ability to dial out, potentially causing expensive bills.

Based on a different implementation by Patrick Koppen.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Acked-by: Jeff Mahoney <jeffm@suse.com>
Cc: Patrick Koppen <isdn4linux@koppen.de>
Cc: Karsten Keil <isdn@linux-pingi.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/isdn/mISDN/core.c   |    6 ++++++
 drivers/isdn/mISDN/core.h   |    1 +
 drivers/isdn/mISDN/socket.c |    9 +++++++++
 3 files changed, 16 insertions(+)

diff -puN drivers/isdn/mISDN/core.c~misdn-add-support-for-group-membership-check drivers/isdn/mISDN/core.c
--- a/drivers/isdn/mISDN/core.c~misdn-add-support-for-group-membership-check
+++ a/drivers/isdn/mISDN/core.c
@@ -21,10 +21,14 @@
 #include "core.h"
 
 static u_int debug;
+static u_int gid;
+kgid_t misdn_permitted_gid;
 
 MODULE_AUTHOR("Karsten Keil");
 MODULE_LICENSE("GPL");
 module_param(debug, uint, S_IRUGO | S_IWUSR);
+module_param(gid, uint, 0);
+MODULE_PARM_DESC(gid, "Unix group for accessing misdn socket (default 0)");
 
 static u64		device_ids;
 #define MAX_DEVICE_ID	63
@@ -372,6 +376,8 @@ mISDNInit(void)
 {
 	int	err;
 
+	misdn_permitted_gid = make_kgid(current_user_ns(), gid);
+
 	printk(KERN_INFO "Modular ISDN core version %d.%d.%d\n",
 	       MISDN_MAJOR_VERSION, MISDN_MINOR_VERSION, MISDN_RELEASE);
 	mISDN_init_clock(&debug);
diff -puN drivers/isdn/mISDN/core.h~misdn-add-support-for-group-membership-check drivers/isdn/mISDN/core.h
--- a/drivers/isdn/mISDN/core.h~misdn-add-support-for-group-membership-check
+++ a/drivers/isdn/mISDN/core.h
@@ -17,6 +17,7 @@
 
 extern struct mISDNdevice	*get_mdevice(u_int);
 extern int			get_mdevice_count(void);
+extern kgid_t misdn_permitted_gid;
 
 /* stack status flag */
 #define mISDN_STACK_ACTION_MASK		0x0000ffff
diff -puN drivers/isdn/mISDN/socket.c~misdn-add-support-for-group-membership-check drivers/isdn/mISDN/socket.c
--- a/drivers/isdn/mISDN/socket.c~misdn-add-support-for-group-membership-check
+++ a/drivers/isdn/mISDN/socket.c
@@ -612,6 +612,11 @@ data_sock_create(struct net *net, struct
 {
 	struct sock *sk;
 
+	if (!capable(CAP_SYS_ADMIN) &&
+			!gid_eq(misdn_permitted_gid, current_gid()) &&
+			!in_group_p(misdn_permitted_gid))
+		return -EPERM;
+
 	if (sock->type != SOCK_DGRAM)
 		return -ESOCKTNOSUPPORT;
 
@@ -694,6 +699,10 @@ base_sock_ioctl(struct socket *sock, uns
 	case IMSETDEVNAME:
 	{
 		struct mISDN_devrename dn;
+		if (!capable(CAP_SYS_ADMIN) &&
+				!gid_eq(misdn_permitted_gid, current_gid()) &&
+				!in_group_p(misdn_permitted_gid))
+			return -EPERM;
 		if (copy_from_user(&dn, (void __user *)arg,
 				   sizeof(dn))) {
 			err = -EFAULT;
_

Patches currently in -mm which might be from jeffm@suse.com are

linux-next.patch
drm-nouveau-make-vga_switcheroo-code-depend-on-vga_switcheroo.patch
drivers-net-ethernet-ibm-ehea-ehea_mainc-add-alias-entry-for-portn-properties.patch
misdn-add-support-for-group-membership-check.patch
reiserfs-fix-deadlock-with-nfs-racing-on-create-lookup.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-05-28 23:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-28 23:13 + misdn-add-support-for-group-membership-check.patch added to -mm tree akpm

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.