Merge branch 'master' into for-next
authorJiri Kosina <jkosina@suse.cz>
Sun, 28 Oct 2012 18:28:52 +0000 (19:28 +0100)
committerJiri Kosina <jkosina@suse.cz>
Sun, 28 Oct 2012 18:29:19 +0000 (19:29 +0100)
Sync up with Linus' tree to be able to apply Cesar's patch
against newer version of the code.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
1  2 
README
drivers/char/ppdev.c
drivers/target/iscsi/iscsi_target_parameters.c
drivers/tty/hvc/hvc_vio.c
drivers/tty/serial/8250/Kconfig
drivers/tty/serial/bfin_uart.c
mm/util.c
net/rfkill/core.c
security/keys/process_keys.c

diff --combined README
index b9a171a0183cd18a713d201fdec4a600fc2d0f00,f32710a817fc392262f5f890cb637e5e0b1b5d1a..a24ec89ba4420ad38e8848422ca5f69baa5ffe1c
--- 1/README
--- 2/README
+++ b/README
@@@ -180,10 -180,6 +180,10 @@@ CONFIGURING the kernel
                          with questions already answered.
                          Additionally updates the dependencies.
  
 +     "make olddefconfig"
 +                        Like above, but sets new symbols to their default
 +                        values without prompting.
 +
       "make defconfig"   Create a ./.config file by using the default
                          symbol values from either arch/$ARCH/defconfig
                          or arch/$ARCH/configs/${PLATFORM}_defconfig,
       "make randconfig"  Create a ./.config file by setting symbol
                          values to random values.
  
+      "make localmodconfig" Create a config based on current config and
+                            loaded modules (lsmod). Disables any module
+                            option that is not needed for the loaded modules.
+                            To create a localmodconfig for another machine,
+                            store the lsmod of that machine into a file
+                            and pass it in as a LSMOD parameter.
+                    target$ lsmod > /tmp/mylsmod
+                    target$ scp /tmp/mylsmod host:/tmp
+                    host$ make LSMOD=/tmp/mylsmod localmodconfig
+                            The above also works when cross compiling.
+      "make localyesconfig" Similar to localmodconfig, except it will convert
+                            all module options to built in (=y) options.
     You can find more information on using the Linux kernel config tools
     in Documentation/kbuild/kconfig.txt.
  
diff --combined drivers/char/ppdev.c
index 99c51b4b07e71c9804f6aa436dda95f631bb3e24,d0d824ebf2c187d492f29daef8bbf1043f56d7f1..1cd49241e60eb5024ac2941a5b0787fa46f7c13e
@@@ -251,8 -251,12 +251,8 @@@ static ssize_t pp_write (struct file * 
                        break;
                }
  
 -              if (signal_pending (current)) {
 -                      if (!bytes_written) {
 -                              bytes_written = -EINTR;
 -                      }
 +              if (signal_pending (current))
                        break;
 -              }
  
                cond_resched();
        }
@@@ -779,7 -783,8 +779,8 @@@ static int __init ppdev_init (void
                err = PTR_ERR(ppdev_class);
                goto out_chrdev;
        }
-       if (parport_register_driver(&pp_driver)) {
+       err = parport_register_driver(&pp_driver);
+       if (err < 0) {
                printk (KERN_WARNING CHRDEV ": unable to register with parport\n");
                goto out_class;
        }
index 1e5c5a8587acaa562cdda8615f33438e53d37b1f,90b740048f26ee7151eda956b092e12fad74e70c..1bf7432bfcbc659f8b27dc15400016b31173add3
@@@ -334,6 -334,13 +334,13 @@@ int iscsi_create_default_params(struct 
        if (!param)
                goto out;
  
+       param = iscsi_set_default_param(pl, MAXXMITDATASEGMENTLENGTH,
+                       INITIAL_MAXXMITDATASEGMENTLENGTH,
+                       PHASE_OPERATIONAL, SCOPE_CONNECTION_ONLY, SENDER_BOTH,
+                       TYPERANGE_512_TO_16777215, USE_ALL);
+       if (!param)
+               goto out;
        param = iscsi_set_default_param(pl, MAXRECVDATASEGMENTLENGTH,
                        INITIAL_MAXRECVDATASEGMENTLENGTH,
                        PHASE_OPERATIONAL, SCOPE_CONNECTION_ONLY, SENDER_BOTH,
@@@ -467,6 -474,8 +474,8 @@@ int iscsi_set_keys_to_negotiate
                        SET_PSTATE_NEGOTIATE(param);
                } else if (!strcmp(param->name, MAXRECVDATASEGMENTLENGTH)) {
                        SET_PSTATE_NEGOTIATE(param);
+               } else if (!strcmp(param->name, MAXXMITDATASEGMENTLENGTH)) {
+                       continue;
                } else if (!strcmp(param->name, MAXBURSTLENGTH)) {
                        SET_PSTATE_NEGOTIATE(param);
                } else if (!strcmp(param->name, FIRSTBURSTLENGTH)) {
@@@ -1056,7 -1065,8 +1065,8 @@@ out
        return proposer_values;
  }
  
- static int iscsi_check_acceptor_state(struct iscsi_param *param, char *value)
+ static int iscsi_check_acceptor_state(struct iscsi_param *param, char *value,
+                               struct iscsi_conn *conn)
  {
        u8 acceptor_boolean_value = 0, proposer_boolean_value = 0;
        char *negoitated_value = NULL;
                                return -1;
                }
  
-               if (!strcmp(param->name, MAXRECVDATASEGMENTLENGTH))
-                       SET_PSTATE_REPLY_OPTIONAL(param);
+               if (!strcmp(param->name, MAXRECVDATASEGMENTLENGTH)) {
+                       struct iscsi_param *param_mxdsl;
+                       unsigned long long tmp;
+                       int rc;
+                       rc = strict_strtoull(param->value, 0, &tmp);
+                       if (rc < 0)
+                               return -1;
+                       conn->conn_ops->MaxRecvDataSegmentLength = tmp;
+                       pr_debug("Saving op->MaxRecvDataSegmentLength from"
+                               " original initiator received value: %u\n",
+                               conn->conn_ops->MaxRecvDataSegmentLength);
+                       param_mxdsl = iscsi_find_param_from_key(
+                                               MAXXMITDATASEGMENTLENGTH,
+                                               conn->param_list);
+                       if (!param_mxdsl)
+                               return -1;
+                       rc = iscsi_update_param_value(param,
+                                               param_mxdsl->value);
+                       if (rc < 0)
+                               return -1;
+                       pr_debug("Updated %s to target MXDSL value: %s\n",
+                                       param->name, param->value);
+               }
        } else if (IS_TYPE_NUMBER_RANGE(param)) {
                negoitated_value = iscsi_get_value_from_number_range(
                                        param, value);
@@@ -1395,7 -1432,6 +1432,7 @@@ static struct iscsi_param *iscsi_check_
                        break;
                case PHASE_OPERATIONAL:
                        pr_debug("Operational phase.\n");
 +                      break;
                default:
                        pr_debug("Unknown phase.\n");
                }
@@@ -1527,8 -1563,9 +1564,9 @@@ int iscsi_decode_text_input
        u8 sender,
        char *textbuf,
        u32 length,
-       struct iscsi_param_list *param_list)
+       struct iscsi_conn *conn)
  {
+       struct iscsi_param_list *param_list = conn->param_list;
        char *tmpbuf, *start = NULL, *end = NULL;
  
        tmpbuf = kzalloc(length + 1, GFP_KERNEL);
                        }
                        SET_PSTATE_RESPONSE_GOT(param);
                } else {
-                       if (iscsi_check_acceptor_state(param, value) < 0) {
+                       if (iscsi_check_acceptor_state(param, value, conn) < 0) {
                                kfree(tmpbuf);
                                return -1;
                        }
@@@ -1721,6 -1758,18 +1759,18 @@@ void iscsi_set_connection_parameters
        pr_debug("---------------------------------------------------"
                        "---------------\n");
        list_for_each_entry(param, &param_list->param_list, p_list) {
+               /*
+                * Special case to set MAXXMITDATASEGMENTLENGTH from the
+                * target requested MaxRecvDataSegmentLength, even though
+                * this key is not sent over the wire.
+                */
+               if (!strcmp(param->name, MAXXMITDATASEGMENTLENGTH)) {
+                       ops->MaxXmitDataSegmentLength =
+                               simple_strtoul(param->value, &tmpptr, 0);
+                       pr_debug("MaxXmitDataSegmentLength:     %s\n",
+                               param->value);
+               }
                if (!IS_PSTATE_ACCEPTOR(param) && !IS_PSTATE_PROPOSER(param))
                        continue;
                if (!strcmp(param->name, AUTHMETHOD)) {
                        pr_debug("DataDigest:                   %s\n",
                                param->value);
                } else if (!strcmp(param->name, MAXRECVDATASEGMENTLENGTH)) {
-                       ops->MaxRecvDataSegmentLength =
-                               simple_strtoul(param->value, &tmpptr, 0);
-                       pr_debug("MaxRecvDataSegmentLength:     %s\n",
-                               param->value);
+                       /*
+                        * At this point iscsi_check_acceptor_state() will have
+                        * set ops->MaxRecvDataSegmentLength from the original
+                        * initiator provided value.
+                        */
+                       pr_debug("MaxRecvDataSegmentLength:     %u\n",
+                               ops->MaxRecvDataSegmentLength);
                } else if (!strcmp(param->name, OFMARKER)) {
                        ops->OFMarker = !strcmp(param->value, YES);
                        pr_debug("OFMarker:                     %s\n",
index 56e97258e55ac1df9078e1c1c02a85356ea5b7c0,070c0ee6864239c5d395f71d37d563edcbbee7be..1a5894c6dfa4b5096f84f99657995f9d0983afab
@@@ -230,6 -230,69 +230,69 @@@ static const struct hv_ops hvterm_hvsi_
        .tiocmset = hvterm_hvsi_tiocmset,
  };
  
+ static void udbg_hvc_putc(char c)
+ {
+       int count = -1;
+       if (!hvterm_privs[0])
+               return;
+       if (c == '\n')
+               udbg_hvc_putc('\r');
+       do {
+               switch(hvterm_privs[0]->proto) {
+               case HV_PROTOCOL_RAW:
+                       count = hvterm_raw_put_chars(0, &c, 1);
+                       break;
+               case HV_PROTOCOL_HVSI:
+                       count = hvterm_hvsi_put_chars(0, &c, 1);
+                       break;
+               }
+       } while(count == 0);
+ }
+ static int udbg_hvc_getc_poll(void)
+ {
+       int rc = 0;
+       char c;
+       if (!hvterm_privs[0])
+               return -1;
+       switch(hvterm_privs[0]->proto) {
+       case HV_PROTOCOL_RAW:
+               rc = hvterm_raw_get_chars(0, &c, 1);
+               break;
+       case HV_PROTOCOL_HVSI:
+               rc = hvterm_hvsi_get_chars(0, &c, 1);
+               break;
+       }
+       if (!rc)
+               return -1;
+       return c;
+ }
+ static int udbg_hvc_getc(void)
+ {
+       int ch;
+       if (!hvterm_privs[0])
+               return -1;
+       for (;;) {
+               ch = udbg_hvc_getc_poll();
+               if (ch == -1) {
+                       /* This shouldn't be needed...but... */
+                       volatile unsigned long delay;
+                       for (delay=0; delay < 2000000; delay++)
+                               ;
+               } else {
+                       return ch;
+               }
+       }
+ }
  static int __devinit hvc_vio_probe(struct vio_dev *vdev,
                                   const struct vio_device_id *id)
  {
                proto = HV_PROTOCOL_HVSI;
                ops = &hvterm_hvsi_ops;
        } else {
 -              pr_err("hvc_vio: Unkown protocol for %s\n", vdev->dev.of_node->full_name);
 +              pr_err("hvc_vio: Unknown protocol for %s\n", vdev->dev.of_node->full_name);
                return -ENXIO;
        }
  
                return PTR_ERR(hp);
        dev_set_drvdata(&vdev->dev, hp);
  
+       /* register udbg if it's not there already for console 0 */
+       if (hp->index == 0 && !udbg_putc) {
+               udbg_putc = udbg_hvc_putc;
+               udbg_getc = udbg_hvc_getc;
+               udbg_getc_poll = udbg_hvc_getc_poll;
+       }
        return 0;
  }
  
@@@ -331,59 -401,6 +401,6 @@@ static void __exit hvc_vio_exit(void
  }
  module_exit(hvc_vio_exit);
  
- static void udbg_hvc_putc(char c)
- {
-       int count = -1;
-       if (c == '\n')
-               udbg_hvc_putc('\r');
-       do {
-               switch(hvterm_priv0.proto) {
-               case HV_PROTOCOL_RAW:
-                       count = hvterm_raw_put_chars(0, &c, 1);
-                       break;
-               case HV_PROTOCOL_HVSI:
-                       count = hvterm_hvsi_put_chars(0, &c, 1);
-                       break;
-               }
-       } while(count == 0);
- }
- static int udbg_hvc_getc_poll(void)
- {
-       int rc = 0;
-       char c;
-       switch(hvterm_priv0.proto) {
-       case HV_PROTOCOL_RAW:
-               rc = hvterm_raw_get_chars(0, &c, 1);
-               break;
-       case HV_PROTOCOL_HVSI:
-               rc = hvterm_hvsi_get_chars(0, &c, 1);
-               break;
-       }
-       if (!rc)
-               return -1;
-       return c;
- }
- static int udbg_hvc_getc(void)
- {
-       int ch;
-       for (;;) {
-               ch = udbg_hvc_getc_poll();
-               if (ch == -1) {
-                       /* This shouldn't be needed...but... */
-                       volatile unsigned long delay;
-                       for (delay=0; delay < 2000000; delay++)
-                               ;
-               } else {
-                       return ch;
-               }
-       }
- }
  void __init hvc_vio_init_early(void)
  {
        struct device_node *stdout_node;
index 93958000a1335f817b854091d55d120663a3818a,f3d283f2e3aa280598867500de23f142cb050670..c31133a6ea8e0361f1f84103c469026bda82c077
@@@ -33,6 -33,14 +33,14 @@@ config SERIAL_825
          Most people will say Y or M here, so that they can use serial mice,
          modems and similar devices connecting to the standard serial ports.
  
+ config SERIAL_8250_PNP
+       bool "8250/16550 PNP device support" if EXPERT
+       depends on SERIAL_8250 && PNP
+       default y
+       ---help---
+         This builds standard PNP serial support. You may be able to
+         disable this feature if you only need legacy serial support.
  config SERIAL_8250_CONSOLE
        bool "Console on 8250/16550 and compatible serial port"
        depends on SERIAL_8250=y
@@@ -85,14 -93,6 +93,6 @@@ config SERIAL_8250_PC
          disable this feature if you only need legacy serial support.
          Saves about 9K.
  
- config SERIAL_8250_PNP
-       tristate "8250/16550 PNP device support" if EXPERT
-       depends on SERIAL_8250 && PNP
-       default SERIAL_8250
-       help
-         This builds standard PNP serial support. You may be able to
-         disable this feature if you only need legacy serial support.
  config SERIAL_8250_HP300
        tristate
        depends on SERIAL_8250 && HP300
@@@ -271,7 -271,7 +271,7 @@@ config SERIAL_8250_D
          present in the Synopsys DesignWare APB UART.
  
  config SERIAL_8250_EM
 -      tristate "Support for Emma Mobile intergrated serial port"
 +      tristate "Support for Emma Mobile integrated serial port"
        depends on SERIAL_8250 && ARM && HAVE_CLK
        help
          Selecting this option will add support for the integrated serial
index 58913eecefe5b1611b01df36fc2cf629a9fa38bb,9242d56ba2670d4aebc21749d9003c4d42986a35..9b11c3f23eae98fcfad2c97f9983ef5b91928ac1
@@@ -182,7 -182,7 +182,7 @@@ static void bfin_serial_start_tx(struc
         * To avoid losting RX interrupt, we reset IR function
         * before sending data.
         */
-       if (tty->termios->c_line == N_IRDA)
+       if (tty->termios.c_line == N_IRDA)
                bfin_serial_reset_irda(port);
  
  #ifdef CONFIG_SERIAL_BFIN_DMA
@@@ -815,7 -815,7 +815,7 @@@ bfin_serial_set_termios(struct uart_por
                lcr = WLS(5);
                break;
        default:
 -              printk(KERN_ERR "%s: word lengh not supported\n",
 +              printk(KERN_ERR "%s: word length not supported\n",
                        __func__);
        }
  
diff --combined mm/util.c
index 3a5278c08d76157343686ecfd2abe78e31ac924f,dc3036cdcc6a60ac4e8bea6521279b2cff687bcb..c55e26b17d93de77dc069d7f30019f7391e0d93f
+++ b/mm/util.c
@@@ -105,6 -105,25 +105,25 @@@ void *memdup_user(const void __user *sr
  }
  EXPORT_SYMBOL(memdup_user);
  
+ static __always_inline void *__do_krealloc(const void *p, size_t new_size,
+                                          gfp_t flags)
+ {
+       void *ret;
+       size_t ks = 0;
+       if (p)
+               ks = ksize(p);
+       if (ks >= new_size)
+               return (void *)p;
+       ret = kmalloc_track_caller(new_size, flags);
+       if (ret && p)
+               memcpy(ret, p, ks);
+       return ret;
+ }
  /**
   * __krealloc - like krealloc() but don't free @p.
   * @p: object to reallocate memory for.
   */
  void *__krealloc(const void *p, size_t new_size, gfp_t flags)
  {
-       void *ret;
-       size_t ks = 0;
        if (unlikely(!new_size))
                return ZERO_SIZE_PTR;
  
-       if (p)
-               ks = ksize(p);
+       return __do_krealloc(p, new_size, flags);
  
-       if (ks >= new_size)
-               return (void *)p;
-       ret = kmalloc_track_caller(new_size, flags);
-       if (ret && p)
-               memcpy(ret, p, ks);
-       return ret;
  }
  EXPORT_SYMBOL(__krealloc);
  
   *
   * The contents of the object pointed to are preserved up to the
   * lesser of the new and old sizes.  If @p is %NULL, krealloc()
 - * behaves exactly like kmalloc().  If @size is 0 and @p is not a
 + * behaves exactly like kmalloc().  If @new_size is 0 and @p is not a
   * %NULL pointer, the object pointed to is freed.
   */
  void *krealloc(const void *p, size_t new_size, gfp_t flags)
                return ZERO_SIZE_PTR;
        }
  
-       ret = __krealloc(p, new_size, flags);
+       ret = __do_krealloc(p, new_size, flags);
        if (ret && p != ret)
                kfree(p);
  
diff --combined net/rfkill/core.c
index 61c112c890a99bdace1ca6756efe0eb441c95eec,a5c95274127990b34de5af72f82e9135cf73aa85..9b9be5279f5dac83f53b1027f10144fe91d6bf98
@@@ -150,6 -150,20 +150,20 @@@ static void rfkill_led_trigger_activate
        rfkill_led_trigger_event(rfkill);
  }
  
+ const char *rfkill_get_led_trigger_name(struct rfkill *rfkill)
+ {
+       return rfkill->led_trigger.name;
+ }
+ EXPORT_SYMBOL(rfkill_get_led_trigger_name);
+ void rfkill_set_led_trigger_name(struct rfkill *rfkill, const char *name)
+ {
+       BUG_ON(!rfkill);
+       rfkill->ledtrigname = name;
+ }
+ EXPORT_SYMBOL(rfkill_set_led_trigger_name);
  static int rfkill_led_trigger_register(struct rfkill *rfkill)
  {
        rfkill->led_trigger.name = rfkill->ledtrigname
@@@ -256,6 -270,7 +270,7 @@@ static bool __rfkill_set_hw_state(struc
  static void rfkill_set_block(struct rfkill *rfkill, bool blocked)
  {
        unsigned long flags;
+       bool prev, curr;
        int err;
  
        if (unlikely(rfkill->dev.power.power_state.event & PM_EVENT_SLEEP))
                rfkill->ops->query(rfkill, rfkill->data);
  
        spin_lock_irqsave(&rfkill->lock, flags);
+       prev = rfkill->state & RFKILL_BLOCK_SW;
        if (rfkill->state & RFKILL_BLOCK_SW)
                rfkill->state |= RFKILL_BLOCK_SW_PREV;
        else
        }
        rfkill->state &= ~RFKILL_BLOCK_SW_SETCALL;
        rfkill->state &= ~RFKILL_BLOCK_SW_PREV;
+       curr = rfkill->state & RFKILL_BLOCK_SW;
        spin_unlock_irqrestore(&rfkill->lock, flags);
  
        rfkill_led_trigger_event(rfkill);
-       rfkill_event(rfkill);
+       if (prev != curr)
+               rfkill_event(rfkill);
  }
  
  #ifdef CONFIG_RFKILL_INPUT
@@@ -656,7 -676,7 +676,7 @@@ static ssize_t rfkill_soft_store(struc
        rfkill_set_block(rfkill, state);
        mutex_unlock(&rfkill_global_mutex);
  
 -      return err ?: count;
 +      return count;
  }
  
  static u8 user_state_from_blocked(unsigned long state)
@@@ -701,7 -721,7 +721,7 @@@ static ssize_t rfkill_state_store(struc
        rfkill_set_block(rfkill, state == RFKILL_USER_STATE_SOFT_BLOCKED);
        mutex_unlock(&rfkill_global_mutex);
  
 -      return err ?: count;
 +      return count;
  }
  
  static ssize_t rfkill_claim_show(struct device *dev,
index 178b8c3b130a4fe374bea90e2e36ab0c8655c4f8,a58f712605d83105b6d32e1b966436a454331a90..86468f385fc8ef1ac0422afb117114f8d81b6ba4
@@@ -34,8 -34,7 +34,7 @@@ struct key_user root_key_user = 
        .lock           = __SPIN_LOCK_UNLOCKED(root_key_user.lock),
        .nkeys          = ATOMIC_INIT(2),
        .nikeys         = ATOMIC_INIT(2),
-       .uid            = 0,
-       .user_ns        = &init_user_ns,
+       .uid            = GLOBAL_ROOT_UID,
  };
  
  /*
@@@ -48,11 -47,13 +47,13 @@@ int install_user_keyrings(void
        struct key *uid_keyring, *session_keyring;
        char buf[20];
        int ret;
+       uid_t uid;
  
        cred = current_cred();
        user = cred->user;
+       uid = from_kuid(cred->user_ns, user->uid);
  
-       kenter("%p{%u}", user, user->uid);
+       kenter("%p{%u}", user, uid);
  
        if (user->uid_keyring) {
                kleave(" = 0 [exist]");
                 * - there may be one in existence already as it may have been
                 *   pinned by a session, but the user_struct pointing to it
                 *   may have been destroyed by setuid */
-               sprintf(buf, "_uid.%u", user->uid);
+               sprintf(buf, "_uid.%u", uid);
  
                uid_keyring = find_keyring_by_name(buf, true);
                if (IS_ERR(uid_keyring)) {
-                       uid_keyring = keyring_alloc(buf, user->uid, (gid_t) -1,
+                       uid_keyring = keyring_alloc(buf, user->uid, INVALID_GID,
                                                    cred, KEY_ALLOC_IN_QUOTA,
                                                    NULL);
                        if (IS_ERR(uid_keyring)) {
  
                /* get a default session keyring (which might also exist
                 * already) */
-               sprintf(buf, "_uid_ses.%u", user->uid);
+               sprintf(buf, "_uid_ses.%u", uid);
  
                session_keyring = find_keyring_by_name(buf, true);
                if (IS_ERR(session_keyring)) {
                        session_keyring =
-                               keyring_alloc(buf, user->uid, (gid_t) -1,
+                               keyring_alloc(buf, user->uid, INVALID_GID,
                                              cred, KEY_ALLOC_IN_QUOTA, NULL);
                        if (IS_ERR(session_keyring)) {
                                ret = PTR_ERR(session_keyring);
@@@ -357,6 -358,8 +358,6 @@@ key_ref_t search_my_process_keyrings(st
  
                switch (PTR_ERR(key_ref)) {
                case -EAGAIN: /* no key */
 -                      if (ret)
 -                              break;
                case -ENOKEY: /* negative key */
                        ret = key_ref;
                        break;