public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org,
	Greg KH <greg@kroah.com>
Cc: stable-review@kernel.org, torvalds@linux-foundation.org,
	akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk,
	serue@us.ibm.com, Philipp Reisner <philipp.reisner@linbit.com>,
	Lars Ellenberg <lars.ellenberg@linbit.com>,
	Evgeniy Polyakov <zbr@ioremap.net>,
	"David S. Miller" <davem@davemloft.net>,
	Greg Kroah-Hartman <gregkh@suse.de>
Subject: [29/46] connector: Provide the senders credentials to the callback
Date: Fri, 16 Oct 2009 10:10:22 -0700	[thread overview]
Message-ID: <20091016171201.890635877@linux.site> (raw)
In-Reply-To: <20091016171422.GA13339@kroah.com>

[-- Attachment #1: connector-provide-the-sender-s-credentials-to-the-callback.patch --]
[-- Type: text/plain, Size: 8582 bytes --]

2.6.31-stable review patch.  If anyone has any objections, please let us know.

------------------
From: Philipp Reisner <philipp.reisner@linbit.com>

commit 7069331dbe7155f23966f5944109f909fea0c7e4 upstream

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 Documentation/connector/cn_test.c      |    4 +---
 Documentation/connector/connector.txt  |    8 ++++----
 drivers/connector/cn_proc.c            |    3 +--
 drivers/connector/cn_queue.c           |   10 +++++++---
 drivers/connector/connector.c          |    6 +++---
 drivers/md/dm-log-userspace-transfer.c |    3 +--
 drivers/staging/dst/dcore.c            |    3 +--
 drivers/staging/pohmelfs/config.c      |    3 +--
 drivers/video/uvesafb.c                |    3 +--
 drivers/w1/w1_netlink.c                |    3 +--
 include/linux/connector.h              |    6 +++---
 11 files changed, 24 insertions(+), 28 deletions(-)

--- a/Documentation/connector/cn_test.c
+++ b/Documentation/connector/cn_test.c
@@ -32,10 +32,8 @@ static char cn_test_name[] = "cn_test";
 static struct sock *nls;
 static struct timer_list cn_test_timer;
 
-void cn_test_callback(void *data)
+static void cn_test_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
 {
-	struct cn_msg *msg = (struct cn_msg *)data;
-
 	printk("%s: %lu: idx=%x, val=%x, seq=%u, ack=%u, len=%d: %s.\n",
 	       __func__, jiffies, msg->id.idx, msg->id.val,
 	       msg->seq, msg->ack, msg->len, (char *)msg->data);
--- a/Documentation/connector/connector.txt
+++ b/Documentation/connector/connector.txt
@@ -23,7 +23,7 @@ handling...  Connector allows any kernel
 based networking for inter-process communication in a significantly
 easier way:
 
-int cn_add_callback(struct cb_id *id, char *name, void (*callback) (void *));
+int cn_add_callback(struct cb_id *id, char *name, void (*callback) (struct cn_msg *, struct netlink_skb_parms *));
 void cn_netlink_send(struct cn_msg *msg, u32 __group, int gfp_mask);
 
 struct cb_id
@@ -53,15 +53,15 @@ struct cn_msg
 Connector interfaces.
 /*****************************************/
 
-int cn_add_callback(struct cb_id *id, char *name, void (*callback) (void *));
+int cn_add_callback(struct cb_id *id, char *name, void (*callback) (struct cn_msg *, struct netlink_skb_parms *));
 
 Registers new callback with connector core.
 
 struct cb_id *id 		- unique connector's user identifier.
 			  	  It must be registered in connector.h for legal in-kernel users.
 char *name 			- connector's callback symbolic name.
-void (*callback) (void *)	- connector's callback.
-				  Argument must be dereferenced to struct cn_msg *.
+void (*callback) (struct cn..)	- connector's callback.
+				  cn_msg and the sender's credentials
 
 void cn_del_callback(struct cb_id *id);
 
--- a/drivers/connector/cn_proc.c
+++ b/drivers/connector/cn_proc.c
@@ -202,9 +202,8 @@ static void cn_proc_ack(int err, int rcv
  * cn_proc_mcast_ctl
  * @data: message sent from userspace via the connector
  */
-static void cn_proc_mcast_ctl(void *data)
+static void cn_proc_mcast_ctl(struct cn_msg *msg, struct netlink_skb_parms *nsp)
 {
-	struct cn_msg *msg = data;
 	enum proc_cn_mcast_op *mc_op = NULL;
 	int err = 0;
 
--- a/drivers/connector/cn_queue.c
+++ b/drivers/connector/cn_queue.c
@@ -79,8 +79,9 @@ void cn_queue_wrapper(struct work_struct
 		container_of(work, struct cn_callback_entry, work);
 	struct cn_callback_data *d = &cbq->data;
 	struct cn_msg *msg = NLMSG_DATA(nlmsg_hdr(d->skb));
+	struct netlink_skb_parms *nsp = &NETLINK_CB(d->skb);
 
-	d->callback(msg);
+	d->callback(msg, nsp);
 
 	d->destruct_data(d->ddata);
 	d->ddata = NULL;
@@ -88,7 +89,9 @@ void cn_queue_wrapper(struct work_struct
 	kfree(d->free);
 }
 
-static struct cn_callback_entry *cn_queue_alloc_callback_entry(char *name, struct cb_id *id, void (*callback)(void *))
+static struct cn_callback_entry *
+cn_queue_alloc_callback_entry(char *name, struct cb_id *id,
+			      void (*callback)(struct cn_msg *, struct netlink_skb_parms *))
 {
 	struct cn_callback_entry *cbq;
 
@@ -121,7 +124,8 @@ int cn_cb_equal(struct cb_id *i1, struct
 	return ((i1->idx == i2->idx) && (i1->val == i2->val));
 }
 
-int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, void (*callback)(void *))
+int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id,
+			  void (*callback)(struct cn_msg *, struct netlink_skb_parms *))
 {
 	struct cn_callback_entry *cbq, *__cbq;
 	int found = 0;
--- a/drivers/connector/connector.c
+++ b/drivers/connector/connector.c
@@ -268,7 +268,8 @@ static void cn_notify(struct cb_id *id, 
  *
  * May sleep.
  */
-int cn_add_callback(struct cb_id *id, char *name, void (*callback)(void *))
+int cn_add_callback(struct cb_id *id, char *name,
+		    void (*callback)(struct cn_msg *, struct netlink_skb_parms *))
 {
 	int err;
 	struct cn_dev *dev = &cdev;
@@ -350,9 +351,8 @@ static int cn_ctl_msg_equals(struct cn_c
  *
  * Used for notification of a request's processing.
  */
-static void cn_callback(void *data)
+static void cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
 {
-	struct cn_msg *msg = data;
 	struct cn_ctl_msg *ctl;
 	struct cn_ctl_entry *ent;
 	u32 size;
--- a/drivers/md/dm-log-userspace-transfer.c
+++ b/drivers/md/dm-log-userspace-transfer.c
@@ -129,9 +129,8 @@ static int fill_pkg(struct cn_msg *msg, 
  * This is the connector callback that delivers data
  * that was sent from userspace.
  */
-static void cn_ulog_callback(void *data)
+static void cn_ulog_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
 {
-	struct cn_msg *msg = (struct cn_msg *)data;
 	struct dm_ulog_request *tfr = (struct dm_ulog_request *)(msg + 1);
 
 	spin_lock(&receiving_list_lock);
--- a/drivers/staging/dst/dcore.c
+++ b/drivers/staging/dst/dcore.c
@@ -846,10 +846,9 @@ static dst_command_func dst_commands[] =
 /*
  * Configuration parser.
  */
-static void cn_dst_callback(void *data)
+static void cn_dst_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
 {
 	struct dst_ctl *ctl;
-	struct cn_msg *msg = data;
 	int err;
 	struct dst_ctl_ack ack;
 	struct dst_node *n = NULL, *tmp;
--- a/drivers/staging/pohmelfs/config.c
+++ b/drivers/staging/pohmelfs/config.c
@@ -446,9 +446,8 @@ out_unlock:
 	return err;
 }
 
-static void pohmelfs_cn_callback(void *data)
+static void pohmelfs_cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
 {
-	struct cn_msg *msg = data;
 	int err;
 
 	switch (msg->flags) {
--- a/drivers/video/uvesafb.c
+++ b/drivers/video/uvesafb.c
@@ -67,9 +67,8 @@ static DEFINE_MUTEX(uvfb_lock);
  * find the kernel part of the task struct, copy the registers and
  * the buffer contents and then complete the task.
  */
-static void uvesafb_cn_callback(void *data)
+static void uvesafb_cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
 {
-	struct cn_msg *msg = data;
 	struct uvesafb_task *utask;
 	struct uvesafb_ktask *task;
 
--- a/drivers/w1/w1_netlink.c
+++ b/drivers/w1/w1_netlink.c
@@ -306,9 +306,8 @@ static int w1_netlink_send_error(struct 
 	return error;
 }
 
-static void w1_cn_callback(void *data)
+static void w1_cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
 {
-	struct cn_msg *msg = data;
 	struct w1_netlink_msg *m = (struct w1_netlink_msg *)(msg + 1);
 	struct w1_netlink_cmd *cmd;
 	struct w1_slave *sl;
--- a/include/linux/connector.h
+++ b/include/linux/connector.h
@@ -136,7 +136,7 @@ struct cn_callback_data {
 	void *ddata;
 
 	struct sk_buff *skb;
-	void (*callback) (struct cn_msg *);
+	void (*callback) (struct cn_msg *, struct netlink_skb_parms *);
 
 	void *free;
 };
@@ -167,11 +167,11 @@ struct cn_dev {
 	struct cn_queue_dev *cbdev;
 };
 
-int cn_add_callback(struct cb_id *, char *, void (*callback) (void *));
+int cn_add_callback(struct cb_id *, char *, void (*callback) (struct cn_msg *, struct netlink_skb_parms *));
 void cn_del_callback(struct cb_id *);
 int cn_netlink_send(struct cn_msg *, u32, gfp_t);
 
-int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, void (*callback)(void *));
+int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, void (*callback)(struct cn_msg *, struct netlink_skb_parms *));
 void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id);
 
 int queue_cn_work(struct cn_callback_entry *cbq, struct work_struct *work);



  parent reply	other threads:[~2009-10-16 17:23 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20091016170953.128828149@linux.site>
2009-10-16 17:14 ` [00/46] 2.6.31.5-stable review Greg KH
2009-10-16 17:09   ` [01/46] SCSI: Retry ADD_TO_MLQUEUE return value for EH commands Greg KH
2009-10-16 17:09   ` [02/46] SCSI: Fix protection scsi_data_buffer leak Greg KH
2009-10-16 17:09   ` [03/46] SCSI: sg: Free data buffers after calling blk_rq_unmap_user Greg KH
2009-10-16 17:09   ` [04/46] ARM: pxa: workaround errata #37 by not using half turbo switching Greg KH
2009-10-16 17:09   ` [05/46] tracing/filters: Fix memory leak when setting a filter Greg KH
2009-10-16 17:09   ` [06/46] x86/paravirt: Use normal calling sequences for irq enable/disable Greg KH
2009-10-16 17:10   ` [07/46] USB: ftdi_sio: remove tty->low_latency Greg KH
2009-10-16 17:10   ` [08/46] USB: ftdi_sio: remove unused rx_byte counter Greg KH
2009-10-16 17:10   ` [09/46] USB: ftdi_sio: clean up read completion handler Greg KH
2009-10-16 17:10   ` [10/46] USB: ftdi_sio: re-implement read processing Greg KH
2009-10-16 17:10   ` [11/46] USB: pl2303: fix error characters not being reported to ldisc Greg KH
2009-10-16 17:10   ` [12/46] USB: digi_acceleport: Fix broken unthrottle Greg KH
2009-10-16 17:10   ` [13/46] USB: serial: dont call release without attach Greg KH
2009-10-16 17:10   ` [14/46] USB: option: Toshiba G450 device id Greg KH
2009-10-16 17:10   ` [15/46] USB: ipaq: fix oops when device is plugged in Greg KH
2009-10-16 17:10   ` [16/46] USB: cp210x: Add support for the DW700 UART Greg KH
2009-10-16 17:10   ` [17/46] USB: Fix throttling in generic usbserial driver Greg KH
2009-10-16 17:10   ` [18/46] USB: storage: When a device returns no sense data, call it a Hardware Error Greg KH
2009-10-16 17:10   ` [19/46] arm, cris, mips, sparc, powerpc, um, xtensa: fix build with bash 4.0 Greg KH
2009-10-16 17:10   ` [20/46] intel-iommu: Cope with broken HP DC7900 BIOS Greg KH
2009-10-16 17:10   ` [21/46] futex: Detect mismatched requeue targets Greg KH
2009-10-16 17:10   ` [22/46] futex: Fix wakeup race by setting TASK_INTERRUPTIBLE before queue_me() Greg KH
2009-10-16 17:10   ` [23/46] tpm-fixup-pcrs-sysfs-file-update Greg KH
2009-10-16 17:10   ` [24/46] TPM: fix pcrread Greg KH
2009-10-16 17:10   ` [25/46] Bluetooth: Disconnect HIDRAW devices on disconnect Greg KH
2009-10-16 17:10   ` [26/46] Bluetooth: Add extra device reference counting for connections Greg KH
2009-10-16 17:10   ` [27/46] Bluetooth: Let HIDP grab the device reference " Greg KH
2009-10-16 17:10   ` [28/46] connector: Keep the skb in cn_callback_data Greg KH
2009-10-16 17:10   ` Greg KH [this message]
2009-10-16 17:10   ` [30/46] connector: Removed the destruct_data callback since it is always kfree_skb() Greg KH
2009-10-16 17:10   ` [31/46] dm/connector: Only process connector packages from privileged processes Greg KH
2009-10-16 17:10   ` [32/46] dst/connector: Disallow unpliviged users to configure dst Greg KH
2009-10-16 17:10   ` [33/46] pohmelfs/connector: Disallow unpliviged users to configure pohmelfs Greg KH
2009-10-16 17:10   ` [34/46] uvesafb/connector: Disallow unpliviged users to send netlink packets Greg KH
2009-10-16 17:10   ` [35/46] e1000e: swap max hw supported frame size between 82574 and 82583 Greg KH
2009-10-16 17:10   ` [36/46] MAINTAINERS: Fix Riku Voipios address Greg KH
2009-10-16 17:10   ` [37/46] macintosh: Dont assume i2c device probing always succeeds Greg KH
2009-10-16 17:10   ` [38/46] i2c: Hide probe errors caused by ACPI resource conflicts Greg KH
2009-10-16 17:10   ` [39/46] ALSA: Dont assume i2c device probing always succeeds Greg KH
2009-10-16 17:10   ` [40/46] bsdacct: switch credentials for writing to the accounting file Greg KH
2009-10-16 17:10   ` [41/46] sysfs: Allow sysfs_notify_dirent to be called from interrupt context Greg KH
2009-10-16 17:10   ` [42/46] Staging: rt2860sta: prevent a panic when disabling when associated Greg KH
2009-10-16 17:10   ` [43/46] usb-storage: Workaround devices with bogus sense size Greg KH
2009-10-16 17:10   ` [44/46] iwlwifi: incorrect method used for finding valid OTP blocks Greg KH
2009-10-16 17:10   ` [45/46] mac80211: fix vlan and optimise RX Greg KH
2009-10-16 17:10   ` [46/46] tty: Make flush_to_ldisc() locking more robust Greg KH
2009-10-16 17:57   ` [00/46] 2.6.31.5-stable review Massimo Cetra
2009-10-16 18:03     ` Greg KH
2009-10-17  5:20       ` Massimo Cetra
2009-11-05 23:12         ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091016171201.890635877@linux.site \
    --to=gregkh@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=davem@davemloft.net \
    --cc=greg@kroah.com \
    --cc=lars.ellenberg@linbit.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=philipp.reisner@linbit.com \
    --cc=serue@us.ibm.com \
    --cc=stable-review@kernel.org \
    --cc=stable@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=zbr@ioremap.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox