Commit 8868c5d
committed
firmware: arm_ffa: Honor partition info descriptor size
FFA_PARTITION_INFO_GET_REGS reports the size of each partition
information descriptor in x2[63:48]. However, __ffa_partition_info_get_regs()
walks the returned register payload with a hardcoded 24-byte stride
(regs += 3), even though the size is already read into buf_sz.
That works for the FF-A v1.1/v1.2 24-byte descriptor layout, where each
descriptor consumes three registers. Newer FF-A revisions can extend the
descriptor while keeping the existing fields at the front. For example, a
48-byte descriptor consumes six registers, so advancing by only three
registers desynchronises the parser and can make it read subsequent entries
from the middle of a descriptor.
Use the advertised descriptor size to derive the register stride. Validate
that the size is register-aligned, large enough for the fields parsed by the
driver, and that the requested number of descriptors fits in the returned
x3..x17 register window. The driver still copies only the fields it
understands, but now skips over any trailing descriptor fields correctly.
Fixes: ba85c64 ("firmware: arm_ffa: Add support for FFA_PARTITION_INFO_GET_REGS")
Suggested-by: Sudeep Holla <sudeep.holla@kernel.org>
Signed-off-by: Jamie Nguyen <jamien@nvidia.com>
Link: https://patch.msgid.link/20260518203116.42624-1-jamien@nvidia.com
(sudeep.holla: Minor rewordng of the commit message and subject)
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
(backported from commit 01b9cae linux-next)
Signed-off-by: Jamie Nguyen <jamien@nvidia.com>1 parent 227c340 commit 8868c5d
1 file changed
Lines changed: 16 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
319 | 319 | | |
320 | 320 | | |
321 | 321 | | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
327 | 325 | | |
328 | 326 | | |
329 | 327 | | |
| |||
337 | 335 | | |
338 | 336 | | |
339 | 337 | | |
340 | | - | |
| 338 | + | |
341 | 339 | | |
342 | 340 | | |
343 | 341 | | |
| |||
360 | 358 | | |
361 | 359 | | |
362 | 360 | | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
363 | 369 | | |
364 | | - | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
365 | 373 | | |
366 | 374 | | |
367 | 375 | | |
368 | 376 | | |
369 | 377 | | |
370 | 378 | | |
371 | 379 | | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | 380 | | |
376 | 381 | | |
377 | 382 | | |
| |||
390 | 395 | | |
391 | 396 | | |
392 | 397 | | |
393 | | - | |
| 398 | + | |
394 | 399 | | |
395 | 400 | | |
396 | 401 | | |
| |||
0 commit comments