.. | .. |
---|
148 | 148 | |
---|
149 | 149 | pid_t f_getown(struct file *filp) |
---|
150 | 150 | { |
---|
151 | | - pid_t pid; |
---|
152 | | - read_lock(&filp->f_owner.lock); |
---|
153 | | - pid = pid_vnr(filp->f_owner.pid); |
---|
154 | | - if (filp->f_owner.pid_type == PIDTYPE_PGID) |
---|
155 | | - pid = -pid; |
---|
156 | | - read_unlock(&filp->f_owner.lock); |
---|
| 151 | + pid_t pid = 0; |
---|
| 152 | + |
---|
| 153 | + read_lock_irq(&filp->f_owner.lock); |
---|
| 154 | + rcu_read_lock(); |
---|
| 155 | + if (pid_task(filp->f_owner.pid, filp->f_owner.pid_type)) { |
---|
| 156 | + pid = pid_vnr(filp->f_owner.pid); |
---|
| 157 | + if (filp->f_owner.pid_type == PIDTYPE_PGID) |
---|
| 158 | + pid = -pid; |
---|
| 159 | + } |
---|
| 160 | + rcu_read_unlock(); |
---|
| 161 | + read_unlock_irq(&filp->f_owner.lock); |
---|
157 | 162 | return pid; |
---|
158 | 163 | } |
---|
159 | 164 | |
---|
.. | .. |
---|
200 | 205 | static int f_getown_ex(struct file *filp, unsigned long arg) |
---|
201 | 206 | { |
---|
202 | 207 | struct f_owner_ex __user *owner_p = (void __user *)arg; |
---|
203 | | - struct f_owner_ex owner; |
---|
| 208 | + struct f_owner_ex owner = {}; |
---|
204 | 209 | int ret = 0; |
---|
205 | 210 | |
---|
206 | | - read_lock(&filp->f_owner.lock); |
---|
207 | | - owner.pid = pid_vnr(filp->f_owner.pid); |
---|
| 211 | + read_lock_irq(&filp->f_owner.lock); |
---|
| 212 | + rcu_read_lock(); |
---|
| 213 | + if (pid_task(filp->f_owner.pid, filp->f_owner.pid_type)) |
---|
| 214 | + owner.pid = pid_vnr(filp->f_owner.pid); |
---|
| 215 | + rcu_read_unlock(); |
---|
208 | 216 | switch (filp->f_owner.pid_type) { |
---|
209 | 217 | case PIDTYPE_PID: |
---|
210 | 218 | owner.type = F_OWNER_TID; |
---|
.. | .. |
---|
223 | 231 | ret = -EINVAL; |
---|
224 | 232 | break; |
---|
225 | 233 | } |
---|
226 | | - read_unlock(&filp->f_owner.lock); |
---|
| 234 | + read_unlock_irq(&filp->f_owner.lock); |
---|
227 | 235 | |
---|
228 | 236 | if (!ret) { |
---|
229 | 237 | ret = copy_to_user(owner_p, &owner, sizeof(owner)); |
---|
.. | .. |
---|
241 | 249 | uid_t src[2]; |
---|
242 | 250 | int err; |
---|
243 | 251 | |
---|
244 | | - read_lock(&filp->f_owner.lock); |
---|
| 252 | + read_lock_irq(&filp->f_owner.lock); |
---|
245 | 253 | src[0] = from_kuid(user_ns, filp->f_owner.uid); |
---|
246 | 254 | src[1] = from_kuid(user_ns, filp->f_owner.euid); |
---|
247 | | - read_unlock(&filp->f_owner.lock); |
---|
| 255 | + read_unlock_irq(&filp->f_owner.lock); |
---|
248 | 256 | |
---|
249 | 257 | err = put_user(src[0], &dst[0]); |
---|
250 | 258 | err |= put_user(src[1], &dst[1]); |
---|
.. | .. |
---|
261 | 269 | static bool rw_hint_valid(enum rw_hint hint) |
---|
262 | 270 | { |
---|
263 | 271 | switch (hint) { |
---|
264 | | - case RWF_WRITE_LIFE_NOT_SET: |
---|
| 272 | + case RWH_WRITE_LIFE_NOT_SET: |
---|
265 | 273 | case RWH_WRITE_LIFE_NONE: |
---|
266 | 274 | case RWH_WRITE_LIFE_SHORT: |
---|
267 | 275 | case RWH_WRITE_LIFE_MEDIUM: |
---|
.. | .. |
---|
277 | 285 | unsigned long arg) |
---|
278 | 286 | { |
---|
279 | 287 | struct inode *inode = file_inode(file); |
---|
280 | | - u64 *argp = (u64 __user *)arg; |
---|
| 288 | + u64 __user *argp = (u64 __user *)arg; |
---|
281 | 289 | enum rw_hint hint; |
---|
282 | 290 | u64 h; |
---|
283 | 291 | |
---|
.. | .. |
---|
362 | 370 | case F_OFD_SETLK: |
---|
363 | 371 | case F_OFD_SETLKW: |
---|
364 | 372 | #endif |
---|
365 | | - /* Fallthrough */ |
---|
| 373 | + fallthrough; |
---|
366 | 374 | case F_SETLK: |
---|
367 | 375 | case F_SETLKW: |
---|
368 | 376 | if (copy_from_user(&flock, argp, sizeof(flock))) |
---|
.. | .. |
---|
735 | 743 | return; |
---|
736 | 744 | |
---|
737 | 745 | switch (signum) { |
---|
738 | | - siginfo_t si; |
---|
739 | | - default: |
---|
| 746 | + default: { |
---|
| 747 | + kernel_siginfo_t si; |
---|
| 748 | + |
---|
740 | 749 | /* Queue a rt signal with the appropriate fd as its |
---|
741 | 750 | value. We use SI_SIGIO as the source, not |
---|
742 | 751 | SI_KERNEL, since kernel signals always get |
---|
.. | .. |
---|
769 | 778 | si.si_fd = fd; |
---|
770 | 779 | if (!do_send_sig_info(signum, &si, p, type)) |
---|
771 | 780 | break; |
---|
772 | | - /* fall-through: fall back on the old plain SIGIO signal */ |
---|
| 781 | + } |
---|
| 782 | + fallthrough; /* fall back on the old plain SIGIO signal */ |
---|
773 | 783 | case 0: |
---|
774 | 784 | do_send_sig_info(SIGIO, SEND_SIG_PRIV, p, type); |
---|
775 | 785 | } |
---|