diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-11 22:40:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-11 22:40:14 -0400 |
commit | 038a5008b2f395c85e6e71d6ddf3c684e7c405b0 (patch) | |
tree | 4735eab577e97e5a22c3141e3f60071c8065585e /drivers/scsi | |
parent | dd6d1844af33acb4edd0a40b1770d091a22c94be (diff) | |
parent | 266918303226cceac7eca38ced30f15f277bd89c (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (867 commits)
[SKY2]: status polling loop (post merge)
[NET]: Fix NAPI completion handling in some drivers.
[TCP]: Limit processing lost_retrans loop to work-to-do cases
[TCP]: Fix lost_retrans loop vs fastpath problems
[TCP]: No need to re-count fackets_out/sacked_out at RTO
[TCP]: Extract tcp_match_queue_to_sack from sacktag code
[TCP]: Kill almost unused variable pcount from sacktag
[TCP]: Fix mark_head_lost to ignore R-bit when trying to mark L
[TCP]: Add bytes_acked (ABC) clearing to FRTO too
[IPv6]: Update setsockopt(IPV6_MULTICAST_IF) to support RFC 3493, try2
[NETFILTER]: x_tables: add missing ip6t_modulename aliases
[NETFILTER]: nf_conntrack_tcp: fix connection reopening
[QETH]: fix qeth_main.c
[NETLINK]: fib_frontend build fixes
[IPv6]: Export userland ND options through netlink (RDNSS support)
[9P]: build fix with !CONFIG_SYSCTL
[NET]: Fix dev_put() and dev_hold() comments
[NET]: make netlink user -> kernel interface synchronious
[NET]: unify netlink kernel socket recognition
[NET]: cleanup 3rd argument in netlink_sendskb
...
Fix up conflicts manually in Documentation/feature-removal-schedule.txt
and my new least favourite crap, the "mod_devicetable" support in the
files include/linux/mod_devicetable.h and scripts/mod/file2alias.c.
(The latter files seem to be explicitly _designed_ to get conflicts when
different subsystems work with them - that have an absolutely horrid
lack of subsystem separation!)
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/scsi_netlink.c | 27 | ||||
-rw-r--r-- | drivers/scsi/scsi_transport_iscsi.c | 84 |
2 files changed, 39 insertions, 72 deletions
diff --git a/drivers/scsi/scsi_netlink.c b/drivers/scsi/scsi_netlink.c index 4bf9aa547c78..40579edca101 100644 --- a/drivers/scsi/scsi_netlink.c +++ b/drivers/scsi/scsi_netlink.c | |||
@@ -64,7 +64,7 @@ scsi_nl_rcv_msg(struct sk_buff *skb) | |||
64 | 64 | ||
65 | if (nlh->nlmsg_type != SCSI_TRANSPORT_MSG) { | 65 | if (nlh->nlmsg_type != SCSI_TRANSPORT_MSG) { |
66 | err = -EBADMSG; | 66 | err = -EBADMSG; |
67 | goto next_msg; | 67 | return; |
68 | } | 68 | } |
69 | 69 | ||
70 | hdr = NLMSG_DATA(nlh); | 70 | hdr = NLMSG_DATA(nlh); |
@@ -99,27 +99,6 @@ next_msg: | |||
99 | 99 | ||
100 | 100 | ||
101 | /** | 101 | /** |
102 | * scsi_nl_rcv_msg - | ||
103 | * Receive handler for a socket. Extracts a received message buffer from | ||
104 | * the socket, and starts message processing. | ||
105 | * | ||
106 | * @sk: socket | ||
107 | * @len: unused | ||
108 | * | ||
109 | **/ | ||
110 | static void | ||
111 | scsi_nl_rcv(struct sock *sk, int len) | ||
112 | { | ||
113 | struct sk_buff *skb; | ||
114 | |||
115 | while ((skb = skb_dequeue(&sk->sk_receive_queue))) { | ||
116 | scsi_nl_rcv_msg(skb); | ||
117 | kfree_skb(skb); | ||
118 | } | ||
119 | } | ||
120 | |||
121 | |||
122 | /** | ||
123 | * scsi_nl_rcv_event - | 102 | * scsi_nl_rcv_event - |
124 | * Event handler for a netlink socket. | 103 | * Event handler for a netlink socket. |
125 | * | 104 | * |
@@ -167,8 +146,8 @@ scsi_netlink_init(void) | |||
167 | return; | 146 | return; |
168 | } | 147 | } |
169 | 148 | ||
170 | scsi_nl_sock = netlink_kernel_create(NETLINK_SCSITRANSPORT, | 149 | scsi_nl_sock = netlink_kernel_create(&init_net, NETLINK_SCSITRANSPORT, |
171 | SCSI_NL_GRP_CNT, scsi_nl_rcv, NULL, | 150 | SCSI_NL_GRP_CNT, scsi_nl_rcv_msg, NULL, |
172 | THIS_MODULE); | 151 | THIS_MODULE); |
173 | if (!scsi_nl_sock) { | 152 | if (!scsi_nl_sock) { |
174 | printk(KERN_ERR "%s: register of recieve handler failed\n", | 153 | printk(KERN_ERR "%s: register of recieve handler failed\n", |
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 34c1860a259d..5428d15f23c6 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c | |||
@@ -1097,61 +1097,49 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
1097 | } | 1097 | } |
1098 | 1098 | ||
1099 | /* | 1099 | /* |
1100 | * Get message from skb (based on rtnetlink_rcv_skb). Each message is | 1100 | * Get message from skb. Each message is processed by iscsi_if_recv_msg. |
1101 | * processed by iscsi_if_recv_msg. Malformed skbs with wrong lengths or | 1101 | * Malformed skbs with wrong lengths or invalid creds are not processed. |
1102 | * invalid creds are discarded silently. | ||
1103 | */ | 1102 | */ |
1104 | static void | 1103 | static void |
1105 | iscsi_if_rx(struct sock *sk, int len) | 1104 | iscsi_if_rx(struct sk_buff *skb) |
1106 | { | 1105 | { |
1107 | struct sk_buff *skb; | ||
1108 | |||
1109 | mutex_lock(&rx_queue_mutex); | 1106 | mutex_lock(&rx_queue_mutex); |
1110 | while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) { | 1107 | while (skb->len >= NLMSG_SPACE(0)) { |
1111 | if (NETLINK_CREDS(skb)->uid) { | 1108 | int err; |
1112 | skb_pull(skb, skb->len); | 1109 | uint32_t rlen; |
1113 | goto free_skb; | 1110 | struct nlmsghdr *nlh; |
1111 | struct iscsi_uevent *ev; | ||
1112 | |||
1113 | nlh = nlmsg_hdr(skb); | ||
1114 | if (nlh->nlmsg_len < sizeof(*nlh) || | ||
1115 | skb->len < nlh->nlmsg_len) { | ||
1116 | break; | ||
1114 | } | 1117 | } |
1115 | 1118 | ||
1116 | while (skb->len >= NLMSG_SPACE(0)) { | 1119 | ev = NLMSG_DATA(nlh); |
1117 | int err; | 1120 | rlen = NLMSG_ALIGN(nlh->nlmsg_len); |
1118 | uint32_t rlen; | 1121 | if (rlen > skb->len) |
1119 | struct nlmsghdr *nlh; | 1122 | rlen = skb->len; |
1120 | struct iscsi_uevent *ev; | ||
1121 | 1123 | ||
1122 | nlh = nlmsg_hdr(skb); | 1124 | err = iscsi_if_recv_msg(skb, nlh); |
1123 | if (nlh->nlmsg_len < sizeof(*nlh) || | 1125 | if (err) { |
1124 | skb->len < nlh->nlmsg_len) { | 1126 | ev->type = ISCSI_KEVENT_IF_ERROR; |
1125 | break; | 1127 | ev->iferror = err; |
1126 | } | ||
1127 | |||
1128 | ev = NLMSG_DATA(nlh); | ||
1129 | rlen = NLMSG_ALIGN(nlh->nlmsg_len); | ||
1130 | if (rlen > skb->len) | ||
1131 | rlen = skb->len; | ||
1132 | |||
1133 | err = iscsi_if_recv_msg(skb, nlh); | ||
1134 | if (err) { | ||
1135 | ev->type = ISCSI_KEVENT_IF_ERROR; | ||
1136 | ev->iferror = err; | ||
1137 | } | ||
1138 | do { | ||
1139 | /* | ||
1140 | * special case for GET_STATS: | ||
1141 | * on success - sending reply and stats from | ||
1142 | * inside of if_recv_msg(), | ||
1143 | * on error - fall through. | ||
1144 | */ | ||
1145 | if (ev->type == ISCSI_UEVENT_GET_STATS && !err) | ||
1146 | break; | ||
1147 | err = iscsi_if_send_reply( | ||
1148 | NETLINK_CREDS(skb)->pid, nlh->nlmsg_seq, | ||
1149 | nlh->nlmsg_type, 0, 0, ev, sizeof(*ev)); | ||
1150 | } while (err < 0 && err != -ECONNREFUSED); | ||
1151 | skb_pull(skb, rlen); | ||
1152 | } | 1128 | } |
1153 | free_skb: | 1129 | do { |
1154 | kfree_skb(skb); | 1130 | /* |
1131 | * special case for GET_STATS: | ||
1132 | * on success - sending reply and stats from | ||
1133 | * inside of if_recv_msg(), | ||
1134 | * on error - fall through. | ||
1135 | */ | ||
1136 | if (ev->type == ISCSI_UEVENT_GET_STATS && !err) | ||
1137 | break; | ||
1138 | err = iscsi_if_send_reply( | ||
1139 | NETLINK_CREDS(skb)->pid, nlh->nlmsg_seq, | ||
1140 | nlh->nlmsg_type, 0, 0, ev, sizeof(*ev)); | ||
1141 | } while (err < 0 && err != -ECONNREFUSED); | ||
1142 | skb_pull(skb, rlen); | ||
1155 | } | 1143 | } |
1156 | mutex_unlock(&rx_queue_mutex); | 1144 | mutex_unlock(&rx_queue_mutex); |
1157 | } | 1145 | } |
@@ -1523,7 +1511,7 @@ static __init int iscsi_transport_init(void) | |||
1523 | if (err) | 1511 | if (err) |
1524 | goto unregister_conn_class; | 1512 | goto unregister_conn_class; |
1525 | 1513 | ||
1526 | nls = netlink_kernel_create(NETLINK_ISCSI, 1, iscsi_if_rx, NULL, | 1514 | nls = netlink_kernel_create(&init_net, NETLINK_ISCSI, 1, iscsi_if_rx, NULL, |
1527 | THIS_MODULE); | 1515 | THIS_MODULE); |
1528 | if (!nls) { | 1516 | if (!nls) { |
1529 | err = -ENOBUFS; | 1517 | err = -ENOBUFS; |