Merge android11-5.4.259+ (70db018
) into msm-5.4
* remotes/origin/tmp-70db018: UPSTREAM: ipv4: igmp: fix refcnt uaf issue when receiving igmp query packet ANDROID: Snapshot Mainline's version of checkpatch.pl UPSTREAM: nvmet-tcp: Fix a possible UAF in queue intialization setup UPSTREAM: nvmet-tcp: move send/recv error handling in the send/recv methods instead of call-sites Conflicts: scripts/checkpatch.pl Change-Id: I28aaacd0fb6478ade935672027760efce65a7911 Signed-off-by: kamasali Satyanarayan <quic_kamasali@quicinc.com>
This commit is contained in:
commit
079b43b825
@ -1 +1 @@
|
|||||||
LTS_5.4.259_81334f26ac70
|
LTS_5.4.259_70db018a109
|
||||||
|
@ -321,6 +321,15 @@ static void nvmet_tcp_fatal_error(struct nvmet_tcp_queue *queue)
|
|||||||
kernel_sock_shutdown(queue->sock, SHUT_RDWR);
|
kernel_sock_shutdown(queue->sock, SHUT_RDWR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void nvmet_tcp_socket_error(struct nvmet_tcp_queue *queue, int status)
|
||||||
|
{
|
||||||
|
queue->rcv_state = NVMET_TCP_RECV_ERR;
|
||||||
|
if (status == -EPIPE || status == -ECONNRESET)
|
||||||
|
kernel_sock_shutdown(queue->sock, SHUT_RDWR);
|
||||||
|
else
|
||||||
|
nvmet_tcp_fatal_error(queue);
|
||||||
|
}
|
||||||
|
|
||||||
static int nvmet_tcp_map_data(struct nvmet_tcp_cmd *cmd)
|
static int nvmet_tcp_map_data(struct nvmet_tcp_cmd *cmd)
|
||||||
{
|
{
|
||||||
struct nvme_sgl_desc *sgl = &cmd->req.cmd->common.dptr.sgl;
|
struct nvme_sgl_desc *sgl = &cmd->req.cmd->common.dptr.sgl;
|
||||||
@ -714,11 +723,15 @@ static int nvmet_tcp_try_send(struct nvmet_tcp_queue *queue,
|
|||||||
|
|
||||||
for (i = 0; i < budget; i++) {
|
for (i = 0; i < budget; i++) {
|
||||||
ret = nvmet_tcp_try_send_one(queue, i == budget - 1);
|
ret = nvmet_tcp_try_send_one(queue, i == budget - 1);
|
||||||
if (ret <= 0)
|
if (unlikely(ret < 0)) {
|
||||||
|
nvmet_tcp_socket_error(queue, ret);
|
||||||
|
goto done;
|
||||||
|
} else if (ret == 0) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
(*sends)++;
|
(*sends)++;
|
||||||
}
|
}
|
||||||
|
done:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -816,15 +829,11 @@ static int nvmet_tcp_handle_icreq(struct nvmet_tcp_queue *queue)
|
|||||||
iov.iov_len = sizeof(*icresp);
|
iov.iov_len = sizeof(*icresp);
|
||||||
ret = kernel_sendmsg(queue->sock, &msg, &iov, 1, iov.iov_len);
|
ret = kernel_sendmsg(queue->sock, &msg, &iov, 1, iov.iov_len);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto free_crypto;
|
return ret; /* queue removal will cleanup */
|
||||||
|
|
||||||
queue->state = NVMET_TCP_Q_LIVE;
|
queue->state = NVMET_TCP_Q_LIVE;
|
||||||
nvmet_prepare_receive_pdu(queue);
|
nvmet_prepare_receive_pdu(queue);
|
||||||
return 0;
|
return 0;
|
||||||
free_crypto:
|
|
||||||
if (queue->hdr_digest || queue->data_digest)
|
|
||||||
nvmet_tcp_free_crypto(queue);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nvmet_tcp_handle_req_failure(struct nvmet_tcp_queue *queue,
|
static void nvmet_tcp_handle_req_failure(struct nvmet_tcp_queue *queue,
|
||||||
@ -1167,11 +1176,15 @@ static int nvmet_tcp_try_recv(struct nvmet_tcp_queue *queue,
|
|||||||
|
|
||||||
for (i = 0; i < budget; i++) {
|
for (i = 0; i < budget; i++) {
|
||||||
ret = nvmet_tcp_try_recv_one(queue);
|
ret = nvmet_tcp_try_recv_one(queue);
|
||||||
if (ret <= 0)
|
if (unlikely(ret < 0)) {
|
||||||
|
nvmet_tcp_socket_error(queue, ret);
|
||||||
|
goto done;
|
||||||
|
} else if (ret == 0) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
(*recvs)++;
|
(*recvs)++;
|
||||||
}
|
}
|
||||||
|
done:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1196,27 +1209,16 @@ static void nvmet_tcp_io_work(struct work_struct *w)
|
|||||||
pending = false;
|
pending = false;
|
||||||
|
|
||||||
ret = nvmet_tcp_try_recv(queue, NVMET_TCP_RECV_BUDGET, &ops);
|
ret = nvmet_tcp_try_recv(queue, NVMET_TCP_RECV_BUDGET, &ops);
|
||||||
if (ret > 0) {
|
if (ret > 0)
|
||||||
pending = true;
|
pending = true;
|
||||||
} else if (ret < 0) {
|
else if (ret < 0)
|
||||||
if (ret == -EPIPE || ret == -ECONNRESET)
|
|
||||||
kernel_sock_shutdown(queue->sock, SHUT_RDWR);
|
|
||||||
else
|
|
||||||
nvmet_tcp_fatal_error(queue);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
ret = nvmet_tcp_try_send(queue, NVMET_TCP_SEND_BUDGET, &ops);
|
ret = nvmet_tcp_try_send(queue, NVMET_TCP_SEND_BUDGET, &ops);
|
||||||
if (ret > 0) {
|
if (ret > 0)
|
||||||
/* transmitted message/data */
|
|
||||||
pending = true;
|
pending = true;
|
||||||
} else if (ret < 0) {
|
else if (ret < 0)
|
||||||
if (ret == -EPIPE || ret == -ECONNRESET)
|
|
||||||
kernel_sock_shutdown(queue->sock, SHUT_RDWR);
|
|
||||||
else
|
|
||||||
nvmet_tcp_fatal_error(queue);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
} while (pending && ops < NVMET_TCP_IO_WORK_BUDGET);
|
} while (pending && ops < NVMET_TCP_IO_WORK_BUDGET);
|
||||||
|
|
||||||
|
@ -218,8 +218,10 @@ static void igmp_start_timer(struct ip_mc_list *im, int max_delay)
|
|||||||
int tv = prandom_u32() % max_delay;
|
int tv = prandom_u32() % max_delay;
|
||||||
|
|
||||||
im->tm_running = 1;
|
im->tm_running = 1;
|
||||||
if (!mod_timer(&im->timer, jiffies+tv+2))
|
if (refcount_inc_not_zero(&im->refcnt)) {
|
||||||
refcount_inc(&im->refcnt);
|
if (mod_timer(&im->timer, jiffies + tv + 2))
|
||||||
|
ip_ma_put(im);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void igmp_gq_start_timer(struct in_device *in_dev)
|
static void igmp_gq_start_timer(struct in_device *in_dev)
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user