Skip to content

Commit 421ca22

Browse files
committed
Merge tag 'nfs-for-6.4-2' of git://git.linux-nfs.org/projects/anna/linux-nfs
Pull NFS client fixes from Anna Schumaker: "Stable Fix: - Don't change task->tk_status after the call to rpc_exit_task Other Bugfixes: - Convert kmap_atomic() to kmap_local_folio() - Fix a potential double free with READ_PLUS" * tag 'nfs-for-6.4-2' of git://git.linux-nfs.org/projects/anna/linux-nfs: NFSv4.2: Fix a potential double free with READ_PLUS SUNRPC: Don't change task->tk_status after the call to rpc_exit_task NFS: Convert kmap_atomic() to kmap_local_folio()
2 parents 44c026a + 43439d8 commit 421ca22

3 files changed

Lines changed: 14 additions & 7 deletions

File tree

fs/nfs/dir.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ static int nfs_readdir_folio_array_append(struct folio *folio,
317317

318318
name = nfs_readdir_copy_name(entry->name, entry->len);
319319

320-
array = kmap_atomic(folio_page(folio, 0));
320+
array = kmap_local_folio(folio, 0);
321321
if (!name)
322322
goto out;
323323
ret = nfs_readdir_array_can_expand(array);
@@ -340,7 +340,7 @@ static int nfs_readdir_folio_array_append(struct folio *folio,
340340
nfs_readdir_array_set_eof(array);
341341
out:
342342
*cookie = array->last_cookie;
343-
kunmap_atomic(array);
343+
kunmap_local(array);
344344
return ret;
345345
}
346346

fs/nfs/nfs4proc.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5437,10 +5437,18 @@ static bool nfs4_read_plus_not_supported(struct rpc_task *task,
54375437
return false;
54385438
}
54395439

5440-
static int nfs4_read_done(struct rpc_task *task, struct nfs_pgio_header *hdr)
5440+
static inline void nfs4_read_plus_scratch_free(struct nfs_pgio_header *hdr)
54415441
{
5442-
if (hdr->res.scratch)
5442+
if (hdr->res.scratch) {
54435443
kfree(hdr->res.scratch);
5444+
hdr->res.scratch = NULL;
5445+
}
5446+
}
5447+
5448+
static int nfs4_read_done(struct rpc_task *task, struct nfs_pgio_header *hdr)
5449+
{
5450+
nfs4_read_plus_scratch_free(hdr);
5451+
54445452
if (!nfs4_sequence_done(task, &hdr->res.seq_res))
54455453
return -EAGAIN;
54465454
if (nfs4_read_stateid_changed(task, &hdr->args))

net/sunrpc/sched.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -927,11 +927,10 @@ static void __rpc_execute(struct rpc_task *task)
927927
*/
928928
do_action = task->tk_action;
929929
/* Tasks with an RPC error status should exit */
930-
if (do_action != rpc_exit_task &&
930+
if (do_action && do_action != rpc_exit_task &&
931931
(status = READ_ONCE(task->tk_rpc_status)) != 0) {
932932
task->tk_status = status;
933-
if (do_action != NULL)
934-
do_action = rpc_exit_task;
933+
do_action = rpc_exit_task;
935934
}
936935
/* Callbacks override all actions */
937936
if (task->tk_callback) {

0 commit comments

Comments
 (0)