1. 14 Nov, 2018 1 commit
  2. 25 May, 2018 1 commit
    • Alex Elder's avatar
      soc: qcom: qmi: fix a buffer sizing bug · 7df5ff25
      Alex Elder authored
      
      In qmi_handle_init(), a buffer is allocated for to hold messages
      received through the handle's socket.  Any "normal" messages
      (expected by the caller) will have a header prepended, so the
      buffer size is adjusted to accomodate that.
      
      The buffer must also be of sufficient size to receive control
      messages, so the size is increased if necessary to ensure these
      will fit.
      
      Unfortunately the calculation is done wrong, making it possible
      for the calculated buffer size to be too small to hold a "normal"
      message.  Specifically, if:
      
        recv_buf_size > sizeof(struct qrtr_ctrl_pkt) - sizeof(struct qmi_header)
      		AND
        recv_buf_size < sizeof(struct qrtr_ctrl_pkt)
      
      the current logic will use sizeof(struct qrtr_ctrl_pkt) as the
      receive buffer size, which is not enough to hold the maximum
      "normal" message plus its header.  Currently this problem occurs
      for (13 < recv_buf_size < 20).
      
      This patch corrects this.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Reviewed-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
      Signed-off-by: default avatarAndy Gross <andy.gross@linaro.org>
      7df5ff25
  3. 12 Feb, 2018 1 commit
    • Denys Vlasenko's avatar
      net: make getname() functions return length rather than use int* parameter · 9b2c45d4
      Denys Vlasenko authored
      Changes since v1:
      Added changes in these files:
          drivers/infiniband/hw/usnic/usnic_transport.c
          drivers/staging/lustre/lnet/lnet/lib-socket.c
          drivers/target/iscsi/iscsi_target_login.c
          drivers/vhost/net.c
          fs/dlm/lowcomms.c
          fs/ocfs2/cluster/tcp.c
          security/tomoyo/network.c
      
      Before:
      All these functions either return a negative error indicator,
      or store length of sockaddr into "int *socklen" parameter
      and return zero on success.
      
      "int *socklen" parameter is awkward. For example, if caller does not
      care, it still needs to provide on-stack storage for the value
      it does not need.
      
      None of the many FOO_getname() functions of various protocols
      ever used old value of *socklen. They always just overwrite it.
      
      This change drops this parameter, and makes all these functions, on success,
      return length of sockaddr. It's always >= 0 and can be differentiated
      from an error.
      
      Tests in callers are changed from "if (err)" to "...
      9b2c45d4
  4. 20 Dec, 2017 1 commit