Skip to content

Commit

Permalink
drivers: Fix some issues caused by Recent Upstream(4.19.306).
Browse files Browse the repository at this point in the history
-Made kernel unable to boot.
  • Loading branch information
Rohail33 authored and raystef66 committed Feb 6, 2024
1 parent 731f2dc commit 879d5f8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion drivers/android/binder.c
Original file line number Diff line number Diff line change
Expand Up @@ -5112,7 +5112,7 @@ static __poll_t binder_poll(struct file *filp,

thread = binder_get_thread(proc);
if (!thread)
return EPOLLERR;
return POLLERR;

binder_inner_proc_lock(thread->proc);
thread->looper |= BINDER_LOOPER_STATE_POLL;
Expand Down
21 changes: 11 additions & 10 deletions drivers/android/binder_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ static int binder_update_page_range(struct binder_alloc *alloc, int allocate,
}
if (mm) {
up_read(&mm->mmap_sem);
mmput_async(mm);
mmput(mm);
}
return 0;

Expand Down Expand Up @@ -317,7 +317,7 @@ static int binder_update_page_range(struct binder_alloc *alloc, int allocate,
err_no_vma:
if (mm) {
up_read(&mm->mmap_sem);
mmput_async(mm);
mmput(mm);
}
return vma ? -ENOMEM : -ESRCH;
}
Expand Down Expand Up @@ -452,17 +452,17 @@ static struct binder_buffer *binder_alloc_new_buf_locked(
if (false)
binder_alloc_debug(BINDER_DEBUG_BUFFER_ALLOC, "%s", NAME_ARRAY[0]);
#endif

/* Pad 0-size buffers so they get assigned unique addresses */
size = max(size, sizeof(void *));

if (is_async && alloc->free_async_space < size) {
if (is_async &&
alloc->free_async_space < size + sizeof(struct binder_buffer)) {
binder_alloc_debug(BINDER_DEBUG_BUFFER_ALLOC,
"%d: binder_alloc_buf size %zd failed, no async space left\n",
alloc->pid, size);
return ERR_PTR(-ENOSPC);
}

/* Pad 0-size buffers so they get assigned unique addresses */
size = max(size, sizeof(void *));

while (n) {
buffer = rb_entry(n, struct binder_buffer, rb_node);
BUG_ON(!buffer->free);
Expand Down Expand Up @@ -563,7 +563,7 @@ static struct binder_buffer *binder_alloc_new_buf_locked(
buffer->extra_buffers_size = extra_buffers_size;
buffer->pid = pid;
if (is_async) {
alloc->free_async_space -= size;
alloc->free_async_space -= size + sizeof(struct binder_buffer);
binder_alloc_debug(BINDER_DEBUG_BUFFER_ALLOC_ASYNC,
"%d: binder_alloc_buf size %zd async free %zd\n",
alloc->pid, size, alloc->free_async_space);
Expand Down Expand Up @@ -628,7 +628,7 @@ size_t binder_alloc_get_free_space(struct binder_alloc *alloc)
* is the sum of the three given sizes (each rounded up to
* pointer-sized boundary)
*
* Return: The allocated buffer or %ERR_PTR(-errno) if error
* Return: The allocated buffer or %NULL if error
*/
struct binder_buffer *binder_alloc_new_buf(struct binder_alloc *alloc,
size_t data_size,
Expand Down Expand Up @@ -727,7 +727,8 @@ static void binder_free_buf_locked(struct binder_alloc *alloc,
BUG_ON(buffer->user_data > alloc->buffer + alloc->buffer_size);

if (buffer->async_transaction) {
alloc->free_async_space += buffer_size;
alloc->free_async_space += buffer_size + sizeof(struct binder_buffer);

binder_alloc_debug(BINDER_DEBUG_BUFFER_ALLOC_ASYNC,
"%d: binder_free_buf size %zd async free %zd\n",
alloc->pid, size, alloc->free_async_space);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ static int rmnet_fill_info(struct sk_buff *skb, const struct net_device *dev)

struct rtnl_link_ops rmnet_link_ops __read_mostly = {
.kind = "rmnet",
.maxtype = IFLA_RMNET_MAX,
.maxtype = __IFLA_RMNET_EXT_MAX,
.priv_size = sizeof(struct rmnet_priv),
.setup = rmnet_vnd_setup,
.validate = rmnet_rtnl_validate,
Expand Down

0 comments on commit 879d5f8

Please sign in to comment.