hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/fs/proc/task_nommu.c
....@@ -208,11 +208,16 @@
208208 return ERR_PTR(-ESRCH);
209209
210210 mm = priv->mm;
211
- if (!mm || !mmget_not_zero(mm))
211
+ if (!mm || !mmget_not_zero(mm)) {
212
+ put_task_struct(priv->task);
213
+ priv->task = NULL;
212214 return NULL;
215
+ }
213216
214217 if (mmap_read_lock_killable(mm)) {
215218 mmput(mm);
219
+ put_task_struct(priv->task);
220
+ priv->task = NULL;
216221 return ERR_PTR(-EINTR);
217222 }
218223
....@@ -221,23 +226,21 @@
221226 if (n-- == 0)
222227 return p;
223228
224
- mmap_read_unlock(mm);
225
- mmput(mm);
226229 return NULL;
227230 }
228231
229
-static void m_stop(struct seq_file *m, void *_vml)
232
+static void m_stop(struct seq_file *m, void *v)
230233 {
231234 struct proc_maps_private *priv = m->private;
235
+ struct mm_struct *mm = priv->mm;
232236
233
- if (!IS_ERR_OR_NULL(_vml)) {
234
- mmap_read_unlock(priv->mm);
235
- mmput(priv->mm);
236
- }
237
- if (priv->task) {
238
- put_task_struct(priv->task);
239
- priv->task = NULL;
240
- }
237
+ if (!priv->task)
238
+ return;
239
+
240
+ mmap_read_unlock(mm);
241
+ mmput(mm);
242
+ put_task_struct(priv->task);
243
+ priv->task = NULL;
241244 }
242245
243246 static void *m_next(struct seq_file *m, void *_p, loff_t *pos)